avr-gcc a debug informace
Jan Waclawek
wek@evona.sk
Úterý Únor 14 12:24:07 CET 2006
Dovolil som si ten MK-ov uuencodovany bordel prelozit do citatelnej podoby.
wek
###############################################################################
# Makefile for the project miniTWICE
###############################################################################
## General Flags
PROJECT = miniTWICE
MCU = atmega16
TARGET = miniTWICE.elf
CC = avr-gcc
## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)
## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -gdwarf-2 -DF_CPU=7372800 -Os -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -Wall
CFLAGS += -Wp,-M,-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 += -nostdlib -Wl,-Map=miniTWICE.map
LDFLAGS += -Wl,-section-start=.utils=0x2e00
LDFLAGS += -Wl,-section-start=.text=0x3c00
## 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
## Objects that must be built in order to link
OBJECTS = miniTWICE.o utils.o avr_isp.o avr_prog.o
## Build
all: $(TARGET) miniTWICE.hex miniTWICE.eep miniTWICE.lss size
## Compile
miniTWICE.o: ../miniTWICE.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
utils.o: ../utils.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
avr_isp.o: ../avr_isp.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
avr_prog.o: ../avr_prog.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
##Link
$(TARGET): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(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) miniTWICE.elf dep/ miniTWICE.hex miniTWICE.eep
miniTWICE.lss miniTWICE.map
## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
Další informace o konferenci Hw-list