【轉】使用IAR時遇到的一些Error、Waring


http://hi.baidu.com/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 "<unnamed>" 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_t dstAddr; dstAddr.addrMode = afAddrBroadcast; dstAddr.addr.shortAddr = 0xFFFF; // 廣播發送 cdwxl   dstAddr.endpoint = SAMPLEAPP_ENDPOINT;                 //error所在 //--------------------------------------------//

A:

我們看看afAddrType_t這個結構就明白錯在哪里了。

typedef struct { union { uint16 shortAddr; } addr; afAddrMode_taddrMode; byteendPoint; } 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\SampleApp.c 206
A:  SampleApp_Periodic_DstAddr.addrMode = Addr16Bit;//(afAddrMode_t)afAddrGroup; typedef enum { 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 詳見www.feibit.com/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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM