Hi,
we are testing a custom jump from user App 1 to user App 2 on the FRDM A S32K344
linker file of app1 and app2 is attached below
#define APP_START_ADDRESS 0x00500000
void Bootup_Application(const uint32_t app_StarAddress)
{
uint32_t appEntry, appStack;
static void (*jump_to_application)(void);
/* Get the application's initial stack pointer value */
appStack = *((uint32_t *)(app_StarAddress));
/* Get the application's reset handler (entry point) address */
appEntry = *((uint32_t *)(app_StarAddress + 4));
/* Assign the application entry address to the function pointer */
jump_to_application = (void (*)(void))appEntry;
/* Relocate the interrupt vector table to the application */
S32_SCB->VTOR = (uint32_t)app_StarAddress;
/* Disable global interrupts (ASM_KEYWORD("cpsid i");) */
__asm volatile ("cpsid i" : : : "memory");
/* Set the Main Stack Pointer (MSP) */
__asm volatile ("MSR msp, %0\n" : : "r" (appStack) : "memory");
/* Set the Process Stack Pointer (PSP) */
__asm volatile ("MSR psp, %0\n" : : "r" (appStack) : "memory");
/* Jump to the application */
jump_to_application();
while (1)
{
/* Reaching here indicates an error occurred */
Siul2_Dio_Ip_WritePin(LED_RED_PORT, LED_RED_PIN, 1U);
}
}
Could you please verify Bootup_Application func can succeffuly jump to app2? If any additional steps are required, please let me know.
Hi @ganavi1
In principle, I can see no problem there. The only thing is that disabling of global interrupts may not be enough. I always recommend to de-initialize all used peripherals. Make sure that all interrupts are disabled also locally via peripheral registers, so they can’t be triggered again once global interrupts are enabled by App2.
Regards,
Lukas