AnsweredAssumed Answered

Jumping from boot loader mode to application mode

Question asked by kirti raje on Jan 22, 2018
Latest reply on Feb 6, 2018 by kirti raje

Hi,

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
UByte checkForUserApp(void)
{
uint32_t startup; /* assuming 32bit function pointers */
startup = ((uint32_t*)APP_FLASH_VECTOR_START); /* this is the reset vector (__startup function) */

if ((startup!=-1))
{
/* 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
0xA000 address.

UByte checkForUserApp(void)
{
__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.

 

Thanks,

Kirti

Outcomes