首先在windows下安装make工具,并建立好ADS工程。
编译命令make -f ads.mk,执行过程请看截图http://hi.csdn.net/space-2513952-do-album-picid-507759.html
MYPATH = C:/boot/44b_flash
PAT = D:/Program Files/ARM/ADSv1_2/Bin
MYLDPATH = D:/arm7/lib
CC = $(PAT)/armcc
LD = $(PAT)/armlink
OBJTOOL = $(PAT)/fromelf
RM = del -f
#AS = $(PAT)/armasm -keep -g
AS = $(PAT)/armasm -keep -g
ASFILE = $(MYPATH)/SRC/44BINIT.S
CFLAGS = -O1 -g+ -Wa -DNO_UNDERSCORES=1 -I../inc
MODEL = test
#SRC = 29lv160.c 44BLIB.C 44BMAIN.C
SRC =$(wildcard *.c)
#OBJS = 29lv160.o 44BLIB.o 44BMAIN.o
DIR = $(notdir $(SRC))
OBJS_TMP = $(patsubst %.c, %.o, $(DIR)) 这里只是把.c转为.o,但.C未被转为.o
OBJS = $(patsubst %.C, %.o, $(OBJS_TMP )) 完成将.C转为.o
all:$(MODEL).axf $(MODEL).bin clean
$(MODEL).axf:$(OBJS) 44BINIT.o
@echo "### Linking ..."
$(LD) $(OBJS) 44BINIT.o -ro-base 0xc000000 -first 44BINIT.o(Init) -o $@ -libpath $(MYLDPATH)
# $(LD) $(OBJS) 44BINIT.o -info totals -ro-base 0xc000000 -first 44BINIT.o(Init) -o $@ -libpath $(MYLDPATH)
# $(LD) $(OBJS) 44BINIT.o -ro-base 0xc000000 -entry Main -first 44BINIT.o -o $@ -libpath $(MYLDPATH)
$(MODEL).bin: $(MODEL).axf
$(OBJTOOL) -c -bin -output $@ $<
$(OBJTOOL) -c -s -o $(<:.axf=.lst) $< 这句的意思是fromelf -c -s -o test.lst test.axf
%.o:%.c
@echo "### Compiling $<"
$(CC) $(CFLAGS) -c $< -o $@
%.o:%.s
@echo "### Compiling $<"
$(AS) $< -o $@
# $(CC) -g -c $@ $<
clean:
$(RM) 44BINIT.o $(OBJS)
test:
@echo "### Just a test ###"
@echo $(SRC)
@echo "#######"
@echo $(OBJS)
编译过程中遇到的问题及解决方案:
L6211E: Ambiguous section selection. Object <objname> contains more than one section.
This can occur when using the linker option -keep on an assembler object that contains more than
one AREA. The linker needs to know which AREA you would like to keep.
To solve this, specify the names of the AREAs that you wish to keep, using more than one -keep
option, for example: -keep boot.o(vectors) -keep boot.o(resethandler)…
Note that using assembler files with more than one AREA may give other problems elsewhere, so