blob: 1a29859053f02374063981a3e3b1442ec4c0bc6b [file] [log] [blame]
#
# (C) Copyright 2004-2006, Texas Instruments, <www.ti.com>
# Jian Zhang <jzhang@ti.com>
#
# (C) Copyright 2000-2004
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# See file CREDITS for list of people who contributed to this
# project.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
VERSION = 1
PATCHLEVEL = 3
SUBLEVEL = 4
EXTRAVERSION =
ORGANIZATION="ZTE Inc"
Z_LOADER_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
VERSION_FILE = include/version_autogenerated.h
HOSTARCH := $(shell uname -m | \
sed -e s/i.86/i386/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/powerpc/ppc/ \
-e s/macppc/ppc/)
HOSTOS := $(shell uname -s | tr A-Z a-z | \
sed -e 's/\(cygwin\).*/cygwin/')
export HOSTARCH
# Deal with colliding definitions from tcsh etc.
VENDOR=
#########################################################################
TOPDIR_ := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
TOPDIR := $(shell echo "$(TOPDIR_)"| sed -e "s/\:/\\\:/g")
export TOPDIR
ifndef CROSS_COMPILE
ARCH = arm
CROSS_COMPILE = $(TOPDIR)/../../../../build/compiler/gcc-4.9.4_thumb_linux/usr/bin/arm-buildroot-linux-uclibcgnueabi-
export CROSS_COMPILE
endif
ifeq (include/config.mk,$(wildcard include/config.mk))
# load ARCH, BOARD, and CPU configuration
include include/config.mk
export ARCH CPU BOARD VENDOR
# load other configuration
include $(TOPDIR)/config.mk
#########################################################################
# Z-LOAD objects....order is important (i.e. start must be first)
OBJS = cpu/$(CPU)/start.o
LIBS += board/$(BOARDDIR)/lib$(BOARD).a
LIBS += cpu/$(CPU)/lib$(CPU).a
LIBS += lib/lib$(ARCH).a
LIBS += drivers/libdrivers.a
.PHONY : $(LIBS)
# Add GCC lib
PLATFORM_LIBS += -nostdlib
#PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`)/thumb2 -lgcc
SUBDIRS =
#########################################################################
#########################################################################
platform: version $(OBJS) $(LIBS) $(LDSCRIPT)
@echo "--Finished build [ Platform_Design ] ..."
@echo "...............................................OK...."
@echo ""
together: z-load.bin
z-load.bin: z-load
$(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
z-load:
UNDEF_SYM=`$(OBJDUMP) -x $(LIBS) |sed -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
$(LD) $(LDFLAGS) $$UNDEF_SYM $(OBJS) \
--start-group $(LIBS) --end-group $(PLATFORM_LIBS) \
-Map z-load.map -o z-load
$(LIBS):
$(MAKE) -C `dirname $@`
System.map: z-load
@$(NM) $< | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
sort > System.map
version:
@echo -n "#define Z_LOADER_VERSION \""$(ORGANIZATION)" Z-Loader " > $(VERSION_FILE); \
echo -n "$(Z_LOADER_VERSION)" >> $(VERSION_FILE); \
echo "\"" >> $(VERSION_FILE)
#########################################################################
else
all install z-load z-load.srec depend dep:
@echo "System not configured - see README" >&2
@ exit 1
endif
#########################################################################
unconfig:
rm -f include/config.h include/config.mk
#########################################################################
## ZX297520v3 (ARM-Cortex M0) Systems
#########################################################################
zx297520v3_tloader_config : unconfig
@./mkconfig $(@:_config=) arm m0 zx297520v3
######## ARCH CPU BOARD
echo "/* Automatically generated - do not edit */" >./include/config.h; \
echo "/* Automatically generated - do not edit */" >./include/board.h; \
echo "#define CPU_SHIFT 0" >./include/board.h; \
echo "#include <configs/zx297520v3.h>" >>./include/config.h; \
echo "#define CFG_TLOAD 1" >./include/load_mode.h; \
echo "TEXT_BASE = 0x82000" >./board/zx297520v3/config.mk;
zx297520v3_zloader_dlon_config : unconfig
@./mkconfig $(@:_config=) arm m0 zx297520v3
######## ARCH CPU BOARD
echo "/* Automatically generated - do not edit */" >./include/config.h; \
echo "/* Automatically generated - do not edit */" >./include/board.h; \
echo "#define CPU_SHIFT 0" >./include/board.h; \
echo "#define CONFIG_DL_DISABLE 0" >>./include/board.h; \
echo "#include <configs/zx297520v3.h>" >>./include/config.h; \
echo "#define CFG_ZLOAD 1" >./include/load_mode.h;\
echo "TEXT_BASE = 0x100000" >./board/zx297520v3/config.mk;
zx297520v3_zloader_dloff_config : unconfig
@./mkconfig $(@:_config=) arm m0 zx297520v3
######## ARCH CPU BOARD
echo "/* Automatically generated - do not edit */" >./include/config.h; \
echo "/* Automatically generated - do not edit */" >./include/board.h; \
echo "#define CPU_SHIFT 0" >./include/board.h; \
echo "#define CONFIG_DL_DISABLE 1" >>./include/board.h; \
echo "#include <configs/zx297520v3.h>" >>./include/config.h; \
echo "#define CFG_ZLOAD 1" >./include/load_mode.h;\
echo "TEXT_BASE = 0x100000" >./board/zx297520v3/config.mk;
####################################################################
### clean
####################################################################
clean:
find . -type f \
\( -name 'core' -o -name '*.bak' -o -name '*~' \
-o -name '*.o' -o -name '*.a' \) -print \
| xargs rm -f
clobber: clean
find . -type f \
\( -name .depend -o -name '*.srec' -o -name '*.bin' \) \
-print \
| xargs rm -f
rm -f $(OBJS) *.bak tags TAGS
rm -fr *.*~
rm -f z-load z-load.map $(ALL)
rm -fr include/asm/proc include/asm/arch $(VERSION_FILE)
mrproper \
distclean: clobber unconfig
backup:
F=`basename $(TOPDIR)` ; cd .. ; \
gtar --force-local -zcvf `date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
#########################################################################