Hello All, I have a problem in jumping from internal flash to execute another program that started from internal RAM. I use an external RAM for the HEAP and RW as shown in the scatter. MCU is LPC1788 with 32 MByte of external RAM.
LR_IROM1 0x10000000 { ; load region size_region ;ER_IROM1 0x00000000 0x00080000 { ; load address = execution address ; *.o (RESET, +First) ; *(InRoot$$Sections) ; .ANY (+RO) ;} ER_IROM1 0x10000000 0xF7D0 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } IRAM_STACK 0x1000F7D0 0x800 { ; RW data startup_LPC177x_8x.o (STACK) } IRAM_HEAP 0xA0000000 0x40000 { ; RW data startup_LPC177x_8x.o (HEAP) } RW_RAM1 0xA0040000 UNINIT 0xA2000000 { ; RW data .ANY (+RW +ZI) }
each time the MCU goes to the 0x00000000 and wait for a command to fill the internal RAM at 0x10000000 and run the second program.
As shown in the picture, all configuration is correct, the RAM is occupied correctly. But the boot_jump would not work and the second program can not run from the RAM!!! Should i do something when i jump to the second prgoram at the start of the internal RAM? the architecture is cortex-M3 and there is no need to change MEMMAP! Am i right?
Best Regards, Mostafa
the picture is :
3ddbeb5d-a-62cb3a1a-s-sites.googlegroups.com/.../bootloader_jump_to_ram.jpg
Ok, but what happens when you step that code and actually load the PC?
Not sure loading PC is the approved way of doing things these days, I'd perhaps use LDR R0, [R0, #4] BLX R0
It is not jumping to 0x10000004, but vectoring indirectly to 0x10009631
Your code when it lands there is probably going to want to set SCB->VTOR to the new vector table.
Thank you for your reply, I just added these line before boot_jump and it will okay! I do not know what happened! is there any interrupt cause this!
__disable_irq(); NVIC_DeInit(); NVIC_SCBDeInit(); NVIC_SetVTOR(USER_PROGRAM_START); boot_jump(USER_PROGRAM_START);
In this way, i found another observation that i do not know, it is correct or not! I found that Keil compiler is more stronger in this situation that you have scatter regions and want to jump everywhere you like!
What interrupts do you enable? SysTick? SDIO, DMA, USART?
The new code has to be ready to immediately deal with these, better to turn them off for a clean hand-off. Would also have a Hard Fault Handler, and USART, set up and ready to output diagnostic data