summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-02-07docs/samd/pinout: Add pinout for the Generic SAMD board types.robert-hh
The table shows the devices available at the pin and the respective package letter. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07docs/samd/pinout: Add pinout for Adafruit NeoKey Trinkey and QT Py.robert-hh
Only pins accessible at the board are shown. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07samd/boards: Add support for the Adafruit NeoKey Trinkey board.robert-hh
Tested with that board. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07samd/boards: Add support for the Adafruit QT Py board.robert-hh
Supporting a variant with an optional SPIFLASH device as well. Tested both variants with a QT Py board. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07samd/Makefile: Add support for board variants.robert-hh
Tested with a Adafruit SAMD QT board, which may optionally be equipped with SPIFLASH memory. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07samd/boards: Add generic SAMD51x20 board definitions.robert-hh
The definition uses the internal oscillator for clock and only internal flash for the file system. It works at SAMD51J20 device as well, only that fewer pins are accessible. Tested with a SAMD51J20 board. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07samd/boards: Add generic SAMD51x19 board definitions.robert-hh
The definition uses the internal oscillator for clock and only internal flash for the file system. It works at SAMD51G19 and SAMD51J19 devices as well, only that fewer pins are accessible. Tested with a SAMD51G19 and SAMD51J9 board. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07samd/boards: Add generic SAMD21x18 board definitions.robert-hh
The definition uses the internal oscillator for clock and only internal flash for the file system. It works at SAMD21G18 and SAMD21E18 devices as well, only that fewer pins are accessible. Tested with a SAMD21E18, SAM21G18 and SAMD21J18 board. Signed-off-by: robert-hh <robert@hammelrath.com>
2025-02-07py/emitnative: Load and store words just once for Viper code.Alessandro Gatti
This commit fixes two Xtensa sequences in order to terminate early when loading and storing word values via an immediate index. This was meant to be part of 55ca3fd67512555707304c6b68b836eb89f09d1c but whilst it was part of the code being tested, it didn't end up in the commit. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07py/emitnative: Mark condition code tables as const.Alessandro Gatti
This commit marks as const the condition code tables used when figuring out which opcode sequence must be emitted depending on the requested comparison type. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07tools/ci.sh: Add natmod tests for QEMU/Arm.Alessandro Gatti
This commit adds the natmod tests for the MPS2_AN385 board running inside QEMU to the CI pipeline. Now natmod tests capabilities are equal between the Arm and RV32 platforms for the QEMU port. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07qemu/Makefile: Fix shell interpolation for automated natmod tests.Alessandro Gatti
This commit fixes the command used to run natmod tests, as it relied on a string interpolation feature of the POSIX shell that was not working as expected inside a makefile. The interpolation was not performed from inside the makefile and the raw command string was sent to the operating system for execution. Now the command is run by using a different type of string substitution, which explicitly performs the interpolation using a POSIX shell for-loop. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07tests/run-natmodtests.py: Autodetect the test target architecture.Alessandro Gatti
This commit lets the natmod tests runner to automatically detect the architecture of the test target. This allows to avoid to explicitly pass the architecture name to the runner in test scripts. However, the ability to manually specify a target was not removed but it was made optional. This way the user is able to override the architecture name if needed (like if one wants to test an armv6 MPY on an armv7 board). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-02-07py/mkrules.mk: Reset USER_C_MODULES when building mpy-cross dependency.Andrew Leech
When a port automatically compiles `mpy-cross`, if `USER_C_MODULES` is provided by the user on the command line then it is also applied to the `mpy-cross` build. That can lead to build errors if the path is relative and not found when building `mpy-cross`. Fix that by explicitly resetting `USER_C_MODULES` when invoking the `mpy-cross` build. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-02-07esp32/README: Fix board in octal-SPIRAM example make command.eggfly
Signed-off-by: eggfly <lihaohua90@gmail.com>
2025-02-07tests/multi_wlan: Remove esp8266 port workaround.Angus Gratton
Not needed due to parent commit. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-07esp8266/network_wlan: Make WLAN.config(channel=x) use wifi_set_channel.Glenn Moloney
Also permits channel option to be used for STA_IF interface. This provides compatibility with esp32 code, especially for espnow users. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2025-02-07esp8266/network_wlan: Make WLAN.config('channel') use wifi_get_channel.Glenn Moloney
Prior to this fix, `WLAN.config('channel')` would return an incorrect channel for AP_IF if STA has connected to an external AP running on a different channel. The esp8266 now has the same behaviour as for esp32 per commit 98d1c50159fe9427d72ec358ba0219eaebb1d991. Fixes issue #11463. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2025-02-07rp2/rp2_flash: Workaround multicore lockout not being reset.Mike Bell
With regression test. See upstream bug https://github.com/raspberrypi/pico-sdk/issues/2201 Tested-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Mike Bell <mdb036@gmail.com>
2025-02-07tests/ports/rp2: Add test for SLEEP_ENx registers over lightsleep.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-02-07rp2/modmachine: Make lightsleep preserve SLEEP_EN0 and SLEEP_EN1.Carl Pottle
The problem was introduced in d1423ef7a23793de3777e84d985f9902241e788e, calling `machine.lightsleep()` overwrites RP2xxx registers `SLEEP_EN0` and `SLEEP_EN1` with their power on default values. Prior to that commit the register values were saved on entry to lightsleep and restored before returning. These changes restores the earlier behavior. Fixes issue #16502. Signed-off-by: Carl Pottle <cpottle9@outlook.com>
2025-02-04stm32/eth: Make ETH DMA buffer attributes configurable.Kwabena W. Agyeman
Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
2025-02-03py/gc: Reorder static functions for clarity.Angus Gratton
- Renamed gc_sweep to gc_sweep_free_blocks. - Call gc_sweep_run_finalisers from top level. - Reordered the gc static functions to be in approximate runtime sequence (with forward declarations) rather than in declaration order. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03unix: Add recursive mutex support.Angus Gratton
Allows refactoring the existing thread_mutex atomic section support to use the new recursive mutex type. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03rp2: Migrate to the new mp_thread_recursive_mutex_t.Angus Gratton
Necessary for GC support, also refactored pendsv usage. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03py: Add optional support for recursive mutexes, use for gc mutex.Angus Gratton
Enabled by default if using threading and no GIL This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03py/gc: Allow gc_free from inside a gc_sweep finalizer.Angus Gratton
Do this by tracking being inside gc collection with a separate flag, GC_COLLECT_FLAG. In gc_free(), ignore this flag when determining if the heap is locked. * For finalisers calling gc_free() when heap is otherwise unlocked, this allows memory to be immediately freed (potentially avoiding a MemoryError). * Hard IRQs still can't call gc_free(), as heap will be locked via gc_lock(). * If finalisers are disabled then all of this code can be compiled out to save some code size. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03py/gc: Split out running finalizers to a separate pass.Angus Gratton
Currently a finalizer may run and access memory which has already been freed. (This happens mostly during gc_sweep_all() but could happen during any garbage collection pass.) Includes some speed improvement tweaks to skip empty FTB blocks. These help compensate for the inherent slowdown of having to walk the heap twice. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03unix: Use the bare metal mbedTLS config in the coverage buiid.Angus Gratton
This allows coverage to test MicroPython-specific features such as the tracked alloc cleanups added in the parent commit. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03extmod/mbedtls: Try GC before failing to setup socket on esp32, unix.Angus Gratton
On mbedTLS ports with non-baremetal configs (mostly esp32, technically also unix port), mbedTLS memory is allocated from the libc heap. This means an old SSL socket may be holding large SSL buffers and preventing a new SSL socket from being allocated. As a workaround, trigger a GC pass and retry before failing outright. This was originally implemented as a global mbedTLS calloc function, but there is complexity around the possibility of C user modules calling into mbedTLS without holding the GIL. It would be interesting to try making a generic version for any malloc which fails, but this would require checking for a Python thread and probably making the GIL recursive. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-02-03tests: Add a test for SSL socket memory leaks.Angus Gratton
Test is for an issue reported on the micropython-lib Discord as effecting the rp2 port umqtt.simple interface when reconnecting with TLS, however it's a more generic problem. Currently this test fails on RPI_PICO_W and ESP32_GENERIC_C3 (and no doubt others). Fixes are in the subsequent commits. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-01-29py/parsenumbase: Favor clarity of code over manual optimisation.Jeff Epler
Follow up to 13b13d1fdd05549d504eeded0b5aa8871d5e5dcf, based on some testing on godbolt, the manual code optimisation seems unnecessary for code size, at least on gcc x86_64 and ARM, and it's definitely not good for clarity. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-01-29extmod/lwip-include: Factor common lwIP config into lwipopts_common.h.Damien George
This lwIP configuration file has options that are common to all ports, and the ports are updated to use this file. This change is a no-op, the lwIP configuration remains the same for the four ports using this common file. This reduces code duplication, keeps the ports in sync, and makes it easier to update the configuration for all ports at once. Signed-off-by: Damien George <damien@micropython.org>
2025-01-29py/mkrules: Add GIT_SUBMODULES_FAIL_IF_EMPTY flag for CMake ports.Angus Gratton
The way CMake gathers the submodule list, it can quietly be empty if the previous step fails. This makes it an explicit error. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-01-29esp32: Don't add TinyUSB files to an ECHO_SUBMODULES build.Angus Gratton
Similar to other places, CMake will error out if this file doesn't exist yet but we don't want this if we're only getting the list of submodules. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-01-29esp32: Disable component manager when running 'make submodules'.Angus Gratton
- ECHO_SUBMODULES=1 exits CMake early. With idf_component_manager 1.x this seems to leave the managed_components directory in a state that causes later builds to fail. - Looks like the component manager isn't needed for this step, so disable it. This invocation logs a warning (not visible in normal output) but completes successfully and returns the correct list of submodules. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-01-29extmod/modlwip: Fix incorrect peer address for IPv6.Jared Hancock
For IPv6 connections, the peer address was previously defined as only the first four bytes of the IP address. For IPv6 addresses, this resulted in an incorrect IPv4 address. For instance, receiving a packet via `::recvfrom` from `'fe80::87:e7ff:fe48:629a'` is returned as having a peer address of `'254.128.0.0'` Signed-off-by: Jared Hancock <jared.hancock@centeredsolutions.com>
2025-01-29tools/mpremote: Introduce timeout_overall for read_until().Hans Maerki
And use it in `enter_raw_repl()`. This prevents waiting forever for a serial device that does not respond to the Ctrl-C/Ctrl-D/etc commands and is constantly outputting data. Signed-off-by: Hans Maerki <buhtig.hans.maerki@ergoinfo.ch>
2025-01-27tools/mpremote: Avoid initial blocking read in read_until().Hans Maerki
If the target does not return any data then `read_until()` will block indefinitely. Fix this by making the initial read part of the general read look, which always checks `inWaiting() > 0` before reading from the serial device. Also added the UART timeout to the constructor. This is not currently used but may be used as an additional safeguard. Signed-off-by: Hans Maerki <buhtig.hans.maerki@ergoinfo.ch>
2025-01-26py/emitnative: Optimise Viper immediate offset load/stores on Xtensa.Alessandro Gatti
This commit introduces the ability to emit optimised code paths on Xtensa for load/store operations indexed via an immediate offset. If an immediate offset for a load/store operation is within a certain range that allows it to be embedded into an available opcode then said opcode is emitted instead of the generic code sequence. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-26py/emitnative: Emit shorter exception handler entry code on RV32.Alessandro Gatti
This commit improves the RV32 code sequence that is emitted if a function needs to set up an exception handler as its prologue. The old code would clear a temporary register and then copy that value to places that needed to be initialised with zero values. On RV32 there's a dedicated register that's hardwired to be equal to zero, which allows us to bypass the extra register clear and use the zero register to initialise values. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-26py/emitnative: Optimise Viper register offset load/stores on Xtensa.Alessandro Gatti
This commit improves the emitted code sequences for address generation in the Viper subsystem when loading/storing 16 and 32 bit values via a register offset. The Xtensa opcodes ADDX2 and ADDX4 are used to avoid performing the extra shifts to align the final operation offset. Those opcodes are available on both xtensa and xtensawin MicroPython architectures. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-01-26py/parsenum: Throw an exception for invalid int literals like "01".Jeff Epler
This includes making int("01") parse in base 10 like standard Python. When a base of 0 is specified it means auto-detect based on the prefix, and literals begining with 0 (except when the literal is all 0's) like "01" are then invalid and now throw an exception. The new error message is different from CPython. It says e.g., `SyntaxError: invalid syntax for integer with base 0: '09'` Additional test cases were added to cover the changed & added code. Co-authored-by: Damien George <damien@micropython.org> Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-01-26tests/basics/nanbox_smallint.py: Fix incorrect use of int() in test.Jeff Epler
The literal is in base 16 but int()'s default radix in CPython is 10, not 0. Signed-off-by: Jeff Epler <jepler@gmail.com>
2025-01-24py/persistentcode: Initialize prelude_ptr to prevent compiler warning.IhorNehrutsa
The esp32 IDF toolchain can give a "may be used uninitialized" warning, at least for ESP32-S3 with gcc 14.2.0. Silence that warning by initializing the variable with NULL. Co-authored-by: Daniel van de Giessen <daniel@dvdgiessen.nl> Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2025-01-24esp32: Add support for IDF v5.4.IhorNehrutsa
Add WIFI_AUTH_WPA3_ENTERPRISE and WIFI_AUTH_WPA2_WPA3_ENTERPRISE, and update PPP callback signature for latest lwIP. Co-authored-by: Daniel van de Giessen <daniel@dvdgiessen.nl> Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
2025-01-23samd/samd_qspiflash: Correct QSPI baud calculation.I. Tomita
The QSPI baud is derived from the AHB clock, not from the APB (peripheral) clock. Datasheet: The QSPI Baud rate clock is generated by dividing the module clock (CLK_QSPI_AHB) by a value between 1 and 255. As previously implemented, all baudrates are 2.5 times greater than expected. Signed-off-by: I. Tomita <ziceva@me.com>
2025-01-23samd/machine_dac: Fix SAMD51 DAC for two channels.Graeme Winter
Improvements to DAC support for SAMD51: - properly validate DAC id - correctly use dac_init flag, as a 2-ple for A0, A1 channels - disable DAC before adjusting settings, see SAMD5x data sheet ยง47.6.2.3 Co-authored-by: robert-hh <robert@hammelrath.com> Signed-off-by: Graeme Winter <graeme.winter@gmail.com>
2025-01-22LICENSE,docs: Update copyright year range to include 2025.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-01-22esp8266/Makefile: Fix local toolchain builds on recent Linux systems.Alessandro Gatti
This commit fixes compilation for the ESP8266 port when using a local toolchain on relatively recent Linux systems. The documentation asks the user to delete the esptool instance that comes with the toolchain, in favour of using the one provided by the system. On Linux systems that are at least two years old (looking at the CI Ubuntu image as an example), the version of esptool installed with the package manager isn't called `esptool.py` but just `esptool`. The Makefile didn't take that into account and used `esptool.py` without checking if such a command exists, making builds fail. Now preference is given to the `esptool` command, falling back to `esptool.py` only if the former command does not exist or it is not available to the current user, to maintain compatibility with old setups. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>