Showing results for 
Search instead for 
Did you mean: 

Problem with self programming after enabling read out protection



I've implemented a bootloader that receives, cache and upgrades my main program.

When RDP (read out protection) is not enabled everything works as expected with no problem.

If I enable RDP. And if I upload the same program as the one already on the chip theres no problem. (I combine program and bootloader together and upload them).

But if I upload a changed version of program, after uploads finishes ( and restarts ) it breaks and stops working.

I'm sure bootloader is working since its alright without RDP enabled. and uploaded program should not be corrupted since I verify once after writing.

The only things that change between two version of program, I think, is size of program and starting address.

Does enabling RDP freezes the starting address or something? any Idea?

I'm using SM32f103RE.



The boot loader should be able to report internal status, like if it is running or not, and the state of the app firmware. It should also be able to dump the memory content. You'll need to use serial port output to debug/diagnose what specifically is happening. I would recommend having HardFault_Handler() and Error_Handler() routines output actionable data, and make sure the app firmware enables interrupts if they were disabled, and sets SCB->VTOR correctly.

You should sign the app image in someway so you can verify its integrity, before calling into it.

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