etisserant@375: ############################################################################### etisserant@375: # Makefile for the project SlaveAVR etisserant@375: ############################################################################### etisserant@375: etisserant@375: ## General Flags etisserant@375: PROJECT = SlaveAVR etisserant@375: MCU = at90can128 etisserant@375: TARGET = SlaveAVR.elf etisserant@375: CC = avr-gcc.exe etisserant@375: etisserant@375: ## Options common to compile, link and assembly rules etisserant@375: COMMON = -mmcu=$(MCU) etisserant@375: etisserant@375: ## Compile options common for all C compilation units. etisserant@375: CFLAGS = $(COMMON) etisserant@375: CFLAGS += -Wall -gdwarf-2 -Os -fsigned-char -fpack-struct etisserant@375: CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d etisserant@375: etisserant@375: ## Assembly specific flags etisserant@375: ASMFLAGS = $(COMMON) etisserant@375: ASMFLAGS += $(CFLAGS) etisserant@375: ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 etisserant@375: etisserant@375: ## Linker flags etisserant@375: LDFLAGS = $(COMMON) etisserant@375: LDFLAGS += -Wl,-Map=SlaveAVR.map etisserant@375: etisserant@375: etisserant@375: ## Intel Hex file production flags etisserant@375: HEX_FLASH_FLAGS = -R .eeprom etisserant@375: etisserant@375: HEX_EEPROM_FLAGS = -j .eeprom etisserant@375: HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" etisserant@375: HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings etisserant@375: etisserant@375: etisserant@375: ## Include Directories etisserant@375: INCLUDES = -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\..\..\..\..\include\AVR" -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\." -I"I:\Entwicklung\Firmware\CAN\CanFestival-3\examples\AVR\DS401_Slave\GCC\..\..\..\..\include" etisserant@375: etisserant@375: ## Objects that must be built in order to link etisserant@375: OBJECTS = can_AVR.o dcf.o timer.o emcy.o lifegrd.o nmtSlave.o objacces.o pdo.o sdo.o states.o sync.o ObjDict.o main.o nmtMaster.o timer_AVR.o etisserant@375: etisserant@375: ## Objects explicitly added by the user etisserant@375: LINKONLYOBJECTS = etisserant@375: etisserant@375: ## Build etisserant@375: all: $(TARGET) SlaveAVR.hex SlaveAVR.eep SlaveAVR.lss size etisserant@375: etisserant@375: ## Compile etisserant@375: can_AVR.o: ../../../../../drivers/AVR/can_AVR.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: dcf.o: ../../../../../src/dcf.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: timer.o: ../../../../../src/timer.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: emcy.o: ../../../../../src/emcy.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: lifegrd.o: ../../../../../src/lifegrd.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: nmtSlave.o: ../../../../../src/nmtSlave.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: objacces.o: ../../../../../src/objacces.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: pdo.o: ../../../../../src/pdo.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: sdo.o: ../../../../../src/sdo.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: states.o: ../../../../../src/states.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: sync.o: ../../../../../src/sync.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: ObjDict.o: ../../ObjDict.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: main.o: ../../main.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: nmtMaster.o: ../../../../../src/nmtMaster.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: timer_AVR.o: ../../../../../drivers/AVR/timer_AVR.c etisserant@375: $(CC) $(INCLUDES) $(CFLAGS) -c $< etisserant@375: etisserant@375: ##Link etisserant@375: $(TARGET): $(OBJECTS) etisserant@375: $(CC) $(LDFLAGS) $(OBJECTS) $(LINKONLYOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET) etisserant@375: etisserant@375: %.hex: $(TARGET) etisserant@375: avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ etisserant@375: etisserant@375: %.eep: $(TARGET) etisserant@375: -avr-objcopy $(HEX_EEPROM_FLAGS) -O ihex $< $@ || exit 0 etisserant@375: etisserant@375: %.lss: $(TARGET) etisserant@375: avr-objdump -h -S $< > $@ etisserant@375: etisserant@375: size: ${TARGET} etisserant@375: @echo etisserant@375: @avr-size -C --mcu=${MCU} ${TARGET} etisserant@375: etisserant@375: ## Clean target etisserant@375: .PHONY: clean etisserant@375: clean: etisserant@375: -rm -rf $(OBJECTS) SlaveAVR.elf dep/* SlaveAVR.hex SlaveAVR.eep SlaveAVR.lss SlaveAVR.map etisserant@375: etisserant@375: etisserant@375: ## Other dependencies etisserant@375: -include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*) etisserant@375: