[U-Boot] [PATCH 1/1] example: introduce EXAMPLE_LOAD_ADDR

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Mar 4 10:11:44 CET 2009


that could be overwrite in followaing order
ARCH
CPU
SOC
BOARD

via the corresponding config.mk

the value could be exported to the environment to reduce the user mistake
when they try to use example's standalone application

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 arm_config.mk                    |    2 +
 avr32_config.mk                  |    2 +
 blackfin_config.mk               |    2 +
 board/omap2420h4/config.mk       |    2 +
 cpu/arm_cortexa8/omap3/config.mk |    2 +
 examples/Makefile                |   47 +++++---------------------------------
 i386_config.mk                   |    2 +
 m68k_config.mk                   |    2 +
 microblaze_config.mk             |    2 +
 mips_config.mk                   |    2 +
 nios2_config.mk                  |    2 +
 nios_config.mk                   |    2 +
 ppc_config.mk                    |    2 +
 sh_config.mk                     |    2 +
 sparc_config.mk                  |    2 +
 15 files changed, 34 insertions(+), 41 deletions(-)

diff --git a/arm_config.mk b/arm_config.mk
index 73d9625..41d810c 100644
--- a/arm_config.mk
+++ b/arm_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
+
+EXAMPLE_LOAD_ADDR = 0xc100000
diff --git a/avr32_config.mk b/avr32_config.mk
index 441caa4..63c4789 100644
--- a/avr32_config.mk
+++ b/avr32_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_RELFLAGS	+= -ffixed-r5 -fPIC -mno-init-got -mrelax
 PLATFORM_LDFLAGS	+= --relax
+
+EXAMPLE_LOAD_ADDR = 0x00000000
diff --git a/blackfin_config.mk b/blackfin_config.mk
index f3fcd7a..2e71e86 100644
--- a/blackfin_config.mk
+++ b/blackfin_config.mk
@@ -44,3 +44,5 @@ endif
 ifneq (,$(findstring s,$(MAKEFLAGS)))
 LDR_FLAGS += --quiet
 endif
+
+EXAMPLE_LOAD_ADDR = 0x1000
diff --git a/board/omap2420h4/config.mk b/board/omap2420h4/config.mk
index 3edcde0..bbe6d5c 100644
--- a/board/omap2420h4/config.mk
+++ b/board/omap2420h4/config.mk
@@ -26,3 +26,5 @@ TEXT_BASE = 0x80e80000
 #TEXT_BASE = 0x0
 #TEXT_BASE = 0x08000000
 #TEXT_BASE = 0x04000000
+
+EXAMPLE_LOAD_ADDR = 0x80300000
diff --git a/cpu/arm_cortexa8/omap3/config.mk b/cpu/arm_cortexa8/omap3/config.mk
index fbb753e..f96ff26 100644
--- a/cpu/arm_cortexa8/omap3/config.mk
+++ b/cpu/arm_cortexa8/omap3/config.mk
@@ -34,3 +34,5 @@ PLATFORM_CPPFLAGS +=$(call cc-option)
 PLATFORM_CPPFLAGS +=$(call cc-option,-mno-thumb-interwork,)
 PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,\
 		    $(call cc-option,-malignment-traps,))
+
+EXAMPLE_LOAD_ADDR = 0x80300000
diff --git a/examples/Makefile b/examples/Makefile
index dbcfa92..348a25c 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -21,63 +21,28 @@
 # MA 02111-1307 USA
 #
 
-ifeq ($(ARCH),ppc)
-LOAD_ADDR = 0x40000
-endif
-
-ifeq ($(ARCH),i386)
-LOAD_ADDR = 0x40000
-endif
-
-ifeq ($(ARCH),arm)
-ifeq ($(BOARD),omap2420h4)
-LOAD_ADDR = 0x80300000
-else
-ifeq ($(CPU),omap3)
-LOAD_ADDR = 0x80300000
-else
-LOAD_ADDR = 0xc100000
-endif
-endif
-endif
-
 ifeq ($(ARCH),mips)
-LOAD_ADDR = 0x80200000 -T mips.lds
+EX_LDFLAGS += -T mips.lds
 endif
 
 ifeq ($(ARCH),nios)
-LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds
+EX_LDFLAGS += -L $(gcclibdir)/m32 -T nios.lds
 endif
 
 ifeq ($(ARCH),nios2)
