X-Git-Url: http://git.kpe.io/?p=avr_bc100.git;a=blobdiff_plain;f=BaseMegaFirmware%2FGCC%2Fdefault%2FMakefile;fp=BaseMegaFirmware%2FGCC%2Fdefault%2FMakefile;h=f1333e5b7c1841633c5d0a9675441ea755ba6537;hp=0000000000000000000000000000000000000000;hb=89173ec9cd6f33843bf27c45be0f2f9be3f5f0ce;hpb=7997f136b12114035265bd082c854bff95fd73dc diff --git a/BaseMegaFirmware/GCC/default/Makefile b/BaseMegaFirmware/GCC/default/Makefile new file mode 100644 index 0000000..f1333e5 --- /dev/null +++ b/BaseMegaFirmware/GCC/default/Makefile @@ -0,0 +1,96 @@ +############################################################################### +# Makefile for the project bc100_master +############################################################################### + +## General Flags +PROJECT = bc100_master +MCU = atmega644 +TARGET = bc100_master.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 -gdwarf-2 -std=gnu99 -DF_CPU=7372800UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d + +## Assembly specific flags +ASMFLAGS = $(COMMON) +ASMFLAGS += $(CFLAGS) +ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 + +## Linker flags +LDFLAGS = $(COMMON) +LDFLAGS += -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -Wl,-Map=bc100_master.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 --no-change-warnings + + +## Objects that must be built in order to link +OBJECTS = uart.o main.o mystdio.o spi.o bc100_slave.o port_ext.o timebase.o key_io.o + +## Objects explicitly added by the user +LINKONLYOBJECTS = + +## Build +all: $(TARGET) bc100_master.hex bc100_master.eep bc100_master.lss size + +## Compile +uart.o: ../uart.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +main.o: ../main.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +mystdio.o: ../mystdio.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +spi.o: ../spi.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +bc100_slave.o: ../bc100_slave.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +port_ext.o: ../port_ext.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +timebase.o: ../timebase.c + $(CC) $(INCLUDES) $(CFLAGS) -c $< + +key_io.o: ../key_io.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 $< $@ || exit 0 + +%.lss: $(TARGET) + avr-objdump -h -S $< > $@ + +size: ${TARGET} + @echo + @avr-size -C --mcu=${MCU} ${TARGET} + +## Clean target +.PHONY: clean +clean: + -rm -rf $(OBJECTS) bc100_master.elf dep/* bc100_master.hex bc100_master.eep bc100_master.lss bc100_master.map + + +## Other dependencies +-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) +