[U-Boot] [PATCH V2] example/standalone: introduce STANDALONE_LOAD_ADDR

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat Mar 14 12:13:02 CET 2009


that could be overwrite in following 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>
---
V2:
fix a typo on the comment
and rename EXAMPLE_LOAD_ADRR to STANDALONE_LOAD_ADDR

Best Regards,
J.
 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..742084d 100644
--- a/arm_config.mk
+++ b/arm_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
+
+STANDALONE_LOAD_ADDR = 0xc100000
diff --git a/avr32_config.mk b/avr32_config.mk
index 441caa4..a6a49f9 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
+
+STANDALONE_LOAD_ADDR = 0x00000000
diff --git a/blackfin_config.mk b/blackfin_config.mk
index f3fcd7a..764c676 100644
--- a/blackfin_config.mk
+++ b/blackfin_config.mk
@@ -44,3 +44,5 @@ endif
 ifneq (,$(findstring s,$(MAKEFLAGS)))
 LDR_FLAGS += --quiet
 endif
+
+STANDALONE_LOAD_ADDR = 0x1000
diff --git a/board/omap2420h4/config.mk b/board/omap2420h4/config.mk
index 3edcde0..23890ce 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
+
+STANDALONE_LOAD_ADDR = 0x80300000
diff --git a/cpu/arm_cortexa8/omap3/config.mk b/cpu/arm_cortexa8/omap3/config.mk
index fbb753e..e7d2f33 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,))
+
+STANDALONE_LOAD_ADDR = 0x80300000
diff --git a/examples/Makefile b/examples/Makefile
index dbcfa92..7e7fd6c 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 $(STANDALONE_LOAD_ADDR) \
 			-o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \
 			-L$(gcclibdir) -lgcc
 
diff --git a/i386_config.mk b/i386_config.mk
index 9e6d37d..83662d6 100644
--- a/i386_config.mk
+++ b/i386_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
+
+STANDALONE_LOAD_ADDR = 0x40000
diff --git a/m68k_config.mk b/m68k_config.mk
index 12bd27c..cf652c4 100644
--- a/m68k_config.mk
+++ b/m68k_config.mk
@@ -23,3 +23,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
+
+STANDALONE_LOAD_ADDR = 0x20000
diff --git a/microblaze_config.mk b/microblaze_config.mk
index e44c79e..a81b415 100644
--- a/microblaze_config.mk
+++ b/microblaze_config.mk
@@ -25,3 +25,5 @@
 #
 
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
+
+STANDALONE_LOAD_ADDR = 0x80F00000
diff --git a/mips_config.mk b/mips_config.mk
index 05eb05d..a4c873a 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
+
+STANDALONE_LOAD_ADDR = 0x80200000
diff --git a/nios2_config.mk b/nios2_config.mk
index 3f23b56..0fe6db3 100644
--- a/nios2_config.mk
+++ b/nios2_config.mk
@@ -24,3 +24,5 @@
 
 PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
 PLATFORM_CPPFLAGS += -ffixed-r15 -G0
+
+STANDALONE_LOAD_ADDR = 0x02000000
diff --git a/nios_config.mk b/nios_config.mk
index 1cf0f32..41e5d2f 100644
--- a/nios_config.mk
+++ b/nios_config.mk
@@ -23,3 +23,5 @@
 #
 
 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs
+
+STANDALONE_LOAD_ADDR = 0x00800000
diff --git a/ppc_config.mk b/ppc_config.mk
index c95b3b1..2426f71 100644
--- a/ppc_config.mk
+++ b/ppc_config.mk
@@ -37,3 +37,5 @@ endif
 ifeq ($(CROSS_COMPILE),powerpc-openbsd-)
 PLATFORM_CPPFLAGS+= -D__PPC__
 endif
+
+STANDALONE_LOAD_ADDR = 0x40000
diff --git a/sh_config.mk b/sh_config.mk
index 49d50f7..6b84f64 100644
--- a/sh_config.mk
+++ b/sh_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SH -D__SH__
+
+STANDALONE_LOAD_ADDR = 0x8C000000
diff --git a/sparc_config.mk b/sparc_config.mk
index 87f745f..ba39595 100644
--- a/sparc_config.mk
+++ b/sparc_config.mk
@@ -22,3 +22,5 @@
 #
 
 PLATFORM_CPPFLAGS += -DCONFIG_SPARC -D__sparc__
+
+STANDALONE_LOAD_ADDR = 0x00000000
-- 
1.5.6.5



More information about the U-Boot mailing list