summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-05-13all: Rename the "NORETURN" macro to "MP_NORETURN".Alessandro Gatti
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 decf8e6a8bb940d5829ca3296790631fcece7b21 ("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-12rp2/modmachine: Add mutual exclusion for machine.lightsleep().Angus Gratton
There's no specified behaviour for what should happen if both CPUs call `lightsleep()` together, but the latest changes could cause a permanent hang due to a race in the timer cleanup code. Add a flag to prevent hangs if two threads accidentally lightsleep, at least. This allows the new lightsleep test to pass on RPI_PICO and RPI_PICO2, and even have much tighter time deltas. However, the test still fails on wireless boards where the lwIP tick wakes them up too frequently. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-12tests/ports/rp2: Add a test case for light sleeping from CPU1.Angus Gratton
Not currently passing. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-12tests/ports/rp2: Update machine idle test to revert skip for RP2350.Peter Harper
This reverts commit b42bb911c663dc90575d6a7fe3ea4760b6559372. Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2025-05-12rp2/modmachine: Add debug code for mp_machine_lightsleep.Peter Harper
Add some debug code that can be enabled to determine why lightsleep is returning early. Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2025-05-12rp2: Use pico-sdk alarm pool instead of soft timer for sleep.Peter Harper
Stop using soft timer for `mp_wfe_or_timeout`. Now uses the alarm pool again as issues with this code have been fixed. This resolves the "sev" issue that stops the RP2350 going idle. Also, change the lightsleep code to use the hardware timer library and alarm 1, as alarm 2 is used by and soft timers and alarm 3 is used by the alarm pool. Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
2025-05-12tests/multi_net: Add test that requires queuing UDP packets.Damien George
This commit adds a new network multi-test which sends a burst of UDP packets from the client, and the server doesn't recv them until they have all been sent. Signed-off-by: Damien George <damien@micropython.org>
2025-05-12extmod/modlwip: Implement a queue of incoming UDP/raw packets.Damien George
The bare-metal lwIP socket interface is currently quite limited when used for UDP streams, because it only allows one outstanding incoming UDP packet. If one UDP packet is waiting to be socket.recv'd and another one comes along, then the second one is simply dropped. This commit implements a queue for incoming UDP and raw packets. The queue depth is fixed at compile time, and is currently 4. This allows better use of UDP connections, eg more efficient. It also makes DTLS work better which sometimes has a queue of UDP packets (eg during the connection phase). Signed-off-by: Damien George <damien@micropython.org>
2025-05-12tools/verifygitlog.py: Apply stricter rules on git subject line.Damien George
There is a bit of ambiguity as to how the prefix of the git subject line should look like. Eg `py/vm: ...` vs `py/vm.c: ...` (whether the extension should be there or not). This commit makes the existing CI check of the git commit message stricter, by applying extra rules to the prefix, the bit before the : in the subject line. It now checks that the subject prefix: - doesn't start with unwanted bits: ., /, ports/ - doesn't have an extension: .c, .h, .cpp, .js, .rst or .md Full error messages are given when a rule does not pass. This helps to reduce maintainer burden by applying stricter rules, to keep the git commit history consistent. Signed-off-by: Damien George <damien@micropython.org>
2025-05-12tests/extmod/vfs_rom.py: Clear sys.path before running test.Damien George
Otherwise if the target has certain files/directories (such as "test") in its filesystem then these interfere with the unit tests. Signed-off-by: Damien George <damien@micropython.org>
2025-05-12tests/net_inet: Update micropython.org certificate for SSL tests.Damien George
The Let's Encrypt root certificate has changed so needs updating in these tests. Also use `bytes.fromhex()` instead of `binascii.unhexlify()`, to eliminate the need for the `binascii` module. Both of these features are controlled by `MICROPY_PY_BUILTINS_BYTES_HEX`, so the test will still work on the same targets that it previously did. Signed-off-by: Damien George <damien@micropython.org>
2025-05-09lib/littlefs: Fix string initializer in lfs1.c.Angus Gratton
Avoids the new Wunterminated-string-literal when compiled with gcc 15.1. It would be preferable to just disable this warning, but Clang -Wunknown-warning-option kicks in even when disabling warnings so this becomes fiddly to apply. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-09py/emitinlinethumb: Refactor string literal as array initializer.Angus Gratton
Avoids the new Wunterminated-string-literal when compiled with gcc 15.1. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-09extmod/moductypes: Refactor string literal as array initializer.Angus Gratton
Avoids the new Wunterminated-string-literal when compiled with gcc 15.1. Also split out the duplicate string to a top-level array (probably the duplicate string literal was interned, so unlikely to have any impact.) This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-09rp2: Add temporary workaround for GCC 15.1 build failure.Angus Gratton
This is a workaround for this upstream issue: https://github.com/raspberrypi/pico-sdk/issues/2448 Can be removed after the next pico-sdk update. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-09py/mpconfig: Enable io.IOBase at core feature level.Damien George
IOBase is quite an important building block of other parts of the system, such as `mpremote mount` and running .mpy and native tests. This feature costs +244 bytes of firmware size on ARM Thumb2 architectures, which is worth the cost for the extra features it enables. The change here means that `io.IOBase` is now enabled on all nrf boards, (previously it was only nRF52840 and nRF9160) and also B_L072Z_LRWAN1 (there is no change to other ports or boards). Signed-off-by: Damien George <damien@micropython.org>
2025-05-09rp2/rp2_dma: Fix default value used in pack_ctrl on RP2350.Damien George
The bit position of CHAIN_TO is not the same as on RP2040. Signed-off-by: Damien George <damien@micropython.org>
2025-05-09rp2/Makefile: Add deploy target that uses picotool load.Damien George
This is a convenient way to deploy firmware to an RP2xxx-based board. Signed-off-by: Damien George <damien@micropython.org>
2025-05-08rp2,extmod/cyw43: Move the LWIP responder fix into common CYW43 config.Angus Gratton
This means the fix from dd1465e7 will also apply to stm32 and mimxrt ports that use CYW43. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-08extmod,alif,mimxrt,rp2,stm32: Create common cyw43 driver config header.Angus Gratton
This is only a surface level refactor, some deeper refactoring would be possible with (for example) the SDIO interface in mimxrt and stm32, or the BTHCI interface which is is similar on supported ports. But sticking to cases where the macros are the same across all ports. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-07zephyr/mpconfigport: Fix mp_int_t and mp_uint_t to work on 64-bit archs.Anton Blanchard
These both need to fit a pointer, so make them `intptr_t` and `uintptr_t`, similar to other ports. Signed-off-by: Anton Blanchard <antonb@tenstorrent.com>
2025-05-07zephyr/modbluetooth_zephyr: Allow BLE to create services at runtime.danicampora
This commit adds the required functionality for a peripheral to create services at runtime, using `BLE.register_services()`. The feature is enabled on the nrf52840dk_nrf52840 board. Note that the `CONFIG_BT_GATT_ENFORCE_SUBSCRIPTION=n` option must be used so that BLE notifications/indications can be sent even if not subscribed. Signed-off-by: danicampora <danicampora@gmail.com>
2025-05-07py/makeversionhdr.py: Change utcfromtimestamp() to fromtimestamp().Jos Verlinde
The former is deprecated. Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
2025-05-07py/modthread: Initialize thread state nlr_top to NULL.Daniël van de Giessen
This ensures the check in MP_NLR_JUMP_HEAD works as expected and nlr_jump_fail gets called so we get a bit better error message. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-07lib/littlefs: Reuse existing CRC32 function to save space.Daniël van de Giessen
Getting this to work required fixing a small issue in `lfs2_util.h`, which has been submitted upstream. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-07lib/littlefs: Update LittleFS to v2.10.2.Daniël van de Giessen
Going above the root directory (/../foo) now gives an error. This is an intentional change made by LittleFS. It required a update of the testsuite and is a (minor) compatibility break. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-07samd/samd_qspiflash: Remove the attempt to handle a unknown device.robert-hh
Since all QSPI flash device used by this port are defined, this code was only used unintentionally. Besides that it was incomplete, so better drop it. Note: The flash type for Mini-SAM had to be changed too. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-05-07samd/samd_spiflash: Improve the flash type detection.robert-hh
Changes in this commit: - Check for the proper SFDP header. - Use the flash size information from SFDP, if present. - Add two more special flash chips <= 1 MByte without SFDP. JEDEC-ID table for special flash types instead of a series of conditional statements. - Add a compile flag `MICROPY_HW_SPIFLASH_SIZE` to set the size in `mpconfigboard.h`, which replaces getting the size from the JEDEC ID or the SFDP record. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-05-07samd/boards/SAMD_GENERIC_D51xxx: Fix VFS settings for internal flash.robert-hh
Fixes in this commit: - The wrong loader script was assigned for SAMD_GENERIC_D51X20, causing the VFS block count to be wrong. - Change the VFS block size from 1536 to 2048. With the setting of 1536, writing more that 1536 bytes at once failed. This applies to SAMD_GENERIC_D51X19 and SAMD_GENERIC_D51X20. No other SAMD51 board uses the internal flash for the file system. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-05-07samd/modtime: Change time.time_ns() to follow the RTC time.robert-hh
That is done by adding the offset to epoch, following the scheme from the RP2 port. RTC and `ticks_us()` are not precisely in sync, and so the difference between `time.time_ns()/1e9` and `time.time()` will increase by more than 9 seconds/24h. So applications should avoid using `time.time()` and `time.time_ns()` in the same context. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-05-07samd/machine_i2c: Add the timeout keyword argument to the constructor.robert-hh
To make it compliant with the documentation. The default value is 50000us. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-05-07samd/boards/SAMD_GENERIC_Dxxx: Add Microchip URL to board.json.robert-hh
To the Microchip Web site. Thanks to Matt Trentini for suggesting this site. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-05-07docs,ports: Fix SparkFun capitalization.Malcolm McKellips
This is a follow-up to 1e92bdd206f6f87ba65ea05c5b2623fca0b926cd correcting more of the instances where "Sparkfun" should be "SparkFun". Signed-off-by: Damien George <damien@micropython.org>
2025-05-07extmod/asyncio: Fix early exit of asyncio scheduler.Yoctopuce dev
This commit fixes three open issues related to the asyncio scheduler exiting prematurely when the main task queue is empty, in cases where CPython would not exit (for example, because the main task is not done because it's on a different queue). In the first case, the scheduler exits because running a task via `run_until_complete` did not schedule any dependent tasks. In the other two cases, the scheduler exits because the tasks are queued in an event queue. Tests have been added which reproduce the original issues. These test cases document the unauthorized use of `Event.set()` from a soft IRQ, and are skipped in unsupported environments (webassembly and native emitter). Fixes issues #16759, #16569 and #16318. Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
2025-05-02tests/extmod: Rename ssl tests that only use the tls module.Angus Gratton
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-02py/malloc: Add mutex for tracked allocations.Angus Gratton
Fixes thread safety issue that could cause memory corruption on ports with (MICROPY_PY_THREAD && !MICROPY_PY_THREAD_GIL) - currently only rp2 and unix have this configuration. Adds unit test for TLS sockets that exercises this code path. I wasn't able to make this fail on rp2, the race condition window is pretty narrow and may not have a direct impact on a quiet system. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-05-02zephyr/boards: Enable ADC on beagleconnect_freedom.Ayush Singh
Enable Analog inputs. Requires Zephyr >= v3.8.0. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-05-02docs/zephyr: Add zephyr FlashArea IDs docs.Vdragon
Signed-off-by: Vdragon <mail@massdriver.space>
2025-05-02zephyr: Introduce auto-listing of FlashArea Partitions.Vdragon
This enables listing all flash area partitions automagically instead of just sotrage_partitions. It uses the label, and the ID when not present. Signed-off-by: Vdragon <mail@massdriver.space>
2025-05-02zephyr: Create ability to use device_next with CDC ACM as REPL.Vdragon
This enables using the newer USB stack and its CDC ACM for the REPL. To switch to it, board file must contain `CONFIG_USB_DEVICE_STACK_NEXT=y` and `CONFIG_USBD_CDC_ACM_CLASS=y`. In the case of a board that is a platform that supports the older device stack, `CONFIG_USB_DEVICE_STACK=n` may be necessary. Signed-off-by: Vdragon <mail@massdriver.space>
2025-05-02tools/mpremote: For mip install, use hash to skip files that exist.Damien George
When using `mip install`, if a file that needs to be downloaded already exists locally, then the hash of that local file will be computed and if it matches the known hash of the remote file it will not be downloaded. Hashes in mip are guaranteed unique, so this change should never leave stale files on the filesystem. This behaviour follows that of the `mip` package in `micropython-lib`. Signed-off-by: Damien George <damien@micropython.org>
2025-05-02tools/ci.sh: Update URL for xtensa-lx106-elf-standalone.tar.gz.Damien George
The https://github.com/jepler/esp-open-sdk repository has been removed, so use the file hosted at micropython.org (it's the same file). Signed-off-by: Damien George <damien@micropython.org>
2025-05-01tests/ports/rp2: Tune rp2.DMA test so it runs in all configurations.Damien George
Changes in this commit: - Allow the DMA instance to be any instance, not just DMA(0); eg WLAN may be using DMA(0). - Make the DMA timing test run a little faster by preloading `dma.active`. - Run the DMA timing test 10 times and take the average time taken as the test result, to eliminate any big effects of caching. - Change the expected time to `range(30, 80)` to cover RP2040, RP2350, RISC-V variants, and both bytecode and native emitter. - Add a `sleep_ms(1)` after waiting for the IRQ to fire, so that any scheduled code gets a chance to run when the test is compiled with the native emitter. With these changes this test passes reliably on RPI_PICO, RPI_PICO_W, RPI_PICO2, RPI_PICO2_W, RPI_PICO2-RISCV and RPI_PICO2_W-RISCV, in both bytecode and native emitter mode, with and without WLAN enabled. Signed-off-by: Damien George <damien@micropython.org>
2025-05-01tests/ports/rp2: Convert rp2.DMA test to a unittest.Damien George
This test is rather complicated and benefits from being a unittest. Signed-off-by: Damien George <damien@micropython.org>
2025-05-01tests/net_hosted: Only run network loopback test on supported targets.Damien George
Only a few ports have TCP/IP loopback enabled in their network stack, and this test will only pass on those ports. There's not really any good way to do a feature check for loopback mode without actually running the test and seeing if it passes/fails, so add an explicit check that the test is running on a port known to support loopback. (Enabling loopback on lwIP, eg RPI_PICO_W, costs +568 code and +272 bss and is a rarely used feature, so not worth unconditionally enabling.) Signed-off-by: Damien George <damien@micropython.org>
2025-04-30zephyr/boards: Add nrf9151dk board configuration.Patrick Joy
Add support for the nrf9151dk. This DK has a GD25WB256 32mb external QSPI flash chip. Signed-off-by: Patrick Joy <patrick@thinktransit.com.au>
2025-04-30zephyr/boards: Add nrf5340dk board configuration.Patrick Joy
Add support for the nrf5340dk. This DK has a MX25R64 8mb external QSPI flash chip. Compile using: $ west build -b nrf5340dk/nrf5340/cpuapp Signed-off-by: Patrick Joy <patrick@thinktransit.com.au>
2025-04-30zephyr: Create options to enable frozen modules.Vdragon
Enables the ability to use frozen modules in the zephyr port. Enabled by adding `CONFIG_MICROPY_FROZEN_MODULES` to the board configuration file. Manually set manifest path with `CONFIG_MICROPY_FROZEN_MANIFEST`. Signed-off-by: Vdragon <mail@massdriver.space>
2025-04-30zephyr/boards: Enable PWM on beagleconnect_freedom.Ayush Singh
Enable PWM config for bcf. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-04-30docs/zephyr: Add quick reference for PWM support.Ayush Singh
Add docs for PWM support. Signed-off-by: Ayush Singh <ayush@beagleboard.org>