AnsweredAssumed Answered

Jump from bootloader to application

Question asked by Juan Abelaira on Jul 11, 2017
Latest reply on Jul 25, 2017 by Juan Abelaira

I'm getting a hard fault when jumping from my bootloader to the app. It's on an LPC1519 and the bootloader resides at 0x0000 - 0x1FFF, while the application starts at 0x2000. I'm using LPCXpresso.

I've seen this question asked and apparently answered somewhere else but none of the solutions proposed worked for me. Here is the code I use for the jump:


SCB->VTOR = (0x2000);
asm volatile("ldr r0, =0x2000");   // Code start address
asm volatile("ldr sp, [r0]");
asm volatile("ldr r0, [r0, #4]");
//asm volatile("add r0, r0, 1"); // tried this as I read address has to be odd for thumb
asm volatile("mov pc, r0");
//asm volatile ("bx r0");           // tried this as I read is not safe to load PC


If I debug it, everything goes fine until the PC load or BX, where it goes to the hard fault loop.

Anything can point the right direction?



Edited: If I edit the application 'ld' file to have the main as entry point, as below, then it works, but I'd like to know what the difference makes skipping the ResetISR function (the bootloader ran it anyways).