cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader: jumping to either App A or App B

ELitv.2
Associate II

Hello

I​ am considering the following approach of the Bootloader.

We will divide the internal flash into :

1. Bootloader

2. App A

3. App B

For App A or B we will have a version number. Bootloader will read the version numbers of both and depending upon which application is newer will jump to there. The application doesn't know in advance where it will reside- either in the App A or App B section, which means we're talking about Position Independent Code.

My compiler is Keil.

My 1st question is​ how can I build such a bin image that can reside in either of these 2 sections?

Another approach looks clear for me. It is to assign the bottom section to the application and the upper se​ction to the buffer to hold the new version. When the new version is downloaded, we then copy it to the bottom and erase the buffer in the upper.

The advantage in the 2nd method is simplicity- no need in PIC. The advantage in the 1st method is speed - no need to copy image from the upper to the bottom section.

My second question is which approach is bett​er in your view and why?

10 REPLIES 10

Hi @Community member​ ,

yes, the banks can be swapped, so either can be mapped to the address 0 (or 0x0800 0000 even). There is also a dual bank STM32G0Bx if that helps. On the G071 the X-CUBE-SBSFU example uses an arrangement of active slot and download slot. One sector is used to ease the swapping. It's slower, but reliable and not too complicated.

BR,

J

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.