Instructions in the blinky.zip, gcc-section, Teensy++ v.2. Makefile and blinky.c are in the zip. I modified the blinky.c by defining F_CPU at the start because not using Makefile, please, see below. So why do I get the errs and how can I compile the C-files for at90usb1286 chip?
$ avr-gcc -mmcu=atmega88 blinky.c
In file included from blinky.c:28:
/usr/local/lib/gcc/avr/4.2.2/../../../../avr/include/util/delay.h:90:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
/tmp//ccB66ecl.o: In function `main':
blinky.c:(.text+0x3e): undefined reference to `usb_init'
/tmp//ccB66ecl.o: In function `morse_character':
blinky.c:(.text+0x24c): undefined reference to `print_P'
blinky.c:(.text+0x36e): undefined reference to `print_P'
blinky.c:(.text+0x378): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x37e): undefined reference to `print_P'
blinky.c:(.text+0x386): undefined reference to `print_P'
blinky.c:(.t开发者_JS百科ext+0x390): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x394): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x416): undefined reference to `print_P'
blinky.c:(.text+0x4fa): undefined reference to `print_P'
blinky.c:(.text+0x6f8): undefined reference to `print_P'
/tmp//ccB66ecl.o: In function `morse_P':
blinky.c:(.text+0x834): undefined reference to `print_P'
Those are link errors. You could do a compile only (notice that I added the -c
flag):
avr-gcc -c -mmcu=atmega88 blinky.c
You would then have to link that with your other objects to create a binary.
Alternately, you could provide all the source files in a single command line and the compiler will compile and link them:
avr-gcc -mmcu=atmega88 blinky.c print.c usb_debug_only.c
精彩评论