summaryrefslogtreecommitdiff
path: root/examples/api
diff options
context:
space:
mode:
Diffstat (limited to 'examples/api')
-rw-r--r--examples/api/Makefile23
-rw-r--r--examples/api/crt0.S10
2 files changed, 9 insertions, 24 deletions
diff --git a/examples/api/Makefile b/examples/api/Makefile
index 722c7e45904..be97b8015bd 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -5,26 +5,9 @@
# Provide symbol API_BUILD to signal that the API example is being built.
KBUILD_CPPFLAGS += -DAPI_BUILD
-ifeq ($(ARCH),powerpc)
-LOAD_ADDR = 0x40000
-endif
-ifeq ($(ARCH),arm)
-ifdef CONFIG_64BIT
-LOAD_ADDR = 0x40400000
-else
-LOAD_ADDR = 0x1000000
-endif
-endif
-ifeq ($(ARCH),mips)
-ifdef CONFIG_64BIT
-LOAD_ADDR = 0xffffffff80200000
-else
-LOAD_ADDR = 0x80200000
-endif
-endif
-ifeq ($(ARCH),riscv)
-LOAD_ADDR = 0x84000000
-endif
+# 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 ))}
# Resulting ELF and binary exectuables will be named demo and demo.bin
extra-y = demo
diff --git a/examples/api/crt0.S b/examples/api/crt0.S
index d2a97557817..6899ebf8ac2 100644
--- a/examples/api/crt0.S
+++ b/examples/api/crt0.S
@@ -29,15 +29,17 @@ syscall:
.text
.globl _start
_start:
- ldr ip, =search_hint
- str sp, [ip]
+ ldr r4, =search_hint
+ mov r5, sp
+ str r5, [r4]
b main
.globl syscall
syscall:
- ldr ip, =syscall_ptr
- ldr pc, [ip]
+ ldr r4, =syscall_ptr
+ ldr r4, [r4]
+ bx r4
#elif defined(CONFIG_ARM64)