Commit Graph

18322 Commits

Author SHA1 Message Date
dependabot[bot] 5e3474236b build(deps): bump actions/github-script from 8 to 9
Bumps [actions/github-script](https://github.com/actions/github-script) from 8 to 9.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-10 19:14:14 +00:00
dependabot[bot] 8c6dfa5bd4 github/workflows: Bump codecov/codecov-action from 5 to 6.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v142, dev, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v142, standard, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v143, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v142, dev, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v142, standard, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v143, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5 to 6.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 11:52:31 +10:00
dependabot[bot] ba28b8f231 github/workflows: Bump microsoft/setup-msbuild from 2 to 3.
Bumps [microsoft/setup-msbuild](https://github.com/microsoft/setup-msbuild) from 2 to 3.
- [Release notes](https://github.com/microsoft/setup-msbuild/releases)
- [Commits](https://github.com/microsoft/setup-msbuild/compare/v2...v3)

---
updated-dependencies:
- dependency-name: microsoft/setup-msbuild
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-09 11:46:21 +10:00
Angus Gratton b0d2072114 github: Ignore codecov upload failure on forks with no token set.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, x64, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v142, dev, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v142, standard, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, v143, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v142, dev, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v142, standard, 2019, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v143, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, v143, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
If you enable Actions on your fork of MicroPython then it consistently
fails the Coverage Upload step (unless you set a codecov token in your
fork).  This means you get a failure email each time you push to your own
repo.

This commit fixes that.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2026-04-08 23:24:50 +10:00
Angus Gratton da0149f629 github: Improve error on "Build mpremote wheel" if fork is missing tags.
Avoids a vague error from the 'vcs' versioning scheme if recent tags
haven't been pushed to the fork.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2026-04-08 23:23:18 +10:00
Andrew Leech 295df7c0b4 github/workflows: Drop VS2017, use preinstalled v142 toolset for VS2019.
The VS 2017 and VS 2019 MSVC CI jobs have been failing intermittently for
months due to Chocolatey/Microsoft installer infrastructure issues when
downloading old Visual Studio build tools onto windows-latest runners.
These are not code failures - the build tools installation itself is
unreliable (CDN timeouts, corrupt downloads, installer self-update loops).

This removes VS 2017 from the matrix entirely and switches VS 2019 to use
the v142 toolset that's already pre-installed on windows-2022 runners as a
component of VS 2022.  The PlatformToolset is now passed explicitly to
MSBuild for both VS 2019 (v142) and VS 2022 (v143), and the Chocolatey
installation step is removed.

VS 2017 reached end-of-life in 2022, and the v141 toolset is no longer
reliably installable on GitHub-hosted runners (actions/runner-images#9701,
actions/runner-images#12764).  The windows-2019 runner image was removed in
June 2025.  Docker containers are not supported on Windows runners, and the
repo's 10GB Actions cache is already full, so caching the installation
isn't feasible either.  MSVC v143 is binary-compatible back to v141, so the
testing value of v141 was marginal.

The net effect is 16 MSVC jobs (down from 24) with zero installation steps
and hopefully no more flaky failures.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2026-04-08 22:49:04 +10:00
Dryw Wade f456a23b62 esp32/machine_pin: Make all pins on ESP32-P4 output capable.
All GPIO pins on the ESP32-P4 are output capable, so there is no need to
define GPIO_FIRST_NON_OUTPUT.

Fixes #18982.

Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
2026-04-08 22:44:03 +10:00
Alessandro Gatti 2f16bf430a esp32/network_wlan: Look up IP addresses for the stations list.
This commit extends the output of `WLAN.status('stations')` to also
include the IP address of WiFi stations connected to the device if in AP
mode.

IP address lookup is currently not available on targets that use hosted
WiFi (eg. ESP32P4), as the hosted API does not yet support performing
the MAC->IP lookup on the WiFi MCU end.

The ESP32 port is brought up to parity with most ports in this regard
(primarily with the ESP8266).  This functionality depends on the DHCP
server provided by ESP-IDF, which is automatically run on the WiFi
interface if the device is put in AP mode.  Currently the ESP32 port
cannot run with said DHCP server disabled, so if a device does not
request a static IP it may either have the wrong IP address returned
(since the DHCP server assigned an address which is then discarded by
the client), or it won't have any (ie. "0.0.0.0").  In the latter case
`None` will be returned as the station's address instead.

This implements #9203.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2026-04-08 22:04:55 +10:00
Dryw Wade e57e522182 esp32/machine_sdcard: Make default SDMMC slot configurable.
Resolves part of #18984.  On ESP32-P4, SDMMC slot 0 supports SDIO 3.0, and
is liekly the default for most boards.  MICROPY_HW_SDMMC_DEFAULT_SLOT can
be set in `mpconfigboard.h` to change default slot.

Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
2026-04-08 21:55:56 +10:00
Pierre Gaufillet 71d2314164 esp32/boards/LILYGO_T3_S3: Add LILYGO T3-S3 board definition.
ESP32-S3FH4R2 with SX1262 LoRa (HPD17A), SSD1306 OLED, SD card.
Freezes lora-sx126x and ssd1306 from micropython-lib.

Signed-off-by: Pierre Gaufillet <pierre.gaufillet@bergamote.eu>
2026-04-08 21:47:09 +10:00
Alessandro Gatti 024178455d unix/modsocket: Add "sendall" method to socket class.
This commit adds an implementation for "socket.sendall" to the Unix
port.

Right now the implementation is a wrapper over a single "socket.send"
call, since it wasn't possible to let "socket.send" perform a partial
transfer.  With no partial transfers it is not possible to have a
testable implementation following the expected behaviour, so a single
send operation is done and OSErr(EINTR) is raised if a partial transfer
occurs.

The discussion for the issue linked to this PR contains more information
about the efforts made to let partial transfers happen.

This fixes #16803.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2026-04-08 19:20:51 +10:00
Damien George a91910cd73 py/persistentcode: Use MP_ENCODE_UINT_MAX_BYTES instead of custom macro.
MP_ENCODE_UINT_MAX_BYTES has an equivalent value to BYTES_FOR_INT and the
former is used in other locations to encode variable (u)int values.

Signed-off-by: Damien George <damien@micropython.org>
2026-04-08 19:14:42 +10:00
Anson Mansfield 8af714e5b9 py/obj: Explicitly cast slot initializer values to (const void *).
This resolves an issue compiling with IAR, where an implicit cast from a
function pointer to a void pointer is disallowed.

Based on comments from @hammondeggs in the MicroPython discord:
https://discord.com/channels/574275045187125269/1012726673709469818/1423683501374308392

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2026-04-08 18:23:53 +10:00
Anson Mansfield e274a38e0f py/obj: Enforce slot function signatures at compile time.
By explicitly casting each slot to its slot type, this will ensure that
a compiler diagnostic is generated when MP_DEFINE_CONST_OBJ_TYPE is
invoked with a slot function with the incorrect signature.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2026-04-08 18:23:53 +10:00
Anson Mansfield 483715dc72 py/obj: Reorganize slot access macros to put with slot definitions.
i.e. rather than having them just arbitrarily between the generated
macros for the define macro and the other macros in that suite.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2026-04-08 18:23:53 +10:00
Anson Mansfield 8223287f24 py/obj: Eliminate trailing comma from MP_DEFINE_CONST_OBJ_TYPE_NARGS.
This is mostly to simplify and make the associated code-gen logic easier
to modify, by inserting the comma in the "obvious" place as part of the
`.join` rather than as part of the element template.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2026-04-08 18:23:53 +10:00
Anson Mansfield f89112dba7 py/obj: Refactor MP_DEFINE_CONST_OBJ_TYPE_NARGS script for readability.
This is a comment-only change. The edited script produces exactly the
same output as the original, just in a way that will allow more minimal
diffs to modify it.

Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
2026-04-08 18:23:53 +10:00
Alessandro Gatti 41137f0526 py/parse: Recognise const assignments with type hints.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
This commit extends the parser's behaviour to also recognise constant
integer assignments even when the assignment itself has a type
annotation.

Now declarations like "var: int = const(val)" can be treated as
constants by the compiler and thus be folded in the rest of the program
as it sees fit.  Before this change, that line would generate a variable
creation and its value assignment, without any folding being performed.

This fixes #15608.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2026-04-08 17:22:38 +10:00
Andrew Leech 18735dde3b tests/ports/unix: Add tests for m_tracked_realloc.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2026-04-08 17:02:01 +10:00
Andrew Leech dc0b2c7f57 py/malloc: Add m_tracked_realloc.
Add realloc support to the tracked allocation API, using an alloc-copy-free
approach for simplicity and thread safety.  This function compliments the
existing `m_tracked_calloc()` and `m_tracked_free()` functions.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2026-04-08 17:01:10 +10:00
Kwabena W. Agyeman 501b0e6bab alif/tinyusb_port: Fix _xfer_trb cache alignment.
TRB buffers, which are the target of cache clean/invalidate actions, were
not cache-aligned between buffers.  Reported the problem to Alif, and
adding padding to them is the proper fix.  Appears to work without any
other changes in device behavior.

Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
2026-04-08 16:24:55 +10:00
iabdalkader ed463edb36 qemu/boards/MPS2_AN500: Configure and enable ROMFS.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Using the last 2MBs of PSRAM.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2026-04-07 17:28:02 +10:00
iabdalkader a22d9da0a3 qemu/boards/MPS3_AN547: Configure and enable ROMFS.
Uses DDR address space.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2026-04-07 17:27:57 +10:00
iabdalkader 6b2488f1d6 qemu: Add basic ROMFS support.
This commit adds basic ROMFS support.  This helps with running tests since
mpremote mount is too slow with big files.

To be configured per-board, and then run with:

    $ make QEMU_ROMFS_IMG0=image.romfs ...

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2026-04-07 17:25:41 +10:00
Daniël van de Giessen e8992ebc78 esp32/machine_uart: Allow passing -1 to specify pin will be unused.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2026-04-07 15:08:21 +10:00
Daniël van de Giessen b6bc2d473c esp32/adc: Raise error if ADC read result is invalid.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2026-04-07 14:57:36 +10:00
Jeff Epler e29bcdcb7b tests/cpydiff: Add test file for annotation expressions.
Document the behavior on expression annotations rejected by CPython but
accepted by MicroPython.

Closes issue #19031.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2026-04-07 14:45:09 +10:00
Weixie Cui c3b3f201c4 py/objint: Fix comment for true operand in binary op extra cases.
The comment incorrectly said true acts as 0; the implementation passes
small int 1, matching Python bool semantics.

Signed-off-by: Weixie Cui <cuiweixie@gmail.com>
2026-04-07 14:15:05 +10:00
Andrew Leech 47fc0d5b81 docs/library: Document Pin.board and Pin.cpu attributes.
Add an Attributes section to the machine.Pin reference describing the
Pin.board and Pin.cpu class attributes, their purpose, availability
across ports, and their role in string-based pin name resolution.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2026-04-07 13:58:11 +10:00
Fin Maaß c16a484796 zephyr/machine_uart: Ignore return value of uart_irq_update.
For uart_irq_update() the allowed return values
are a negative errno or 1. 0 is not allowd.
Therefore ignore the return value.
Also the return type might soon be changed to void.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-04-07 13:41:15 +10:00
Jeff Epler 8abca6bacb py/objexcept: Use mp_obj_get_type_str when printing exception name.
Saves a few bytes of code.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2026-04-07 13:37:07 +10:00
Jeff Epler 4fe08ff16b all: Avoid qstr_str calls when printing a qstr.
The `%q` formatter of mp_printf can be used instead, and may save a small
amount of code.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2026-04-07 13:36:34 +10:00
Andrew Leech c20302dbb2 shared/netutils/dhcpserver: Set default DNS to the server address.
This sets the DHCP server's own IP address as the default DNS server
when no explicit DNS is configured, providing a more complete network
configuration for DHCP clients.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2026-04-07 13:33:32 +10:00
Damien George 367178fce7 all: Bump version to 1.29.0-preview.
Signed-off-by: Damien George <damien@micropython.org>
v1.29.0-preview
2026-04-07 13:07:26 +10:00
Damien George e0e9fbb17e all: Bump version to 1.28.0.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Signed-off-by: Damien George <damien@micropython.org>
v1.28.0
2026-04-06 23:12:49 +10:00
Damien George e8a3ee0342 esp32/esp32_common.cmake: Add missing C flags to user C module sources.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
On the esp32 port when adding a user C module, the source code for the user
C module was being compiled without certain C flags.  Notably the
optimisation flag was missing.

This commit fixes that by explicitly adding the missing C flags to the
compilation of user C modules.

The missing flags were the following, which are now included when building
user C modules (found by inspecting the generated CMake files when building
with ulab):

    -ffunction-sections
    -fdata-sections
    -Wall
    -Werror=all
    -Wno-error=unused-function
    -Wno-error=unused-variable
    -Wno-error=unused-but-set-variable
    -Wno-error=deprecated-declarations
    -Wextra
    -Wno-error=extra
    -Wno-unused-parameter
    -Wno-sign-compare
    -Wno-enum-conversion
    -gdwarf-4
    -ggdb
    -mdisable-hardware-atomics
    -O2
    -fmacro-prefix-map=micropython/ports/esp32=.
    -fmacro-prefix-map=espressif/esp-idf=/IDF
    -fstrict-volatile-bitfields
    -fno-jump-tables
    -fno-tree-switch-conversion

See related issue #18880.

Work done in collaboration with @andrewleech.

Signed-off-by: Damien George <damien@micropython.org>
2026-04-01 14:44:04 +11:00
Damien George d41b8dc52e py/emitglue: Fix macro logic that selects cache flushing code.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
This fixes a regression made by 9e9da6cb0d.

There are two issues here:

1. `MPY_FEATURE_ARCH` and `MP_NATIVE_ARCH_xxx` are not visible in this file
   because `py/persistentcode.h` is not included.

2. Even if they were visible the macro logic will not work because
   `MP_NATIVE_ARCH_xxx` are enum values and cannot be used in #if logic.

What this means is that the first #if is always true, so there is no cache
flushing on ARM (non-Thumb) or RISC-V targets.  This breaks native code on,
eg, ESP32-P4.

The fix here aims to simplify the logic by using built-in compiler defines
to select the target:

- On an ARM Thumb target with `__ICACHE_PRESENT` enabled, it will flush the
  cache.

- On an ARM (non-Thumb) target, it will prefer `__builtin___clear_cache()`
  if possible, otherwise it will use inline assembler.

- On a RISC-V target, it will use `MP_HAL_CLEAN_DCACHE()` if that macro is
  defined (that's only on ESP32-P4 at the moment).

The logic should be the same as before, except for the cases where an
emitter is enabled on a mismatching architecture.  For example, if
`MICROPY_EMIT_THUMB` and/or `MICROPY_EMIT_INLINE_THUMB` were enabled on a
non-Thumb target, previously that will try to generate code to flush caches
(which doesn't really make sense), but now it will not.  This actually
happened for `mpy-cross` which does enable all the emitters, and prior to
this fix would follow the Thumb path, but not generate any code because
`__ICACHE_PRESENT` is disabled (at least when building `mpy-cross` on x86).

Signed-off-by: Damien George <damien@micropython.org>
2026-03-31 00:03:10 +11:00
Matt Trentini 2dc2e30d98 esp32/boards/SEEED_XIAO_ESP32C6: Add new XIAO board definition.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
Signed-off-by: Matt Trentini <matthew.trentini@planetinnovation.com.au>
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2026-03-25 23:57:07 +11:00
Dryw Wade f4d2447174 esp32/boards/SPARKFUN_THINGPLUS_ESP32C5: Add SF Thing Plus ESP32-C5.
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
2026-03-25 23:55:21 +11:00
Matt Trentini ac48088749 rp2/boards/SEEED_XIAO_RP2040: Add XIAO RP2040 board definition.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2026-03-25 23:48:48 +11:00
Damien George 93201ff2d1 lib/cyw43-driver: Update driver to latest version v1.1.1.
Includes a fix to STA teardown to deinit tcpip and clear itf_state.

Signed-off-by: Damien George <damien@micropython.org>
2026-03-25 23:08:31 +11:00
Damien George bce854928d tests/feature_check/tstring.py: Remove check for string.templatelib.
If a port enables t-strings then it is required to have the
`string.templatelib` package (at least to run the tests).  That's
automatically the case if `MICROPY_PY_TSTRINGS` is enabled.

If a port freezes in the micropython-lib `string` extension package then
the latest version of this package will include the built-in
`string.templatelib` classes.  So the feature check for t-strings no longer
needs to check if they are available.

Signed-off-by: Damien George <damien@micropython.org>
2026-03-24 23:56:05 +11:00
Damien George 85e8f6189e lib/micropython-lib: Update submodule to latest.
This brings in:
- sdcard: Send stop bit after multi-block read/write
- sdcard: Compute CRC7 for all SPI commands
- sdcard: Add read/write speed test to sdtest
- lsm6dsox: Add pedometer support
- lsm6dsox: Add pedometer example code
- unix-ffi/re: Handle PCRE2_UNSET in group and groups methods
- unix-ffi/re: Add tests for empty string match in ffi regex
- unix-ffi/machine: Retrieve a unique identifier if one is known
- senml/docs: Correct capitalization of 'MicroPython'
- unix-ffi/_libc: Extend FreeBSD libc versions range
- string: Convert string module to package and import templatelib

Signed-off-by: Damien George <damien@micropython.org>
2026-03-24 23:38:44 +11:00
Damien George 5c00edcee2 tools/ci.sh: Increase qemu_arm test run timeout.
JavaScript code lint and formatting with Biome / eslint (push) Has been cancelled
Check code formatting / code-formatting (push) Has been cancelled
Check spelling with codespell / codespell (push) Has been cancelled
Build docs / build (push) Has been cancelled
Check examples / embedding (push) Has been cancelled
Package mpremote / build (push) Has been cancelled
.mpy file format and tools / test (push) Has been cancelled
Build ports metadata / build (push) Has been cancelled
alif port / build_alif (alif_ae3_build) (push) Has been cancelled
cc3200 port / build (push) Has been cancelled
esp32 port / build_idf (esp32_build_c2_c5_c6, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_cmod_spiram_s2, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_p4, v5.5.1) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.3) (push) Has been cancelled
esp32 port / build_idf (esp32_build_s3_c3, v5.5.1) (push) Has been cancelled
esp8266 port / build (push) Has been cancelled
mimxrt port / build (push) Has been cancelled
nrf port / build (push) Has been cancelled
powerpc port / build (push) Has been cancelled
qemu port / build_and_test_arm (bigendian) (push) Has been cancelled
qemu port / build_and_test_arm (sabrelite) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_hardfp) (push) Has been cancelled
qemu port / build_and_test_arm (thumb_softfp) (push) Has been cancelled
qemu port / build_and_test_rv32 (push) Has been cancelled
qemu port / build_and_test_rv64 (push) Has been cancelled
renesas-ra port / build_renesas_ra_board (push) Has been cancelled
rp2 port / build (push) Has been cancelled
samd port / build (push) Has been cancelled
stm32 port / build_stm32 (stm32_misc_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_nucleo_build) (push) Has been cancelled
stm32 port / build_stm32 (stm32_pyb_build) (push) Has been cancelled
unix port / minimal (push) Has been cancelled
unix port / reproducible (push) Has been cancelled
unix port / standard (push) Has been cancelled
unix port / standard_v2 (push) Has been cancelled
unix port / coverage (push) Has been cancelled
unix port / coverage_32bit (push) Has been cancelled
unix port / nanbox (push) Has been cancelled
unix port / longlong (push) Has been cancelled
unix port / float (push) Has been cancelled
unix port / gil_enabled (push) Has been cancelled
unix port / stackless_clang (push) Has been cancelled
unix port / float_clang (push) Has been cancelled
unix port / settrace_stackless (push) Has been cancelled
unix port / repr_b (push) Has been cancelled
unix port / macos (push) Has been cancelled
unix port / qemu_mips (push) Has been cancelled
unix port / qemu_arm (push) Has been cancelled
unix port / qemu_riscv64 (push) Has been cancelled
unix port / sanitize_address (push) Has been cancelled
unix port / sanitize_undefined (push) Has been cancelled
webassembly port / build (push) Has been cancelled
windows port / build-vs (Debug, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Debug, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Debug, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x64, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, dev, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2017, [15, 16)) (push) Has been cancelled
windows port / build-vs (Release, true, x86, standard, 2019, [16, 17)) (push) Has been cancelled
windows port / build-vs (Release, x64, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x64, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, dev, 2022, [17, 18)) (push) Has been cancelled
windows port / build-vs (Release, x86, standard, 2022, [17, 18)) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, dev) (push) Has been cancelled
windows port / build-mingw (i686, mingw32, standard) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, dev) (push) Has been cancelled
windows port / build-mingw (x86_64, mingw64, standard) (push) Has been cancelled
windows port / cross-build-on-linux (push) Has been cancelled
zephyr port / build (push) Has been cancelled
Python code lint and formatting with ruff / ruff (push) Has been cancelled
It takes longer now that weakref is enabled in the coverage build.

Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:19:28 +11:00
Damien George 44d8f70a8e docs/library/weakref: Add documentation for weakref module.
Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:19:28 +11:00
Damien George 6f96d260e6 webassembly/variants/pyscript: Enable weakref module and add tests.
The webassembly port needs some additional weakref tests due to the fact
that garbage collection only happens when Python execution finishes and
JavaScript resumes.

The `tests/ports/webassembly/heap_expand.py` expected output also needs to
be updated because the amount of GC heap got smaller (weakref WTB takes
some of the available RAM).

Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:13:26 +11:00
Damien George f83f363bb8 webassembly/Makefile: Add test//% target.
Following a69425b533, this is a convenient
way to run a subset of tests.

Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:06:07 +11:00
Damien George 2cca3481f2 tests/basics: Add test for weakref having exception in callback.
Needs a native exp file because native code doesn't print line numbers in
the traceback.

Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:06:05 +11:00
Damien George c91d09a00d tests/basics: Add tests for weakref.ref and weakref.finalize.
Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:06:01 +11:00
Damien George 74e945752b py/modweakref: Implement weakref module with ref and finalize classes.
This adds support for the standard `weakref` module, to make weak
references to Python objects and have callbacks for when an object is
reclaimed by the GC.

This feature was requested by PyScript, to allow control over the lifetime
of external proxy objects (distinct from JS<->Python proxies).

Addresses issue #646 (that's nearly a 12 year old issue!).

Functionality added here:
- `weakref.ref(object [, callback])` create a simple weak reference with
  optional callback to be called when the object is reclaimed by the GC
- `weakref.finalize(object, callback, /, *args, **kwargs)` create a
  finalize object that holds a weak reference to an object and allows more
  convenient callback usage and state change

The new module is enabled at the "everything" level.

The implementation aims to be as efficient as possible, by adding another
bit-per-block to the garbage collector, the WTB (weak table).  Similar to
the finalizer bit (FTB), if a GC block has its corresponding WTB bit set
then a weak reference to that block is held.  The details of that weak
reference are stored in a global map, `mp_weakref_map`, which maps weak
reference to ref/finalize objects, allowing the callbacks to be efficiently
found when the object is reclaimed.

With this feature enabled the overhead is:
- 1/128th of the available memory is used for the new WTB table (eg a 128k
  heap now needs an extra 1k for the WTB).
- Code size is increased.
- At garbage collection time, there is a small overhead to check if the
  collected objects had weak references.  This check is the same as the
  existing FTB finaliser scan, so shouldn't add much overhead.  If there
  are weak reference objects alive (ref/finalize objects) then additional
  time is taken to call the callbacks and do some accounting to clean up
  the used weak reference.

Signed-off-by: Damien George <damien@micropython.org>
2026-03-22 23:02:38 +11:00