Question
Boot into multiple main applications?
Posted on August 16, 2016 at 15:30
I currently have my own bootloader running with a main application on a STM32F429ZIT. The internal flash memory is broken down into 3 sections:
1. Bootloader2. Main Application (Bank A)3. Temporary storage for new update (Bank B)For ease of discussion, assume the memory map is as follows:Bootloader0x08000000 - 0x0800FFFFMain App (Bank A)0x08010000 - 0x0801FFFFTempororary storage (Bank B)0x08020000 - 0x0802FFFFCurrently, when I update the firmware, I store the new hex file in Bank B, and then perform a processor reset. The bootloader will see the new hex file in Bank B, and perform the following steps:1. Delete current main application residing in Bank A2. Copy new hex file from Bank B to Bank A3. Reset, and go right into the newly updated application in Bank A.What I am looking to do is eliminate the step 2, which copies the hex file from Bank B to Bank A. I would like to have the bootloader be able to go to either Bank A or Bank B.Basically, I want to ping-pong between the two different applications.For example, if I am currently running from Bank B, I'll store the new update in Bank A. If I am currently running from Bank A, I'll store the new update in Bank B. The bootloader will then jump to whichever one is newer.So my question is this:If I compile the main app as if it were being run from Bank A (starting address of 0x08010000), will it matter that the application was compiled with a start address of 0x08010000 but then it is being run from 0x08020000? I would like to be able to compile the main app, and have it be able to run from either bank when programmed into the chip. I know at least as a start, the application needs to be aware of what bank it is running in, and adjust the interrupt vector table offset accordingly on the fly(SCB->VTOR),
Thank you! #stm32f4 #bootloader #c #stm2