AnsweredAssumed Answered

keaz128 bootloading

Question asked by VITALI HARUDKA on Oct 4, 2017
Latest reply on Oct 8, 2017 by Kerry Zhou

Hello people. I try to make a custom bootloader for keaz128 MCU and got next trouble. I write jump to app function like this(got from example for other MCU):

void JumpToUserApplication(LWord userSP, LWord userStartup)
{
volatile LWord avoid_optimization;
avoid_optimization = userSP; //In order to avoid optimization issue when -Os
avoid_optimization = userStartup; //In order to avoid optimization issue when -Os
// set up stack pointer
__asm("msr msp, r0");
__asm("msr psp, r0");
// Jump to PC (r1)
__asm("mov pc, r1");
}
While i debug in i found what register R1 doesn't contatin userStartup value. I fix this problem and mcu jump to new area but it start execute interrup table as a code.

volatile uint32_t avoid_optimization, avoid_optimization2;
avoid_optimization = userSP;
avoid_optimization2 = userStartup;


// set up stack pointer
__asm("msr msp, r0");
__asm("msr psp, r0");

// Jump to PC (r1)
__asm("mov pc, r3");

No jump to startup code of new app. May be it's because of i don't relocate VTOR. But i didn't find it's address in MCU lib. I try change it using address(0xE000ED08) witch i get from other exaple but it didn't solve a trouble.

Do somebody know solution for this trouble?

Outcomes