Every example code ends to the undefined reference to `main' error.
Build started 4.12.2007 at 17:58:47
avr-gcc.exe -mmcu=at90s2313 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT demo.o -MF dep/demo.o.d -c ../demo.c
avr-gcc.exe -mmcu=at90s2313 -Wl,-Map=demo.map demo.o -o demo.elf
c:/program files/winavr/bin/../lib/gcc/avr/4.1.2/../../../../avr/lib/crts2313.o: In function `__vectors':
../../../../../avr-libc-1.4.6/crt1/gcrt1.S:51: undefined reference to `main'
make: *** [demo.elf] Error 1
Build failed with 1 errors and 0 warnings...
Even with code like this:
#include// Define the bits in the port typedef struct { unsigned char bit0 : 1, bit1 : 1, bit2 : 1, bit3 : 1, bit4 : 1, bit5 : 1, bit6 : 1, bit7 : 1; } bit_field; // Define macro to get the value of each bit #define GET_BIT(port) (*(volatile bit_field *) (_SFR_ADDR(port))) // Define functions for each bit of the I/O ports in the program #define SIG GET_BIT(PINB).bit0 #define LED GET_BIT(PORTD).bit0 int main (void) { for (;;) { if (SIG) LED = 1; else LED = 0; } }
I mean EVERY example code compiling! I am a total newbie with AVR, remember that when replying :)