Content originally posted in LPCWare by gianlucarenzi on Mon Nov 19 09:06:56 MST 2012
Hello,
I am stuck on a reset-after-setting-the-m3memmap register.
Scenario: my application (a bootmonitor) is loaded from SPIFI at boot.
Before running main() it relocate itself into SRAM address space (0x1000_0000) VTOR and other stuff.
It uses the SPIFI (ROM)Library to access the SPIFI Device (64Mbit) to program/erase the device using a simple protocol via UART interface.
When the bootmonitor receive a JUMP instruction to execute the user-application something goes wrong:
The SPIFI Area (between 0 - 0x0008_0000) 512K are reserved for bootmonitor itself (remapped 0x1400_0000 - 0x1408_0000).
The SPIFI Area (between 0x0008_0000 up to 7.5MBytes) are reserved for user application (linked-relocated at 0x0000_0000 but physically located at those address space 0x1408_0000...0x1478_0000)
The bootmonitor when receive the JUMP command:
1- set the M3MEMMAP register to 0x1408_0000 (so at the next M3-reset the address 0x0000_0000 is relocated at 0x1408_0000) where are the VTORs data (SP, Reset Handler, Exception Handlers,...)
2- disable every interrupt using __disable_irq() provided by the CMSIS-Library
3- Hit a PERIPH_RST writing RGU_SIG_PERIPH bit (1) in the LPC_RGU->RESET_CTRL0 register.
Nothing happens. I thought my application stack pointer and Reset Handler started, but nothing.
If I use the RGU_SIG_CORE bit (0) in the LPC_RGU->RESET_CTRL0 register, ALL the system is rebooted as the PowerOn, so the M3MEMMAP has the 0x8000_0000 value.
Where I am doing the wrong thing?
Please help me,
Best regards,
Gianluca