• <li id="00i08"><input id="00i08"></input></li>
  • <sup id="00i08"><tbody id="00i08"></tbody></sup>
    <abbr id="00i08"></abbr>
  • 新聞中心

    EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > ICC錯誤集錦,看懂ICC AVR的報錯

    ICC錯誤集錦,看懂ICC AVR的報錯

    作者: 時間:2016-10-19 來源:網(wǎng)絡 收藏

      新手用編程的時候,經(jīng)常會出現(xiàn)一些錯誤,現(xiàn)在將常見的錯誤報告整理如下。這里的一些錯誤是我為了展示而故意制造的,歡迎你提供你遇到的錯誤。排名不分先后:

    本文引用地址:http://www.czjhyjcfj.com/article/201610/311530.htm

      一、正常編譯通過

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -c -IC:iccinclude -e -DATMEGA -DATMega16 -l -g -Mavr_enhanced D:桌面實驗教程LED應用霓虹燈main.c

      iccavr -o main -LC:icclib -g -ucrtatmega.o -bfunc_lit:0x54.0x4000 -dram_end:0x45f -bdata:0x60.0x45f -dhwstk_size:16 -beeprom:1.512 -fihx_coff -S2 @main.lk -lcatmega

      Device 1% full.

      Done.

      [Copy to clipboard]

      這是我們最想看到的了,萬事大吉。

      二、工程中未加入.C文件

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -o main -LC:icclib -g -ucrtatmega.o -bfunc_lit:0x54.0x4000 -dram_end:0x45f -bdata:0x60.0x45f -dhwstk_size:16 -beeprom:1.512 -fihx_coff -S2 @main.lk -lcatmega

      unknown file type @main.lk, passed to linker

      !ERROR unknown file type '@main.lk'

      C:iccbinimakew.exe: Error code 1

      Done: there are error(s). Exit code: 1

      [Copy to clipboard]

      解決辦法:將你的程序加入工程中,可以右鍵程序區(qū)>>ADD to project

      三、程序沒有后綴名,或者后綴名不正確。

      CODE:

      C:iccbinimakew -f main.mak

      C:iccbinimakew.exe: 'main' is up to date

      Done.

      [Copy to clipboard]

      這是一個很難理解的錯誤,它是由工程中的程序文件沒有后綴名造成的。

      解決辦法:將原有文件移出工程,將文件的后綴名改為.C,然后再加入工程中。

      四、沒有main函數(shù)

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -c -IC:iccinclude -e -DATMEGA -DATMega16 -l -g -Mavr_enhanced D:桌面實驗教程LED應用霓虹燈main.c

      iccavr -o main -LC:icclib -g -ucrtatmega.o -bfunc_lit:0x54.0x4000 -dram_end:0x45f -bdata:0x60.0x45f -dhwstk_size:16 -beeprom:1.512 -fihx_coff -S2 @main.lk -lcatmega

      !ERROR file 'crtatmega.o': undefined symbol '_main'

      C:iccbinimakew.exe: Error code 1

      Done: there are error(s). Exit code: 1

      [Copy to clipboard]

      解決辦法,編寫程序主函數(shù)MAIN。

      五、沒有選擇目標芯片出現(xiàn)如下錯誤:

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -c -IC:iccinclude -e -l -g -Wa-W D:桌面實驗教程LED應用霓虹燈main.c

      iccavr -o main -LC:icclib -g -Wl-W -bfunc_lit:0.0x2000 -dram_end:0x25f -bdata:0x60.0x25f -dhwstk_size:16 -beeprom:1.512 -fihx_coff -S2 @main.lk

      !E C:icclibcrt.o(41): Code address 0 already contains a value

      !E C:icclibcrt.o(41): Code address 0x1 already contains a value

      C:iccbinimakew.exe: Error code 1

      Done: there are error(s). Exit code: 1

      [Copy to clipboard]

      解決辦法:project>>Options>>target>>device configuration 選擇合適的芯片。

      六、缺少分號

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -c -IC:iccinclude -e -DATMEGA -DATMega16 -l -g -Mavr_enhanced D:桌面實驗教程LED應用霓虹燈main.c

      !E D:桌面實驗教程LED應用霓虹燈main.c(52): unrecognized statement

      !E D:桌面實驗教程LED應用霓虹燈main.c(53): syntax error; found `}' expecting `;'

      !E D:桌面實驗教程LED應用霓虹燈main.c(53): syntax error; found `end of input' expecting `}'

      C:iccbinimakew.exe: Error code 1

      C:iccbinimakew.exe: 'main.o' removed.

      Done: there are error(s). Exit code: 1

      [Copy to clipboard]

      上面的報告說明了第52行缺少一個分號,預期分號的地方出現(xiàn)了“}”。

      解決方法,在52行末尾添加分號。

      類似的有:缺少}的報錯

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -c -IC:iccinclude -e -DATMEGA -DATMega16 -l -g -Mavr_enhanced D:桌面實驗教程LED應用霓虹燈main.c

      !E D:桌面實驗教程LED應用霓虹燈main.c(55): illegal statement termination

      !E D:桌面實驗教程LED應用霓虹燈main.c(55): skipping `void'

      !W D:桌面實驗教程LED應用霓虹燈main.c(55):[warning] calling function without prototype may cause errors

      !E D:桌面實驗教程LED應用霓虹燈main.c(56): syntax error; found `{' expecting `;'

      !E D:桌面實驗教程LED應用霓虹燈main.c(57): syntax error; found `end of input' expecting `}'

      C:iccbinimakew.exe: Error code 1

      C:iccbinimakew.exe: 'main.o' removed.

      Done: there are error(s). Exit code: 1

      [Copy to clipboard]

      七:變量沒有定義

      CODE:

      C:iccbinimakew -f main.mak

      iccavr -c -IC:iccinclude -e -DATMEGA -DATMega16 -l -g -Mavr_enhanced D:桌面實驗教程LED應用霓虹燈main.c

      !E D:桌面實驗教程LED應用霓虹燈main.c(48): undeclared identifier `i'

      C:iccbinimakew.exe: Error code 1

      C:iccbinimakew.exe: 'main.o' removed.

      Done: there are error(s). Exit code: 1

      [Copy to clipboard]

      解決辦法:在程序開始前添加變量定義,比如unsigned char i;注意,定義變量要在函數(shù)的最前面進行,及在進行計算操作之前定義所有變量。

      歡迎你發(fā)布你遇到的錯誤和解決方法,或者你遇到的錯誤還沒解決的。

      八、在編譯時總是不能生成COF文件,不能進行調(diào)試

      解決辦法:在編譯環(huán)境中,進入Project -> Option -> Compiler中在Output format區(qū)選COFF/HEX格式

      九、請指點一下:

      我的程序出現(xiàn)下列錯誤提示,是不是我什么地方設置錯了呀。

      CODE:

      D:iccbinimakew -f tex.mak

      -lstudio -lfpavr

      want size 346

      lo 3910 hi 4096 size 187

      !E (37): area 'text' not large enough

      D:iccbinimakew.exe: Error code 1

      Done: there are error(s). Exit code: 1

      一點錯誤那行的時候就出來一個提示框,但沒有移到某一行上去。。。。

      ans1:還沒有確切的解釋,可能原因:應該是定義的數(shù)組過大,減小數(shù)組的數(shù)量應該可以了

      ans2:這是超過編譯空間了,你可以到壓縮下代碼,project>options>compiler,選擇Enable code compression或者只有優(yōu)化代碼了

      十:無意中又發(fā)現(xiàn)一個:

      too many arguments to `delay_1ms'

      問題原因,函數(shù)的參數(shù)太多,比如上面一個定義的是delay_1ms(void),我確用了delay_1ms(1);改為delay_1ms();就好了。

      十一、!ERROR can't open file 'libiccavrlibsliccatmega-m.a'

      剛才問了一下人,新建一個工程,然后把所有的C文件都導入里面,就沒有的問題了,剩下一些語法錯誤。

      十二、7 的代碼大小限制的問題,DEMO版超過4K不能編譯。

      D:PROGRA~1iccv7avrbinimakew -f mytest.mak

      D:PROGRA~1iccv7avrbinimakew.exe: Couldn't open mytest GetLastError() = 5

      Done: there are error(s). Exit code: 1

      (斑竹,我后來發(fā)現(xiàn)這好像是因為ICC編譯生成的某些文件有錯誤,把ICC生成的文件都刪掉,重新建立一個project,重新選擇Target,重新編譯就好了)

      十三、

      CODE:

      iccavr -o main -LD:avricclib -g -ucrtatmega.o -bfunc_lit:0x8c.0x10000 -dram_end:0x10ff -bdata:0x100.0x10ff -dhwstk_size:16 -beeprom:1.2048 -fihx_coff -S2 @main.lk D:PROTEU~1.7PROTEU~1.7JOHUmcuallCH375HFB.A -lcatmega

      Device 45% full.

      warning: COFF no struct tag '_CMD_PARAM' found for symbol index 1362

      Done.

      一個警告,搞不太清楚,以前starnewtech說過,好像是ram不夠用了。

      十四、重復定義 ,請在包含的頭文件里面用這種格式。

      #ifndef __config_H__

      #define __config_H__ 1

      //你的定義放這里。

      #endif



    關鍵詞: ICC AVR

    評論


    相關推薦

    技術專區(qū)

    關閉
    主站蜘蛛池模板: 黄山市| 长海县| 鹤岗市| 长沙市| 怀来县| 麦盖提县| 灵寿县| 松滋市| 黄龙县| 高阳县| 宝山区| 剑阁县| 聂拉木县| 崇礼县| 扶余县| 玛多县| 上林县| 石首市| 湘阴县| 肥东县| 浪卡子县| 丹寨县| 涿鹿县| 安福县| 平邑县| 罗田县| 林周县| 深水埗区| 广西| 大姚县| 贺州市| 宣武区| 绥阳县| 团风县| 璧山县| 和林格尔县| 吉木乃县| 旺苍县| 清徐县| 杭州市| 河源市|