新聞中心

IAR編譯常見錯誤

作者: 時間:2016-11-28 來源:網(wǎng)絡(luò) 收藏
Error[Cp001]: Copy protection check, No valid license found for this prod t [20]

原因:安裝的時候沒有把注冊機的0x.....字串的小寫字母改為大寫字母。

本文引用地址:http://butianyuan.cn/article/201611/322906.htm

Warning[Pe001]: last line of file ends without a newline F:emoTionIARPK升級CC1110-8main.c

原因:在使用IAR時常常會彈出類似這樣一個警告,其實只要在最后一行多加一個回車就不會再有這個警告了.

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

原因:這是用730B編譯的錯誤,可能是由于相對于目標工程版本過高的,后改用720H,沒有發(fā)生錯誤。

Error[Pe005]: could not open source file "stdio.h"

原因:頭文件路徑不對造成,改正的方法是在設(shè)置選項卡的C/C++ Compiler -> Preprocessor選項里,將$TOOLKIT_DIR$INCCLIB添到Incl? paths中。

Error[Pe005]:could not open source file "hal.h" C:UsersuserDesktop例子程序無線通信綜合測試Librarycc2430HALsourcesetTimer34Period.c

原因:先檢查C:UsersuserDesktop例子程序無線通信綜合測試Librarycc2430HALsource有無setTimer34Period.c這個文件,若有,則是因為IAR對中文路徑支持不好的緣故,把這個工程復(fù)制到英文路徑下編譯就不會發(fā)生錯誤。

Error[e16]: Segment CODE_C (size: 0x1869 align: 0) is too long for segment definition. At least 0x1259 more bytes needed.

原因:CODE不夠了,在xcl文件中修改其大小,0x28FF+0x1259=0x3B58,設(shè)置為-D_CODE_END=0x3B58

Error[e16]: Segment XDATA_Z (size: 0x1ea7 align: 0) is too long for segment definition. At least 0x2a7 more bytes

原因:在xcl文件里修改段大小,-D_IXDATA_END=0xFD53// Revison D (this setting is safe for all revisions)還有可能是定義的大數(shù)組太多了,有時候某些函數(shù)中定義的數(shù)組有點大,在主函數(shù)中單獨測試這個函數(shù)時不會報錯

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#",

原因:此錯誤是所定義的全局變量和數(shù)組緩沖區(qū)等所占的RAM超出硬件支持所致,size: 0x50為超出的大小。只要減少不要的全局變量和盡量縮小數(shù)組緩沖區(qū)就可以了!

Error[e46]: Undefined external "OnBoard_SendPhoto::?relay" referred in hal_key ( C:Texas InstrumentsZStack-1.4.3-1.2.1ProjectszstackSamplesSimpleAppCC2430DBSimpleControllerEBObjhal_key.r51 )

原因:只有沒有找到該函數(shù)的定義OnBoard_SendPhoto(),只有聲明和使用。一般在鏈接時發(fā)生此錯誤。

Error[e89]:Too m h object code prod ed(more than 0x1000 bytes)for this package

原因:4K限制版,請使用非限制版的。

IAR常見錯誤請先從以下幾個方面入手:

1、序列號是否正確。

2、使用版本是否正確,應(yīng)該使用7.30B打開的工程文件不能用7.20H打開。

3、盡量不要使用中文路徑。

4、Zigbee協(xié)議棧文件夾需要放在IAR安裝盤根目錄下。

5、請確定當前編譯文件夾是否有讀寫權(quán)限。

6、使用的版本是否為限制版。

下面是我自己的補充(不斷更新哦)

1.Error[e16]: Segment CODE (size: 0xffe align: 0x1) is too long for segment definition. At least 0x4a more bytes needed. The problem occurred while processing the segmentplacement command "-Z(CODE)CODE=_..X_FLASH_BASE-_..X_FLASH_END", where at the moment of placement the available memory ranges were "CODE:4b-fff"

Reserved ranges relevant to this placement:

CODE:34-44NEAR_F
CODE:45-4aINITTAB

CODE:4b-fffCODE

這個我的修改是 project options---->C/C++ Compiler----->Optimizations(最優(yōu)化)----->size----->High(maximum optimization)

也就是,將代碼最大限度的優(yōu)化,以節(jié)省空間。
2.configuration is up-to-data.

在新建工程時,添加程序文件,需注意,必須添加有效的.c或者匯編文件。

嘿嘿,筆者新建工程時,保存的.c文件經(jīng)常忘記加后綴,添加進入工程時,系統(tǒng)無法識別,這種低級錯誤寫出來是自己提醒自己的。

3. Warning[Pe069]: integer conversion resulted in truncation程序如下:
#define SEG_A~0x04
#define SEG_B~0x01
#define SEG_C~0x40
#define SEG_D~0x10
#define SEG_E~0x08
#define SEG_F~0x02
#define SEG_G~0x80
#define SEG_H~0x20

SEG_A&SEG_B&SEG_G&SEG_D&SEG_E,//2

原因:后來將SEG_A到SEG_H的值求出來之后,eg,~0x04改為0xFB.問題就解決,因該是以數(shù)組中計算量過復(fù)雜。



關(guān)鍵詞: IAR編譯常見錯

評論


技術(shù)專區(qū)

關(guān)閉