summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/qemu/Makefile6
-rw-r--r--ports/qemu/README.md18
-rw-r--r--ports/qemu/boards/VIRT_RV32.mk2
-rwxr-xr-xtools/ci.sh13
4 files changed, 34 insertions, 5 deletions
diff --git a/ports/qemu/Makefile b/ports/qemu/Makefile
index 237e1e951..b85ff2896 100644
--- a/ports/qemu/Makefile
+++ b/ports/qemu/Makefile
@@ -168,6 +168,12 @@ test: $(BUILD)/firmware.elf
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && ./run-tests.py -t execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_TESTS_ARGS) $(RUN_TESTS_EXTRA)
+.PHONY: test_natmod
+test_natmod: $(BUILD)/firmware.elf
+ $(eval DIRNAME=ports/$(notdir $(CURDIR)))
+ # "btree" cannot build against Picolibc right now.
+ cd $(TOP)/tests && ./run-natmodtests.py -p -d execpty:"$(QEMU_SYSTEM) $(QEMU_ARGS) -serial pty -kernel ../$(DIRNAME)/$<" $(RUN_NATMODTESTS_ARGS) extmod/{deflate,framebuf,heapq,random_basic,re}*.py
+
$(BUILD)/firmware.elf: $(LDSCRIPT) $(OBJ)
$(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
$(Q)$(SIZE) $@
diff --git a/ports/qemu/README.md b/ports/qemu/README.md
index 984faf870..9274bcc4e 100644
--- a/ports/qemu/README.md
+++ b/ports/qemu/README.md
@@ -71,8 +71,9 @@ To access the REPL directly use:
$ make repl
-This will start `qemu-system-arm` with the UART redirected to stdio. It's also
-possible to redirect the UART to a pty device using:
+This will start `qemu-system-arm` (or `qemu-system-riscv32`) with the UART
+redirected to stdio. It's also possible to redirect the UART to a pty device
+using:
$ make run
@@ -84,7 +85,7 @@ for example `mpremote`:
You can disconnect and reconnect to the serial device multiple times. Once you
are finished, stop the `make run` command by pressing Ctrl-C where that command
-was started (or execute `machine.reset()` at the REPL).
+was started (or execute `import machine; machine.reset()` at the REPL).
The test suite can be run against the firmware by using the UART redirection.
You can either do this automatically using the single command:
@@ -97,6 +98,17 @@ tests against the serial device, for example:
$ cd ../../tests
$ ./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 supported only for the
+`VIRT_RV32` board):
+
+ $ make test_natmod
+
+The same remarks about manually running the tests apply for native modules, but
+`run-natmodtests.py` should be run instead of `run-tests.py`. In this case you
+also have to explicitly pass the architecture you are running native modules to
+`run-natmodtests.py` ("--arch rv32imc" for the `VIRT_RV32` board).
+
Extra make options
------------------
diff --git a/ports/qemu/boards/VIRT_RV32.mk b/ports/qemu/boards/VIRT_RV32.mk
index a61b659fa..355a09c3d 100644
--- a/ports/qemu/boards/VIRT_RV32.mk
+++ b/ports/qemu/boards/VIRT_RV32.mk
@@ -12,3 +12,5 @@ MPY_CROSS_FLAGS += -march=rv32imc
# These Thumb tests don't run on RV32, so exclude them.
RUN_TESTS_ARGS = --exclude 'inlineasm|qemu/asm_test'
+
+RUN_NATMODTESTS_ARGS = --arch rv32imc
diff --git a/tools/ci.sh b/tools/ci.sh
index c67aeed0c..8d75d7cec 100755
--- a/tools/ci.sh
+++ b/tools/ci.sh
@@ -273,6 +273,7 @@ function ci_qemu_setup_arm {
}
function ci_qemu_setup_rv32 {
+ ci_mpy_format_setup
ci_gcc_riscv_setup
sudo apt-get update
sudo apt-get install qemu-system
@@ -292,6 +293,10 @@ function ci_qemu_build_rv32 {
make ${MAKEOPTS} -C mpy-cross
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV32 submodules
make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV32 test
+
+ # Test building and running native .mpy with rv32imc architecture.
+ ci_native_mpy_modules_build rv32imc
+ make ${MAKEOPTS} -C ports/qemu BOARD=VIRT_RV32 test_natmod
}
########################################################################################
@@ -476,10 +481,14 @@ function ci_native_mpy_modules_build {
arch=$1
fi
make -C examples/natmod/features1 ARCH=$arch
- make -C examples/natmod/features2 ARCH=$arch
+ if [ $arch != rv32imc ]; then
+ # This requires soft-float support on rv32imc.
+ make -C examples/natmod/features2 ARCH=$arch
+ # This requires thread local storage support on rv32imc.
+ make -C examples/natmod/btree ARCH=$arch
+ fi
make -C examples/natmod/features3 ARCH=$arch
make -C examples/natmod/features4 ARCH=$arch
- make -C examples/natmod/btree ARCH=$arch
make -C examples/natmod/deflate ARCH=$arch
make -C examples/natmod/framebuf ARCH=$arch
make -C examples/natmod/heapq ARCH=$arch