I have written a boot loader and application code using KDS 3.2 for K64FN controller.
My boot loader starts at 0x00000000 and application starts at address 0x0000A000.
My boot loader is able to flash application (S19 file) in application area. After
firmware flashing, I am using below function to jump to application start -
APP_FLASH_VECTOR_START - 0x0000A000
uint32_t startup; /* assuming 32bit function pointers */
startup = ((uint32_t*)APP_FLASH_VECTOR_START); /* this is the reset vector (__startup function) */
/* we do have a valid application vector? -1/0xfffffff would mean flash erased */
((void(*)(void))startup)(); /* Jump to application startup code */
I have also tried below code to jump to application but it is not able to jump to
__asm(" ldr r0, = 0xA000");
__asm(" ldr r1,[r0]"); // get the stack pointer value from the program's reset vector
__asm(" mov sp,r1"); // copy the value to the stack pointer
__asm(" ldr r0, = 0xA004"); // get the program counter value from the program's reset vector
__asm(" ldr r1,[r0]");
__asm(" blx r1"); // jump to the start address
The value at startup is 0xAB5D which is Program counter's value.
My issue is that, boot loader is not able to jump to application and is jumping to
thumb startup function.
did some one come across this scenario. Any help is appreciated.