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

📄 makedefs

📁 atmel AVR MCU UCOS Source code.
💻
字号:
#----------------------------------------------------------------------------------
# GCC-AVR standard Makefile part 3
# Based on Volker Oth's makefiles of jan.2000
# Modified and merged by AVRfreaks.net for smoother integration with AVR Studio,
# and easier comprehension for the average user (nov.2001). Minor errors corrected.
# ---------------------------------------------------------------------------------

###### BLOCK 1) define some variables based on the AVR base path in $(AVR) #######

	CC	= avr-gcc
	AS	= avr-gcc -x assembler-with-cpp	
	RM	= rm -f
	RN	= mv
	OUT	= coff
	ELFCOF	= elfcoff
	CP	= cp
	BIN	= avr-objcopy
	SIZE = avr-size


###### BLOCK 2) output format can be srec, ihex (avrobj is always created) #######

	FORMAT = ihex	


###### BLOCK 3) define all project specific object files ######

#OBJ = $(ASRC:.s=.o) $(SRC:.c=.o) 
CPFLAGS += -mmcu=$(MCU)
ASFLAGS += -mmcu=$(MCU)
LDFLAGS += -mmcu=$(MCU)

  
###### BLOCK 4) this defines the aims of the make process ######

#all:	$(TRG).obj $(TRG).elf $(TRG).hex  $(TRG).cof $(TRG).eep $(TRG).ok


###### BLOCK 5) compile: instructions to create assembler and/or object files from C source ######

%.o : %.c 
	$(CC) -c $(CPFLAGS) -I$(INCDIR) $< -o $@

%.s : %.c
	$(CC) -S $(CPFLAGS) -I$(INCDIR) $< -o $@


###### BLOCK 6) assemble: instructions to create object file from assembler files ######

%.o : %.s
	$(AS) -c $(ASFLAGS) -I$(INCDIR) $< -o $@


###### BLOCK 7)  link: instructions to create elf output file from object files ######
%.elf: $(ALL_OBJS)
	$(CC) $(ALL_OBJS) $(LIBDIR) $(LDFLAGS) -o $@

###### BLOCK 8) create avrobj file from elf output file ######

%.obj: %.elf
	$(BIN) -O avrobj -R .eeprom $< $@


###### BLOCK 9) create bin (.hex and .eep) files from elf output file ######

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

%.eep: %.elf
	$(BIN) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O $(FORMAT) $< $@

%.cof: %.elf
	$(ELFCOF) $< $(OUT) $@ $*.sym
	$(CP) $(OUT)/$@ .
	$(CP) $(OUT)/* .
#	$(CP) $(OUT)\\*sym .
#	$(CP) $(OUT)\\*S .

###### BLOCK 10) If all other steps compile ok then echo "Errors: none" ######

%ok:
	$(SIZE) $(TRG).elf
	@echo "Errors: none" 


###### BLOCK 11)  make instruction to delete created files ######

size:
	$(SIZE) $(TRG).elf

⌨️ 快捷键说明

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