Skip to content

Commit 5d9597f

Browse files
author
Huang Qi
authored
platform/nuttx: Support riscv based chips (#648)
Signed-off-by: Huang Qi <[email protected]>
1 parent a5ffd65 commit 5d9597f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

core/shared/platform/nuttx/platform_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef _PLATFORM_INTERNAL_H
77
#define _PLATFORM_INTERNAL_H
88

9+
#include <assert.h>
910
#include <ctype.h>
1011
#include <errno.h>
1112
#include <inttypes.h>

product-mini/platforms/nuttx/wamr.mk

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ else ifeq ($(CONFIG_ARCH_X86_64),y)
1717
WAMR_BUILD_TARGET := X86_64
1818
else ifeq ($(CONFIG_ARCH_XTENSA),y)
1919
WAMR_BUILD_TARGET := XTENSA
20+
else ifeq ($(CONFIG_ARCH_RV64GC),y)
21+
WAMR_BUILD_TARGET := RISCV64
22+
else ifeq ($(CONFIG_ARCH_RV32IM),y)
23+
WAMR_BUILD_TARGET := RISCV32
2024
else ifeq ($(CONFIG_ARCH_SIM),y)
2125
ifeq ($(CONFIG_SIM_M32),y)
2226
WAMR_BUILD_TARGET := X86_32
@@ -62,8 +66,36 @@ else ifeq (${WAMR_BUILD_TARGET}, XTENSA)
6266
CFLAGS += -DBUILD_TARGET_XTENSA
6367
INVOKE_NATIVE := invokeNative_xtensa.s
6468
AOT_RELOC := aot_reloc_xtensa.c
69+
else ifeq (${WAMR_BUILD_TARGET}, RISCV64)
70+
71+
ifeq (${CONFIG_ARCH_FPU},y)
72+
$(error riscv64 lp64f is unsupported)
73+
else ifeq (${CONFIG_ARCH_DPFPU}, y)
74+
CFLAGS += -DBUILD_TARGET_RISCV64_LP64D
75+
INVOKE_NATIVE += invokeNative_riscv64_lp64d.s
76+
else
77+
CFLAGS += -DBUILD_TARGET_RISCV64_LP64
78+
INVOKE_NATIVE += invokeNative_riscv64_lp64.s
79+
endif
80+
81+
AOT_RELOC :=
82+
83+
else ifeq (${WAMR_BUILD_TARGET}, RISCV32)
84+
85+
ifeq (${CONFIG_ARCH_FPU}, y)
86+
$(error riscv32 ilp32f is unsupported)
87+
else ifeq (${CONFIG_ARCH_DPFPU}, y)
88+
CFLAGS += -DBUILD_TARGET_RISCV64_ILP32D
89+
INVOKE_NATIVE += invokeNative_riscv32_ilp32d.s
90+
else
91+
CFLAGS += -DBUILD_TARGET_RISCV64_ILP32
92+
INVOKE_NATIVE += invokeNative_riscv32_ilp32.s
93+
endif
94+
95+
AOT_RELOC :=
96+
6597
else
66-
$(error Build target don't support)
98+
$(error Build target is unsupported)
6799
endif
68100

69101
ifeq (${CONFIG_INTERPRETERS_WAMR_LOG},y)

0 commit comments

Comments
 (0)