How S32K jumps to function through function address

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How S32K jumps to function through function address

1,765 次查看
2974515017
Contributor I

Hello:

   My development environment is S32DS.I defined a function "void IAP_main(void)" in the program bootloader, fixed his address as 0x00007C00, and the map file showed that the function address was set successfully. Now I need to jump from the program APP to “void IAP_main(void)”, but I pass the following code can not achieve:

(*((void (*)())0x00007C00))();or   (*((void (*)())0x00007C01))();

How to solve this problem?

   In addition, when I jump from APP to boodloader, I need to keep the peripheral state unchanged. How to initialize the interrupt vector table and stack? The starting address of the flash of the boodloader is 0.

0 项奖励
回复
1 回复

1,720 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello,

You can jump at a certain address by the code below:

typedef void (*function_pointer)(void);

function_pointer func_p = (function_pointer) 0x000007C01;
func_p();

About your second question, you can look at the AN12218 where is this relocation used before jump into the application.

AN12218SW.zip

Vector table relocation S32_SCB->VTOR = (uint32_t)APP_START_ADDRESS;

Best regards,

Diana

0 项奖励
回复