📄 makefile
字号:
###############################################################################
# Makefile for the project EnorOnHand
###############################################################################
## General Flags
PROJECT = EnorOnHand
MCU = atmega16
TARGET = EnorOnHand.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 += -Wall -gdwarf-2 -DF_CPU=8000000UL -Os -fsigned-char
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 += -Wl,-Map=EnorOnHand.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
## Include Directories
INCLUDES = -I"D:\Enor\Controler\EnorOnHand\Inc\AVR" -I"D:\Enor\Controler\EnorOnHand\Inc"
## Objects that must be built in order to link
OBJECTS = main.o BoardIni.o comm.o Key.o Sleep.o Buffer.o Platform.o EEPROM_LOW.o I2CMiddle.o
## Build
all: $(TARGET) EnorOnHand.hex EnorOnHand.eep EnorOnHand.lss size
## Compile
main.o: ../../../../Source/main.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
BoardIni.o: ../../../../Source/Platform/AVR/BoardIni.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
comm.o: ../../../../Source/comm.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
Key.o: ../../../../Source/Key.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
Sleep.o: ../../../../Source/Sleep.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
Buffer.o: ../../../../Source/Buffer.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
Platform.o: ../../../../Source/Platform/AVR/Platform.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
EEPROM_LOW.o: ../../../../Source/Platform/AVR/EEPROM_LOW.c
$(CC) $(INCLUDES) $(CFLAGS) -c $<
I2CMiddle.o: ../../../../Source/Platform/AVR/I2CMiddle.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) EnorOnHand.elf dep/ EnorOnHand.hex EnorOnHand.eep EnorOnHand.lss EnorOnHand.map
## Other dependencies
-include $(shell mkdir dep 2>/dev/null) $(wildcard dep/*)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -