summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
11 daysesp32/mpconfigport: Enable Zcmp opcodes for ESP32P4.HEADorigin/masterorigin/HEADmasterAlessandro Gatti
This commit enables support for Zcmp opcodes when the firmware is built to target ESP32P4 microcontrollers. The ESP32P4 explicitly supports the Zcmp extension for reducing the amount of code needed for function prologues and epilogues (see section 4.1.1.1 of the ESP32P4 datasheet). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 daysrp2/CMakeLists.txt: Set the appropriate mpy-cross flags on all targets.Alessandro Gatti
This commit lets the RP2 port build system use the appropriate flags to pass to "mpy-cross" when building frozen MPY files as part of the build process. Now all possible variants (RP2040, RP2350/Arm, and RP2350/RV32) have their right flags assigned, falling back the flags set of the RP2040 if a new variant is introduced. Before these changes all variants would use the RP2040 set of flags which may be a bit of an issue when building code for the RP2350 in RV32 mode. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 daysrp2/mpconfigport: Enable Zcmp opcodes for RP2350 in RV32 mode.Alessandro Gatti
This commit enables support for Zcmp opcodes when the firmware is built for the RP2350 in RV32 mode. The RP2350 explicitly supports the Zcmp extension for reducing the amount of code needed for function prologues and epilogues (see section 3.8.1.20 of the datasheet). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 dayspy/asmrv32: Use Zcmp opcodes for function prologues and epilogues.Alessandro Gatti
This commit introduces the possibility of using Zcmp opcodes when generating function prologues and epilogues, reducing the generated code size. With the addition of selected Zcmp opcodes, each generated function can be up to 30 bytes shorter and having a faster prologue and epilogue. If Zcmp opcodes can be used then register saving is a matter of a simple CM.PUSH opcode rather than a series of C.SWSP opcodes. Conversely, register restoring is a single CM.POPRET opcode instead of a series of C.LWSP opcodes followed by a C.JR RA opcode. This should also lead to faster code given that there's only one opcode doing the registers saving rather than a series of them. For functions that allocate less than three locals then the generated code will allocate up to 12 bytes of unused stack space. Whilst this is a relatively rare occurrence for generated native and viper code, inline assembler blocks will probably incur into this penalty. Still, considering that at the moment the only targets that support Zcmp opcodes are relatively high-end MCUs (the RP2350 in RV32 mode and the ESP32P4), this is probably not much of an issue. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 dayspy/asmrv32: Reserve a flag for the Zcmp RV32 CPU extension.Alessandro Gatti
This commit performs the necessary changes to handle an additional RV32 CPU extension flag, for the Zcmp extension in this case. The changes are not limited to RV32-only code, as other parts of the tooling need to be modified for this: the testing framework has to be made aware that an extra bit can be set in sys.implementation._mpy and needs to know how it is called, and "mpy-cross" must be able to actually set that flag bit in the first place via the appropriate command line argument. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 daysqemu/Makefile: Allow usage of a custom QEMU binary to run code.Alessandro Gatti
This commit introduces a new optional makefile variable to let the build system know that, when running code, a custom QEMU binary must be used instead of the one provided by the system's PATH. Given that the CI machine won't keep up with QEMU updates unless its base image tracks a new version of QEMU itself, sometimes it is needed to use a custom QEMU build to be able to test new code in an emulated context rather than having to perform on-device testing during development. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 daystests/run-tests.py: Discover RV32 extension inlineasm tests.Alessandro Gatti
This commit extends the test runner to automatically discover inline assembler tests for known RV32 extensions, and checks whether to add the discovered tests to the enabled tests list. Automatic discovery requires that inline assembler tests for RV32 extensions follow a specific pattern both for filenames and for the tests' output in case of success. A valid RV32 extension test must have: * A code fragment that checks for support of the extension on the running target in "/tests/feature_check", called "inlineasm_rv32_<extensionname>.py" that should print the string "rv32_<extensionname>" if the extension is supported * A matching expected result file in "/tests/feature_check" called "inlineasm_rv32_<extensionname>.py.exp" that must contain the string "rv32_<extensionname>" (without quotes) * A regular MicroPython test file in "/tests/inlineasm/rv32" called "asm_ext_<extensionname>.py" For example, to test the Zba extension, there must be a file called "/tests/feature_check/inlineasm_rv32_zba.py" that should print the string "rv32_zba" if the extension is supported, together with a file called "/test/feature_check/inlineasm_rv32_zba.py.exp" that contains the string "rv32_zba" in it, and finally there must be a regular MicroPython test file called "/tests/inlineasm/rv32/asm_ext_zba.py". Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
11 dayspy/emitnative: Optimise register clearing.Alessandro Gatti
This commit introduces a new generic ASM API function to clear a register (i.e. clearing all the registers' bits). The native emitter used to perform a XOR operation to clear a given register, but different platform have more optimised method to achieve the same result taking up less space - either for the generated code or for the code generator itself. Arm, RV32, X86, and X64 already had an already optimised generator and generated optimised code. The code generator when build for Thumb takes less space generating a constant immediate move rather than a XOR operation, even though both operations would distill down to a single narrow opcode. On Xtensa the situation is almost the same as Thumb, with the exception that a constant immediate move would take one byte less than a XOR operation. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
13 daysesp32/machine_sdcard: Fix SDMMC slot assignment for non-default slots.jetpax
The SDMMC_HOST_DEFAULT() macro sets slot to SDMMC_HOST_SLOT_1, but this was not being overridden when the user specified a different slot number. This caused SDMMC initialization to fail on chips like ESP32-P4 when trying to use slot 0. This commit ensures the slot number passed to the SDCard constructor is properly assigned to the host configuration structure. Tested on ESP32-P4 with SD card on slot 0. Signed-off-by: jetpax <jep@alphabetiq.com>
13 daysdocs/library/network.WLAN: Fix typo for ESP32 protocol constants.Thomas Kiss
Signed-off-by: Thomas Kiss <thokis@googlemail.com>
13 dayspy/misc: Remove unused mp_check function.Jeff Epler
This is unused since 007f127a61ea058ca010b85883072bdefe0234c0 "all: Simplify mp_int_t/mp_uint_t definition". Signed-off-by: Jeff Epler <jepler@unpythonic.net>
13 daystests/target_wiring: Provide an ESP8266 target wiring module.Alessandro Gatti
This commit introduces ESP8266 support for target wiring tests, fixing execution of relevant tests that once failed on that platform. ESP8266 boards need to have GPIO4 and GPIO5 connected together to provide a UART loopback, in order to test whether UART data effectively flows through. The wiring-enabled UART transmission timing test was also updated with measurements compatible with a few ESP8266 test boards. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
13 daystests/extmod/vfs_blockdev_invalid.py: Handle low memory conditions.Alessandro Gatti
This commit modifies the "extmod/vfs_blockdev_invalid" test to better behave on boards with low available memory. Before these changes the test would fail on ESP8266 (at least), due to low memory, but in a way that could not be easily solved as the error occurred in the middle of the test. The test has been rewritten to delay its output until the very end, so if a low memory condition occurs and needs to stop execution then no real output will show up before the skip marker. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
13 daystests/run-tests.py: Skip list sort stress test for ESP8266.Alessandro Gatti
This commit marks the "stress/list_sort.py" test to be skipped when running on ESP8266. The test just takes too long without yielding to the OS whilst doing the sort, causing the internal software watchdog to kick in and reboot the board. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-12-17tests/basics/string_fstring.py: Test fstring nested replacement fields.Jeff Epler
This does not actually cover any additional lines, but it does cover new functionality not previously covered. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-12-16tests/ports/esp32/check_err_str.py: Preallocate global variable.Damien George
This test fails on all esp32 boards without this fix, because the try/except that runs with the heap locked attempts to increase the size of the globals dict when assigning to the exception variable `e`. Fix that by preallocating the global variable `e`. Signed-off-by: Damien George <damien@micropython.org>
2025-12-16esp8266/boards/ESP8266_GENERIC: Remove OTA board variant.Damien George
The OTA variant of the ESP8266_GENERIC board was never fully completed in its functionality. It relies on the https://github.com/pfalcon/yaota8266 component which was also never fully finished and has been unmaintained for many years. This commit removes this variant and it's associated build support. It makes it an "old_variant" so the existing historical firmware is still listed on the download page. Signed-off-by: Damien George <damien@micropython.org>
2025-12-16esp32/boards/ESP32_GENERIC_S3: Reinstate old FLASH_4M variant.Damien George
Commit 6201e77999b3614518abc4b21773e735d9b0b0ee removed the ESP32_GENERIC_S3 FLASH_4M variant from `board.json`. But the firmware still exists on the download server, and it makes sense to still keep those old versions available for download, just like all other older versions are still available. This commit introduce a new scheme for `board.json` whereby old variants that are no longer built can be moved to the "old_variants" section. This keeps them available on the download page, allowing a way to deprecate individual board variants without removing them entirely. An optional string can be added to the old variant to describe why it's obsolete and what to use instead. Signed-off-by: Damien George <damien@micropython.org>
2025-12-15all: Bump version to 1.28.0-preview.v1.28.0-previewDamien George
Signed-off-by: Damien George <damien@micropython.org>
2025-12-10all: Bump version to 1.27.0.v1.27.0Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-12-08lib/micropython-lib: Update submodule to latest.Damien George
This brings in: - usb-device: raise RuntimeError when DCD error occurs - usb-device-hid: return True after submit_xfer - inspect: implement a very basic signature function - datetime: apply localtz patch to include naive date/time support - datetime: optimize for code size - sdcard: updating sector calculation for SDXC - mip: optimize _CHUNK_SIZE const for code size - aioble/examples: change variable name to _ADV_INTERVAL_US - aioble: fix typo in README in aioble.ADDR_PUBLIC - copy: fix typo in _deepcopy_dispatch - requests: update example for fetching using requests - all: fix formatting errors in docstrings - CONTRIBUTING: add guidelines for module documentation and versioning - cbor2: silence missing `__eq__` warning - pyproject.toml: reorganize ruff lint settings for newer ruff - all: correct various typos in comments and docs - lora: fix import error detection for missing drivers - inspect: support closures/generators/async-funcs in inspect.signature - usb-device-hid: fix descriptor protocol config and set correct default - usb-device-hid: use report protocol after report descriptor requested - umqtt.simple: add unsubscribe method - aiohttp: correctly handle WebSocket message fragmentation - iperf3: fix use as a CLI on the unix port of MicroPython - iperf3: factor out data transfer logic to separate function - iperf3: fix server UDP mode - unix-ffi/socket: remove ip add/drop membership from socket - tarfile: add basic unittest for tarfile.TarFile - tarfile: fix FileSection.skip to not rely on extended readinto args - argparse: Add support for custom argument types - pyproject.toml: add codespell configuration, CI and precommit - all: fix spelling and typos in comments and docstring - aioble/examples: change variable name to _ADV_INTERVAL_US Signed-off-by: Damien George <damien@micropython.org>
2025-12-08esp32/main: Update esp_hosted component to latest version 2.7.0.Damien George
This updates the esp_hosted component for ESP32-P4 boards to use the latest version 2.7.0. Testing on a P4 board with C6 WiFi shows there are no regressions for WiFi or BLE. Also rename the `CONFIG_ESP_ENABLE_BT` option to the new `CONFIG_ESP_HOSTED_ENABLE_BT_NIMBLE` option used by the component. This change is made partly to work around a current issue with the IDF component manager, that esp_hosted versions after 2.0.17 and prior to 2.7.0 have all disappeared. Signed-off-by: Damien George <damien@micropython.org>
2025-12-08esp32/boards: Enable ESP32P4_REV_MIN_0 option for P4 boards.Damien George
The ESP32-P4 currently comes in three revisions (0.0, 0.1 and 1.0) and all of them are out in the wild. Even though the IDF defaults to a minimum of 0.1 we would like to support as many as possible, so configure MicroPython to work down to revision 0.0. The firmware only grows by 32 bytes when enabling this option. Signed-off-by: Damien George <damien@micropython.org>
2025-12-08stm32/boards/NUCLEO_G474RE: Restore disabled modules on g474re.Steve Sanbeg
Among other things, the framebuf module is missing on NUCEO_G474RE. This board seems to disable a lot of modules, while other *E boards with the same flash configuration (eg NUCLEO_F411RE) don't seem to disable any modules in this way. So, remove all of the lines disabling modules to make it consistent with other boards. Signed-off-by: Steve Sanbeg <steve.sanbeg@gmail.com>
2025-12-07stm32/system_stm32: Fix clock config for STM32G4.Yuuki NAGAO
Add peripheral clock selection for ADC345 to use analog port under ADC3. Fixes #18527. Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
2025-12-07tests/basics/builtin_help.py: Test correct handling of deleted entries.Anson Mansfield
This test reproduces the bug that gave rise to the esp32 segfaults in issues #18061 and #18481 on all platforms. Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-12-07py/builtinhelp: Don't print removed sentinel entries.Anson Mansfield
This fixes the test used by the help function to iterate over its argument's attribute to use the proper `mp_map_slot_is_filled` function to check if a slot in the map is filled; the previous test only checked for `MP_OBJ_NULL` keys and would attempt to print the null value whenever a `MP_OBJ_SENTINEL` key marking a deleted entry was present. Fixes: #18061 Fixes: #18481 Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-12-07py/emitinlinerv32: Change mask arg of is_in_signed_mask to uint32_t.Damien George
Prior to this change mpy-cross would fail to build under Windows with: D:\a\micropython\micropython\py\emitinlinerv32.c(398,40): warning C4319: '~': zero extending 'unsigned int' to 'mp_uint_t' of greater size [D:\a\micropython\micropython\mpy-cross\mpy-cross.vcxproj] Signed-off-by: Damien George <damien@micropython.org>
2025-12-07py/asmbase: Cast prior to bitwise invert when the type is widened.Damien George
Add a cast to fix build error of mpy-cross on Windows CI. Prior to this fix the failure was: D:\a\micropython\micropython\py\asmbase.c(105,56): warning C4319: '~': zero extending 'unsigned int' to 'size_t' of greater size [D:\a\micropython\micropython\mpy-cross\mpy-cross.vcxproj] Signed-off-by: Damien George <damien@micropython.org>
2025-12-07tests/net_inet: Update micropython.org certificate for SSL tests.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-12-07tests/serial_test.py: Add a serial echo test.Damien George
The existing `serial_test.py` script tests data in/out throughput and reliability. But it only tests data sizes that are a power of two, which may not catch certain errors with USB transmission (because FS packet size is 64 bytes). This commit adds a new echo sub-test to the `serial_test.py` script. It sends out data to the target and gets the target to echo it back, and then compares the result (the echo'd data should be equal to the sent data). It does this for data packets between 1 and 520 (inclusive) bytes, which covers USB FS and HS packet sizes (64 and 512 respectively). It uses random data for the test, but seeded by a constant seed so that it's deterministic. If there's an error then it prints out all the sent and echo'd data to make it easier to see where it went wrong (eg if the previous packet was repeated). Signed-off-by: Damien George <damien@micropython.org>
2025-12-07tests/serial_test.py: Factor common reset code into send_script func.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-12-04tools/autobuild: Make firmware destination directory configurable.Damien George
The destination directory for the firmware built by `autobuild.sh` is currently hard-coded to `/tmp/autobuild-firmware-$$`. Now that there are many boards built by this script, the `/tmp` partition can run out of space. This commit makes the destination directory configurable via the `MICROPY_AUTOBUILD_DEST` environment variable. Signed-off-by: Damien George <damien@micropython.org>
2025-12-03docs/library/machine.Timer: Explain the id parameter in more detail.Angus Gratton
As noted in discussion on PR #18263, the id parameter is optional on ports that support virtual timers. Add some more general explanation of hardware vs virtual timers, and remove redundant documentation about timer callbacks in favour of the isr_rules page. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-12-03esp32: Don't disable component manager when updating submodules.Angus Gratton
- Reverts the change from ec527a1 - since later change cccac2cc we no longer exit CMake early to get the submodule list, so it's OK to run component manager during this phase. - Fixes issue where "make submodules BOARD=ESP32_GENERIC_S3" (or any other board that depends on USB) would fail due to missing component(s). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-12-03esp32/boards/ESP32_GENERIC_P4: Add variants to board.json and .md files.Damien George
Add variants to the new ESP32_GENERIC_P4 board, so they appear on the download page. Signed-off-by: Damien George <damien@micropython.org>
2025-12-03esp32: Fix board images for ESP32_GENERIC_[C2|C5|P4].Angus Gratton
These recently added boards had copy-paste image names, change them to match the images pending addition to micropython-media. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-12-02rp2/mpconfigport: Enable MD5, SHA1 and cryptolib on all boards.Damien George
This fixes a regression introduced by PR #17926 / commit b5fcb33eaa682bb666c839cd4fb301175cc3564f which accidentally disabled `hashlib.sha1` and the `cryptolib` module on rp2 boards that don't have networking enabled, eg RPI_PICO. `hashlib.md5` is enabled to keep the configuration the same as boards that do have networking enabled. Signed-off-by: Damien George <damien@micropython.org>
2025-12-02rp2/rp2_pio: Fix support for pin wrapping and RP2350B upper-bank pins.Anson Mansfield
On RP2350B where there are more than 32 pins, using `pio_sm_set_pins_with_mask()` and `pio_sm_set_pindirs_with_mask()` is not correct because their arguments are `uint32_t` and higher bits get lost when `pio.gpio_base(16)` is used. This commit fixes the issue by using the 64-bit API functions on RP2350B. It also makes sure pin wrapping is supported, i.e. using [30, 31, 0, 1] or [46, 47, 16, 17] as contiguous pin ranges for a PIO program. Fixes issue #16199. Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2025-12-01rp2/rp2_dma: Properly close DMA channels.Dryw Wade
Clears the control registers and aborts the closed channel upon a call to `.close()` and `.__del__()` (GC collect). Fixes issue #18446. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
2025-12-01rp2: Add HSTX alternate function.Dryw Wade
A follow up to 40df95357c7b3270dc60421a0078fd73b122473f / PR #17692, this commit adds the HSTX alternate pin function for GPIO12-19 on the RP2350. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
2025-12-01rp2/main: Add guard around machine_i2s_init0().David Lechner
Add a #if MICROPY_PY_MACHINE_I2S guard around the call to machine_i2s_init0() in ports/rp2/main.c. This matches the existing guard around machine_i2s_deinit_all() in the same function. Signed-off-by: David Lechner <david@pybricks.com>
2025-12-01rp2/boards/WEACTSTUDIO_RP2350B_CORE: Add board.pinout.Matt Trentini
This adds an ANSI-rendered pinout for the WeAct Studio RP2350B Core board. Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2025-12-01esp32/boards/SOLDERED_NULA_MINI: Add new board definition.Josip Šimun Kuči
Add support for the upcoming Soldered NULA Mini ESP32C6 board by Soldered Electronics. Signed-off-by: Josip Šimun Kuči <josipsimunkuci@gmail.com>
2025-12-01esp32/mphalport: Enable D-cache flushing on P4 for native code.Damien George
This is necessary to get native code running on the ESP32-P4. Signed-off-by: Damien George <damien@micropython.org>
2025-12-01py/emitglue: Add hook for RV32 arch to flush D-cache for native emitter.Damien George
Eventually this cache flushing mechanism should be generalised to work the same way for all architectures. But for now, this allows ESP32 RV32 SoCs to flush the D-cache whenn needed. Signed-off-by: Damien George <damien@micropython.org>
2025-12-01esp32/usb_serial_jtag: Flush usb_serial_jtag TXFIFO from ISR.Angus Gratton
This was necessary to un-wedge the USJ TX path on ESP32-P4, I think because the bootloader prints a lot on this chip. I think it might be possible to hit it on other chips, though. The implementation is based on the ESP-IDF driver, which will always add an extra flush when the TXFIFO is empty in case the host is expecting a ZLP. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-12-01esp32/boards/ESP32_GENERIC_P4: Add board definition for ESP32P4.Vincent1-python
Includes a base variant with LAN, and C5_WIFI and C6_WIFI variants with LAN, WiFi and BLE. And builds this board in the esp32 CI, to cover the P4 support. Signed-off-by: Vincent1-python <pywei201209@163.com> Signed-off-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Damien George <damien@micropython.org>
2025-12-01esp32: Add support for ESP32-P4.Vincent1-python
This commit adds support for ESP32-P4 SoCs. Signed-off-by: Vincent1-python <pywei201209@163.com> Signed-off-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Damien George <damien@micropython.org>
2025-11-30esp32: Support building with network and/or bluetooth disabled.Angus Gratton
(and a smaller binary size as a result) Signed-off-by: Angus Gratton <angus@redyak.com.au>