Hello everybody! Happy to write my first post in this blog.
Would like to share my results: i reach my finally goal - wrote an application which is select the working firmaware on chip.
For example: we have several firmwares and would like to switch beetween them during working. uC LPC1837 have 512 kBytes of Flash. Thus mean that we could download several specific firmwares and switch from one to another by setting vector table offset (SCB->VTOR).
The main application placed in address 0x00. And have size about 2 kBytes. This application go to EEPROM of uC and get the offset of application, which will begin to work now. Then create an entry point to reset_handler of application and jump into it.
This high weigth application in flash, placed from address 0x2000. And it can use EEPROM to setup the next application what should runing after reset. Also it ca
This can be used for updating one of them, leave previous version without changings Like doubled buffered.
Here i place main function of the booter program:
void go_to_app(uint32_t addr) // addr - addres of main application(e.g. 0x2000)
void (*app)(void); // create an Reset_Handler of app
uint32_t *p = (uint32_t *)addr; // get a pointer to app
SCB->VTOR = addr; // offset the vector table
__set_MSP(*p++); // set main stack pointer to app
app = (void (*)(void))(*p); // app now is entry point