arm vscode + openocd+stlink 调试stm32f40xxx

发布时间 2023-03-29 01:02:41作者: ljymoonlight

配置

` {
"name": "Cortex Debug-stlink",
"type": "cortex-debug",
"request": "launch",
"executable": "${workspaceFolder}\STM32F405 Ethercat\MDK-ARM\debug.elf",
"cwd": "${workspaceFolder}\STM32F405 Ethercat",
"interface": "swd",
"servertype": "openocd", //要选择的GDB server
"device": "STM32F405RGT", //
"configFiles": [
// "${workspaceRoot}/openocd.cfg"
"interface/stlink.cfg",
"target/stm32f4x.cfg",
// "-c init",
// "-c halt",
// "-c 'stm32fx unlock 0'",
// "-c 'reset halt'",
// "-c exit",
],
"runToMain": true,
"showDevDebugTimestamps": true,
"armToolchainPath": "D:/soft/arm-gcc/5.4 2016q3/bin/",

	}

`

问题:

Please check OUTPUT tab (Adapter Output) for output from D:\soft\openocd-20230202\OpenOCD-20230202-0.12.0\bin\openocd.exe
Launching server: "D:\soft\openocd-20230202\OpenOCD-20230202-0.12.0\bin\openocd.exe" "-c" "gdb_port 50000" "-s" "D:\pro\2022NB4\STM32F405底板\IO程序\STM32F405 Ethercat" "-f" "interface/stlink.cfg" "-f" "target/stm32f4x.cfg"
Launching GDB: "D:\soft\arm-gcc\5.4 2016q3\bin\arm-none-eabi-gdb.exe" "-q" "--interpreter=mi2"
Reading symbols from D:\pro\2022NB4\STM32F405�װ�\IO����\STM32F405 Ethercat\MDK-ARM\debug.elf...

warning:
Loadable section "RW_IRAM1" outside of ELF segments
done.
warning: Loadable section "RW_IRAM1" outside of ELF segments
Reset_Handler () at ....\Libraries\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm/startup_stm32f40_41xxx.s:182
182 LDR R0, =SystemInit
Not implemented stop reason (assuming exception): undefined
2
Unable to match requested speed 2000 kHz, using 1800 kHz
[stm32f4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000270 msp: 0x20000fd0
2
Unable to match requested speed 2000 kHz, using 1800 kHz
[stm32f4x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000270 msp: 0x20000fd0