📄 makefile
字号:
#---------------------------------------------------
WORKDIR=.
OBJDIR=$(WORKDIR)/obj
BASEDIR=$(WORKDIR)/..
ALLCSRCDIR = $(BASEDIR)/main
ALLCSRCDIR += $(BASEDIR)/boot
ALLCSRCDIR += $(BASEDIR)/uart
ALLCSRCDIR += $(BASEDIR)/uCOS-II/Ports
ALLCSRCDIR += $(BASEDIR)/uCOS-II/Source
ALLCSRCDIR += $(BASEDIR)/uC-CPU
ALLCSRCDIR += $(BASEDIR)/uC-LIB
ALLCSRCDIR += $(BASEDIR)/rtc
ALLCSRCDIR += $(BASEDIR)/common
ALLCSRCDIR += $(BASEDIR)/shell
ALLASMSRCDIR = $(BASEDIR)/boot
ALLASMSRCDIR += $(BASEDIR)/uCOS-II/Ports
ALLASMSRCDIR += $(BASEDIR)/uC-CPU
ALLASMSRCDIR += $(BASEDIR)/uC-LIB
ALLASMSRCDIR += $(BASEDIR)/rtc
ALLINCLDIR = $(ALLCSRCDIR)
ALLINCLDIR += $(ALLASMSRCDIR)
ALLINCLDIR += $(BASEDIR)/incl
#---------------------------------------------------
vpath %h ../boot
vpath %h ../uCOS-II/Source
vpath %h ../incl
vpath %h ../incl_pub
vpath %h ../uCOS-II/Ports
vpath %h ../uC-CPU
vpath %h ../uC-LIB
vpath %h ../rtc
vpath %h ../common
vpath %h ../shell
vpath %c ../boot
vpath %c ../main
vpath %c ../uCOS-II/Ports
vpath %c ../uCOS-II/Source
vpath %c ../uart
vpath %c ../uC-CPU
vpath %c ../uC-LIB
vpath %c ../rtc
vpath %c ../common
vpath %c ../shell
vpath %s ../boot
vpath %s ../uCOS-II/Ports
vpath %s ../uC-CPU
vpath %s ../uC-LIB
#---------------------------------------------------
cc = armcc
asm = armasm
link = armlink
#---------------------------------------------------
CSRC = $(notdir $(foreach dir,$(ALLCSRCDIR),$(wildcard $(dir)/*.c)))
ASMSRC = $(notdir $(foreach dir,$(ALLASMSRCDIR),$(wildcard $(dir)/*.s)))
objs = $(addprefix $(OBJDIR)/, $(CSRC:.c=.o) $(ASMSRC:.s=.o))
incls = $(addprefix -I, $(ALLINCLDIR))
#---------------------------------------------------
CFLAGS = $(incls) -c -g -O2
ASMFLAGS = $(incls) -g
LINKFLAGS = -scatter ..\boot\mem_c.scf \
-entry 0x00000000 \
-o test.axf
# -S
# -info totals -info unused -map
#---------------------------------------------------
# main target
test.bin : test.axf
fromelf test.axf -bin -o test.bin
test.axf : $(objs)
$(link) $(objs) $(LINKFLAGS)
#---------------------------------------------------
# Implicit rules for building .c and .s files
./$(OBJDIR)/%.o : %.c
$(cc) $(CFLAGS) $< -o $@
./$(OBJDIR)/%.o : %.s
$(asm) $(ASMFLAGS) $< -o $@
#---------------------------------------------------
.PHONY : clean
clean :
del test.axf test.bin obj
#---------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -