⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 WINAVR编写的LED流水灯程序
💻
字号:
CC = avr-gcc
MCU = atmega16
F_CPU =7372800
TARGET = led
FORMAT = ihex

SRC = led.c

CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU)UL 
CFLAGS += -O2 -Wall -I. 
CFLAGS += -std=gnu99


 
OBJCOPY = avr-objcopy
SIZE = avr-size
MSG_SIZE_BEFORE = Size before: 
MSG_SIZE_AFTER = Size after:
MSG_BEGIN = Makefile create by ken

all:begin  $(TARGET).hex  $(TARGET).elf sizeafter

begin:
	@echo $(MSG_BEGIN)
	@echo

# Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) -A $(TARGET).elf
AVRMEM = avr-mem.sh $(TARGET).elf $(MCU)

sizebefore:
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
	$(AVRMEM) 2>/dev/null; echo; fi

sizeafter:
	@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \
	$(AVRMEM) 2>/dev/null; echo; fi
	


%.hex : %.elf
	$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@

%.elf : $(SRC:.c=.o) 
	$(CC) $(CFLAGS) $^ --output $@ $(LDFLAGS)
	
%.o : %.c
	$(CC) -c $(CFLAGS) $< -o $@ 
	
clean:
	rm -f *.o *.elf  *.hex  *.cof

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -