summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2024-06-23 08:18:04 +0200
committerDamien George <damien@micropython.org>2024-12-23 10:02:20 +1100
commit6760e00817ff6cb449134418411850fc577d0f9c (patch)
treec5d618a92a6504a48c58a8c5517387bf03a0c669 /py
parent136058496f05b4b2ab5e63829b301671dc8b9a59 (diff)
downloadmicropython-6760e00817ff6cb449134418411850fc577d0f9c.tar.gz
micropython-6760e00817ff6cb449134418411850fc577d0f9c.zip
tools/mpy_ld.py: Add native modules support for RV32 code.
This commit adds support for RV32IMC native modules, as in embedding native code into a self-contained MPY module and and make its exported functions available to the MicroPython environment. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'py')
-rw-r--r--py/dynruntime.mk16
1 files changed, 16 insertions, 0 deletions
diff --git a/py/dynruntime.mk b/py/dynruntime.mk
index 62db43ad14..71679954ea 100644
--- a/py/dynruntime.mk
+++ b/py/dynruntime.mk
@@ -99,6 +99,22 @@ CROSS = xtensa-esp32-elf-
CFLAGS +=
MICROPY_FLOAT_IMPL ?= float
+else ifeq ($(ARCH),rv32imc)
+
+# rv32imc
+CROSS = riscv64-unknown-elf-
+CFLAGS += -march=rv32imac -mabi=ilp32 -mno-relax
+# If Picolibc is available then select it explicitly. Ubuntu 22.04 ships its
+# bare metal RISC-V toolchain with Picolibc rather than Newlib, and the default
+# is "nosys" so a value must be provided. To avoid having per-distro
+# workarounds, always select Picolibc if available.
+PICOLIBC_SPECS = $(shell $(CROSS)gcc --print-file-name=picolibc.specs)
+ifneq ($(PICOLIBC_SPECS),picolibc.specs)
+CFLAGS += --specs=$(PICOLIBC_SPECS)
+endif
+
+MICROPY_FLOAT_IMPL ?= none
+
else
$(error architecture '$(ARCH)' not supported)
endif