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