I have two project : RM57L843 project + bootloader.
In their .icf files, vector address and flash address are defined as below.
<RM57L843> :
vector address : 0x20000 - 0x20020
application flash address : 0x20020 - 0x3FFFFF
<Bootloader>:
vector address : 0x0 - 0x20
bootloader flash address : 0x20 - 0x3FFF
My bootloader's design goal : Once CPU is locked, when I push a button located in target board at powering on,
the entire flash will be erased. When I don't push the button at powering on, app. program located at 0x20000 will be running.
Bootloader's main() method is as below.
main()
{
if(1 == CheckGPIOForceUpdate()) /* judge whether button is pushed down */
{
selfEraseFlash();
}
else
{
g_ulTransferAddress = (uint32_t)APP_START_ADDRESS;
if((*(uint32_t *)APP_START_ADDRESS) != 0xFFFFFFFF)
{
((void (*)(void))g_ulTransferAddress)();
... ...
}
Because bootloader and application is different project, they used different vector table. How can I do change vector mapping from bootloader's vector table to application's vector table before jumps to application start address?