cancel
Showing results for 
Search instead for 
Did you mean: 

Custom bootloader and debugger issues

JR2963
Senior

Hello,

I am using an STM32WB with a custom bootloader, which is currently simple and only knows how to jump to a specific address to start the application. I upload firmware using debuggers (STLink V3 and JLink). When I upload the bootloader and the application separately, then make reset of MCU everything works – the bootloader launches the application, and it seems to run fine. However, if I have the bootloader already uploaded and I upload only the application via the debugger, it often happens that the application does not start (in debug mode). The bootloader seems to be active, probably sending a command to jump to the application (that's just my guess), and in debug mode, I see that the application gets stuck right at the reset handler, and nothing can be done with it. Sometimes switching from JLink to STLink or vice versa helps. It's very frustrating to debug software when most of the time it doesn't work. Do you have any idea what could be the issue?

Thank you.

 

 

4 REPLIES 4
Radosław
Senior II

1 solution,  marge bootloader to  aplication.

2. load bootloader  when debug is started (see lauch configuration)

SMarie
Associate III

Hello,

Did you update your linker script with the start address of your application and applied it in Properties>C/C++ Build>Settings>MCU GCC Linker>General ?

Then, did you add the start address in your debug configuration ?

Add some more diagnostic or telemetry from the loader, about what's happening, and the integrity of the app image.

When it fails determine if the IDE or upload process has trashed the loader, or failed to load the app image such that it doesn't match the PC side image. Perhaps in a post-link step CRC or SHA the app image so the loader can determine if it is complete and intact, and report such before jumping or dying.

Don't have any silent death while(1) loops in Error_Handler or HardFault_Handler

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Radosław
Senior II

Maybe bootloader is stack when mcu is not hard reset but only by core reset?   Some loaders liitle mess with that,