[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-chat] arv-gcc tools with assembler source code
From: |
Weddington, Eric |
Subject: |
RE: [avr-chat] arv-gcc tools with assembler source code |
Date: |
Mon, 3 Aug 2009 20:14:44 -0600 |
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden
> On Behalf Of Marge Coahran
> Sent: Monday, August 03, 2009 3:33 PM
> To: address@hidden
> Subject: [avr-chat] arv-gcc tools with assembler source code
>
> I would appreciate some tips on building an avr program from
> assembler source using the avr-gcc toolchain. My ultimate goal is to
> create a .hex file that can be fed to avrdude.
>
> Here is an excerpt from my makefile:
> -----------------------
> CC = avr-gcc
> OBJCOPY=avr-objcopy
> MCU = atmega16
>
> # translate an .elf file into a .hex file
> .SUFFIXES: .elf .hex
> .elf.hex:
> $(OBJCOPY) -O ihex -R .eeprom $< $@
>
> # Link: create ELF output file from object files.
> %.elf: $(FILE).o
> $(CC) -mmcu=$(MCU) $(FILE).o --output $@
>
> # Assemble: create object file from assembler source file
> %.o: $(FILE).s
> $(CC) -mmcu=$(MCU) -x assembler-with-cpp -c $(FILE).s
> ----------------------
>
> The (current) difficulty is the command to create the .elf
> file, for which
> avr-gcc gives the following complaint:
>
> /usr/lib/gcc/avr/4.3.2/../../../avr/lib/avr5/crtm16.o: In function
> `__bad_interrupt':
> ../../../../crt1/gcrt1.S:193: undefined reference to `main'
> make: *** [mirror.elf] Error 1
However, to add to my previous post: The reason why you are getting the error
above, is because you are not providing a main() function in your application.
You need to define this function if you are going to use the toolchain.