-LOAD_ADDR = 0x02000000 -L $(gcclibdir) -T nios2.lds
+EX_LDFLAGS += -L $(gcclibdir) -T nios2.lds
 endif
 
 ifeq ($(ARCH),m68k)
-LOAD_ADDR = 0x20000  -L $(clibdir)
-endif
-
-ifeq ($(ARCH),microblaze)
-LOAD_ADDR = 0x80F00000
+EX_LDFLAGS += -L $(clibdir)
 endif
 
-ifeq ($(ARCH),blackfin)
-LOAD_ADDR = 0x1000
-endif
-
-ifeq ($(ARCH),avr32)
-LOAD_ADDR = 0x00000000
-endif
-
-ifeq ($(ARCH),sh)
-LOAD_ADDR = 0x8C000000
 ifeq ($(CPU),sh2)
 BIG_ENDIAN=y
 endif
-endif
 
 ifeq ($(ARCH),sparc)
-LOAD_ADDR = 0x00000000 -L $(gcclibdir) -T sparc.lds
+EX_LDFLAGS += -L $(gcclibdir) -T sparc.lds
 endif
 
 include $(TOPDIR)/config.mk
@@ -176,7 +141,7 @@ $(LIB):	$(obj).depend $(LIBOBJS)
 
 $(ELF):
 $(obj)%:	$(obj)%.o $(LIB)
-		$(LD) -g $(EX_LDFLAGS) -Ttext $(LOAD_ADDR) \
+		$(LD) -g $(EX_LDFLAGS) -Ttext $(EXAMPLE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
diff --git a/i386_config.mk b/i386_config.mk
index 9e6d37d..07c5a9a 100644
--- a/i386_config.mk
+++ b/i386_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
+
+EXAMPLE_LOAD_ADDR = 0x40000
diff --git a/m68k_config.mk b/m68k_config.mk
index 12bd27c..5a38044 100644
--- a/m68k_config.mk
+++ b/m68k_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
+
+EXAMPLE_LOAD_ADDR = 0x20000
diff --git a/microblaze_config.mk b/microblaze_config.mk
index e44c79e..6cc45d5 100644
--- a/microblaze_config.mk
+++ b/microblaze_config.mk
@@ -25,3 +25,5 @@
 #
 
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
+
+EXAMPLE_LOAD_ADDR = 0x80F00000
diff --git a/mips_config.mk b/mips_config.mk
index 05eb05d..8a51939 100644
--- a/mips_config.mk
+++ b/mips_config.mk
@@ -46,3 +46,5 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 PLATFORM_CPPFLAGS		+= -G 0 -mabicalls -fpic
 PLATFORM_CPPFLAGS		+= -msoft-float
 PLATFORM_LDFLAGS		+= -G 0 -static -n -nostdlib
+
+EXAMPLE_LOAD_ADDR = 0x80200000
diff --git a/nios2_config.mk b/nios2_config.mk
index 3f23b56..7d444e3 100644
--- a/nios2_config.mk
+++ b/nios2_config.mk
@@ -24,3 +24,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -ffixed-r15 -G0
+
+EXAMPLE_LOAD_ADDR = 0x02000000
diff --git a/nios_config.mk b/nios_config.mk
index 1cf0f32..1a4323b 100644
--- a/nios_config.mk
+++ b/nios_config.mk
@@ -23,3 +23,5 @@
 #
 
 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs
+
+EXAMPLE_LOAD_ADDR = 0x00800000
diff --git a/ppc_config.mk b/ppc_config.mk
index c95b3b1..f25ceb4 100644
--- a/ppc_config.mk
+++ b/ppc_config.mk
@@ -37,3 +37,5 @@ endif
 ifeq ($(CROSS_COMPILE),powerpc-openbsd-)
 PLATFORM_CPPFLAGS+= -D__PPC__
 endif
+
+EXAMPLE_LOAD_ADDR = 0x40000
diff --git a/sh_config.mk b/sh_config.mk
index 49d50f7..8838e24 100644
--- a/sh_config.mk
+++ b/sh_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
+
+EXAMPLE_LOAD_ADDR = 0x8C000000
diff --git a/sparc_config.mk b/sparc_config.mk
index 87f745f..0526b79 100644
--- a/sparc_config.mk
+++ b/sparc_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
+
+EXAMPLE_LOAD_ADDR = 0x00000000
-- 
1.5.6.5



More information about the U-Boot mailing list