#############################################################
# Makefile for TI UBL project. #
# Generates the binary UBL file can be used as the #
# secondary bootloader for the DM35x in NOR, NAND, and #
# UART boot modes. #
#############################################################
# Author: Daniel Allred
#
ENTRYPOINT:=boot
PROGRAM:=ubl
TYPE :=nand
EXECUTABLE:=$(PROGRAM)_$(TYPE)
CROSSCOMPILE = arm_v5t_le-
CC = $(CROSSCOMPILE)gcc
OBJCOPY = $(CROSSCOMPILE)objcopy
OBJDUMP = $(CROSSCOMPILE)objdump
CFLAGS = -c -I./include -I./src -I./
LDFLAGS = -Wl,-T$(LINKERSCRIPT),-Map,systmp.map -nostdlib
OBJCOPYFLAGS = --gap-fill 0xFF -S
#SOURCES =ubl.c boot.c selfcopy.c uartboot.c device.c debug.c uart.c util.c
SOURCES = $(wildcard *.c ./src/*.c)
OBJECTS = $(patsubst %.c,%.o,$(SOURCES)) #function patsubst(
,,)
#OBJECTS = $(SOURCES:%.c=%.o)
BINARY:=$(EXECUTABLE).bin
LINKERSCRIPT=ubl.lds
# Target definitions
all: $(BINARY)
$(BINARY): $(EXECUTABLE)
$(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@
@echo "The entry point of the binary is 0x"
@$(OBJDUMP) -t $(EXECUTABLE) | grep -E '[0-9a-f]{8}*[0-9a-f]{8} $(ENTRYPOINT)' | sed 's/\([0-9a-f]*\).*/\1/'
$(EXECUTABLE): $(OBJECTS)
@echo $(OBJECTS) hello
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
#$(OBJECTS) : %.o : %.c
# $(CC) $(CFLAGS) $< -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
.PHONY : clean
clean:
-rm -f -v $(OBJECTS) $(BINARY) $(EXECUTABLE)
#Search paths for code and header files
#vpath %.h :./include
#vpath %.c :./src
阅读(1161) | 评论(0) | 转发(0) |