summaryrefslogtreecommitdiff
path: root/examples/api
diff options
context:
space:
mode:
Diffstat (limited to 'examples/api')
-rw-r--r--examples/api/Makefile7
-rw-r--r--examples/api/crt0.S32
2 files changed, 37 insertions, 2 deletions
diff --git a/examples/api/Makefile b/examples/api/Makefile
index ec1643e4875..722c7e45904 100644
--- a/examples/api/Makefile
+++ b/examples/api/Makefile
@@ -22,6 +22,9 @@ else
LOAD_ADDR = 0x80200000
endif
endif
+ifeq ($(ARCH),riscv)
+LOAD_ADDR = 0x84000000
+endif
# Resulting ELF and binary exectuables will be named demo and demo.bin
extra-y = demo
@@ -43,8 +46,8 @@ EXT_COBJ-y += lib/vsprintf.o
EXT_COBJ-y += lib/charset.o
EXT_COBJ-$(CONFIG_LIB_UUID) += lib/uuid.o
EXT_SOBJ-$(CONFIG_PPC) += arch/powerpc/lib/ppcstring.o
-ifeq ($(ARCH),arm)
-EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/arm/lib/memset.o
+ifneq ($(CONFIG_ARM)$(CONFIG_RISCV),)
+EXT_SOBJ-$(CONFIG_USE_ARCH_MEMSET) += arch/$(ARCH)/lib/memset.o
endif
# Create a list of object files to be compiled
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