初学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.c Invoking: AVR Compiler In 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 argument make: [GCC-4.lss] Error 126 (ignored) /usr/bin/sh: /d/WinAVR/bin/avr-objcopy: Invalid argument make: [GCC-4.hex] Error 126 (ignored) /usr/bin/sh: /d/WinAVR/bin/avr-objcopy: Invalid argument make: [GCC-4.eep] Error 126 (ignored)
换到winavr的环境下编译,能生产hex文件,但是还是出错的。 > "make.exe" all
-------- begin -------- avr-gcc (GCC) 3.4.3 Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling: main.c avr-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.c avr-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.c avr-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 file key_scan.c: In function `key_scan': key_scan.c:6: warning: unused variable `m'
Linking: main.elf avr-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.hex avr-objcopy -O ihex -R .eeprom main.elf main.hex
Creating load file for EEPROM: main.eep avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ --change-section-lma .eeprom=0 -O ihex main.elf main.eep
Creating Extended Listing: main.lss avr-objdump -h -S main.elf > main.lss
Creating Symbol Table: main.sym avr-nm -n main.elf > main.sym /usr/bin/sh: /d/WinAVR/bin/avr-nm: Invalid argument make.exe: *** [main.sym] Error 126
> Process Exit Code: 2 hex文件在protues中能正常运行。不知道啥问题。 望高人指点一二。
|