Name
SWD support — Usage
Use of JTAG for debugging
JTAG can be used to single-step and debug loaded applications, or even applications resident in ROM.
Debugging of ROM applications is only possible if using hardware
breakpoints. The Cortex-M4 core of the STM32L4R9 only supports a
limited number of such hardware breakpoints, so they may need to
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.
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.
J-Link Support
The preferred debug device for this board is the on-board ST-Link debug interface probe. This also has the benefit fof routing USART2 as a standard USB CDC-ACM terminal.
Initialization scripts that support debugging the board via
either the OpenOCD or J-Link GDB servers can be found in the directory
packages/hal/cortexm/stm32/stm32l4r9_disco/
relative to the root of your eCos installation.
VERSION
/misc
For JLinkGDBServer,
the file stm32l4r9_disco.jlink
, provides
initialization for the board and should be used in the following
command line:
$ JLinkGDBServer -device STM32L4R9AI -xc stm32l4r9_disco.jlink
Similarly OpenOCD may be invoked with the following command line:
$ openocd -f openocd.stm32l4r9_disco.cfg
Configuration of JTAG applications
JTAG/SWD applications can be loaded directly into SRAM or flash without requiring a ROM monitor. Loading can be done directly through the JTAG/SWD device, or through GDB where supported by the JTAG/SWD device.
In order to configure the application to support these modes, it is
recommended to use the SRAM
,
ROM
or ROMAPP
startup types
which will implicitly cause two important settings to change.
Firstly, CYGSEM_HAL_USE_ROM_MONITOR
must be
disabled. Secondly the
CYGDBG_HAL_DIAG_TO_DEBUG_CHAN
option should be
enabled in order to prevent HAL diagnostic output being encoded
into GDB ($O) packets. These configuration changes could be made
by hand, but use of the aformentioned startup types will
just work.
With these changes, any diagnostic output will appear out
of the configured diagnostic channel, by default USART2 on
ST-Link USB CN13. An eCosCentric extension allows diagnostic
output to appear on the GDB console, or on the Eclipse
console. To enable this feature, you must set the
configuration option
CYGSEM_HAL_DIAG_TO_GDBFILEIO_CHAN
in the
common HAL package. If you are using the graphical configuration tool then
you should then accept any suggested solutions to the subsequent configuration
conflicts. Older eCos releases also required the gdb "set hwdebug on" command
to be used to enable GDB or Eclipse console output,
but this is no longer required with the latest tools.
2024-03-18 | eCosPro License |