关于winavr编译的问题

2019-03-24 20:56发布

初学avr,使用win7+winavr的环境,不过常年写java代码,实在是不习惯winavr的编译器,后来找到了eclipse的插件,很好用,但是编译有问题。Build的时候会出现这个问题:Problems occurred building the selected resources.  Errors running builder 'CDT Builder' on project 'GCC-4'.        java.lang.NullPointerException    java.lang.NullPointerException控制台打印:
**** Clean-only build of configuration Release for project GCC-4 ****
make clean rm -rf  ./key_scan.o ./led.o ./main.o  ./key_scan.d ./led.d ./main.d  GCC-4.eep  GCC-4.hex  GCC-4.lss  sizedummy  GCC-4.elf 
**** Build of configuration Release for project GCC-4 ****
make all Building file: ../key_scan.cInvoking: AVR CompilerIn file included from ../key_scan.c:3:../led.h:8:20: warning: no newline at end of file../key_scan.c: In function `key_scan':../key_scan.c:6: warning: unused variable `m'/usr/bin/sh: /d/WinAVR/bin/avr-objdump: Invalid argumentmake: [GCC-4.lss] Error 126 (ignored)/usr/bin/sh: /d/WinAVR/bin/avr-objcopy: Invalid argumentmake: [GCC-4.hex] Error 126 (ignored)/usr/bin/sh: /d/WinAVR/bin/avr-objcopy: Invalid argumentmake: [GCC-4.eep] Error 126 (ignored)
换到winavr的环境下编译,能生产hex文件,但是还是出错的。> "make.exe" all
-------- begin --------avr-gcc (GCC) 3.4.3Copyright (C) 2004 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiling: main.cavr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=3686400UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.lst  -std=gnu99 -MD -MP -MF .dep/main.o.d main.c -o main.o main.c:14: warning: function declaration isn't a prototype
Compiling: led.cavr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=3686400UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=led.lst  -std=gnu99 -MD -MP -MF .dep/led.o.d led.c -o led.o 
Compiling: key_scan.cavr-gcc -c -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=3686400UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=key_scan.lst  -std=gnu99 -MD -MP -MF .dep/key_scan.o.d key_scan.c -o key_scan.o In file included from key_scan.c:3:led.h:8:20: warning: no newline at end of filekey_scan.c: In function `key_scan':key_scan.c:6: warning: unused variable `m'
Linking: main.elfavr-gcc -mmcu=atmega16 -I. -gdwarf-2 -DF_CPU=3686400UL  -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=main.o  -std=gnu99 -MD -MP -MF .dep/main.elf.d main.o led.o key_scan.o --output main.elf -Wl,-Map=main.map,--cref    -lm
Creating load file for Flash: main.hexavr-objcopy -O ihex -R .eeprom main.elf main.hex
Creating load file for EEPROM: main.eepavr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex main.elf main.eep
Creating Extended Listing: main.lssavr-objdump -h -S main.elf > main.lss
Creating Symbol Table: main.symavr-nm -n main.elf > main.sym/usr/bin/sh: /d/WinAVR/bin/avr-nm: Invalid argumentmake.exe: *** [main.sym] Error 126
> Process Exit Code: 2hex文件在protues中能正常运行。不知道啥问题。望高人指点一二。 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
2条回答
zxq6
1楼-- · 2019-03-25 01:14
用avrstudio 内嵌 winavr吧,那个好用。
coolrunning
2楼-- · 2019-03-25 05:19
太难了。太难了。。。。

一周热门 更多>