关于转载的说明:原文内容可能会不断更新,要想得到最新的内容请跳到到原文看。
无编号警告类型:
1、Sat Jun 23, 2012 17:41:05: The stack pointer for stack 'Stack' (currently Memory:0xF5336) is
原因:新浪博客
IAR相关设置:Tools->Option->Stack->Warn when stack pointer is out of bounds.
The stack pointer for stack is outside the stack range
( 2012-06-24 20:36:38)
1、
Debugging using IAR Embedded Workbench
Because the IAR debugger is not presently aware of Micrium’s μC/OS-III operating system, the
following error may be reported when the debugger is halted:
Mon Sep 20 16:24:14 2010: The stack pointer for stack 'CSTACK' (currently
0x200023D8) is outside the stack range (0x20000000 to 0x20000400)
Ignore this error message as it does not affect debugging.
原文:http://www.ti.com/lit/ug/spmu164a/spmu164a.pdf
outside the stack range (Memory:0x5400 to Memory:0x5C00)
2、
在使用iar for msp430调试msp430f247的时候,在仿真过程中出现上述的warnning,觉得很奇怪。因为我只是跳入一个子程序而已,不应该占用这么多的堆栈空间。被调用的子程序开头如下:
void spitest()
{
unsigned char firstdata[128];
unsigned char seconddata[128];
unsigned char i;
Led_Init();
Led_On();
Led_Off();
.........
}
仔细查看该段代码对应的汇编,如下:
spitest:
0081E8 8031 0100 sub.w #0x100,SP
0081EC 12B0 871C call #Led_Init
0081F0 12B0 8716 call #Led_On
0081F4 12B0 8710 call #Led_Off
.........
总结:出现该warrning的是编译器的原因,编译器优化初始化数组的方法为占用堆栈,即汇编中的代码“sub.w #100,SP ” ,占用的实在太多,所有导致warrning。同时注意到当spitest子程序跑完后,sp指针会重新恢复正常,所有这个仿真警告是不影响正常程序的。
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
有编号警告类型:
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 经过验证是由于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
新浪博客
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-49dc-bf97-630271a26dfc.html
14Q:Error[e46]:
Undefined external "__program_start" referred in ?ABS_ENTRY_MOD ( )
A:该问题应该是IAR设置问题,具体设置如下:
Project->Option->Linker->Config 勾选"Override default program"
再选择"Defined by application"
B、 static (const)变量是不能被外部文件调用的 ( ? )
C、只包含了.h文件, .c文件没有添加进工程
从debug切换到release出现错误:release不