[En-Nut-Discussion] Unable to compile 'simple'

Lloyd Bailey lbailey at pharmanord.com
Fri Jan 27 11:34:48 CET 2006


Hi,

I had the same problem, so I re-ordered the libraries (swopped  nutdev
and nutarch and add nutdev at the end.

I hope this helps,

Lloyd.


###############################################################################
# Makefile for the project door
###############################################################################

## General Flags
PROJECT = door
MCU = atmega128
TARGET = door.elf
CC = avr-gcc.exe

## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -D__HARVARD_ARCH__ -c -fno-delete-null-pointer-checks -Wstrict-prototypes -O0 -fsigned-char -gdwarf-2  -DETHERNUT2 
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d 

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS += -Wl,--defsym=main=0  -Wl,-Map=door.map


## Intel Hex file production flags
HEX_FLASH_FLAGS = -R .eeprom

HEX_EEPROM_FLAGS = -j .eeprom
HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load"
HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0


## Include Directories
INCLUDES = -I"D:\WinAVR\avr\include\avr" -I"C:\ethernut-4.1.3\nut\include" -I"C:\WinAVR\avr\include\avr" 

## Library Directories
LIBDIRS = -L"C:\ethernut-4.1.3\lloyd\lib\gcc\atmega128" 

## Libraries
LIBS = -lnutpro -lnutos -lnutdev -lnutarch -lnutnet -lnutfs -lnutcrt -lnutc -lnutdev 

## Objects that must be built in order to link
OBJECTS = door.o 

## Objects explicitly added by the user
LINKONLYOBJECTS = "C:\ethernut-4.1.3\lloyd\lib\gcc\atmega128\nutinit.o" 

## Build
all: $(TARGET) door.hex door.eep door.lss size

## Compile
door.o: ../door.c
	$(CC) $(INCLUDES) $(CFLAGS) -c  $<

##Link
$(TARGET): $(OBJECTS)
	 $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET)

%.hex: $(TARGET)
	avr-objcopy -O ihex $(HEX_FLASH_FLAGS)  $< $@

%.eep: $(TARGET)
	avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@

%.lss: $(TARGET)
	avr-objdump -h -S $< > $@

size: ${TARGET}
	@echo
	@sh avr-mem.sh ${TARGET} ${MCU}

## Clean target
.PHONY: clean
clean:
	-rm -rf $(OBJECTS) door.elf dep/* door.hex door.eep door.lss door.map


## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)


-- 
EDB afgang
Pharma Nord
Sadelmagervej 30-32
7100 Vejle
Denmark
Tel:. +45 75 85 74 00




More information about the En-Nut-Discussion mailing list