]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
examples: eliminate CONFIG_STANDALONE_LOAD_ADDR
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 27 Jan 2025 07:18:46 +0000 (08:18 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 4 Feb 2025 17:57:36 +0000 (11:57 -0600)
CONFIG_STANDALONE_LOAD_ADDR has been used for examples/standalone
but not for examples/api.

The suitability of an address to load an ELF binary and run it does
not only depend on the architecture but also on the memory layout of
the board which is not reflected in the default value of
CONFIG_STANDALONE_LOAD_ADDR.

Commit 32b7e39db4d3 ("Convert CONFIG_STANDALONE_LOAD_ADDR to Kconfig")
set the default on RISC-V to 0x0 though most boards used 0x80200000
before the patch.

On most boards we can assume 8 MiB of memory available above $loadaddr.
So we can safely use $loadaddr + 4 MiB as load address for the standalone
example and eliminate CONFIG_STANDALONE_LOAD_ADDR altogether.

Fixes: 32b7e39db4d3 ("Convert CONFIG_STANDALONE_LOAD_ADDR to Kconfig")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
api/Kconfig
config.mk
examples/standalone/Makefile

index b5a7399d7f3c5cb6de776d6e1c2ee53654e8b864..8cfd98ad6a62cb6118434510229e14f6555ce2ae 100644 (file)
@@ -19,24 +19,4 @@ config EXAMPLES
          U-Boot provides an API for standalone applications. Examples are
          provided in directory examples/.
 
-config STANDALONE_LOAD_ADDR
-       depends on EXAMPLES
-       hex "Address in memory to link standalone applications to"
-       default 0xffffffff80200000 if MIPS && 64BIT
-       default 0x8c000000 if SH
-       default 0x82000000 if ARC
-       default 0x80f00000 if MICROBLAZE
-       default 0x80300000 if ARCH_OMAP2PLUS || FSL_LSCH2 || FSL_LSCH3
-       default 0x80200000 if MIPS && 32BIT
-       default 0x0c100000 if ARM
-       default 0x02000000 if NIOS2
-       default 0x00040000 if PPC || X86
-       default 0x00020000 if M68K
-       default 0x0 if RISCV
-       default SYS_LOAD_ADDR
-       help
-         This option defines a board specific value for the address where
-         standalone program gets loaded, thus overwriting the architecture
-         dependent default settings.
-
 endmenu
index e294be2a4c4279e05cdc3b5d297d172a0833db7f..abed9cb65c6f210a8f4ebf851feee169af62a1e0 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -76,4 +76,3 @@ export PLATFORM_CPPFLAGS
 export RELFLAGS
 export LDFLAGS_FINAL
 export LDFLAGS_STANDALONE
-export CONFIG_STANDALONE_LOAD_ADDR
index 559170dd5c97305300db1675c3343f0f90c6ba9b..9b57f1c0c66ce21746c5b545fd9f1fa4a2c5f4ae 100644 (file)
@@ -7,6 +7,10 @@ extra-y        := hello_world
 extra-$(CONFIG_SPI_FLASH_ATMEL)    += atmel_df_pow2
 extra-$(CONFIG_PPC)                += sched
 
+# Environment variable loadaddr is set from CONFIG_SYS_LOAD_ADDR.
+# Run the examples 4 MiB above this address.
+LOAD_ADDR:=${shell printf 0x%X $$(( $(CONFIG_SYS_LOAD_ADDR) + 0x400000 ))}
+
 #
 # Some versions of make do not handle trailing white spaces properly;
 # leading to build failures. The problem was found with GNU Make 3.80.
@@ -46,7 +50,7 @@ endif
 # source file.
 ccflags-y += $(call cc-option,-fno-toplevel-reorder)
 
-LDFLAGS_STANDALONE     += -Ttext $(CONFIG_STANDALONE_LOAD_ADDR)
+LDFLAGS_STANDALONE     += -Ttext $(LOAD_ADDR)
 
 #########################################################################