Skip to content

Commit 9af1033

Browse files
committed
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>
1 parent e939d3e commit 9af1033

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

ports/qemu/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ tests against the serial device, for example:
142142
$ ./run-tests.py -t /dev/pts/1
143143

144144
Selected native modules that come as examples with the MicroPython source tree
145-
can also be tested with this command (this is currently not supported for the
146-
`VIRT_RV64` board):
145+
can also be tested with this command:
147146

148147
$ make test_natmod
149148

ports/qemu/mpconfigport.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@
3939
#define MICROPY_EMIT_INLINE_THUMB (1)
4040
#endif
4141
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))
42-
#elif defined(__riscv) && (__riscv_xlen == 32)
42+
#elif defined(__riscv)
43+
#if (__riscv_xlen == 32)
4344
#define MICROPY_EMIT_RV32 (1)
4445
#define MICROPY_EMIT_RV32_ZBA (1)
4546
#define MICROPY_EMIT_INLINE_RV32 (1)
47+
#elif (__riscv_xlen == 64)
48+
#define MICROPY_PERSISTENT_CODE_LOAD_NATIVE (1)
49+
#else
50+
#error "Unsupported RISC-V platform!"
51+
#endif
4652
#endif
4753

4854
#define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1)

tools/ci.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,9 @@ function ci_qemu_build_rv64 {
439439
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV64 submodules
440440
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV64 test
441441

442-
# Test building native .mpy with rv64imc architecture.
442+
# Test building and running native .mpy with rv64imc architecture.
443443
ci_native_mpy_modules_build rv64imc
444+
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV64 test_natmod
444445
}
445446

446447
########################################################################################

0 commit comments

Comments
 (0)