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

本文详细介绍了在ARM架构中如何定义和调用IAP(In Application Programming)函数,包括设置函数入口地址、定义数据结构以及通过指针调用函数的具体步骤。对于理解和实现嵌入式系统的在线编程具有重要指导意义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

////////定义一个指定函数入口地址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);
 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值