JTAG support — Usage
Use of JTAG for debugging
JTAG can be used to single-step and debug loaded applications, or even applications resident in ROM, including the GDB stub ROM.
Debugging of ROM applications is only possible if using hardware
breakpoints. The Cortex-M3 core of the STM32 only supports six such
hardware breakpoints, so they should be used sparingly. If using a GDB
front-end such as Eclipse, check it has not set unnecessary extra
breakpoints such as at
main(). Some JTAG devices
give the option of whether to set hardware or software breakpoints by
default. Be sure to configure your device appropriately.
The base BCM943364WCD1 module exposes the STM32F411RE JTAG/SWD signals on the module connectors TP7..TP11. A suitable hardware connection would be required to allow JTAG debugging. The BCM943364WCD1_EVB kit provides a standard 20-pin ARM JTAG header J3, but by default the module JTAG connection is configured to use the BCM9WCD9EVAL1 motherboard FT2232 connection presented via the USB J4 connector. Direct support for this USB interface is provided by the WICED-SDK supplied OpenOCD binary.
When debugging via JTAG, you are likely to need to disable the default HAL idle thread action, otherwise there may be issues where the target fails to halt and the debugging session is unreliable. More details can be found in the Cortex-M architectural HAL.
Normally a notable disadvantage with JTAG debugging is that it does not allow thread-aware debugging, such as the ability to inspect different eCos threads or their stack backtraces, set thread-specific breakpoints, and so on. Fortunately the Ronetix PEEDI JTAG unit does support thread-aware debugging of eCos applications, however extra configuration steps are required. Consult the PEEDI documentation for more details as usage is beyond the scope of this document.
The following OpenOCD documentation uses as an example the
BCM943364WCD1_EVB J4 USB JTAG connection. An OpenOCD configuration
that supports the
ft2232 interface and understands
ft2232_layout BCM9WCD1EVAL1 configuration
must be used, Such an openocd is pre-built and
available in the WICED-SDK. For example WICED-SDK revision 3.5.1 the
necessary host binaries can be found in the
An example OpenOCD configuration
openocd.bcm943364wcd1_evb.cfg is provided
within the eCos platform HAL package in the source repository. This
will be in the
relative to the root of your eCos installation.
This configuration file can be used with the WICED-SDK supplied OpenOCD on the host as follows:
./Linux64/openocd-all-brcm-libftdi -f openocd.bcm943364wcd1_evb.cfgOpen On-Chip Debugger 0.9.0-00029-g33ca6ac-dirty (2015-05-28-14:31) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : only one transport option; autoselect 'jtag' trst_and_srst separate srst_nogate trst_push_pull srst_push_pull connect_assert_srst adapter speed: 2000 kHz adapter_nsrst_delay: 100 jtag_ntrst_delay: 100 cortex_m reset_config sysresetreq jtag_init Warn : Using DEPRECATED interface driver 'ft2232' Info : Consider using the 'ftdi' interface driver, with configuration files in interface/ftdi/... Info : max TCK change to: 30000 kHz Info : clock speed 2000 kHz Info : JTAG tap: stm32f4x.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4) Info : JTAG tap: stm32f4x.bs tap/device found: 0x06431041 (mfg: 0x020, part: 0x6431, ver: 0x0) Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
By default openocd provides a console on
4444, and this can be used to interact with
the target system. This console interface can be used to perform
debugging, program the flash, etc.
Normally arm-eabi-gdb is used to connect
to the default GDB server port
debugging. For example:
(gdb) target remote localhost:3333 Remote debugging using localhost:3333 0x00000000 in ?? () (gdb)
The application can then be loaded and executed under GDB as normal. If you are using Eclipse then, if required, you can define a “preload” gdb macro to emit any necessary commands to OpenOCD. See the “Hardware Assisted Debugging” section of the “Eclipse/CDT for eCos application development” document's “Debugging eCos applications” chapter.
|2018-07-27||eCosPro Non-Commercial Public License|