Skip to content

Update from upstream repo micropython/micropython@master#3

Open
backstroke-bot wants to merge 9594 commits intobynds:masterfrom
micropython:master
Open

Update from upstream repo micropython/micropython@master#3
backstroke-bot wants to merge 9594 commits intobynds:masterfrom
micropython:master

Conversation

@backstroke-bot
Copy link

Hello!

The upstream repository micropython/micropython@master has some new changes that aren't in this fork. So, here they are, ready to be merged! 🎉

If this pull request can be merged without conflict, you can publish your software with these new changes. Otherwise, fix any merge conflicts by clicking the Resolve Conflicts button.


If you like Backstroke, consider donating to help us pay for infrastructure here. Backstroke is a completely open source project that's free to use, but we survive on sponsorships and donations. Thanks for your support! Help out Backstroke.


Created by Backstroke (I'm a bot!)

iabdalkader and others added 30 commits January 4, 2026 16:50
P5_6 doesn't have that alt function, and only has 7 alt functions.  This
workaround was never really needed, it was introduced in DFP because the
wrong P10_7 alt function was used, in original DFP sources.

This has been removed from DFP starting with 1.3.4, so remove it here also.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Update romfs partition to reflect the latest layout.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Allows user control of JTAG pins on the AE3 which are exposed via the B2B
header.

Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
Default queue size is too small that it overflows easily if debugging
printfs are enabled. Increase TinyUSB event queue size to 128.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Add an esp32 build (specifically ESP32_GENERIC) to the CI code-size check.
Multiple new steps must be done to prepare for building esp32, and caching
is used to speed up both the install of the IDF and the build process.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
To make this CI step runnable locally by `ci.sh`.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit updates the Unix/MIPS target's environment to use the latest
available LTS version of Ubuntu Linux (24.04).

Since the new OS updated some key components used in the CI build
process, a few modifications have been made to the setup and build
procedure.  Newer QEMU's sysroot location changed and the "static"
variant of the QEMU emulators has to be used to make binfmt work, and
updated autotools versions split some macros into an optional package
that has to be manually installed.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit updates the Unix/Arm target's environment to use the latest
available LTS version of Ubuntu Linux (24.04).

Since the new OS updated some key components used in the CI build
process, a few modifications have been made to the setup and build
procedure.  Newer QEMU's sysroot location changed and the "static"
variant of the QEMU emulators has to be used to make binfmt work, and
updated autotools versions split some macros into an optional package
that has to be manually installed.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit forces the installation of CPython 3.11 instead of CPython
3.12 in the OS image for Unix/RV64 CI jobs.

CPython 3.12 is not compatible with settrace tests, but it is the
CPython version that is installed by default in "ubuntu-latest" (which
is Ubuntu 24.04 LTS right now).  Updating the base image for the RV64
tests also disabled settrace tests to work around its incompatibility,
however turns out there is a way to force CI to set up a base OS image
with an arbitrary CPython version.

Now the RV64 CI jobs are now going to be executed using CPython 3.11,
and thus the settrace tests can be removed from the ignore list.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Also make sure code_size runs when the esp32 port source changes, as per
the other ports that are built as part of code_size.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Signed-off-by: Damien George <damien@micropython.org>
This commit updates the Unix/x86 target's environment to use the latest
available LTS version of Ubuntu Linux (24.04).

Since the new OS updated some key components used in the CI build
process, a few modifications have been made to the setup and build
procedure.  The new OS introduces a CPython version that is known to not
be compatible with a subset of settrace tests, so even though the OS is
updated, an older version of CPython is installed as part of the image
provisioning process.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit changes the way native modules' trampoline code sequence is
emitted, generating an optimised code sequence to jump to the entry
symbol.

Turns out the address of the entry point is known even before the
segments are built and the address of the entry point doesn't change
when processing the module on anything but Xtensa.  This means that the
jump trampoline doesn't have to be a dummy fixed-size block to be filled
in later, but it can be the final trampoline being used in the module.

On Xtensa the address of the symbol is offset by the length of the
literals pool, but since the trampoline being generated is always the
shortest one said platform is left alone (handling distances greater than
128KiB would require more extensive changes).

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets "tools/mpy_ld.py" store architecture flags in generated
MPY files if explicitly requested, like "mpy-cross" does.

To achieve this, a new command-line option ("--arch-flags") was added to
receive the architecture flags value, accepting the same arguments'
format as "mpy-cross", and performing the same input validation.

The rest of the MPY toolchain was also modified to let the user pass the
arch flags to standard native module makefiles.  Given that there's
already a well-established "ARCH" argument, "ARCH_FLAGS" was chosen to
pass the optional flags to "mpy_ld.py".

Finally, documentation was updated to mention the new variable.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Damien George <damien@micropython.org>
"MicroPython" is sometimes misspelled as "Micropython".  Add an explicit
check for that as part of CI (note that codespell doesn't consider case
when spelling, hence the need to do it this way).

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
SPIRAM usually uses GPIO 9 and 10 on ESP32, so don't use them as default
UART pins.

Fixes issue #18544.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Elvis Pfutzenreuter <elvis.pfutzenreuter@gmail.com>
The main functional change here is to make sure that the SDMMC1/2 clocks
are enabled in low power mode; they were not previously enabled for SD card
use, only WLAN.  It doesn't hurt to unconditionally enable the clocks in
low power, like all the other peripherals.

Signed-off-by: Damien George <damien@micropython.org>
This doubles the speed of SD card transfers.

Signed-off-by: Damien George <damien@micropython.org>
And fix typo in the usage string of plli2svalues.py.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
The existing linker script for F412 is renamed to separate F412xG (with
1MB RAM) from F412xE (with 512K).

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Configuration:
- Clock is 8MHz from STLINK MCO, CPU runs at 400MHz
- REPL on USB and on UART connected to ST-Link interface
- Storage is configured for internal flash memory
- 3x LEDs and 1x user button
- Ethernet

Product page:
https://www.st.com/en/evaluation-tools/nucleo-h753zi.html

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
To connect STM32H7 that is in SLEEPD1 state (e.g. during REPL)
debuggers like st-flash or openocd must assert SRST.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
STM32CubeMX shows a conflict of UART5 with ETH MII.
However UART1 can be used with TX and RX on the pin headers.

PLL1Q is reduced from 200 to 100 MHz because it may be used for FDCAN
or SDMMC. FDCAN needs <= 150 MHz, and 100 MHz is enough for an SDCard
connected to pin headers to work reliably.

Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
projectgus and others added 30 commits March 19, 2026 09:37
Closes #18922

Signed-off-by: Angus Gratton <angus@redyak.com.au>
The function arguments mean totally different things for Classic vs FDCAN
hardware, but the argument name wasn't particularly clear for either.

This commit shouldn't really change the binary firmware at all.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Simplifies the pattern of an optional arg which can be a list of at
least a certain length, otherwise one is lazily initialised.

Modify pyb.CAN and ESP-NOW APIs to use the helper. Note this changes
the return type of pyb.CAN.recv() from tuple to list.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
API is different to the original machine.CAN proposal, as numerous
shortcomings were found during initial implementation.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
These are oddly missing from the STM32G4 HAL, but the
reference manual describes being able to use them and
the implementations seem to work as expected.

Note that unlike STM32H7 it doesn't seem like we must use this approach,
because HAL_FDCAN_AddMessageToTxFifoQ() does seem to not have the issues
with priority inversion seen on the H7. However it's simpler to use the
same API for both...

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Implemented according to API docs in a parent comment.

Adds new multi_extmod/machine_can_* tests which pass when testing between
NUCLEO_G474RE, NUCLEO_H723ZG and PYBDV11.

This work was mostly funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
The DAR register field is for auto-retransmit, FDCAN doesn't support
automatic restart to clear Bus Off.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Some MCUs (eg N6) have more timers which are 32-bit, and it's best to use
this macro to work that out.

Signed-off-by: Damien George <damien@micropython.org>
This functionality already exists in the TIM code, and can be reused by the
upcoming PWM implementation.

Signed-off-by: Damien George <damien@micropython.org>
This commit implements the standard `machine.PWM` class on stm32, using the
common bindings in `extmod/machine_pwm.c`.  Features implemented are:
- construct a PWM object from a pin, with automatic selection of TIM
  instance and channel;
- get and set freq, duty_u16 and duty_ns;
- optionally invert the output.

The PWM objects are static objects (partly in ROM, partly in RAM) so
creating a PWM instance on the same pin will return exactly the same
object.  That's consistent with other peripherals in the stm32 port, and
consistent with other PWM implementations (eg rp2).

When creating a PWM object on a pin, if that pin has multiple TIM instances
then only the first will be selected.  A future extension could allow
selecting the TIM/channel (eg similar to how ADCBlock allows selecting an
ADC).

Signed-off-by: Damien George <damien@micropython.org>
When assigning a TIMx_CHy to a pin, the second available alternate function
is chosen (or the first if there is only one).  This gives better overall
static allocation of TIM's to pins.

On most MCUs (eg F4, F7, H5, H7) picking the second gives TIM5_CH[1-4] for
PA0-PA3, and TIM5 is a 32-bit timer.  That leaves TIM2 (also usually on
PA0-PA3) for other pins that only have TIM2.

For STM32G0, STM32L432 and STM32L452 the heuristic is to simply use the
first available alternate function because that gives TIM2 (a 32-bit timer)
on PA0-PA3.

The above heuristic guarantees that PA0-PA3 always get a 32-bit timer on
all supported MCUs.

Signed-off-by: Damien George <damien@micropython.org>
To be slightly more accurate computing the expected low/high times for the
PWM output.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
This allows the newly-added `machine.PWM` class to fit on these boards,
which is arguably more useful than the features disabled in this commit.

Signed-off-by: Damien George <damien@micropython.org>
So that TIM2_CH1 can be used.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Intended to catch problems where new features don't build
in old ESP-IDF.

Includes major refactor to the GitHub Actions Workflow for
esp32 port, including making a reusable workflow for both
Code Size and ESP32 build jobs.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Damien George <damien@micropython.org>
This commit updates the listed limitations of the native emitter in the
documentation related to how to increase speed of python code.

Context managers are supported, as in functions marked as native can use
the `with` statement in regular code.  Generators can be used in native
functions both on the emitting (ie. `yield <whatever>`) and on the
receiving end.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes an issue related to the NimBLE initialisation
procedure in low memory environments on ESP32 boards.

MicroPython uses at least two different NimBLE stacks across the
supported ports, mynewt (imported as an external library), and the one
provided by Espressif in their own SDKs.  The problem is that these two
ports differ in the signature for `nimble_port_init(void)`, with mynewt
returning `void`, and Espressif's returning a status code on failure.

On ESP32 boards, allocating almost all the available heap and then
turning on the Bluetooth stack would trigger a failure in the NimBLE
initialisation function that is not handled by the NimBLE integration
code, as there's no expectation of a recoverable condition.  Since the
stack initialisation would progress, then uninitialised memory accesses
crash the board.

Since we cannot really modify neither mynewt nor Espressif SDKs, the
next best thing is to provide two conditional initialisation paths
depending on a configuration setting.  This would make Espressif ports
recover from a failed initialisation whilst retaining the existing
behaviour on other ports.

This fixes #14293.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Because socket objects have a finaliser they must be created carefully, in
case an exception is raised during the population of their members, eg
invalid input argument or out-of-memory when allocating additional arrays.

Prior to the fix in this commit, the finaliser would crash due to
`incoming.udp_raw.array` being an invalid pointer in the following cases:
- if a SOCK_RAW was created with a proto argument that was not an integer
- if a SOCK_DGRAM or SOCK_RAW was created where the allocation of
  `lwip_incoming_packet_t` failed
- if an integer was passed in for the socket type but it was not one of
  SOCK_STREAM, SOCK_DGRAM or SOCK_RAW

Furthermore, if the allocation of `lwip_incoming_packet_t` failed then it
may have led to corruption within lwIP when freeing `socket->pcb.raw`
because that PCB was not fully set up with its callbacks.

This commit fixes all of these issues by ensuring:
- `pcb.tcp` and `incoming.udp_raw.array` are initialised to NULL early on
- the proto argument is parsed before allocating the PCB
- the allocation of `lwip_incoming_packet_t` occurs befor allocating the
  PCB
- `incoming.udp_raw.array` is checked for NULL in the finaliser code

The corresponding test (which already checked most of these causes of
failure) has been updated to include a previously-uncovered scenario.

Signed-off-by: Damien George <damien@micropython.org>
User callbacks allow code to respond to incoming messages without blocking
or polling.  User callbacks are optional, and if no callback is registered
the code has no effect.

The mechanism is the same as for TCP: when a connection is accepted or a
TCP packet is received, a user callback is executed.

Fixes issue #3594.

Signed-off-by: Jack Whitham <jack.d.whitham@gmail.com>
Add DMA, NPU and PDM IRQ priorities to irq.h.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2.25k Seems necessary so it doesn't crash `thread/thread_stacksize1.py`.
But 2.5k gives a little extra headroom to make that test actually pass.

Signed-off-by: Damien George <damien@micropython.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.