📄 makefile
字号:
include Makefile.inc#sub model must be "LPC2" followed by 3 digit flavor e.g. LPC2138# look in main includes for #ifdef's that are affected by the # particular chip model, i.e. A/D convertor in lpcADC.h#SUBMDL = LPC2138ALL_CFLAGS +=-D$(SUBMDL)PROGRAM=main2138# Target file name (without extension).TARGET = $(PROGRAM)# List C source files here. (C dependencies are automatically generated.)SRC = $(PROGRAM).cSRC += armVIC.c close_r.c device_init.c devices.cSRC += finddevice.c fstat_r.c gettimeofday_r.c link_r.cSRC += lseek_r.c mmc_hardware.c mmc_init.c itoa.cSRC += mmc_module.c open_r.c pll_start.c rdcf2.c time_r.cSRC += read_r.c RTCfuncs.c sbrk_r.c settimeofday.c fflushdir.cSRC += timer0ISR.c uart.c uartISR.c unlink_r.c write_r.c isatty.c# List Assembler source files here.ASRC = crt0.S# Linker flags.# -Wl,...: tell GCC to pass this to linker.# -Map: create map file# --cref: add cross reference to map fileLDFLAGS = -nostartfiles -Wl,-Map=$(TARGET).map,--cref# Set Linker-Script Depending On Selected Memoryifeq ($(RUN_MODE),RAM_RUN)LDFLAGS +=-T$(SUBMDL)-RAM.ldelse LDFLAGS +=-T$(SUBMDL)-ROM.ldendif# ---------------------------------------------------------------------------# Default target.all: CRCsum lpc21isp announce buildannounce: @echo "** Building EVNT(2138)"CRCsum: utils/CRCsum.c gcc $< -o $@lpc21isp: utils/lpc21isp.c gcc -ggdb $< -o $@build: elf bin lss sym elf: $(TARGET).elfbin: $(TARGET).binlss: $(TARGET).lss sym: $(TARGET).sym# Display compiler version information.gccversion : @$(CC) --version# Program the device. LPC21ISP = lpc21ispLPC21ISP_CONTROL = -binLPC21ISP_PORT = /dev/ttyS0LPC21ISP_BAUD = 115200LPC21ISP_XTAL = 14746LPC21ISP_FLASHFILE = $(TARGET).binprogram: $(TARGET).bin $(LPC21ISP) $(LPC21ISP_CONTROL) $(LPC21ISP_DEBUG) $(LPC21ISP_FLASHFILE) $(LPC21ISP_PORT) $(LPC21ISP_BAUD) $(LPC21ISP_XTAL)# Create final output files (.hex, .eep) from ELF output file.# TODO: handling the .eeprom-section should be redundant%.bin: %.elf $(OBJCOPY) -O $(FORMAT) $< $@ ./CRCsum $@ $(COPY) $@ /var/lib/tftpboot/# Create extended listing file from ELF output file.%.lss: %.elf $(OBJDUMP) -h -S $< > $@# Create a symbol table from ELF output file.%.sym: %.elf $(NM) -n $< > $@# Link: create ELF output file from object files..SECONDARY : $(TARGET).elf.PRECIOUS : $(OBJ)%.elf: $(OBJ) $(CC) $(OPTNONE) $(THUMB) $(THUMB_IW) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS)timer0ISR.o: timer0ISR.c $(CC) -c $(THUMB_IW) -O0 $(ALL_CFLAGS) $< -o $@armVIC.o: armVIC.c $(CC) -c $(THUMB_IW) -O0 $(ALL_CFLAGS) $< -o $@uartISR.o: uartISR.c $(CC) -c $(THUMB_IW) -O0 $(ALL_CFLAGS) $< -o $@# Compile: create object files from C source files.%.o : %.c $(CC) -c $(OPTNONE) $(THUMB) $(THUMB_IW) $(ALL_CFLAGS) $< -o $@ # Compile: create assembler files from C source files.%.s : %.c $(CC) -S $(THUMB_IW) $(ALL_CFLAGS) $< -o $@# Assemble: create object files from assembler source files.%.o : %.S $(CC) -c $(THUMB_IW) $(ALL_ASFLAGS) $< -o $@# Target: clean project.clean: clean_listclean_list : @$(REMOVE) $(TARGET).bin @$(REMOVE) $(TARGET).obj @$(REMOVE) $(TARGET).elf @$(REMOVE) $(TARGET).map @$(REMOVE) $(TARGET).obj @$(REMOVE) $(TARGET).a90 @$(REMOVE) $(TARGET).sym @$(REMOVE) $(TARGET).lnk @$(REMOVE) $(TARGET).lss @$(REMOVE) $(OBJ) @$(REMOVE) $(LST) @$(REMOVE) $(SRC:.c=.s) @$(REMOVE) $(SRC:.c=.d) @$(REMOVE) .dep/* @$(REMOVE) CRCsum lpc21ispallclean: clean @find . -type d | \ xargs -ithis echo "(cd this ; rm -f *~)" | /bin/sh# Include the dependency files.-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)# Listing of phony targets..PHONY : all begin finish end sizebefore sizeafter gccversion \build elf bin lss sym \clean clean_list program allclean announce
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -