指定函数入口以及调用方法

 

定义一个指定函数入口地址0x1FFF00FC

typedef void (*IAP)(uint32_t*, uint32_t*);
const IAP Iap_entry __attribute__((at(0x1FFF00FC))) = Iap_Command;

void Iap_Command(uint32_t* cmd, uint32_t* out){.......}

调用方法

The IAP function could be called in the following way using C.
Define the IAP location entry point. Since the 0th bit of the IAP location is set there will be a change to Thumb instruction
set when the program counter branches to this address.
#define IAP_ADDR_LOCATION 0x1FFF00FC
Define data structure or pointers to pass IAP command table and result table to the IAP function:
unsigned long command[10];
unsigned long result[5];
or
unsigned long * command;
unsigned long * result;
command=(unsigned long *) 0x……
result= (unsigned long *) 0x……
Define pointer to function type, which takes two parameters and returns void. Note the IAP returns the result with the
base address of the table residing in r1.
Typedef void (*IAP)(unsigned int [],unsigned int[]);
IAP iap_entry;
Setting function pointer:
iap_entry=(IAP)(*(( unsigned long *) IAP_ADDR_LOCATION));
Whenever you wish to call IAP you could use the following statement.
Iap_entry (command, result);
 

 

 

你可能感兴趣的:(ARM)