2008-03-30 19:46:13 +00:00
|
|
|
#
|
|
|
|
# U-boot - Makefile
|
|
|
|
#
|
|
|
|
# Copyright (c) 2005-2008 Analog Device Inc.
|
|
|
|
#
|
|
|
|
# (C) Copyright 2000-2006
|
|
|
|
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
#
|
|
|
|
# Licensed under the GPL-2 or later.
|
|
|
|
#
|
|
|
|
|
|
|
|
include $(TOPDIR)/config.mk
|
|
|
|
|
2010-11-05 14:48:07 +00:00
|
|
|
LIB = $(obj)lib$(CPU).o
|
2008-03-30 19:46:13 +00:00
|
|
|
|
2011-05-07 21:55:04 +00:00
|
|
|
EXTRA := init.elf
|
2008-03-30 19:46:13 +00:00
|
|
|
CEXTRA := initcode.o
|
|
|
|
SEXTRA := start.o
|
2008-08-07 21:52:59 +00:00
|
|
|
SOBJS := interrupt.o cache.o
|
2009-07-10 00:56:56 +00:00
|
|
|
COBJS-y += cpu.o
|
2010-06-02 08:17:26 +00:00
|
|
|
COBJS-y += gpio.o
|
2009-07-10 00:56:56 +00:00
|
|
|
COBJS-y += interrupts.o
|
2008-10-12 01:51:20 +00:00
|
|
|
COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o
|
2009-07-10 00:56:56 +00:00
|
|
|
COBJS-y += os_log.o
|
|
|
|
COBJS-y += reset.o
|
|
|
|
COBJS-y += serial.o
|
|
|
|
COBJS-y += traps.o
|
2009-11-12 23:42:07 +00:00
|
|
|
COBJS-$(CONFIG_HW_WATCHDOG) += watchdog.o
|
2008-03-30 19:46:13 +00:00
|
|
|
|
2008-10-12 01:51:20 +00:00
|
|
|
SRCS := $(SEXTRA:.o=.S) $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
|
|
|
|
OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
|
2008-03-30 19:46:13 +00:00
|
|
|
EXTRA := $(addprefix $(obj),$(EXTRA))
|
|
|
|
CEXTRA := $(addprefix $(obj),$(CEXTRA))
|
|
|
|
SEXTRA := $(addprefix $(obj),$(SEXTRA))
|
|
|
|
|
|
|
|
all: $(obj).depend $(LIB) $(obj).depend $(EXTRA) $(CEXTRA) $(SEXTRA) check_initcode
|
|
|
|
|
|
|
|
$(LIB): $(OBJS)
|
2010-11-05 14:48:07 +00:00
|
|
|
$(call cmd_link_o_target, $(OBJS))
|
2008-03-30 19:46:13 +00:00
|
|
|
|
|
|
|
$(OBJS): $(obj)bootrom-asm-offsets.h
|
|
|
|
$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk
|
|
|
|
echo '#include <asm/mach-common/bits/bootrom.h>' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp
|
|
|
|
mv $@.tmp $@
|
|
|
|
$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c
|
|
|
|
$(CC) $(CFLAGS) -S $^ -o $@.tmp
|
|
|
|
mv $@.tmp $@
|
|
|
|
$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s
|
|
|
|
sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@
|
|
|
|
|
|
|
|
# make sure our initcode (which goes into LDR) does not
|
|
|
|
# have relocs or external references
|
2008-10-24 22:18:16 +00:00
|
|
|
$(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections
|
2008-03-30 19:46:13 +00:00
|
|
|
READINIT = env LC_ALL=C $(CROSS_COMPILE)readelf -s $<
|
|
|
|
check_initcode: $(obj)initcode.o
|
|
|
|
ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
|
|
|
|
@if $(READINIT) | grep '\<GLOBAL\>.*\<UND\>' ; then \
|
|
|
|
echo "$< contains external references!" 1>&2 ; \
|
|
|
|
exit 1 ; \
|
|
|
|
fi
|
|
|
|
endif
|
|
|
|
|
2011-05-07 21:55:04 +00:00
|
|
|
$(obj)init.lds: init.lds.S
|
|
|
|
$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
|
|
|
|
$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
|
|
|
|
$(LD) $(LDFLAGS) -T $^ -o $@
|
|
|
|
|
2008-03-30 19:46:13 +00:00
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# defines $(obj).depend target
|
|
|
|
include $(SRCTREE)/rules.mk
|
|
|
|
|
|
|
|
sinclude $(obj).depend
|
|
|
|
|
|
|
|
#########################################################################
|