AnsweredAssumed Answered

STM32F0 custom bootloader

Question asked by winix on Apr 28, 2016
Latest reply on Apr 29, 2016 by winix
Hi, I have made a custom bootloader, but it sometimes freeze when going from bootloader to the actual firmware.  Usually the bootloader should just go to the firmware by doing the following:

uint32_t startAddress = *(__IO uint32_t*)(FIRMWARE_START_ADDRESS + 4);
pFunction RestartFirmware = (pFunction)startAddress;
__set_MSP(*(__IO uint32_t*)FIRMWARE_START_ADDRESS);

Where the FIRMWARE_START_ADDRESS is the first data for the actual firmware.

In the firmware itself, I would copy the vector table, and do as normal.

uint32_t i = 0;
for(i = 0; i < 48; i++)
     VectorTable[i] = *(__IO uint32_t*)(FIRMWARE_START_ADDRESS + (i<<2));

I do not know what is failing, and when it is failing.  Someone experienced told me to actually disable the IRQ and also de-init everything before passing to firmware, which I will do.  However, is there anything best practice to do this?

Just for information, I am going to add:

Before the jumping of bootloader to firmware to disable everything first.

Am I doing the right thing?