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 BCM943362WCD4 module exposes the STM32F205RG JTAG/SWD signals on the module connectors TP6..TP10. A suitable hardware connection would be required to allow JTAG debugging. The BCM943362WCD4_EVB kit provides a standard 20-pin ARM JTAG header J8, but by default the module JTAG connection is configured to use the BCM9WCD1EVAL1 motherboard FT2232 connection presented via the USB J5 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
BCM943362WCD4_EVB J5 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.1.2 the
necessary host binaries can be found in the
An example OpenOCD configuration
openocd.bcm943362wcd4_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.bcm943362wcd4_evb.cfgOpen On-Chip Debugger 0.8.0-dev-00139-g4505978-dirty (2013-08-26-15:55) 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: 1000 kHz adapter_nsrst_delay: 100 jtag_ntrst_delay: 100 jtag_init Info : max TCK change to: 30000 kHz Info : clock speed 1000 kHz Polling target stm32f2xxx.cpu failed, GDB will be halted. Polling again in 100ms Info : JTAG tap: stm32f2xxx.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4) Info : JTAG tap: stm32f2xxx.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0) Info : Selecting JTAG transport command set. Info : AP INIT COMPLETE Info : stm32f2xxx.cpu: hardware has 6 breakpoints, 4 watchpoints Polling target stm32f2xxx.cpu succeeded again Info : JTAG tap: stm32f2xxx.cpu tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4) Info : JTAG tap: stm32f2xxx.bs tap/device found: 0x06411041 (mfg: 0x020, part: 0x6411, ver: 0x0) Info : Selecting JTAG transport command set. Info : AP INIT COMPLETE Info : Selecting JTAG transport command set. Info : AP INIT COMPLETE
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.
|2019-06-13||eCosPro Non-Commercial Public License|