avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-chat] arv-gcc tools with assembler source code


From: Marge Coahran
Subject: [avr-chat] arv-gcc tools with assembler source code
Date: Mon, 3 Aug 2009 16:32:38 -0500 (CDT)

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

I recognize this to mean that the linker cannot find the function main(), but I don't know how to tell it there shouldn't be one since the entire program is the single object module, which came from assembly source.
Perhaps I should not be making the .elf file at all?

Thanks in advance for any light you can shed on this.

Marge




reply via email to

[Prev in Thread] Current Thread [Next in Thread]