Issue
The ST-Link utility does not seem to be well supported for the NUCLEO-U575ZI-Q development board. I can neither upload code nor debug my code using the stlink configuration in VS Code. This board uses the ST-Link v3 interface which I believe is currently supported by OpenOCD.
I am unable to find any discussions on this board, likely because it is relatively new on the market.
Hardware testing
I am able to upload the compiled firmware binary (compiled in VS Code using platformio) by the drag-and-drop method offered by the ST-Link debugger where the board presents itself as a removable drive - this works well.
The STM32CubeIDE platform also allows for full firmware upload and debugging without issue using the on-board ST-Link interface.
Uploading code
NOTE: Comment on MCU Reset button being pressed mid-way through uploading over ST-LINK to exit the failed upload session.
Command run
pio run --environment=my_firmware_env --target=upload --verbose
Code upload logs for "my_firmware_env" with verbose output
Building in release mode
MethodWrapper(["checkprogsize"], [".pio\build\my_firmware_env\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 5.8% (used 15296 bytes from 262144 bytes)
Flash: [= ] 5.8% (used 121617 bytes from 2097152 bytes)
.pio\build\my_firmware_env\firmware.elf :
section size addr
.isr_vector 564 134217728
.text 98520 134218296
.rodata 22237 134316816
.ARM 8 134339056
.init_array 28 134339064
.fini_array 12 134339092
.data 860 536870912
.bss 14433 536871776
.noinit 3 536886209
._user_heap_stack 1540 536886212
.ARM.attributes 54 0
.comment 102 0
.debug_frame 5696 0
Total 144057
<lambda>(["upload"], [".pio\build\my_firmware_env\firmware.elf"])
AVAILABLE: blackmagic, cmsis-dap, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
openocd -d2 -s C:\Users\Sam\Documents\code\firmware\.platformio\packages\tool-openocd/scripts -f interface/stlink.cfg -c "transport select hla_swd" -f target/stm32u5x.cfg -c "program {.pio\build\my_firmware_env\firmware.elf} verify reset; shutdown;"
xPack OpenOCD x86_64 Open On-Chip Debugger 0.11.0+dev (2021-10-16-21:19)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : DEPRECATED target event trace-config; use TPIU events {pre,post}-{enable,disable}
Info : clock speed 500 kHz
Info : STLINK V3J10M3 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.287408
Info : stm32u5x.cpu: Cortex-M33 r0p4 processor detected
Info : stm32u5x.cpu: target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32u5x.cpu on 3333
Info : Listening on port 3333 for gdb connections
Info : Unable to match requested speed 480 kHz, using 200 kHz
Info : Unable to match requested speed 480 kHz, using 200 kHz
stm32u5x.dap
Error executing event halted on target stm32u5x.cpu:
C:\Users\Sam\Documents\code\firmware\.platformio\packages\tool-openocd/scripts/target/stm32u5x.cfg:122: Error:
in procedure 'program'
in procedure 'ocd_process_reset'
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 788
in procedure 'ahb_ap_non_secure_access' called at file "C:\Users\Sam\Documents\code\firmware\.platformio\packages\tool-openocd/scripts/target/stm32u5x.cfg", line 158
at file "C:\Users\Sam\Documents\code\firmware\.platformio\packages\tool-openocd/scripts/target/stm32u5x.cfg", line 122
target halted due to debug-request, current mode: Thread
xPSR: 0xf9000000 pc: 0x08000e3c msp: 0x200c0000
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
Info : Unable to match requested speed 4000 kHz, using 3300 kHz
** Programming Started **
Info : device idcode = 0x20016482 (STM32U57/U58xx - Rev 'unknown' : 0x2001)
Info : TZEN = 0 : TrustZone disabled by option bytes
Info : RDP level 0 (0xAA)
Info : flash size = 2048kbytes
Info : flash mode : dual-bank
Info : Padding image section 1 at 0x0801dd7c with 4 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x0801dd80 .. 0x0801dfff
Error: Target not halted
Error: failed erasing sectors 0 to 14
embedded:startup.tcl:1070: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1135
at file "embedded:startup.tcl", line 1070
*** [upload] Error 1
================================================================== [FAILED] Took 12.58 seconds ==================================================================
Environment Status Duration
------------------- -------- ------------
my_firmware_env FAILED 00:00:12.580
============================================================= 1 failed, 0 succeeded in 00:00:12.580 =============================================================
Development setup
VS Code platformio environment
[env:my_firmware_env]
platform = ststm32
board = nucleo_u575zi_q
framework = arduino
lib_ldf_mode = chain+
monitor_speed = 250000
upload_protocol = stlink
monitor_dtr = 1
build_flags =
-D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF
-D PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_SCANF
Software versions
- Windows 10 Pro 64-bit
- PlatformIO Core, version 6.1.5