Failed to launch GDB: Load failed (from target-download) in STM32H753BI

129 views Asked by At

I am attempting to debug an STM32H753BI microcontroller using OpenOCD and an STLink v2 to read RTT (Real-Time Transfer). However, I am encountering difficulties loading the firmware onto the H7 board. Below is the output from VS Code:

Reading symbols from /home/project/tools/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objdump --syms -C -h -w /home/Project/Workspace/build/stm32h7.elf
Reading symbols from /home/project/tools/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-nm --defined-only -S -l -C -p /home/Project/Workspace/build/stm32h7.elf
Launching GDB: /usr/bin/gdb-multiarch -q --interpreter=mi2
1-gdb-version
Launching gdb-server: /home/project/Workspace/xpack/xpack-openocd-0.12.0-2-linux-x64/xpack-openocd-0.12.0-2/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/project/Workspace/xpack/xpack-openocd-0.12.0-2-linux-x64/xpack-openocd-0.12.0-2/openocd/scripts -f /home/project/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/stlink.cfg -f target/stm32h7x.cfg
    Please check TERMINAL tab (gdb-server) for output from /home/project/Workspace/xpack/xpack-openocd-0.12.0-2-linux-x64/xpack-openocd-0.12.0-2/bin/openocd
-> =thread-group-added,id="i1"
-> ~"GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2\n"
-> ~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
-> ~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
-> ~"\nType \"show copying\" and \"show warranty\" for details.\n"
-> ~"This GDB was configured as \"x86_64-linux-gnu\".\n"
-> ~"Type \"show configuration\" for configuration details.\n"
-> ~"For bug reporting instructions, please see:\n"
-> ~"<http://www.gnu.org/software/gdb/bugs/>.\n"
-> ~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
-> ~"\n\n"
-> ~"For help, type \"help\".\n"
-> ~"Type \"apropos word\" to search for commands related to \"word\".\n"
-> 1^done
2-gdb-set mi-async on
Finished reading symbols from objdump: Time: 132 ms
-> 2^done
3-interpreter-exec console "set print demangle on"
-> 3^done
4-interpreter-exec console "set print asm-demangle on"
-> =cmd-param-changed,param="print asm-demangle",value="on"
-> 4^done
5-enable-pretty-printing
-> 5^done
6-interpreter-exec console "source /home/project/.vscode/extensions/marus25.cortex-debug-1.12.1/support/gdbsupport.init"
-> 6^done
7-interpreter-exec console "source /home/project/.vscode/extensions/marus25.cortex-debug-1.12.1/support/gdb-swo.init"
-> =cmd-param-changed,param="language",value="c"
-> =cmd-param-changed,param="language",value="auto"
-> 7^done
8-interpreter-exec console "set output-radix 0xa"
-> ~"Output radix now set to decimal 10, hex a, octal 12.\n"
Output radix now set to decimal 10, hex a, octal 12.
-> 8^done
9-interpreter-exec console "set input-radix 0xa"
-> ~"Input radix now set to decimal 10, hex a, octal 12.\n"
Input radix now set to decimal 10, hex a, octal 12.
-> 9^done
10-file-exec-and-symbols "/home/Project/Workspace/build/stm32h7.elf"
-> 10^done
11-target-select extended-remote localhost:50000
-> =thread-group-started,id="i1",pid="42000"
-> =thread-created,id="1",group-id="i1"
-> ~"0x08010b54 in ?? ()\n"
0x08010b54 in ?? ()
-> *stopped,frame={addr="0x08010b54",func="??",args=[],arch="armv7e-m"},thread-id="1",stopped-threads="all"
mi2.status = stopped
Program stopped, probably due to a reset and/or halt issued by debugger
-> 11^connected
12-interpreter-exec console "monitor reset halt"
-> @"[stm32h7x.cpu0] halted due to debug-request, current mode: Thread \n"
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread
-> @"xPSR: 0x01000000 pc: 0x08010b54 msp: 0x2407fff8\n"
xPSR: 0x01000000 pc: 0x08010b54 msp: 0x2407fff8
-> 12^done
13-target-download
-> 13+download,{section=".rodata",section-size="181744",total-size="25419240"}
-> 13+download,{section=".rodata",section-sent="16272",section-size="181744",total-sent="16272",total-size="25419240"}
Finished reading symbols from nm: Time: 665 ms
-> 13+download,{section=".rodata",section-sent="65152",section-size="181744",total-sent="65152",total-size="25419240"}
-> 13+download,{section=".rodata",section-sent="113904",section-size="181744",total-sent="113904",total-size="25419240"}
-> 13+download,{section=".rodata",section-sent="162400",section-size="181744",total-sent="162400",total-size="25419240"}
-> 13+download,{section=".ARM",section-size="8",total-size="25419240"}
-> 13+download,{section=".init_array",section-size="68",total-size="25419240"}
-> 13+download,{section=".fini_array",section-size="4",total-size="25419240"}
-> 13+download,{section=".data",section-size="4036",total-size="25419240"}
-> 13+download,{section=".class_b_ram",section-size="36",total-size="25419240"}
-> 13+download,{section=".class_b_ram_rev",section-size="36",total-size="25419240"}
-> 13+download,{section=".stack_bottom",section-size="16",total-size="25419240"}
-> 13+download,{section=".SectionEXternalResource",section-size="5847768",total-size="25419240"}
-> 13^error,msg="Load failed"
14-interpreter-exec console "monitor reset halt"
Failed to launch GDB: Load failed (from target-download)

gdb server output:

[2023-11-27T16:48:15.242Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/home/project/Workspace/xpack/xpack-openocd-0.12.0-2-linux-x64/xpack-openocd-0.12.0-2/bin/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /home/project/Workspace/xpack/xpack-openocd-0.12.0-2-linux-x64/xpack-openocd-0.12.0-2/openocd/scripts -f /home/project/.vscode/extensions/marus25.cortex-debug-1.12.1/support/openocd-helpers.tcl -f interface/stlink.cfg -f target/stm32h7x.cfg
xPack Open On-Chip Debugger 0.12.0+dev-01312-g18281b0c4-dirty (2023-09-04-22:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDLiveWatchSetup
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 V2J41S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.213613
Info : [stm32h7x.cpu0] Cortex-M7 r1p1 processor detected
Info : [stm32h7x.cpu0] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for stm32h7x.cpu0 on 50000
Info : Listening on port 50000 for gdb connections
[stm32h7x.cpu0] halted due to breakpoint, current mode: Thread 
xPSR: 0x01000000 pc: 0x08010b54 msp: 0x2407fff8
Info : accepting 'gdb' connection on tcp/50000
Info : Device: STM32H74x/75x
Info : flash size probed value 2048k
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08010b54 msp: 0x2407fff8
[stm32h7x.cpu0] halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08010b54 msp: 0x2407fff8
shutdown command invoked

I have an external flash memory defined at ".SectionEXternalResource." After removing it and attempting the debugging process again, I was able to successfully debug. However, I'm uncertain whether the code was flashed onto the device or not.

I verified this using a simple code.

static int var = 0;
var = 10;
 SEGGER_RTT_printf(0, "before data:%d\n",var);

its print

before data : 10

after i made some changes like

static int var = 0;
var = 5;
 SEGGER_RTT_printf(0, "after data:%d\n",var);

And debug its print

before data : 5

When making changes to a variable and debugging, the variable's value updates correctly, but the strings printed using SEGGER_RTT_printf remain unchanged.

Could someone provide an explanation for why this issue is occurring? Additionally, are there any viable methods available to load external flash using OpenOCD?

0

There are 0 answers