Bootloader Debugging [SOLVED]

Hiya,

I’m having difficulty debugging the bootloader firmware.
From the main function and on debugging works just fine, however I can’t seem to debug any code prior to entry in the main function.
After flashing (via JTAG), gdb enters at main.c:90 0x080001a0, ignoring all breakpoints I place in the SystemInit function (system_stm32f2xx.c).
I’m running make with USE_SWD_JTAG=y DEBUG_BUILD=y (i’ve also tried setting export COMPILE_LTO=n in the makefile).

Being that SystemInit is called before main (see build/arm/startup/startup_stm32f2xx.S), and the -g3 debugging flag is present in the CFLAGS, why is it that my breakpoints are not being hit?

Thank you!

Are you loading the .elf compiled for the bootloader using gdb?

Yep, using gdb through the Eclipse CDT.

So you loaded the .elf built for the user firmware or the bootloader?

The binary you load for user firmware does not contain the bootloader code so the does .elf. You will need the .elf for the bootloader…

Solved! Silly mistake: Eclipse was still referencing the “-lto” version of the bootloader elf file!
Flashing the non-lto version (COMPILE_LTO=n) of the bootloader firmware I am now able to debug code prior to the main.

Thanks :smile:

1 Like