Boot from flash bank A to bank B failing

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by FlorentCapelle on Wed Sep 24 09:27:05 MST 2014
Dear all,

I am facing an issue implementing a bootloader on LPC1857.

My bootloader code is linked at address 0x00000000 and copied in the µC at address 0x1A000000, in the flash bank A of the controller.
From this bootloader, I want to jump to an application code situated in flash bank B at address 0x1B004000 (the code of this application is compiled at address 0x4000).

The steps I take are the following:

- copy the application code to address 0x1B004000 using IAP functions
- set the stack pointer to the value contained in address 0x1B004000
- set the VTOR register to 0x1B004000
- set the M3MEMMAP register to 0x1B000000 (remember my application is linked @0x4000)
- jump to the address contained in address 0x1B004004

My observation is that the bootloader is jumping correctly to my application in flash bank B but the program hangs very quickly. My guess is that the issue comes from the vectors table not being set correctly and that my application goes wrong as soon as interrupts are enabled.

Note also that the same process with the application put in flash bank A at address 0x1A004000 is giving no problem.

Could it be that switching from bank A to bank B is not allowed somehow?

Thanks in advance.
Best regards,