summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-07-08stm32/dma: Extend STM32H5 DMA use to SPI3 and SPI4.Matt Trentini
Attempting to configure SPI3 and SPI4 for the STM32H5 would fail with a linker error. This patch resolves that, ensuring that appropriate DMA channels are assigned to those SPI resources. Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2025-07-08stm32/irq: Change SPI IRQ priority to be higher than DMA IRQ.Yuuki NAGAO
On STM32H5/STM32H7, SPI flash cannot use as storage device with DMA. SPI interruption may not be genearated even if DMA transfer has been done. This is due to lower priority of SPI interruption than DMA. This commit changes SPI interrupt priority more higher than DMA's priority. Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
2025-07-08tests/extmod/select_poll_eintr.py: Skip test if target can't bind.Damien George
Eg on PYBV10 with THREAD variant, the firmware has both the `_thread` and `socket` modules but no NIC. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08tests/ports/stm32: Tweak tests to run on a wider set of boards.Damien George
There should be no change to these tests for existing PYBV1x and PYBD_SFx boards. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08tests/extmod_hardware/machine_uart_irq_rxidle.py: Test multiple writes.Damien George
This tests that the RXIDLE callback is called correctly after a second lot of bytes are received. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08tests/extmod_hardware/machine_uart_irq_rxidle.py: Ignore inital IRQ.Damien George
On stm32, the hardware generates an RXIDLE IRQ after enabling the UART, because the RX line is technically idle. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08tests/extmod_hardware: Add UART config for STM32WB boards.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08tests/extmod/machine_uart_tx.py: Support STM32WB boards.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/uart: Suppress additional RX idle IRQs on F4/L1.Damien George
These MCUs only clear the RX idle IRQ if the data register is read, which won't occur if the only IRQ is the RX idle IRQ (because then reading and discarding the DR may lead to lost data). To work around this, explicitly suppress the RX idle IRQ so that it's only passed through to the Python callback once. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/machine_adc: Fix internal ADC channel reading on WB MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/adc: Fix core temperature reading on WB55.Damien George
It needs a divisor of 100 because the calibration temperatures are 30 and 130 degrees, similar to the H5. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/adc: Simplify ADC calibration settings.Damien George
Combine the common settings for L1/L4/WB with existing G0/G4/H5 settings. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08stm32/adc: Apply re-read errata for WB55.Damien George
Following 17898f8607dc4fb881e860719cc1906d304e60f4. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/machine_pin: Retry configuring gpio with just GPIO_OUTPUT.Damien George
Some targets like frdm_k64f don't support GPIO_OUTPUT|GPIO_INPUT, so just use GPIO_OUTPUT in those cases (it seems they still support reading the current output state even when configured only as GPIO_OUTPUT, unlike other targets which require both settings). Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/machine_timer: Make machine.Timer id argument optional.Damien George
With a default of -1, for soft timer. This matches other ports, and the `extmod/machine_timer.c` implementation. This change allows the `tests/extmod/machine_soft_timer.py` test to pass. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/mpconfigport: Enable emergency exception buffer.Damien George
Needed to pass exception tests. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/mpconfigport: Enable sys.maxsize.Damien George
Costs +48 bytes. Useful to introspect the target. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/boards/rpi_pico: Add board configuration for rpi_pico.Damien George
Although the rpi_pico can already build and run with the zephyr port, this configuration improves it in a number of ways: - Use the USB CDC ACM as the REPL, rather than just a UART. - Enable I2C and SPI, and add I2C1. - Enable a filesystem, which matches exactly the rp2 port's RPI_PICO configuration. So switching between zephyr and rp2 is possible and will retain the filesystem. - Make the MicroPython GC heap make the most use of the available RAM. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/boards/nucleo_wb55rg: Enable BLE, I2C, SPI and add filesystem.Damien George
Bluetooth works well now on this board, so enable all supported features. Also increase the MicroPython GC heap size to make use of the available RAM. Unfortunately the filesystem does not match the stm32 port's NUCLEO_WB55 configuration. That's not possible to do because stm32 uses a 512 byte flash erase size, while zephyr uses 4096 bytes. But at least here in zephyr there's now a sizable and usable filesystem. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/boards/frdm_k64f: Improve board configuration.Damien George
Changes: - Enable CONFIG_PWM so that `machine.PWM()` works. - Increase MicroPython GC heap size. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/mpconfigport: Enable MICROPY_NLR_THUMB_USE_LONG_JUMP.Damien George
Needed for some ARMv6M boards, eg rpi_pico. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/mpconfigport: Enable import of mpy and a few related features.Damien George
Support for importing .mpy files is quite fundamental to MicroPython these days, eg it allows installing more efficient .mpy code via "mip install" (and installing `unittest` only works with the .mpy version because the .py version uses f-strings, which are not enabled on the zephyr port). So enable it generally for use by all boards. As part of this, also enable: - min/max: needed by `micropython/import_mpy_invalid.py`, and widely used - sys.modules: needed by `run-tests.py` to run .mpy tests with --via-mpy - io module: needed to run .mpy tests, and useful for `io.IOBase` - array slice assign: needed to run .mpy tests, and generally useful as a way to do a memory copy. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/mpconfigport: Enable machine.SoftI2C and machine.SoftSPI.Damien George
These work now that the C-level pin HAL is implemented. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/mphalport: Implement C-level pin HAL.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/machine_pin: Allow constructing a Pin with an existing Pin.Damien George
Following other ports. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/machine_pin: Add Pin.OPEN_DRAIN constant.Damien George
Adding this constant is all that's needed to support open-drain pins. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/src: Fix USB device_next driver to work with zephyr 4.0.0.Damien George
The blocklist argument is not available in zephyr 4.0.0. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/src: Increase UART input buffer to 512 bytes and reduce latency.Damien George
There are two changes here: 1. Increase the UART input bufffer to 512 bytes. That's necessary to get basic REPL reliability tests working, and helps improve `mpremote` usage, eg copying large files. 2. Remove `uart_sem` semaphore. This is no longer needed because `zephyr_getchar()` should be fully non-blocking and have as low a latency as possible. `mp_hal_stdin_rx_chr()` (which calls `zephyr_getchar`) already uses `MICROPY_EVENT_POLL_HOOK` to get an efficient wait, and doing an extra wait and check for the semaphore in `zephyr_getchar()` just introduces unnecessary latency and can lead to slower input, and potentially overflowing the UART input buffer. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr: Enable sys.stdin/out/err.Damien George
This change enables `sys.stdin`, `sys.stdout` and `sys.stderr` objects. They are useful for general IO, and also help with testing zephyr boards. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/main: Add /flash/lib or /sd/lib to sys.path on start up.Damien George
If there is a filesystem available, this change makes sure there is a "lib" in `sys.path`, eg so that "mip install" works correctly. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/main: Execute boot.py and main.py like other ports.Damien George
Changes here make the zephyr port act the same as other ports for the start up and shut down sequence: - `boot.py` is executed if it exists, and can force a soft reset - `main.py` is only executed if in friendly REPL and if `boot.py` executed successfully; and it can also force a soft reset - print "MPY: " before "soft reboot" on soft reset Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr: Update generated header path.David Schneider
Support disabled LEGACY_GENERATED_INCLUDE_PATH compatibility option. Since Zephyr 3.7 generated include files are namespaced. See also: zephyrproject-rtos/zephyr@bbe5e1e6ebf4a1a66c0 Signed-off-by: David Schneider <schneidav81@gmail.com>
2025-07-08zephyr/prj.conf: Use UART for console as default, not CONSOLE_SUBSYS.Damien George
Most boards enable the UART console because it's needed for USB (where USB CDC creates a virtual UART), and for ctrl-C to work. The `prj_minimal.conf` settings still use CONSOLE_SUBSYS. Fixes issue #17608. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/README: Update URL describing QEMU network settings.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/boards: Disable WDT on qemu boards and networking for cortex_m3.Damien George
This gets qemu_x86 and qemu_cortex_m3 building with `prj.conf` settings. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/machine_pin: Configure OUT pin also as input so it's readable.Damien George
Zephyr allows setting both GPIO_OUTPUT and GPIO_INPUT on a pin, which means it's an output pin that can have its current value read. Fixes issue #17596. Signed-off-by: Damien George <damien@micropython.org>
2025-07-08zephyr/machine_uart: Complete UART driver and make it interrupt driven.Daniel Campora
Before this commit the UART would only work in very simple use cases. Receiving large amounts of data would result in lost bytes. Plus the print function would crash due to `uart_config_get()` returning incorrect values. Additionally, receiving data with `timeout==0` would fail even if data was already available in the internal UART Rx FIFO. This commit fixes those issues. The non-implemented functions have also been made usable. Signed-off-by: Daniel Campora <danicampora@gmail.com>
2025-07-06esp32/panichandler: Support building against IDFv5.4.2.Daniël van de Giessen
The IDF panic handler resets the watchdog timeout to prevent the printing of the error message from being cut off by a WDT reset. We use the exact same function call in our wrapper function for the same purpose. In IDFv5.4.2 the function used for this was changed from `esp_panic_handler_reconfigure_wdts` to `esp_panic_handler_feed_wdts`, specifically in this commit: https://github.com/espressif/esp-idf/commit/cd887ef59a7b966a7f431754aaec6ee653849d77 Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-07-06github/workflows: Use Python 3.11 for unix coverage testing.Jeff Epler
This removes the need for an explicit `sys_settrace_features.py.exp` file. This means that people testing locally will also need to install Python 3.11 in some way, such as with pyenv or uv, and use it during `make VARIANT=coverage test`, or they will get failures. When using Python from GitHub actions/setup-python, pip3 can't be wrapped by sudo, because this invokes the operating system python instead. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06tools/ci.sh: Increase test timeout to 60s in coverage jobs.Jeff Epler
The additional overhead of the settrace profiler means that the `aes_stress.py` test was running too slowly on GitHub CI. Double the timeout to 60 seconds. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06github/workflows: Remove the unix "settrace" CI job.Jeff Epler
This becomes redundant when the main coverage build includes settrace. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06py/profile: Fix printing lineno in frame objects.Jeff Epler
The argument corresponding to a `%q` specifier must be of type `qstr`, not a narrower type like `int16_t`. Not ensuring this caused an assertion error on one Windows x64 build. The argument corresponding to a `%d` specifier must be of type `int`, not a potentially-wider type like `mp_uint_t`. Not ensuring this prevented the function name from being printed on the unix nanbox build. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06unix/coverage: Initialize more code_state fields.Jeff Epler
When `MICROPY_PY_SYS_SETTRACE` was enabled, a crash was seen in the qemu_mips build. It seems likely that this was due to these added fields not being initialized. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06py/runtime: Initialize profile fields in mp_thread_init_state.Jeff Epler
If the fields added for `MICROPY_PY_SYS_SETTRACE` are not initialized properly, their value in a thread is indeterminate. In particular, if the callback is not NULL, it will be invoked as a function. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06tests/misc: Improve test coverage of py/profile.c.Jeff Epler
Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-06unix/variants/coverage: Enable sys.settrace.Jeff Epler
The unix coverage variant should have all features enabled, so they can be tested for coverage. Therefore, enabled `MICROPY_PY_SYS_SETTRACE`. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-07-04py/emitnative: Let emitters know the compiled entity's name.Alessandro Gatti
This commit introduces an optional feature to provide to native emitters the fully qualified name of the entity they are compiling. This is achieved by altering the generic ASM API to provide a third argument to the entry function, containing the name of the entity being compiled. Currently only the debug emitter uses this feature, as it is not really useful for other emitters for the time being; in fact the macros in question just strip the name away. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-07-04tools/mpremote: Fix disconnect handling on Windows and Linux.Andrew Leech
Changes in this commit: - Handle SerialException on Windows when device disconnects. - Print clean 'device disconnected' message instead of stack trace. - Fix terminal formatting issues on Linux after disconnect. - Return disconnected state after console cleanup to avoid terminal issues. This ensures proper disconnect messages on both platforms without showing confusing error traces to users. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-07-04webassembly/objpyproxy: Avoid throwing on symbol or iterator has-check.Andrea Giammarchi
JavaScript code uses "Symbol in object" to brand check its own proxies, and such checks should also work on the Python side. Signed-off-by: Andrea Giammarchi <andrea.giammarchi@gmail.com>
2025-07-03alif/machine_spi: Improve transfer function to poll events.iabdalkader
Poll events during SPI transfer (USB fails during long transfers otherwise). And add a timeout for the blocking transfer. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>