📄 makefile
字号:
################################################################################ Makefile for the project AVR################################################################################# General FlagsPROJECT = demoMCU = atmega168TARGET = demoCC=/cygdrive/c/WinAVR/bin/avr-gccOBJCOPY=/cygdrive/c/WinAVR/bin/avr-objcopy## Options common to compile, link and assembly rulesCOMMON = -mmcu=$(MCU)## Compile options common for all C compilation units.CFLAGS = $(COMMON) \ -Iport -I. \ -I../../modbus/rtu -I../../modbus/ascii -I../../modbus/include CFLAGS += -Wall -gstabs -DF_CPU=20000000UL -Os -Wall -Wstrict-prototypesCFLAGS += -Wp,-M,-MP,-MT,$(*F).o,-MF,dep/$(@F).d ## Assembly specific flagsASMFLAGS = $(COMMON)ASMFLAGS += -x assembler-with-cpp -Wa,-gstabs## Linker flagsLDFLAGS = $(COMMON)LDFLAGS += -Wl,-Map=$(TARGET).map,--cref## Intel Hex file production flagsHEX_FLASH_FLAGS = -R .eepromHEX_EEPROM_FLAGS = -j .eepromHEX_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 = excoils.oOBJECTS = demo.oMBPORTOBJECTS = port/portserial.o \ port/portevent.o \ port/porttimer.o \ port/mbcrc.oMBOBJECTS = ../../modbus/mb.o \ ../../modbus/rtu/mbrtu.o \ ../../modbus/ascii/mbascii.o \ ../../modbus/functions/mbfunccoils.o \ ../../modbus/functions/mbfuncdiag.o \ ../../modbus/functions/mbfuncholding.o \ ../../modbus/functions/mbfuncinput.o \ ../../modbus/functions/mbfuncother.o \ ../../modbus/functions/mbfuncdisc.o \ ../../modbus/functions/mbutils.o ## Buildall: $(TARGET).elf $(TARGET).cof $(TARGET).hex $(TARGET).eep ## Compiledemo.o: demo.c $(CC) $(INCLUDES) $(CFLAGS) -c $<##Link$(TARGET).elf: $(OBJECTS) $(MBOBJECTS) $(MBPORTOBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) $(MBPORTOBJECTS) $(MBOBJECTS) $(LIBDIRS) $(LIBS) -o $(TARGET).elf%.hex: $(TARGET).elf $(OBJCOPY) -O ihex $(HEX_FLASH_FLAGS) $< $@%.cof: $(TARGET).elf $(OBJCOPY) --debugging \ --change-section-address .data-0x800000 \ --change-section-address .bss-0x800000 \ --change-section-address .noinit-0x800000 \ --change-section-address .eeprom-0x810000 -O coff-avr $< $@%.eep: $(TARGET).elf $(OBJCOPY) $(HEX_EEPROM_FLAGS) -O ihex $< $@%.lss: $(TARGET) $(OBJCOPY) -h -S $< > $@flash: avrdude -p m168 -c stk200 -U flash:w:$(TARGET).hex #size: ${TARGET}# @echo# @sh avr-mem.sh ${TARGET} ${MCU}## Clean target.PHONY: cleanclean: -rm -rf $(OBJECTS) $(MBOBJECTS) $(MBPORTOBJECTS) $(TARGET).elf $(TARGET).hex $(TARGET).eep## Other dependencies-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -