qemu: Enable loading natmods on RV64.

This commit lets the QEMU port's VIRT_RV64 board load and run native
modules, via the appropriate configuration changes in mpconfigport.h.

Now the CI test job for the QEMU/RV64 port can also run natmods and see
whether they actually work, so the CI tasks script has been updated to
bring RV64 to parity with RV32 as far as CI checks go.

Documentation was also updated, since now all supported boards in the
QEMU port should be able to run natmod tests.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2025-11-17 03:57:05 +01:00
parent e939d3ec76
commit 9af103300f
3 changed files with 10 additions and 4 deletions

View File

@@ -142,8 +142,7 @@ tests against the serial device, for example:
$ ./run-tests.py -t /dev/pts/1
Selected native modules that come as examples with the MicroPython source tree
can also be tested with this command (this is currently not supported for the
`VIRT_RV64` board):
can also be tested with this command:
$ make test_natmod

View File

@@ -39,10 +39,16 @@
#define MICROPY_EMIT_INLINE_THUMB (1)
#endif
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))
#elif defined(__riscv) && (__riscv_xlen == 32)
#elif defined(__riscv)
#if (__riscv_xlen == 32)
#define MICROPY_EMIT_RV32 (1)
#define MICROPY_EMIT_RV32_ZBA (1)
#define MICROPY_EMIT_INLINE_RV32 (1)
#elif (__riscv_xlen == 64)
#define MICROPY_PERSISTENT_CODE_LOAD_NATIVE (1)
#else
#error "Unsupported RISC-V platform!"
#endif
#endif
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)

View File

@@ -439,8 +439,9 @@ function ci_qemu_build_rv64 {
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV64 submodules
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV64 test
# Test building native .mpy with rv64imc architecture.
# Test building and running native .mpy with rv64imc architecture.
ci_native_mpy_modules_build rv64imc
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV64 test_natmod
}
########################################################################################