Commit Graph

24 Commits

Author SHA1 Message Date
Alessandro Gatti
f47e214cdc all: Rename the "NORETURN" macro to "MP_NORETURN".
Some checks failed
unix port / settrace (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
This commit renames the NORETURN macro, indicating to the compiler
that a function does not return, into MP_NORETURN to maintain the same
naming convention of other similar macros.

To maintain compaitiblity with existing code NORETURN is aliased to
MP_NORETURN, but it is also deprecated for MicroPython v2.

This changeset was created using a similar process to
decf8e6a8b ("all: Remove the "STATIC"
macro and just use "static" instead."), with no documentation or python
scripts to change to reflect the new macro name.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-05-13 10:36:47 +10:00
Damien George
89e6c58c80 extmod/modvfs: Add vfs.rom_ioctl function and its ioctl constants.
This is a generic interface to allow querying and modifying the read-only
memory area of a device, if it has such an area.

Signed-off-by: Damien George <damien@micropython.org>
2025-03-06 12:52:35 +11:00
Damien George
e3101ce1b3 qemu/boards/SABRELITE: Increase MicroPython heap to 160k.
Signed-off-by: Damien George <damien@micropython.org>
2025-02-26 16:11:09 +11:00
Alessandro Gatti
f594c6f66e tools/ci.sh: Add natmod tests for QEMU/Arm.
This commit adds the natmod tests for the MPS2_AN385 board running
inside QEMU to the CI pipeline.  Now natmod tests capabilities are equal
between the Arm and RV32 platforms for the QEMU port.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07 17:37:04 +11:00
Alessandro Gatti
ca3090a33f qemu/Makefile: Fix shell interpolation for automated natmod tests.
This commit fixes the command used to run natmod tests, as it relied on
a string interpolation feature of the POSIX shell that was not working
as expected inside a makefile.

The interpolation was not performed from inside the makefile and the raw
command string was sent to the operating system for execution.  Now the
command is run by using a different type of string substitution, which
explicitly performs the interpolation using a POSIX shell for-loop.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07 17:37:04 +11:00
Alessandro Gatti
dfd1d69a72 tests/run-natmodtests.py: Autodetect the test target architecture.
This commit lets the natmod tests runner to automatically detect the
architecture of the test target.  This allows to avoid to explicitly
pass the architecture name to the runner in test scripts.

However, the ability to manually specify a target was not removed but it
was made optional.  This way the user is able to override the
architecture name if needed (like if one wants to test an armv6 MPY on
an armv7 board).

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07 17:37:04 +11:00
Damien George
b4f53a0e51 qemu/boards: Change boards to use a subdirectory like other ports.
Some checks failed
unix port / settrace (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x64, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2019, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-2022, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, x86, windows-latest, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
This commit moves `<board>.mk` to `<board>/mpconfigboard.mk` for all qemu
boards, making it the same as other bare-metal ports.

Signed-off-by: Damien George <damien@micropython.org>
2025-01-19 12:45:37 +11:00
Alessandro Gatti
a46e842807 qemu/boards/SABRELITE.mk: Remove exception for omitted tests.
This commit re-introduces `tests/extmod/vfs_rom.py` and
`tests/float/math_domain.py` to the test suite, as the issues that made
them fail have now been addressed.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-16 12:52:56 +11:00
Alessandro Gatti
e84c9abfc2 qemu/Makefile: Increase GC heap size to 140KiB.
This commit increases the GC heap size from 120KiB to 140KiB, as it is
needed to make the full test suite pass on SABRELITE when ran through the
armv6 native emitter.

This is needed as the code output by the armv6 native emitter is limited to
4-bytes opcodes and thus takes more space than other ARM emitters.

To keep things aligned, the RV32 port also got its heap size increased even
though it is not needed on that platform right now.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-16 12:51:11 +11:00
Alessandro Gatti
3225c1bc66 qemu: Disable native emitter for the MICROBIT board.
The Micro:Bit machine definition in Qemu has soft MMU support enabled,
which is currently not compatible with the way MicroPython generates code
that needs to call back into non-emitted code.

As a stop-gap solution, the native code emitter for the MICROBIT board is
turned off.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-16 12:11:09 +11:00
Alessandro Gatti
1232a83555 qemu/mcu/arm: Dump exception cause and registers on machine error.
When a CPU exception is raised when emulating a Thumb-capable processor,
the default exception handler would simply enter in an endless loop without
providing any further information.

This commit adds a more complete exception handler that dumps to STDOUT the
exception cause and the status of the registers at the moment of the
exception.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-16 12:10:56 +11:00
Damien George
b2a4501461 qemu/Makefile: Add test_full target to run a comprehensive test suite.
The tests now include `--via-mpy` and `--via-mpy --emit native`, which will
test more cases of the native emitter under both ARM and RISC-V.

Signed-off-by: Damien George <damien@micropython.org>
2025-01-06 17:57:48 +11:00
Damien George
bb1e7de5c6 qemu/boards: Exclude Thumb2 tests and tests failing with native emitter.
The `asmbcc`, `asmbitops`, `asmconst` and `asmit` tests fail to compile
with mpy-cross on armv6 architecture (used by SABRELITE), so explicitly
exclude them.

The `math_domain` and `vfs_rom` tests fail when compiled to native machine
code, so also exclude those unconditionally.

Signed-off-by: Damien George <damien@micropython.org>
2025-01-06 17:57:29 +11:00
Alessandro Gatti
931a768f55 tests/run-tests.py: Detect inlineasm support and add tests if needed.
This commit implements a method to detect at runtime if inline assembler
support is enabled, and if so which platform it targets.

This allows clean test runs even on modified version of ARM-based ports
where inline assembler support is disabled, running inline assembler tests
on ports that have such feature not enabled by default and manually
enabled, and allows to always run the correct inlineasm tests for ports
that support more than one architecture (esp32, qemu, rp2).

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-02 11:52:28 +11:00
Alessandro Gatti
36aa7545b0 qemu/main: Make GC heap size configurable on a per-arch basis.
In certain circumstances depending on the code size, the
`deflate_decompress` test fails on both ARM and RV32 with a memory
allocation failure error.  The issue is mitigated by having a larger GC
heap, in this case around 20 KBytes more than the original 100 KBytes
default.

This commit makes the GC heap size configurable on a per-arch basis, with
both ARM and RV32 using the enlarged 120 KBytes heap.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-02 11:51:50 +11:00
Alessandro Gatti
268acb714d py/emitinlinerv32: Add inline assembler support for RV32.
This commit adds support for writing inline assembler functions when
targeting a RV32IMC processor.

Given that this takes up a bit of rodata space due to its large
instruction decoding table and its extensive error messages, it is
enabled by default only on offline targets such as mpy-cross and the
qemu port.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-02 11:49:10 +11:00
Alessandro Gatti
a5270c84cf tests/inlineasm: Make room for RV32IMC inline asm tests.
Thumb/Thumb2 tests are now into their own subdirectory, as
RV32IMC-specific tests will be added as part of the RV32 inline
assembler support.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-01 10:44:50 +01:00
Damien George
def9a37994 qemu/mpconfigport: Enable VfsRom.
Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:55 +11:00
Alessandro Gatti
7ca6e5eb68 qemu: Add test_natmod target for RV32 and use as part of CI pipeline.
This commit brings the natmod tests in the CI build process for the RV32
platform.  Not all example natmods are tested at the moment, as
`features` requires soft-float support, and `btree` needs thread-local
storage support in `mpy_ld.py` when built with the CI's toolchain.

Co-authored-by: Damien George <damien@micropython.org>
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-12-23 10:04:19 +11:00
Damien George
46a37a09fd qemu/mpconfigport: Enable VFS reader, loading .mpy files and io.IOBase.
This allows importing from the VFS, and enables the following 7 additional
tests: builtin_execfile, io_iobase, json_dump_iobase, import_mpy_invalid,
import_mpy_native, import_mpy_native_gc, vfs_userfs.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-17 23:40:52 +11:00
Damien George
d3d2976586 qemu/Makefile: Include unittest in firmware.
So that this port can run unittest-based tests.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-06 13:48:07 +11:00
Damien George
8978102f35 tests/run-tests.py: Change --target/--device options to --test-instance.
Previously to this commit, running the test suite on a bare-metal board
required specifying the target (really platform) and device, eg:

    $ ./run-tests.py --target pyboard --device /dev/ttyACM1

That's quite a lot to type, and you also need to know what the target
platform is, when a lot of the time you either don't care or it doesn't
matter.

This commit makes it easier to run the tests by replacing both of these
options with a single `--test-instance` (`-t` for short) option.  That
option specifies the executable/port/device to test.  Then the target
platform is automatically detected.

The `--test-instance` can be passed:
- "unix" (the default) to use the unix version of MicroPython
- "webassembly" to test the webassembly port
- anything else is considered a port/device to pass to Pyboard

There are also some shortcuts to specify a port/device, following
`mpremote`:
- a<n> is short for /dev/ttyACM<n>
- u<n> is short for /dev/ttyUSB<n>
- c<n> is short for COM<n>

For example:

    $ ./run-tests.py -t a1

Note that the default test instance is "unix" and so this commit does not
change the standard way to run tests on the unix port, by just doing
`./run-tests.py`.

As part of this change, the platform (and it's native architecture if it
supports importing native .mpy files) is show at the start of the test run.

Signed-off-by: Damien George <damien@micropython.org>
2024-11-04 12:47:47 +11:00
Plaque FCC
324871f380 qemu/mcu/rv32: Fix test of mcause value in lookup_cause.
Signed-off-by: Plaque FCC <plaque-fcc@github>
2024-10-22 14:52:01 +11:00
Damien George
659113825d qemu: Rename qemu-arm port to qemu.
Because this port now supports multiple architectures.

Signed-off-by: Damien George <damien@micropython.org>
2024-09-06 11:08:39 +10:00