2020-10-21 11:03 PM
I want to let STM32L010K4T can jump from my application into bootloader of system memory. (Without hardware pin to set BOOT0 to 1)
According to document AN2606 page 237:
Note: Due to empty check mechanism present on this product, it is not possible to jump from user code to system bootloader. Such jump results in a jump back to user Flash memory space. But if the first 4 bytes of user lash memory (at 0x0800 0000) are empty at the moment of the jump (i.e. erase first sector before jump or execute code from SRAM while Flash is empty), then system bootloader is executed when jumped to.
I build two firmware one is my application start on 0x08000000
The other one is for erase first page memory of 0x08000000 which start on 0x08003900
After the test, the first page of memory 0x08000000 can be erase success but the MCU will be stuck which is not into the bootloader of system memory.
After reboot the MCU, the MCU is into the bootloader .
After to do more test, if can find if my MCU power on in bootloader mode(which means the first page of 0x08000000 is empty), the MCU can update firmware and use the erase structure that I build to jump bootloader without issue. In this case, I can loop for updating firmware and erase memory for jumping to bootloader.
The issue only happen on the MCU power on in application mode, then erase and jump.
Is there anyone can help me for find the reason?
Thanks.