搜档网
当前位置:搜档网 › 使用IAR时遇到的一些Error、Waring

使用IAR时遇到的一些Error、Waring

使用IAR时遇到的一些Error、Waring
使用IAR时遇到的一些Error、Waring

使用IAR时遇到的一些Error、Waring

https://www.sodocs.net/doc/2f610685.html,/sendoc/blog

作为菜虫,在使用IAR的时候编写CC2430、、Z-Stack2006程序会遇到如下一些错误,当然随着学习的深入,我会持续更新。

1

Q:

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];

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

用数组里面的数值了。

2

Q:

烧写程序时无法跳入断点

为什么我每次烧程序都出现: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选项

3

Q:

/*********************************************************************

*

*/

错误提示:

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

A:

可以将IAR全部安装上,但是在编译文件时却会报这个错,原因是安装的时候

没有把注册机的0x.....字串的小写字母改为大写字母。

/*********************************************************************

*

*/

4

Q:

“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为超出的大小。只要减少不不要的全局变量和尽量缩小数组缓冲区就可以了!

/*********************************************************************

*

*/

5

Q:

Warning[Pe001]: last line of file ends without a newline F:\emoTion\IAR\PK升级\CC1110-8\main.c 179

A:

在使用IAR时常常会弹出类似这样一个警告,其实只要在最后一行多加一个回车就不会再有这个警告了.

/*********************************************************************

*

*/

6

Q:

在编写一个串口程序时:编译没有错,但MAKE时就出现下面的错误

undefined external“UART1_ISR”referred in startup

A:

串口1中断向量没有定义,实际上是串口1中断向量定义其他名称,而不是UART1_ISR.

出现这样的调试IAR错误时:Fatal error: Unknown exception in driver (#E1),是因为IAR软件没有跟Texas Instruments文件放在同一个系统盘下

7

Q:

Fatal Error[e72]: Segment BANK_RELAYS must be defined in a segment definition option (-Z, -b or -P)

A:

使用无线龙的串口互发,发现上述错误,原因是版本太高,具体原因不清,下载一下7.20H就可以了

8

Q:

Error[Pe136]: struct "" has no field

"SampleApp_Periodic_DstAddr" D:\Program Files\Texas

Instruments\ZStack-1.4.3-1.2.1\Projects\zstack\Samples\SampleApp\Source\ SampleApp.c 417

//--------------------------------------------//

afAddrType_tdstAddr;

dstAddr.addrMode = afAddrBroadcast;

dstAddr.addr.shortAddr = 0xFFFF; // 广播发送cdwxl

dstAddr.endpoint = SAMPLEAPP_ENDPOINT; //error所在

//--------------------------------------------//

A:

我们看看afAddrType_t这个结构就明白错在哪里了。

typedefstruct

{

union

{

uint16 shortAddr;

} addr;

afAddrMode_t addrMode;

byte endPoint;

} afAddrType_t;

居然是endPoint大小写错误,Ω 。

9

Q:

我最开始也是IAR仿真时找不到main函数,

显示:

Fri Jun 11 14:37:00 2010: Error (col 1): Unknown or ambiguous symbol. main Fri Jun 11 14:37:01 2010: Error (col 1): Unknown or ambiguous symbol. main Fri Jun 11 14:37:01 2010: Couldn't go to 'main'.

之后在project==>options==>linker里面的format设成debug,没有这个问题了,但是

程序又不能通过TI的那个Flash Programmer下载到板子里了,说是Could not open specified HEX file

A:

这个烧录工具只认release code. 而且扩展名必须是.hex。

所以要用这个烧录工具来烧录必须做两件事:

1. output file设为release version

2. output file 扩展名改为.hex, 默认的是.a51

测试学习阶段可以不用.但产品量产就必须生成二进制文件.

同时programmer还有些其它的功能会常用的

10

Q:Warning[Pe188]: enumerated type mixed with another type D:\Program Files\Texas

Instruments\ZStack-1.4.3\Projects\zstack\Samples\SampleApp\Source\Sampl eApp.c 206

A:SampleApp_Periodic_DstAddr.addrMode =

Addr16Bit;//(afAddrMode_t)afAddrGroup;

typedefenum

{

afAddrNotPresent = AddrNotPresent,

afAddr16Bit = Addr16Bit,

afAddrGroup = AddrGroup,

afAddrBroadcast = AddrBroadcast

} afAddrMode_t;

问题就在于Addr16Bit未加afAddrMode_t这个套子。

11

Q:Error[Pe513]: a value of type "int (*)(uint8, uint8)" cannot be assigned to an entity of type "halUARTCBack_t" D:\Program Files\Texas

Instruments\ZStack-1.4.3-1.2.1\Components\stack\sapi\sapi.c 968

A:估计是一个函数本没有返回值即void类型,而你却将这个函数赋给了一个int 型变量了。。

static rxCB( uint8 port,uint8 event )改为

static void rxCB( uint8 port,uint8 event )

12

Q:

Warning[Pe177]: function "rxCB" was declared but never referenced

D:\Program Files\Texas

Instruments\ZStack-1.4.3-1.2.1\Components\stack\sapi\sapi.c 982

A:函数虽定义但从未被引用(使用)。如果你需要使用该函数,就需要检查;否则略过。

13

Q:

Fri Jun 11 14:37:00 2010: Error (col 1): Unknown or ambiguous symbol. main Fri Jun 11 14:37:01 2010: Error (col 1): Unknown or ambiguous symbol. main Fri Jun 11 14:37:01 2010: Couldn't go to 'main'.

A:project==>options==>linker 看看里面的format是不是设成debug

详见https://www.sodocs.net/doc/2f610685.html,/bbs/viewthread.php

14

Q:Error[e46]: Undefined external "__program_start" referred

in ?ABS_ENTRY_MOD ( )

A:该问题应该是IAR设置问题,具体设置如下:

Project->Option->Linker->Config勾选"Override default program"

再选择"Defined by application"

15

Q:Fatal Error[Cp001]: Copy protection check, No valid license found for this product [24]

XP下装的IAR,到了Win7下出来的问题。

A:这个问题是使用注册机带来的,系统换了,本机ID也要改了。

、、单击IARID.EXE得到本机的ID号

、、右键点Key.cmd,选择编辑,打开,将ID修改为本机ID

、、运行KEY.cmd,在key.txt中的含有EW8051-EV的序列号就是7.30的序列号

16

Q:

在用iar debug 下载进已有程序板子出现的

A:将核心板与扩展板分开,只烧写核心板。

17

Q:

A:自小峰关于协议栈XDATA溢出的小结

(1)减小程序;

(2)把配置文件f8w2430.xcl/f8w2430pm.xcl中的-D_CODE_END改大点:********************

f8w2430.xcl:

// CODE

//

// These settings determine the size/location of the ROOT segment.

// Increase _CODE_END to increase ROOT memory, i.e. for constants. -D_CODE_START=0x0000 // Code size = 128k for CC2430-F128

-D_CODE_END=0x4000 // Last address for ROOT bank

********************

f8w2430pm.xcl:

// CODE

//

// These settings determine the size/location of the ROOT segment.

// Increase _CODE_END to increase ROOT memory, i.e. for constants. -D_CODE_START=0x0000 // Code size = 128k for CC2430-F128

-D_CODE_END=0x29FF//(原0x28FF) Last address for ROOT bank

相关主题