Цитата(mdmitry @ Nov 14 2007, 23:09)

В исходном файле должны быть соответствующие заголовочные, как минимум при работе с портами
#include <avr/io.h>
другие по неоходимости (прерывания, собака и EEPROM и т.д.)
В makefile указать правильно тип контроллера, тактовую частоту, если используется таймер.
С встроенным ассемблером у WinAvr не здорово в смысле сложный синтаксис, смесь вывода С и ассемблера.
вот пример сборки
Код
> "make"
-------- begin --------
avr-gcc (GCC) 4.1.2 (WinAVR 20070525)
Copyright (C) 2006 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 C: cmd.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./cmd.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/cmd.o.d cmd.c -o cmd.o
Compiling C: eeprom.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./eeprom.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/eeprom.o.d eeprom.c -o eeprom.o
Compiling C: flex6000.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./flex6000.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/flex6000.o.d flex6000.c -o flex6000.o
Compiling C: gidro.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./gidro.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/gidro.o.d gidro.c -o gidro.o
Compiling C: irka.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./irka.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/irka.o.d irka.c -o irka.o
Compiling C: main.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./main.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/main.o.d main.c -o main.o
main.c: In function 'main':
main.c:197: warning: return type of 'main' is not 'int'
Compiling C: uart.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./uart.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/uart.o.d uart.c -o uart.o
Compiling C: util.c
avr-gcc -c -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=./util.lst -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/util.o.d util.c -o util.o
Linking: IRKA_103.elf
avr-gcc -mmcu=atmega103 -I. -g -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=cmd.o -I"C:/WinAVR/avr/include" -I"C:/WinAVR/avr/include/avr" -I"C:/WinAVR/avr/include/compat" -std=gnu99 -Wundef -MMD -MP -MF .dep/IRKA_103.elf.d cmd.o eeprom.o flex6000.o gidro.o irka.o main.o uart.o util.o dac420.o loader.o prg_reset.o --output IRKA_103.elf -Wl,-uInterruptVectors -static -mmcu=atmega103 -LC:/WinAVR/avr/include/ -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm
Creating load file for Flash: IRKA_103.hex
avr-objcopy -O ihex -j .text -j .data -j .bss -R .eeprom IRKA_103.elf IRKA_103.hex
Creating load file for EEPROM: IRKA_103.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex IRKA_103.elf IRKA_103.eep || exit 0
c:\WinAVR\bin\avr-objcopy.exe: there are no sections to be copied!
Creating Extended Listing: IRKA_103.lss
avr-objdump -h -S IRKA_103.elf > IRKA_103.lss
Creating Symbol Table: IRKA_103.sym
avr-nm -n IRKA_103.elf > IRKA_103.sym
Converting to AVR Extended COFF: IRKA_103.cof
avr-objcopy --debugging --change-section-address .data-0x800000 --change-section-address .bss-0x800000 --change-section-address .noinit-0x800000 --change-section-address .eeprom-0x810000 -O coff-ext-avr IRKA_103.elf IRKA_103.cof
Warning: file C:/WINDOWS/TEMP/ccm5PzQa.s not found in symbol table, ignoring
Warning: ignoring function __vectors() outside any compilation unit
Warning: ignoring function __bad_interrupt() outside any compilation unit
Warning: file C:\DOCUME~1\veter\LOCALS~1\Temp/ccPqGPfj.s not found in symbol table, ignoring
Warning: file C:\DOCUME~1\veter\LOCALS~1\Temp/ccXIZWtu.s not found in symbol table, ignoring
Warning: file C:\DOCUME~1\veter\LOCALS~1\Temp/ccBVLsKR.s not found in symbol table, ignoring
avr-objcopy: --change-section-vma .eeprom+0xff7f0000 never used
avr-objcopy: --change-section-lma .eeprom+0xff7f0000 never used
avr-objcopy: --change-section-vma .noinit+0xff800000 never used
avr-objcopy: --change-section-lma .noinit+0xff800000 never used
Size after:
AVR Memory Usage
----------------
Device: atmega103
Program: 84586 bytes (64.5% Full)
(.text + .data + .bootloader)
Data: 65087 bytes (1627.2% Full)
(.data + .bss + .noinit)
-------- end --------
> Process Exit Code: 0
> Time Taken: 00:21
меня настораживают эти сооющения
Warning: ignoring function __vectors() outside any compilation unit
Warning: ignoring function __bad_interrupt() outside any compilation unit
тоесть программа собирается
но полученный хекс файл не работает...