Hi NXP team,
We are using S32K1XX controller in our project.
I have placed the application hex values in array and located the array at the XYZ segment area.
I have checked in map file and memory window, array is located at the XYZ segment .
__attribute__((section (".XYZ_codearea"))) T_U8 EraseArr[12] =
{
0x80,0xB4,0x00,0xAF,0x22,0x4B,0x4F,0xF0,0x80,0x42,0xC3,0xF8
};
typedef void (*BL_pfvJumpAddress_t)(void);
Jump function :
void BL_BLC_JumpToApp( T_U32 *pu32JumpAddress )
{
BL_pfvJumpAddress_t pfvJumpAddress;
/* Assign address to pseudo function. */
pfvJumpAddress = (BL_pfvJumpAddress_t)(pu32JumpAddress);
(pfvJumpAddress)();
}
calling the function :
EraseRoutineFlashPtr = EraseArr;//0x20000541;
BL_BLC_JumpToApp ((T_U32)EraseRoutineFlashPtr);
but it is going default ISR.
please let me know what is the problem ?
Regards,
Ambarish
Hi,
Actually the jump address should have LSB bit (bit 0) set to 1. This indicates that a thumb instruction will be executed after branch. You can e.g. try this:
pfvJumpAddress = (BL_pfvJumpAddress_t)(pu32JumpAddress + 1); // Set LSB bit = Thumb instruction
I also assume that routine "EraseArr" represented here as an array of opcodes needs some arguments/registers to be passed. E.g. address of flash to be erased or a counter...
Therefore before branching to EraseArr please make sure the appropriate GPR core registers/function parameters are initialized correctly.
Otherwise it may end up with exception e.g. trying to write into non-existing memory...
Hope it helps.
Stan