I'm working on STM32F407 device, developing a Bootloader and Application
The environnement is Visual Studio Code, and using Cortex-Debug extension for the debug.
The bootloader at address 0x0800 0000 is launching the application relocated at 0x0802 0000 in FLASH. So the application linker file specified the new start address @0x0802 000, and the system_stm32f4xx.c file define a VECT_TAB_OFFSET = 0x00020000
When running without debuger, the bootloader start the application and everything is fine. But in debug mode, main() is never reached and no debug is possible. But Cortex-debug do not crash. I can pause/play it, but is it not showing anything. It seems "lost"
So, in run mode, everything works as expected. The boot call the application and the application execute.
If I relocate the application @0x0800 0000 with VECT_TAB_OFFSET == 0, I am able to debug the code using Cortex Debug. But debugging @0x0802 0000 with VECT_TAB_OFFSET == 0x0002 0000 is not possible. Main() is never called. I have checked memory, the .bin is correctly loaded at 0x0802 0000
Here is my launch.json file:
{
"version": "0.2.0",
"configurations": [
{
"name": "Cortex Debug",
"cwd": "${workspaceFolder}",
"executable": "./build/Debug/APP.bin",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"device": "STM32F407",
"configFiles": [
"interface/stlink.cfg",
"target/stm32f4x.cfg"
],
"symbolFiles": [
"${workspaceFolder}/build/Debug/APP.elf"
],
"loadFiles": [
"${workspaceFolder}/build/Debug/APP.hex"
],
"gdbPath": "arm-none-eabi-gdb.exe",
"interface": "swd"
}
]
}
Is there a parameter to say the debugger to work at 0x0802 0000? I supposed that loading the .hex file was enough be maybe i'm wrong
I was having the same issue. After adding
overrideLaunchCommandsto theconfigurationsnode inlaunch.jsonfile, I am able to debug successfully.