关于IAR的ICF编程操作

最近有一个项目需要对ICF进行外部编程。两个工程引用相同的ICF,通过外部输入参数来区分内部的地址范围。通过相关资料的研究,cmake可以通过参数导入一个变量来就觉这个问题。后来参考IAR手册发现可以在IDE中定义.

例子:

icf文件:

if (isdefinedsymbol(CONFIG_SYM3)) {

define symbol __ICFEDIT_region_ROM_start__     = 0x4000;
define symbol __ICFEDIT_region_ROM_end__       =  0x7FFFF;

}else

{

define symbol __ICFEDIT_region_ROM_start__     = 0x000000;
define symbol __ICFEDIT_region_ROM_end__       =  0x7FFFF;

}

...... 其他略。

为了使用相同的ICF进行维护防止多个文件导致的地址不统一问题。可以再IAR的option->linker->config里面定义定义CONFIG_SYM =XX值。

这样在编译的时候会根据工程中是否定义了这个CONFIG_SYM符号来采用不同的地址范围进行编译。

下面是IAR的官方解释:

Config

The Config options specify the path and name of the linker configuration file and define symbols for the configuration file.

Configuration file symbol definitions

Define constant configuration symbols to be used in the configuration file. Such a symbol has the same effect as a symbol defined using the define symbol directive in the linker configuration file.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值