Commit Graph

16558 Commits

Author SHA1 Message Date
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
3044233ea3 py/misc: Add a popcount(uint32_t) implementation.
This makes the existing popcount(uint32_t) implementation found in the
RV32 emitter available to the rest of the codebase.  This version of
popcount will use intrinsic or builtin implementations if they are
available, falling back to a generic implementation if that is not the
case.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-01 10:44:53 +01: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
c73204128e tests/extmod: Add VfsRom test.
Some checks failed
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
unix port / macos (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
Provides full coverage of the VfsRom driver.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:55 +11:00
Damien George
def9a37994 qemu/mpconfigport: Enable VfsRom.
Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:55 +11:00
Damien George
d9378c9287 unix: Enable VfsRom on standard and coverage variants.
Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:55 +11:00
Damien George
97518064cd py/persistentcode: Add support for loading .mpy files from a ROM reader.
This adds an optimisation for loading .mpy files from a reader that points
to ROM.  In such a case qstr, str and bytes data, along with bytecode, are
all referenced in-place in ROM.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:55 +11:00
Damien George
5e9dd4b6a2 extmod/vfs_reader: Add support for opening a memory-mappable file.
If the file can be memory mapped (because it responds to the buffer
protocol) then return a memory-reader that directly references the ROM data
of the file.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:54 +11:00
Damien George
f870e8d2d4 py/reader: Provide mp_reader_try_read_rom() function.
This allows accessing data directly in ROM if the reader supports it.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:54 +11:00
Damien George
a1c32101ac py/qstr: Add qstr_from_strn_static() helper function.
Allows an interned string to reference static/ROM data, instead of
allocating it on the GC heap.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:54 +11:00
Damien George
50637ff239 extmod/vfs_rom: Add VfsRom filesystem object.
This commit defines a new ROMFS filesystem for storing read-only files that
can be memory mapped, and a new VfsRom driver.  Files opened from this
filesystem support the buffer protocol.  This allows naturally getting the
memory-mapped address of the file using:
- memoryview(file)
- uctypes.addressof(file)

Furthermore, if these files are .mpy files then their content can be
referenced in-place when importing.  Such imports take up a lot less RAM
than importing from a normal filesystem.  This is essentially dynamically
frozen .mpy files, building on the revamped v6 .mpy file format.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-23 13:04:54 +11:00
Alessandro Gatti
4729a89504 tools/verifygitlog.py: Show invalid commit subjects in quotes.
If a commit subject line has any trailing whitespace it won't match the
repository validation rules, and the line will show up as part of the
relevant error message.  However, since there's no quotation marks
around the offending text, the trailing whitespace may go unnoticed, and
given that the commit message is then discarded when the commit
operation is retried this can get fairly annoying.

This commit simply modifies the error output for invalid subject lines
to add quotation marks around the offending text, so trailing whitespace
is much easier to see.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-12-23 12:55:20 +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
Alessandro Gatti
4bf087b272 py/dynruntime.mk: Delete compiled module file on clean.
This commit adds the compiled native module file to the list of files to
remove when `make clean` is issued in a native module source directory.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-12-23 10:03:02 +11:00
Alessandro Gatti
1857e62fdc examples/natmod/re: Fix build on RV32 with alloca.
This fixes compilation of the `re` natmod example when built with Picolibc
in the CI environment.  Ubuntu 22.04's combination of its bare metal RISC-V
toolchain and its version of Picolibc makes the `alloca` symbol more
elusive than it should be.

This commit makes the `re` natmod try harder to get an `alloca`
implementation.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-12-23 10:02:42 +11:00
Alessandro Gatti
6760e00817 tools/mpy_ld.py: Add native modules support for RV32 code.
This commit adds support for RV32IMC native modules, as in embedding native
code into a self-contained MPY module and and make its exported functions
available to the MicroPython environment.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2024-12-23 10:02:20 +11:00
robert-hh
136058496f esp32/machine_timer: Restrict timer numbers for ESP32C6 to 0 and 1.
Some checks failed
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
unix port / macos (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
The ESP32C6 has only one timer in each of the two groups.  Also add a check
for valid timer numbers.

Addresses issue #16438.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-12-21 00:37:49 +11:00
Damien George
8b6bd43eab extmod/vfs: Guard mutating fs functions with MICROPY_VFS_WRITABLE.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
Enabled by default.  Useful for ports that need the VFS but don't have any
writable filesystems.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-20 21:58:50 +11:00
Damien George
a3128f89cc tests: Fix all file ioctl's to support only MP_STREAM_CLOSE.
A return value of 0 from Python-level `ioctl()` means success, but if
that's returned unconditionally it means that the method supports all
ioctl calls, which is not true.  Returning 0 without doing anything can
potentially lead to a crash, eg for MP_STREAM_SEEK which requires returning
a value in the passed-in struct pointer.

This commit makes it so that all `ioctl()` methods respond only to
MP_STREAM_CLOSE, ie they return -1 (indicating error) for all other ioctl
calls.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-20 21:52:19 +11:00
Angus Gratton
4e76acc88d doc: Note that machine.USBDevice is now available on esp32 port.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
Support was added in commit 5f2d05d, this updates the docs to match.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-12-20 14:02:17 +11:00
Dryw Wade
39538e4c9a rp2/boards/SPARKFUN_PROMICRO: Fix SparkFun Pro Micro RP2040 image.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
2024-12-19 17:13:40 +11:00
Peter Harper
a70a90ccfc rp2/boards/RPI_PICO2_W: Add RISCV variant for Pico 2 W.
Build with:

    make BOARD=RPI_PICO2_W BOARD_VARIANT=RISCV

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:54:39 +11:00
Peter Harper
1b611dab03 rp2/boards/RPI_PICO2_W: Add new Pico 2 W board definition.
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:54:39 +11:00
Peter Harper
4a6c246008 rp2/mphalport: Add mp_hal_is_pin_reserved() function.
As cyw43 pins might be dynamic, add a function that returns if a pin is
reserved.  This is used by `MICROPY_HW_PIN_RESERVED` to prevent the pin IRQ
from being reset across a soft-reset.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:54:39 +11:00
Peter Harper
30163e0ae4 rp2/cyw43_configport: Define cyw43 pins.
The cyw43 pins used to be hardcoded and `CYW43_PIN_WL_HOST_WAKE` and
`CYW43_PIN_WL_REG_ON` were in the `pico_w.h` board header.

This has been changed so the board header just defines the "default
version of the pins, e.g. `CYW43_DEFAULT_PIN_WL_HOST_WAKE`,
`CYW43_DEFAULT_PIN_WL_REG_ON` etc.

Set the pin values in `cyw43_configport.`h so `cyw43-driver` sees them and
allow them to be changed at runtime (dynamic) if required.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:54:39 +11:00
Phil Howard
929d7a7526 rp2/CMakeLists.txt: Add components required by bootrom.h.
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:54:36 +11:00
Peter Harper
a93762a762 rp2/modmachine: Fix USB sleep on RP2350 MCUs.
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:54:30 +11:00
Peter Harper
32b98d3e66 lib/pico-sdk: Update to version 2.1.0.
Brings in support for Pico 2 W, among other things.

Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2024-12-19 16:51:21 +11:00
robert-hh
f4e4599523 ports: Fix machine.RTC.init() method so argument order matches the docs.
This commit makes the argument ordering of `machine.RTC.init()` the same
for all the ports that implement arguments to this method: cc3200, esp32,
mimxrt and samd.  The cc3200 argument ordering is used, which matches the
documentation.

Also document the availability and the differing semantics for the stm32
and renesas-ra port.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-12-19 16:04:47 +11:00
robert-hh
0302cd65e8 mimxrt/machine_rtc: Drop machine.RTC.now() method.
This is not part of the common machine API.  It's dropped on the mimxrt
port and kept only on the cc3200 port for legacy.

Also show the port availability of `RTC.now()` in the documentation.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-12-19 16:00:41 +11:00
robert-hh
b5de529ffc docs: Fix the quickref documentation of rtc.datetime().
Such that it matches the implementation and the documentation of the
`machine.RTC` class.

Signed-off-by: robert-hh <robert@hammelrath.com>
2024-12-19 16:00:15 +11:00
Damien George
e323da7291 tests/run-tests.py: Set name of injected test module to '__main__'.
Running unittest-based tests with --via-mpy is currently broken, because
the unittest test needs the module to be named `__main__`, whereas it's
actually called `__injected_test`.

Fix this by changing the name when the file is opened.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-19 15:12:04 +11:00
Damien George
3c1722e705 stm32: Fix extraction of hse/hsi/pllm values from preprocessed source.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
The expressions for the `micropy_hw_hse_value` etc variables may contain
parenthesis, eg `micropy_hw_hse_value = ((25) * 1000000)`.  To handle such
a case, simplify the regex and always use `eval(found)` to evaluate the
expression.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-19 00:55:31 +11:00
Andrew Leech
7924b31050 stm32: Generate PLL tables from pre-processed headers.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
Allows boards to configure their HSE and PLL values in variants.

Signed-off-by: Andrew Leech <andrew@alelec.net>
2024-12-18 16:55:53 +11:00
Andrew Leech
22804fccf3 stm32/boards/WEACT_F411_BLACKPILL: Add WeAct F411 'blackpill' boards.
Adds board profile for the WeAct F411 'blackpill' which is a quite popular
low cost ST dev board.  This board also has optional spiflash so can be
purchased in a few different configurations.

Builds for v3.1 with no SPI Flash by default.  Includes variants for
different board versions and spi flash sizes.

Signed-off-by: Andrew Leech <andrew@alelec.net>
2024-12-18 16:55:53 +11:00
Angus Gratton
a9945fc528 ci: Add caching of ccache for Zephyr.
Similar to the ESP32 builds, but needs additional step to pass the
ccache directory through to the Zephyr container.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-12-18 15:11:01 +11:00
Angus Gratton
db4b095644 ci: Pull the Zephyr CI docker image from GitHub container reg.
This image is 15GB so in theory this may be faster, although
in testing the improvement is either non-existent or marginal.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-12-18 15:11:01 +11:00
Angus Gratton
92a5ea51b4 ci: Cache Zephyr workspace installation.
Can save several minutes downloading the Zephyr docker image and/or cloning
repo from GitHub. Cache keyed on the Zephyr version, which AFAIK is the
only determinant for the workspace contents.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-12-18 15:11:01 +11:00
Damien George
d10cda66dc tests/extmod: Add test for uctypes.addressof function.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
Signed-off-by: Damien George <damien@micropython.org>
2024-12-18 11:01:23 +11:00
Damien George
8970ede7cc extmod/moductypes: Fix large return values of addressof and INT_MAYBE.
So they don't return a negative number for an address (prior to this fix
they would return negative addresses for values that were larger than the
maximum small-int value).

Signed-off-by: Damien George <damien@micropython.org>
2024-12-18 11:00:08 +11:00
Damien George
23bfa95d34 stm32/extint: Fix EXTI IRQ handlers for H5 MCUs.
Some checks failed
mimxrt port / build (push) Failing after 0s
nrf port / build (push) Failing after 0s
powerpc port / build (push) Failing after 0s
qemu port / build_and_test_arm (push) Failing after 0s
qemu port / build_and_test_rv32 (push) Failing after 0s
renesas-ra port / build_renesas_ra_board (push) Failing after 0s
rp2 port / build (push) Failing after 0s
samd port / build (push) Failing after 0s
stm32 port / build_stm32 (stm32_misc_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_nucleo_build) (push) Failing after 0s
stm32 port / build_stm32 (stm32_pyb_build) (push) Failing after 0s
unix port / minimal (push) Failing after 0s
unix port / reproducible (push) Failing after 0s
unix port / standard (push) Failing after 0s
unix port / standard_v2 (push) Failing after 0s
unix port / coverage (push) Failing after 0s
unix port / coverage_32bit (push) Failing after 0s
unix port / nanbox (push) Failing after 0s
unix port / float (push) Failing after 0s
unix port / stackless_clang (push) Failing after 0s
unix port / float_clang (push) Failing after 0s
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
The existing EXTI IRQ handlers are moved from `stm32_it.c` to `extint.c` to
keep them with related code.  A macro is defined to make it easier to
define the handler function that handles one line, and correct handlers
added for STM32H5xx MCUs.

Also, to prevent errors in the future, `MP_STATIC_ASSERT(<irqn> > 0)` is
added to each handler function to check that the correct `IRQn` constant is
used, which corresponds to the handler function name.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-18 00:22:21 +11:00
Damien George
a2efafcce3 stm32/pin: Exclude Pin.cpu/Pin.board if they contain no entries.
Signed-off-by: Damien George <damien@micropython.org>
2024-12-17 23:53:26 +11:00
Damien George
3203e950fc tools/boardgen.py: Provide macro defns for number of cpu/board pins.
So a port can use them if needed to exclude the Pin.cpu/Pin.board objects.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-17 23:53:24 +11:00
Damien George
1c2cdf9f6d stm32/pin: Add config option to exclude Pin alternate function.
Signed-off-by: Damien George <damien@micropython.org>
2024-12-17 23:53:03 +11:00
Damien George
bd6edf00bb stm32/pin: Add option to exclude legacy Pin methods and constants.
This is enabled by default, but disabled when MICROPY_PREVIEW_VERSION_2 is
enabled.  The intention is that these methods and constants are deprecated
in MicroPython 2.x.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-17 23:53:03 +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
ee8d8b3448 tools/ci.sh: Re-enable vfs_posix tests on unix qemu MIPS CI.
Some checks failed
unix port / settrace (push) Failing after 0s
unix port / settrace_stackless (push) Failing after 0s
unix port / qemu_mips (push) Failing after 0s
unix port / qemu_arm (push) Failing after 0s
unix port / qemu_riscv64 (push) Failing after 0s
webassembly port / build (push) Failing after 0s
windows port / cross-build-on-linux (push) Failing after 0s
zephyr port / build (push) Failing after 0s
Python code lint and formatting with ruff / ruff (push) Failing after 0s
unix port / macos (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
These work now that _FILE_OFFSET_BITS=64.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-16 11:58:43 +11:00
Damien George
8e4c809694 unix,windows: Force _FILE_OFFSET_BITS=64 to fix 32-bit file ABI.
On 64-bit systems this should have no effect.

On 32-bit systems it will force 64-bit file sizes and fixes directory
listing on certain 32-bit ports.  This option should work on pretty much
all 32-bit systems these days.

Signed-off-by: Damien George <damien@micropython.org>
2024-12-16 11:56:03 +11:00
Sebastian Romero
5f2d05d417 esp32: Enable machine.USBDevice to configure USB at runtime.
This adds support for `machine.USBDevice` to S2 and S3 boards.

Signed-off-by: Sebastian Romero <s.romero@arduino.cc>
2024-12-16 11:41:40 +11:00
Damien George
bdda91fe74 tests/extmod_hardware: Add a test for machine.PWM freq and duty.
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 adds a hardware test for `machine.PWM`.  It requires a jumper wire
between two pins, uses `machine.PWM` to output on one of them, and
`machine.time_pulse_us()` to time the PWM on the other pin (some boards
test more than one pair of pins).

It times both the high and low duty cycle (and hence the frequency) for a
range of PWM frequencies and duty cycles (including full on and full off).

Currently supported on:
- esp32 (needs a minor hack for initialisation, and some tests still fail)
- esp8266 (passes for frequencies 1kHz and less)
- mimxrt / Teensy 4.0 (passes)
- rp2 (passes)
- samd21 (passes for frequencies 2kHz and less)

Signed-off-by: Damien George <damien@micropython.org>
2024-12-11 12:22:15 +11:00