Gast
#5262
Hallöchen! Nach zwei Tagen tüfteln und wahrscheinlich unnötigen flashen meines AVR geb ich heute auf und Frage jetzt hier im Forum. ich habe folgendes Testprogrämmchen geschrieben, kompiliert und erfolgreich getestet: ------------------------------------------------------------------------ ----------------------- #include <io.h> int main(void){ int i; outp(0xff, DDRB); //Port B = Output outp(0x00, DDRA); //Port A = Input for(;;){ //loop i=inp(PINA); outp(i, PORTB); } } Läut ohne Probleme. Nun möchte ich eine Funktion hinzufügen: ------------------------------------------------------------------------ ----------------------- Datei: delay.h #define LoopCount 40 void delay(unsigned char us); und die delay.c #include "delay.h" void delay(unsigned char us){ int i, j, k, l; for (i=0; i < us; i++){ for(j=0; j<255; j++){ for(k=0; k<255; k++){ l++; } } } } Compiler sagt dazu folgendes: ------------------------------------------------------------------------ ----------------------- C:\avrgcc128\ctest>make avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Wa,-ahlms=test3.lst -mmcu=atmega12 8 -I. test3.c -o test3.o avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Wa,-ahlms=delay.lst -mmcu=atmega12 8 -I. delay.c -o delay.o avr-gcc test3.o delay.o -Wl,-Map=test3.map,--cref -mmcu=atmega128 -o test3.el f avr-objcopy -O avrobj -R .eeprom test3.elf test3.obj avr-objcopy -O ihex -R .eeprom test3.elf test3.hex elfcoff test3.elf coff test3.cof test3.sym Ended cp coff/test3.cof . cp coff/* . avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section -lma .eeprom=0 -O ihex test3.elf test3.eep avr-size test3.elf text data bss dec hex filename 280 0 0 280 118 test3.elf Errors: none rm delay.o Das verwendete makefile: ------------------------------------------------------------------------ -----------------------# Simple Makefile Volker Oth (c) 1999 # edited by AVRfreaks.net nov.2001 ########### change these lines according to your project ################## #put the name of the target mcu here (at90s8515, at90s8535, attiny22, atmega603 etc.) MCU = atmega128 #put the name of the target file here (without extension) TRG = test3 #put your C sourcefiles here SRC = $(TRG).c delay.c #put additional assembler source file here ASRC = #additional libraries and object files to link LIB = #additional includes to compile INC = #assembler flags ASFLAGS = -Wa, -gstabs #compiler flags CPFLAGS = -g -Os -Wall -Wstrict-prototypes -Wa,-ahlms=$(<:.c=.lst) #linker flags LDFLAGS = -Wl,-Map=$(TRG).map,--cref ########### you should not need to change the following line ############# include avr_make ###### dependencies, add any dependencies you need here ################### $(TRG).o : $(TRG).c Sieht doch eigentlich alles ok aus, oder???? Debugge ich das Programm im AVR Studio 4, funktioniert anscheinend alles völlig einwandfrei. Lade ich das Programm in dem Prozessor, bleibt der Prozessor stehen bzw. steht wohl in einer Endlosschleife. Ich habe langsam keine Idee mehr und vermute, daß ich hier gleich was bezüglich Header-Datei oder Variablendeklarationen zu hören bekomme und mich lächerlich mache, weil ich eine ganz einfache Sache übersehen habe. Fakt ist nur, das ich halt gerade anfange C zu lernen und zum ersten mal mit dem ATMEL's arbeite und vorher alles in Maschinensprache geschrieben habe. Hier komme ich einfach nicht weiter. Noch was zu der IDE Umgebung: Windows 2000 Proff. AVR GCC für den ATmega 128 http://www.smartsolutionnet.de/avrgcc/ PonyProg2000 2.05a Beta AVR Studio 4.02 Build 135 Für jede Hilfe Dankbar!!! Guido