2020-04-06 09:00 AM
Dear all,
I am requesting your help to understand well how the dual bank mechanism works before I start writing the firmware:
My questions :
Thank you all very much for your help and your contribution to this forum.
Best
Solved! Go to Solution.
2020-04-06 11:04 AM
> If the MCU boots on Bank 2 but the firmware is uncorrect, how can I reboot on Bank1? Is it possible to reset the BFB2 bit with power cycling? I want to be sure I cannot brick my device.
No, option bits are in persistent memory. To change BFB2 back you'd have to use a programmer, or the ROM bootloader.
> Could you confirm that I do not have to relocate the interrupt vector table if I use the internal bootloader?
Yes, the ROM bootloader uses its own vector table. It doesn't care about the user code.
> How should I generate the binary to be sent to the device to be written in bank 2?
Since memory is remapped, create it as if you're sending it to flash bank 1.
2020-04-06 11:04 AM
> If the MCU boots on Bank 2 but the firmware is uncorrect, how can I reboot on Bank1? Is it possible to reset the BFB2 bit with power cycling? I want to be sure I cannot brick my device.
No, option bits are in persistent memory. To change BFB2 back you'd have to use a programmer, or the ROM bootloader.
> Could you confirm that I do not have to relocate the interrupt vector table if I use the internal bootloader?
Yes, the ROM bootloader uses its own vector table. It doesn't care about the user code.
> How should I generate the binary to be sent to the device to be written in bank 2?
Since memory is remapped, create it as if you're sending it to flash bank 1.
2020-04-06 01:44 PM
Hi TDK,
Thank you for your answers.
So, if I want to use the ROM bootloader, I must check carefully that the bank 2 contains a valid code before rebooting on it.
My idea to reduce the risk would be to reset BFB2 at the beginning of each firmware to reboot on the factory firmware if the mcu stops unexpectedly. And I can make the code as robust as possible until the BFB2 is reset, and always reuse the same piece of validated code.
Does it make sense? or would you recommend to write my own bootloader?
Thanks a lot,
Best,
F.