# -Wall
# $(CC) -o start -nostdinc -I./include -nostdlib -Bstatic src/ubl.c src/uart.c src/util.c -Wl,-T./src/ubl_davinci.lds \
# -Wl,--start-group /home/reny/workdir/app/ubl2/lib/libc.a /home/reny/workdir/app/ubl2/net/libnet.a -Wl,--end-group
CC=arm-linux-gcc
LD=arm-linux-ld
CFLAGS= -c -nostdinc -I./include
LDFLAGS= -nostdlib -Bstatic -T./src/ubl_davinci.lds
OBJECTS= ubl.o uart.o util.o lib/libc.a net/libnet.a
all: boot.bin
boot.bin: $(OBJECTS)
$(LD) -o start -nostdlib -static -T./src/ubl_davinci.lds ubl.o uart.o util.o \
--start-group /home/reny/workdir/app/ubl2/lib/libc.a /home/reny/workdir/app/ubl2/net/libnet.a --end-group
#$(LD) $(LDFLAGS) $(OBJECTS) -o start
arm-linux-objcopy -O binary start boot.bin
@echo -n "The entry point of the binary is 0x"
@arm-linux-objdump -t start | grep -E '[0-9a-f]{8}*[0-9a-f]{8} nmain' | sed 's/^\([0-9a-f]\{8\}\)\([0-9a-f]\{4\}\).*/\2/'
uart.o:src/uart.c
$(CC) $(CFLAGS) src/uart.c
ubl.o:src/ubl.c
$(CC) $(CFLAGS) src/ubl.c
util.o:src/util.c
$(CC) $(CFLAGS) src/util.c
.PHONY : lib/libc.a
lib/libc.a:
cd lib; make libc.a; cd ..
.PHONY : net/libnet.a
net/libnet.a:
cd net; make libnet.a; cd ..
clean:
@rm *.o
@touch 1.bin
cd lib; make clean; cd ..
cd net; make clean; cd ..
@rm *.bin
@touch 1.bak
@rm *.bak
@rm start
阅读(944) | 评论(0) | 转发(0) |