This commit fixes building the "btree" example natmod on RV32 when
Picolibc is being used and uses thread-local storage for storing the
errno variable.
The fix is surprisingly simple: Picolibc allows overriding the function
that will provide a pointer to the "errno" variable, and the btree
natmod integration code already has all of this machinery set up as part
of its library integration. Redirecting Picolibc to the already
existing pointer provider function via a compile-time definition is
enough to let the module compile and pass QEMU tests.
This workaround will work on any Picolibc versions (Arm, RV32, Xtensa,
etc.) even if TLS support was not enabled to begin with, and will
effectively do nothing if the toolchain used will rely on Newlib to
provide standard C library functions.
Given that the btree module now builds and passes the relevant natmod
tests, said module is now part of the QEMU port's natmod testing
procedure, and CI now will build the btree module for RV32 as part to
its checks.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>