summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2025-01-27 08:18:46 +0100
committerTom Rini <trini@konsulko.com>2025-02-04 11:57:36 -0600
commit72bbb645b365c19def1527855248c11ec9665f28 (patch)
tree58916d9091add20ce71e5706673050a7c7240629 /examples
parent1df9cbd70f56bdbb3b8b004d51c8eea7379a28b2 (diff)
examples: eliminate CONFIG_STANDALONE_LOAD_ADDR
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>
Diffstat (limited to 'examples')
-rw-r--r--examples/standalone/Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index 559170dd5c9..9b57f1c0c66 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -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)
#########################################################################