STM8S IAR 中常量变量函数绝对位置设置

三种方法,举例如下:

1.需要修改icf文件。
#pragma location ="ConstSection1"
__root __no_int char RELEASEDATE[16]  @"ConstSection1";

在icf文件中增加下面
place at address mem:0x08001000 { readonly section ConstSection1 };

注意:icf中需要有';'结尾;
2.
__root __no_init char RELEASEDATE[16] @0x08010000;

3.
#pragma location =0x08010000
__root __no_init char
RELEASEDATE[16];

#if  1
 #pragma location= "ConstSection1"
__root const unsigned int test = 0xaabb;
 #pragma location= "ConstSection2"
__root const unsigned int test1 = 0xccdd;
#endif
 
#pragma location=0x9ff0
__root const unsigned int test[]   = {0xaa,0xbb,0xcc};
__root const unsigned int test1 @0x9ff8 = 0xaabc;

变量绝对定位:

__no_init char array1[100]@0x2000B000;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值