【IAR Error】IAR MSP430编译报错:error

关于转载的说明:原文内容可能会不断更新,要想得到最新的内容请跳到到原文看。

无编号警告类型:

1、Sat Jun 23, 2012 17:41:05: The stack pointer for stack 'Stack' (currently Memory:0xF5336) is
原因:http://blog.sina.com.cn/s/blog_4c0cb1c0010153l9.html

IAR相关设置:Tools->Option->Stack->Warn when stack pointer is out of bounds.

2、无法查看结构体/共同体/联合体 变量[Syntax error, unexpected $end, expecting COLON2] column 1

  struct drpoint  {
     uint16 x;
     uint16 y; 
  }drpoint[10];

改成:

  struct  

  {
     uint16 x;
     uint16 y; 
  }drpoint[10];
 

参考:http://tech.groups.yahoo.com/group/lpc2000/messages/34213?threaded=1&m=e&var=1&tidx=1

UESTC 2012.12

IAR 各版本BUG错误修正历史:ftp://efo-6.ip.peterstar.net/pub/efo-ftp/TMP/pub/atmel/_AVR32_MCUs_32bit/Compilers/IAR/IAR_2.20/Install software/EWAVR32-KS-CD-220A/doc/common/doc/CorrectedProblems.pdf

有编号警告类型:

Error[e16]: Segment XDATA_Z (size: 0x19a1 align: 0) is too long for segment definition. At least 0xe4c more bytes needed. The problem occurred while processing the segment placement command
"-Z(XDATA)XDATA_N,XDATA_Z,XDATA_I=_XDATA_START-_XDATA_END", where at the moment of placement the available memory ranges were "XDATA:f1ff-fd53"

Reserved ranges relevant to this placement:
XDATA:f000-f1fe XSTACK
XDATA:f1ff-fd53 XDATA_N
BIT:0-7 BREG
BIT:80-97 SFR_AN
BIT:a8-af SFR_AN
BIT:b8-c7 SFR_AN
BIT:d8-df SFR_AN
BIT:e8-ef SFR_AN

A:

其实这个问题并不是你的程序本身有问题,主要是因为你编写的程序太大了,超出了芯片本身的定义。今天在群里学习了一招,就是将数组定义到code里,我们看一下例子。我们定义一个5100个元素的数组,有以下两种方法:

mermaid提出的方法是:

typedef unsigned char const __code INT8U;

extern INT8U shuzi[5100];

文晶提出的方法是

INT8U code shuzi[5100];

这两种方法其实效果是一致的,定义完数组之后,调用的部分就是需要用指针来调用数组里面的数值了。

Error[e16]: Segment DATA16_I (size: 0xa80 align: 0x1) is too long for segment definition. At least 0x27f more bytes needed. The
pro××em occurred while processing the segment placement command
"-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,HEAP+_HEAP_SIZE=0200-0A00", where at the moment of placement the ××aila××e
memory ranges were "CODE:200-A00"

经过验证是由于RAM耗尽,程序里估计有很大的数据量,最好使用const定义到FLASH里面,问题基本可以解决。

Error[e16]: Segment DATA16_Z (size: 0x6b9 align: 0x1) is too long for segment definition. At least 0x317 more bytes needed. The problem occurred 
while processing the segment placement command 
"-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I,DATA16_HEAP+_DATA16_HEAP_SIZE=0200-09FF", where at the moment of placement the 
available memory ranges were 
"CODE:5ce-5ff,CODE:602-605,CODE:609-60b,CODE:60d-60d,CODE:60f-61b,CODE:61e-63f,CODE:642-645,CODE:649-64b,CODE:64d-64d,CODE:64
f-65b,CODE:65e-9ff"
   Reserved ranges relevant to this placement:

可能的原因:1、设置的某个数组过大,超过了设置的堆栈。

            2、设置的堆栈不够大

            3、选择的型号不对(编写的程序是用在RAM较大的一个单片机上的,IAR里选择的却是RAM较小的一个型号)

UESTC 2013.3.8 

2Q: 

烧写程序时无法跳入断点
为什么我每次烧程序都出现:The stack plug-in failed to set a breakpoint on "main". The Stack window will not be able to display stack contents. (You can change this setting in the Tool>Options dialog box.)的警告。但是程序能烧进去,只是不能调试。

A:

确认设置没有问题(和好用的工程相比)这是设置不对,请找下面顺序修改:

iar->options->linker->output->format;
选择 Debug information for c-SPY选项

3Q:

错误提示:

Fatal Error[Cp001]: Copy protecTIon check, No valid license found for this product [20]

A:

可以将IAR全部安装上,但是在编译文件时却会报这个错,原因是安装的时候没有把注册机的0x.....字串的小写字母改为大写字母。

4Q:“Error[e16]: Segment CSTACK (size: 0x50 align: 0x1) is too long for segment definition. At least 0x50 more bytes needed. The problem occurred while processing the segment placement command "-Z(DATA)CSTACK+_STACK_SIZE#", ”

A:


此错误是所定义的全局变量和数组缓冲区等所占的RAM超出硬件支持所致:size: 0x50为超出的大小。只要减少不不要的全局变量和尽量缩小数组缓冲区就可以了!

5Q:

7Q:

Error[Pe018]: expected a ")" C:\Documents and Settings\Administrator\桌面\Crane\Crane\塔吊防碰撞系统1.1版(SIM908 倾角查询)\5438A塔吊防碰撞1.1\api_function.h 5

1、函数或者语句中有变量名复用:

#define length 50                   // 吊臂长度

extern int dec_to_bcd(int dec_dat, unsigned char *bcd, int length);

将以上的变量名之一换做别的即可解决。

UESTC 2012.3.27

 Error[e27]:(变量没有extern声明外部可调用)  uestc

http://blog.sina.com.cn/s/blog_4c0cb1c00100z0w1.html
Error[e27]: Entry "ER_WARN" in module AD (……) redefined in module FINGERPRINT (……)

解决方法是把变量定义在其中一个cpp文件里面,
然后在另一个文件里面用extern来引用。
sample:

文件一:
int a=0;

文件二:
extern int a;  //此处不能使他等于某个数就可以了,如果此处a再赋值extern int a=0;就会报错e27

以为我在x.h文件中定义有变量,然后x.h放入 config.h中,config.h被其他的各个.c文件包含,就造成了,x.h中的变量在各个.c中定义,造成了重复定义。 UESTC 2012.3.27

相关问答:

http://topic.csdn.net/u/20120222/22/c9b258d3-f58e-49

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值