MK64 Program FLASH

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MK64 Program FLASH

710件の閲覧回数
DINGii
Contributor II
Question 1:
Hi, I use MK64FX512, now I want to divide the program space into two blocks, the first block is located in 0x00-0x2ffff, the second block is located in 0x3000-0x80000, jump from the first block to the second block with the following program:
typedef void (*iapfun) (void);
iapfun jump2app;
 
void msrmsp (unsigned int addr)
{
__asm volatile (
"MSR MSP, r0 n"
"BX r14 n"
);
}
 
void iap_load_app (unsigned int appxaddr)
{
    unsigned long tmp;
    
tmp = (*(volatile unsigned int *)appxaddr) & 0x2ff00000;
    tmp = tmp;
if (tmp == 0x20000000) {
jump2app = (iapfun)*(volatile unsigned int *)(appxaddr + 4);
msrmsp (*(volatile unsigned int *)appxaddr);
jump2app();
}
}
 
Call iap_load_app (0x3000), 0x3000 already have a program, the above program is no problem to use in M4 of ST and TI, but the program of the 0x3000 cannot be run in MK64.
 
Question 2:
CAN THE PROGRAM RUN 0x10000000 SECOND FLASH?
ラベル(1)
0 件の賞賛
返信
1 返信

659件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @DINGii 

I recommend you refer to the jump code in 

https://community.nxp.com/t5/Kinetis-Microcontrollers/Kinetis-Bootloader-to-Update-Multiple-Devices-...  

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");
}

 

BR

Alice

 

 

0 件の賞賛
返信