avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] AVR-Insight and c++


From: Patrizio Zelotti
Subject: [avr-gcc-list] AVR-Insight and c++
Date: Thu, 6 May 2004 21:54:27 +0200

On 6 May 2004 at 08:56, Eric Weddington wrote :

>> Hi,
>> finally I discovered the problem : it was a fault in my makefile.
>Glad you found out the problem!

>> I have attached the makefile I use :
>Maybe it's my email client, but I couldn't find any attachment.

Sorry, I attacched the makefile, but I have not found the attacchemnt when I
received the mail.

Here is it.

############################################################################
###
# makefile
# part of this makefile is partially derived from
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al.
#

#target project definitions

TARGET = Test

#programming language and compiler definitions

LANGUAGE = c++
#LANGUAGE = c

ifeq ($(LANGUAGE),c)
 EXT = c
 CC = avr-gcc
 CSTANDARD = -std=gnu99
else
 EXT = cpp
 CC = avr-g++
 CSTANDARD =
endif

#source and object file definitions

SRC = $(wildcard *.$(EXT))
INC = $(wildcard *.h)
OBJ = $(SRC:.$(EXT)=.o)

#commands and definitions

OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
SIZE = avr-size
RM = rm -f
COPY = cp

#debuger definitions

AVARICE = avarice.exe
JTAGCOM = /dev/com1

#compiler options

MCU = atmega128
OPT = -Os

LIB =

FORMAT = ihex

CFLAGS += -g -mmcu=$(MCU) $(OPT)
CFLAGS += -Wall -Wstrict-prototypes
CFLAGS += $(CSTANDARD)

LDFLAGS += -Wl,-Map=$(TARGET).map,--cref -mmcu=$(MCU)

#target

all: $(TARGET).d $(TARGET).elf $(TARGET).hex list size

$(TARGET).d: $(SRC)
 $(CC) $(CFLAGS) -MM $(SRC) > $(TARGET).d

include $(TARGET).d

$(TARGET).elf : $(OBJ)

$(TARGET).hex : $(TARGET).elf

#compile: instructions to create object files from source

%.o: %.$(EXT)
 $(CC) -c $(CFLAGS) $< -o $@

%.elf: $(OBJ)
 $(CC) $(ALL_CFLAGS) $(OBJ) $(LIB) $(LDFLAGS) --output $@

%.hex: %.elf
 $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@

dep:
 $(CC) $(CFLAGS) -MM $(SRC) > $(TARGET).d

clean:
 $(RM) $(OBJ)
 $(RM) $(SRC:.$(EXT)=.s)
 $(RM) $(SRC:.$(EXT)=.lst)
 $(RM) $(SRC:.$(EXT)=.bak)
 $(RM) $(INC:.h=.bak)
 $(RM) $(TARGET).map
 $(RM) $(TARGET).elf
 $(RM) $(TARGET).obj
 $(RM) $(TARGET).eep
 $(RM) $(TARGET).hex
 $(RM) $(TARGET).cof
 $(RM) $(TARGET).sym
 $(RM) $(TARGET).bin
 $(RM) $(TARGET).lst
 $(RM) $(TARGET).d
 if [ -f "makefile.bak" ]; then $(RM) "makefile.bak"; fi

size:
 $(SIZE) $(TARGET).elf

list:
 $(OBJDUMP) -h -S $(TARGET).elf > $(TARGET).lst

#debug and program instruction using JTAG-ICE

FUSES = ff810f
PORT = 1212

gdb:
 $(AVARICE) -B 500KHz --file $(TARGET).elf --jtag $(JTAGCOM) :1212

program:
 $(AVARICE) -B 500KHz -D --write-fuses $(FUSES) --file $(TARGET).elf --jtag
$(JTAGCOM) :$(PORT)

#End of makefile
############################################################################
###


Regards,
Patrizio Zelotti




reply via email to

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