My debug configuration that used to work (I haven't touched that project in a couple of months) fails with "Failed to launch GDB: Load failed (from target-download)".
From what I could gather from the logs, it seems the problem seems to be the target-download command which now fails on my board. I suspect it has something to do with the external flash where we store parts of the executable's sections.
I'm using the ST-Link debugger (v3?), openocd 11 on a STM32H757 target running Arch Linux.
➜ ~ uname -a
Linux work-arch 5.14.9-arch2-1 #1 SMP PREEMPT Fri, 01 Oct 2021 19:03:20 +0000 x86_64 GNU/Linux
{
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build/CM7/QMP.elf",
"name": "Debug Microcontroller",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"interface": "swd",
"device": "STM32H757XI",
"runToMain": true,
"svdFile": "STM32H7x7_CM7.svd",
"configFiles": [
"interface/stlink.cfg",
"target/stm32h7x.cfg"
],
"showDevDebugOutput": true
},
Reading symbols from './build/CM7/QMP.elf'
Finished reading symbols
Please check TERMINAL tab (gdb-server) for output from openocd
Launching server: "openocd" "-c" "gdb_port 50000" "-c" "tcl_port 50001" "-c" "telnet_port 50002" "-s" "/home/sonic/devel/TouchGFX/QMP" "-f" "interface/stlink.cfg" "-f" "target/stm32h7x.cfg"
Launching GDB: "arm-none-eabi-gdb" "-q" "--interpreter=mi2"
1-gdb-set target-async on
2-interpreter-exec console "source /home/sonic/.vscode/extensions/marus25.cortex-debug-0.4.7/support/gdbsupport.init"
3-interpreter-exec console "set print demangle on"
4-interpreter-exec console "set print asm-demangle on"
5-target-select extended-remote localhost:50000
6-interpreter-exec console "monitor reset halt"
7-target-download
8-interpreter-exec console "monitor reset halt"
9-enable-pretty-printing
10-interpreter-exec console "monitor foreach t [target names] { $t configure -event gdb-detach { shutdown } }"
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-added","output":[["id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reading symbols from /home/sonic/devel/TouchGFX/QMP/build/CM7/QMP.elf...\n"}]}
Reading symbols from /home/sonic/devel/TouchGFX/QMP/build/CM7/QMP.elf...
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.\n"}]}
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Use 'set mi-async'.\n\n"}]}
Use 'set mi-async'.
GDB -> App: {"token":1,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":2,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"cmd-param-changed","output":[["param","print asm-demangle"],["value","on"]]}]}
GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-started","output":[["id","i1"],["pid","42000"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-created","output":[["id","1"],["group-id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"vApplicationIdleHook () at /home/sonic/devel/TouchGFX/QMP/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c:2414\n"}]}
vApplicationIdleHook () at /home/sonic/devel/TouchGFX/QMP/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c:2414
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"2414\t__WEAK void vApplicationIdleHook (void){}\n"}]}
2414 __WEAK void vApplicationIdleHook (void){}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["frame",[["addr","0x0803123c"],["func","vApplicationIdleHook"],["args",[]],["file","/home/sonic/devel/TouchGFX/QMP/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c"],["fullname","/home/sonic/devel/TouchGFX/QMP/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2/cmsis_os2.c"],["line","2414"],["arch","armv7e-m"]]],["thread-id","1"],["stopped-threads","all"]]}]}
Program stopped, probably due to a reset and/or halt issued by debugger
GDB -> App: {"token":5,"outOfBandRecord":[],"resultRecords":{"resultClass":"connected","results":[]}}
11-thread-list-ids
12-thread-list-ids
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0x01000000 pc: 0x08036740 msp: 0x24040000\n"}]}
xPSR: 0x01000000 pc: 0x08036740 msp: 0x24040000
GDB -> App: {"token":6,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":7,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":7,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":7,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":7,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Load failed"]]}}
SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : clock speed 1800 kHz
Info : STLINK V3J7M2B4S1 (API v3) VID:PID 0483:374F
Info : Target voltage: 3.285562
Info : stm32h7x.cpu0: hardware has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 50000
Info : Listening on port 50000 for gdb connections
Info : accepting 'gdb' connection on tcp/50000
Info : Device: STM32H74x/75x
Info : flash size probed value 2048
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08036740 msp: 0x24040000
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08036740 msp: 0x24040000
shutdown command invoked
Info : dropped 'gdb' connection
SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
My debug configuration that used to work (I haven't touched that project in a couple of months) fails with "Failed to launch GDB: Load failed (from target-download)".
From what I could gather from the logs, it seems the problem seems to be the target-download command which now fails on my board. I suspect it has something to do with the external flash where we store parts of the executable's sections.
I'm using the ST-Link debugger (v3?), openocd 11 on a STM32H757 target running Arch Linux.
launch.json
Debug console output
gdb-server output