Skip to main content
Explorer
July 31, 2024
Question

Help : Bootloader and 2 flash sections on STM32U575

  • July 31, 2024
  • 4 replies
  • 2594 views

Hi All,

I am using a STM32U575QI and I am wondering if it would be possible to create my own boot loader and then split my FLASH into 2 sections. I know I can get the boot loader application to start at address 0x0800000 and I have offset the vector table and applicationA.

But what I am trying to figure out if it is possible to split FLASH in the linker file to allow me to have two applications, it would be the same project but two different versions of it. Basically I want the boot loader to run and I want to read application A and B from an SD card and store them in FLASH. Then have my boot loader run and decide which application to run.

From some research I know it can be possible with the two banks on the device without the need for a boot loader but wondered if it would be possible this way with a boot loader and 2 sections of FLASH.

Would I need to have a project each for application A and B and specify where the vector table is for both of them in each section of FLASH?

Any help would be appreciated.

Thanks!

    This topic has been closed for replies.

    4 replies

    Super User
    July 31, 2024

    No problems with this scheme. You can split the FLASH into as many sections as you want, just ensure they are all on separate flash pages.

    When the application starts, it should set the vector table location itself based on what you specify in the linker file. That's the idea at least, probably want to verify that.

    Visitor II
    July 31, 2024

    Need to remember both aplication need to be compiled with own start address

    joeSDAuthor
    Explorer
    August 1, 2024

    Hi, thanks for the replies. Let me just give some more information to still see if its possible.

    The applications I want to be able to store in two sections of Flash are exactly the same just different versions - compiled the same way and everything.

    The only thing I did to the linker file was create a section section of FLASH (gave both the correct sizes). Do I need to set up the .rodata, .isr_vector etc for the section section?

    If both applications are the same with the same linker files will they both be able to run if they are stored in flash in different sections?

    This is all new to me so apologies if its not 100% correct or I'm not getting it across properly!

    @TDK @Radosław 

    Visitor II
    August 1, 2024

    My suggestion: bootloader need check if copy 1(working aplication) are correct, and if not, move copy 2 to working section, bootloader can not erase anythning from section 2.

     

    Graduate
    August 1, 2024

    If you want to actually run the unaltered application in both locations, you would have to make sure that it is build and linked in a location independent way. Normally the linker would not use offset addressing but direct addressing for jumps into funtions etc. . That can not work if the application can be at two different places in the rom.

    This is why the common solution (e.g. the standard in mcuboot, which by the way can support your controller) is to swap the applications before starting them, so that the execution always happens from the same address. The hardware solution is to use two times the same offset, meaning you also have the bootloader twice, on two banks and switch the banks, but in my mind that only wastes flash.