summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2024-11-23 09:47:52 +0100
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2025-01-05 02:30:47 +0100
commit9eb59201ab60b7ca3af41cd3000f8ff823ae5f02 (patch)
tree4b7532a7311ad6cbdf92eb6c11d3cd1c4210fa56
parent6f7f47e8c09aac1a81a1cf5cf2d2c9fadcb9e662 (diff)
examples: implement _start and syscall for RISC-V
To build the API examples on RISC-V we need to implement _start and syscall for RISC-V. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r--examples/api/crt0.S32
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/api/crt0.S b/examples/api/crt0.S
index f1b88ed8a3d..d2a97557817 100644
--- a/examples/api/crt0.S
+++ b/examples/api/crt0.S
@@ -80,6 +80,38 @@ syscall:
return_addr:
.align 8
.long 0
+#elif defined(CONFIG_ARCH_RV32I)
+
+ .text
+ .globl _start
+_start:
+ la t0, search_hint
+ sw sp, 0(t0)
+ la t0, main
+ jalr x0, t0
+
+ .globl syscall
+syscall:
+ la t0, syscall_ptr
+ lw t0, 0(t0)
+ jalr x0, t0
+
+#elif defined(CONFIG_ARCH_RV64I)
+
+ .text
+ .globl _start
+_start:
+ la t0, search_hint
+ sd sp, 0(t0)
+ la t0, main
+ jalr x0, t0
+
+ .globl syscall
+syscall:
+ la t0, syscall_ptr
+ ld t0, 0(t0)
+ jalr x0, t0
+
#else
#error No support for this arch!
#endif