初级会员

- 积分
- 83
- 金钱
- 83
- 注册时间
- 2017-3-12
- 在线时间
- 13 小时
|

楼主 |
发表于 2017-8-23 10:58:04
|
显示全部楼层
本帖最后由 dczjn 于 2017-8-23 10:59 编辑
dczjn 发表于 2017-8-23 10:38
uint8_t testValue[6] __attribute__((at(0x68000000));
uint8_t testValue[6]={6,6,8,8,9,9};
int mai ...
uint8_t testValue[6] __attribute__((at(0x68000000));
uint8_t testValue[6]={6,6,8,8,9,9};
int main(void)
{
int i=0;
for(;i<6;i++)
{
printf("%d\n"testValue);
}
printf("%x\n " &testValue);
}
输出结果是垃圾数,数组地址到正确 是0x68000000
***************************************
如果在main函数内赋值,数组很大时,内存溢出,地址不是外部0X68000000
uint8_t testValue[6] __attribute__((at(0x68000000));
int main(void)
{
testValue[307200]={};
int i=0;
for(;i<307200;i++)
{
printf("%d\n"testValue);
}
}
上次的代码,忘记写中括号了,帖子中括号写不进去为何? |
|