Skip to content

Commit 7a93e9e

Browse files
erwangonashif
authored andcommitted
boards: nucleo_u575zi_q: Instructions and configuration for openocd
STM32U5 support is not yet supported in upstream openocd. Provide instructions to use STMicro openocd fork as a temporary workaround. Additionally, provide openocd configuration to be used for this target. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 5c24a68 commit 7a93e9e

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
board_runner_args(stm32cubeprogrammer "--erase" "--port=swd" "--reset=hw")
22
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset=hw")
33

4+
board_runner_args(openocd "--tcl-port=6666")
5+
board_runner_args(openocd --cmd-pre-init "gdb_report_data_abort enable")
6+
board_runner_args(openocd "--no-halt")
7+
48
include(${ZEPHYR_BASE}/boards/common/stm32cubeprogrammer.board.cmake)
9+
# FIXME: openocd runner requires use of STMicro openocd fork.
10+
# Check board documentation for more details.
11+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

boards/arm/nucleo_u575zi_q/doc/nucleou575zi_q.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,38 @@ You should see the following message on the console:
234234
235235
Hello World! arm
236236
237+
Debugging
238+
=========
239+
240+
STM32U5 support is not currently supported in openocd. As a temporary workaround,
241+
user can use `STMicroelectronics customized version of OpenOCD`_ to debug the
242+
the Nucleo U575ZI Q.
243+
For this you need to fetch this repo and build openocd following the instructions
244+
provided in the README of the project. Then, build zephyr project indicating the
245+
openocd location in west build command.
246+
247+
Here is an example for the :ref:`blinky-sample` application.
248+
249+
.. zephyr-app-commands::
250+
:zephyr-app: samples/basic/blinky
251+
:board: nucleo_u575zi_q
252+
:gen-args: -DOPENOCD="<path_to_openocd>/openocd/src/openocd" -DOPENOCD_DEFAULT_PATH="<path_to_openocd>/openocd/tcl/"
253+
:goals: build
254+
255+
Then, indicate openocd as the chosen runner in flash and debug commands:
256+
257+
.. zephyr-app-commands::
258+
:zephyr-app: samples/basic/blinky
259+
:board: nucleo_u575zi_q
260+
:gen-args: -r openocd
261+
:goals: flash
262+
263+
.. zephyr-app-commands::
264+
:zephyr-app: samples/basic/blinky
265+
:board: nucleo_u575zi_q
266+
:gen-args: -r openocd
267+
:goals: debug
268+
237269

238270
.. _STM32 Nucleo-144 board User Manual:
239271
http://www.st.com/resource/en/user_manual/dm00615305.pdf
@@ -246,3 +278,6 @@ You should see the following message on the console:
246278

247279
.. _STM32CubeProgrammer:
248280
https://www.st.com/en/development-tools/stm32cubeprog.html
281+
282+
.. _STMicroelectronics customized version of OpenOCD:
283+
https://github.com/STMicroelectronics/OpenOCD
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
source [find interface/stlink-dap.cfg]
2+
3+
set WORKAREASIZE 0x8000
4+
5+
transport select "dapdirect_swd"
6+
7+
set CHIPNAME STM32U575ZITxQ
8+
set BOARDNAME NUCLEO-U575ZI-Q
9+
10+
# Enable debug when in low power modes
11+
set ENABLE_LOW_POWER 1
12+
13+
# Stop Watchdog counters when halt
14+
set STOP_WATCHDOG 1
15+
16+
# STlink Debug clock frequency
17+
set CLOCK_FREQ 8000
18+
19+
# Reset configuration
20+
# use hardware reset, connect under reset
21+
# connect_assert_srst needed if low power mode application running (WFI...)
22+
reset_config srst_only srst_nogate connect_assert_srst
23+
set CONNECT_UNDER_RESET 1
24+
set CORE_RESET 0
25+
26+
# ACCESS PORT NUMBER
27+
set AP_NUM 0
28+
# GDB PORT
29+
set GDB_PORT 3333
30+
31+
# BCTM CPU variables
32+
33+
source [find target/stm32u5x.cfg]
34+
35+
$_TARGETNAME configure -event gdb-attach {
36+
echo "Debugger attaching: halting execution"
37+
reset halt
38+
gdb_breakpoint_override hard
39+
}
40+
41+
$_TARGETNAME configure -event gdb-detach {
42+
echo "Debugger detaching: resuming execution"
43+
resume
44+
}

0 commit comments

Comments
 (0)