Jump to Array pointer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Jump to Array pointer

780 Views
ambarishhundeka
Contributor III

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

Labels (1)
0 Kudos
Reply
1 Reply

668 Views
stanish
NXP Employee
NXP Employee

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

0 Kudos
Reply