Skip to content

Conversation

@maxpromer
Copy link
Member

No description provided.

@iPAS
Copy link

iPAS commented Aug 22, 2024

The current version (before the incoming merge) has a bug while trying to compile ports/unix.
I guess this is because of this repo is lacking behind the original which has changed the directory name from 'lib' -> 'extmod', so that AXTLS library includes a file from the wrong path.

I have to edit the code of the AXTLS library:

-------------------------- ssl/os_port_micropython.h --------------------------
index 88697f2..7d10cd9 100644
@@ -75,7 +75,7 @@ extern int mp_stream_errno;

#define TTY_FLUSH()

-#include "../../../extmod/crypto-algorithms/sha256.h"
+#include "../../../lib/crypto-algorithms/sha256.h"

#define SHA256_CTX CRYAL_SHA256_CTX
#define SHA256_Init(a) sha256_init(a)

dpgeorge and others added 29 commits October 20, 2025 11:18
This makes sure that `open()` raises `OSError(ENOENT)` if the test script
attempts to open a file that does not exist.

For example, the test `tests/ports/esp32/check_err_str.py` attempts to do
this and this test currently fails when run with `--via-mpy` because the
injected filesystem lets a file by any name be opened.

The fix here tries to be as minimal as possible, so includes a size
optimisation for `stat()` to use a fixed 10-tuple.  It also fixes the
`OSError` argument, which should be positive.

Signed-off-by: Damien George <damien@micropython.org>
The main reason for moving this test is that it needs internet connection
to pass.  So putting it in `net_inet` makes sure it's alongside other tests
that need the internet.

Also, it's a general test that could eventually run on other ports, if/when
they support doing an address resolution as part of `socket.connect()`.

Signed-off-by: Damien George <damien@micropython.org>
This makes it clear what this test is expected to return/do.

Signed-off-by: Damien George <damien@micropython.org>
These tests cannot run with axTLS, eg on esp8266.

Signed-off-by: Damien George <damien@micropython.org>
This test is very specific to mbedTLS and how it raises errors when the
heap is locked.

Signed-off-by: Damien George <damien@micropython.org>
axTLS will print a warning, and the added .exp file will skip that line.

Signed-off-by: Damien George <damien@micropython.org>
axTLS does not implement the `verify_callback` attribute.

Signed-off-by: Damien George <damien@micropython.org>
If `time.time` doesn't exist, it tries to use `globals()['time']` which is
the time module itself, and that causes the test to fail.  Instead it
should just skip `time.time`.

Signed-off-by: Damien George <damien@micropython.org>
This moves the `port:<dev>` check for the test instance to the
`convert_device_shortcut_to_real_device()` helper function, which means
that `run-multitests.py` can use this specification.

Signed-off-by: Damien George <damien@micropython.org>
The zephyr port doesn't have a Makefile so can't run `make submodules`.
Instead they must be explicitly initialized.

Signed-off-by: Damien George <damien@micropython.org>
Existing C code in `main.c` only mounts a flash filesystem if one exists,
and doesn't do anything if the 'storage' partition is not formatted.

This commit moves the mounting logic from `main.c` to frozen code using
`modules/_boot.py` and adds the formatting of a previously unformatted
partition if the mount fails.

Every available disk (in the newly added `DiskAccess.disks` tuple) will be
mounted on separate mount points (if they're formatted), and the 'storage'
flash partition (if any) will be mounted on /flash (and will be formatted
as LFS2 if necessary).

Also, `sys.path` will be updated with appropriate 'lib' subdirectories for
each mounted filesystem.

The current working directory will be changed to the last `DiskAccess.disk`
mounted, or to /flash if no disks were mounted.

Then `boot.py` and `main.py` will be executed from the current working
directory if they exist.

Thanks to @VynDragon for the logic in `zephyr/zephyr_storage.c`.

Signed-off-by: Ned Konz <ned@metamagix.tech>
This commit changes the values in the `FlashArea.areas` dictionary from
simple integer IDs to (ID, erase-block-size) tuples.

`_boot.py` was changed to use the newly available erase block size.

Signed-off-by: Ned Konz <ned@metamagix.tech>
This commit adds Zephyr support for the XIAO BLE NRF52840 SENSE board from
Seeed Studio.

It also provides a good example of a richer Zephyr port than the default,
adding:
- Frozen modules (including asyncio, upysh, aioble and aiorepl).
- Enough MicroPython features to support using aioble (at least for the
  `temp_sensor.py` example).
- JSON, random, re, struct, etc.

Signed-off-by: Ned Konz <ned@metamagix.tech>
This board has plenty of RAM, flash, and peripherals, including Ethernet.
It also has a microSD slot, which also works.

Access to the REPL is via UART1, which is available via the DAPLink
connector J23.

Signed-off-by: Ned Konz <ned@metamagix.tech>
MicroPython has quite a few ports now (20 of them), but not all are in the
same stage of development.  This commit attempts to define port Tier levels
and assign a Tier to each of the existing ports.

The main aim here is to set expectations for the level of support and
development each port gets.  And also lower the bar of entry for new ports
so they can enter at a low Tier and gradually rise up to Tier 1.

See prior art here:
- https://peps.python.org/pep-0011/
- https://doc.rust-lang.org/rustc/target-tier-policy.html
- https://docs.zephyrproject.org/latest/project/release_process.html#hardware-support-tiers

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Assuming proper C99 language support, we can select "the int type as big as
a pointer" (most of the time) or "the 64-bit int type" (nanboxing with
REPR_D), and then define everything else automatically.

This simplifies port configuration files.  And the types can still be
overridden if needed.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This is the case in arm-none-eabi-gcc 14.2.1 (debian trixie).

This fixes a diagnostic like:

    ../../lib/libm_dbl/libm.h:92:9: error:
        "DBL_EPSILON" redefined [-Werror]
    /usr/lib/gcc/arm-none-eabi/14.2.1/include/float.h:114:9: note:
        this is the location of the previous definition

when building MPS2_AN500 (qemu port).

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This will show a line for both the reference and comparison, e.g.,

    Reference:  zephyr/boards: Add PocketBeagle 2 rev A1… [00a926e]
    Comparison: metrics: Tersely show the commi… [merge of c7ac411]

When the comparison is a merge commit (as it is during CI) the second
parent of that commit is shown instead.

This will be helpful when checking which revision of the code size report
comment on a PR corresponds to which revision of the code.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
Now the default reference commit is the first parent of the selected
commit, instead of the first parent of HEAD.

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This makes the version string consistent with the one used in code, see
commit 9e89c75.

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
So it can be used for polling.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Using the newly added `uart_rx_any()` and system ticks functions.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This is a Cortex-M55 board.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
robert-hh and others added 30 commits January 2, 2026 14:48
The default size for the ROM partition is 256k, and it is placed in flash
between the text and writable vfs sections.  Its size can be changed in
`mpconfigboard.mk` by defining `MICROPY_HW_ROMFS_BYTES` to a different
value, but it must not be smaller than a single sector.

The MIMXRT1170_EVK and SEEED ARCH MIX ROMFS boards use a larger size of
512kB.  ROMFS support is disabled for MIMXRT1050_EVKB due to issues with
Hyperflash.

The extents of the ROM partition are defined by the linker-level symbols
`_micropy_hw_romfs_part0_start` and `_micropy_hw_romfs_part0_size`,
following existing ports.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
The flash driver is update to support the new `mp_vfs_rom_ioctl()`
function, and the buffer protocol is added to `samd_flash_type` (it is
needed for VfsRom on devices without external flash).

For SAMD21, only boards with external SPI flash have VfsRom enabled, due
to size constraints.  For such boards, the VfsRom filesystem has a size of
12k and is placed at the upper end of the flash.  The `onewire`, `ds18x20`
and `dht` drivers have been removed from frozen bytecode as they can be
placed into the VfsRom files when needed.

For SAMD51, the VfsRom filesystem has a default size of 64k for SAMD51x19
and 256K for SAMD51x20.  It is placed at the upper end of the flash.
For boards with external SPI flash, the code size is reduced from 496K to
432K.  If that is not sufficient for some boards or configurations, it can
be changed for each board or board variant.

Tested with ADAFRUIT_ITSYBITSY_M0_EXPRESS, ADAFRUIT_ITSYBITSY_M4_EXPRESS,
SPARKFUN_SAMD51_THING_PLUS, SEEED_XIAO_SAMD21, SAMD_GENERIC_D51X19, and
SAMD_GENERIC_D51X20.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
The ROM partition is taken from the last part of the flash text section, so
the existing writable filesystem is untouched.  VfsRom file system sizes:
- EK_RA4M1: 12K
- RA4M1_CLICKER: 12k
- EK_RA4W1: 64k
- EK_RA6M1: 64k
- EK_RA6M2: 256k
- VK_RA6M5: 384k
- ARDUINO_PORTENTA_C33: 256k

Tested with Weact RA4M1 core board with EK_RA4M1 firmware and EK_RA6M2.

Signed-off-by: robert-hh <robert@hammelrath.com>
Signed-off-by: Damien George <damien@micropython.org>
The implementation uses the object based capabilities, which avoids
complication about different flash block sizes.  The ROM partition is
placed between the text and writable filesystem sections, and the latter
size is unchanged.  VfsRom sizes are:
- NRF51x22: 12K
- NRF52832: 128K
- NRF52840: 256K
- NRF9160:  256K

Use frozen `_boot.py` to set up and mount the filesystem, replacing a mix
of C-Code and Python code.  The mkfs part has been simplified to save code.

Tested with Microbit and Arduino Nano Connect.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: robert-hh <robert@hammelrath.com>
This commit performs a minor change to the "pin_af_t" structure,
changing the data type used to store alternate function pin name QSTRs
in order to have a smaller impact on the .rodata section of the
firmware.

The data type used to store the QSTR name of the pin is changed from
"qstr" to "qstr_short_t", that is able to store the same name string
index but in half the size.

Other pin-related structures in the port that also store QSTRs do not
benefit from a narrower data type, as their members are mostly
word-aligned and thus the linker is forced to insert padding bytes
between entries.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit performs a few minor changes to the structures used to store
board pin information, in order to reduce the impact on the .rodata
section of the firmware of instances of those structures.

The data type used to store the QSTR name of alternate function pins
("machine_pin_af_obj_t") is changed from "qstr" to "qstr_short_t", that
is able to store the same name string index but in half the size.

Regular pin objects structure ("machine_pin_obj_t") instead has its QSTR
variable holder changed from "qstr" to "qstr_short_t", and some elements
of that structure have been rearranged to remove enough padding bytes
inside structure elements to let the linker allocate less data for
instances of that structure.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit performs a few minor changes to the structures used to store
board pin information, in order to reduce the impact on the .rodata
section of the firmware of instances of those structures.

The pin objects structure ("machine_pin_obj_t") instead has its QSTR
variable holder changed from "qstr" to "qstr_short_t", and some elements
of that structure have been rearranged to remove enough padding bytes
inside structure elements to let the linker allocate less data for
instances of that structure.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit performs a few minor changes to the structures used to store
board pin information, in order to reduce the impact on the .rodata
section of the firmware of instances of those structures.

The data type used to store the QSTR name of both regular and alternate
function pins ("machine_pin_obj_t" and "machine_pin_af_obj_t") is changed
from "qstr" to "qstr_short_t", that is able to store the same name string
index but in half the size.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit performs a few minor changes to the structures used to store
board pin information, in order to reduce the impact on the .rodata
section of the firmware of instances of those structures.

The pin objects structure ("machine_pin_obj_t") instead has its QSTR
variable holder changed from "qstr" to "qstr_short_t", and some elements
of that structure have been rearranged to remove enough padding bytes
inside structure elements to let the linker allocate less data for
instances of that structure.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit performs a few minor changes to the structures used to store
board pin information, in order to reduce the impact on the .rodata
section of the firmware of instances of those structures.

The "pin_obj_t" structure, holding pin information, had an unused
word-sized field ("pull") that isn't used by any of the board
definitions, yet it takes up space in each pin structure being compiled
in the final firmware image.

Images for all available boards were built successfully with this
change, so there should be no unwanted issues arising from shrinking
that structure.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit reworks the setup procedure for the OpenAMP trace buffer,
used by the libmetal framework to provide cross-core logging data if
needed.

Before these changes, the buffer was provided by MicroPython, as a fixed
size 128 bytes chunk that was accidentally put into the .rodata section,
making it not usable for its intended purpose.

Now, a buffer placed in .bss with a default size of 128 bytes is
provided by MicroPython unless chosen otherwise.  A user-chosen buffer
pointer can be provided to MicroPython using the
MICROPY_PY_OPENAMP_TRACE_BUF preprocessor definition.  If what
MicroPython provides by default is fine, the buffer size can be
overridden with a new value for the MICROPY_PY_OPENAMP_TRACE_BUF_LEN
preprocessor definition instead.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds byte-swapping macros for 16-, 32-, and 64-bit values.

Modern compilers are usually able to detect manual byte/endian swaps and
will generate optimised code sequences if they know how to do that.
However, in certain situations it may be helpful to let the compiler
generate an optimised sequence if it doesn't recognise the pattern.

Most compilers provide built-in byte swap operations for 16, 32, and 64
bit values, accessed via "__builtin_bswap<size>", but if those are not
available a fallback implementation is provided.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes a build issue occurring on systems where the Python
3.x interpreter isn't aliased to 'python' but has a different name
(usually `python3').

The main Linux distribution where this occurs is Ubuntu LTS, where the
Python 3.x interpreter is available as 'python3' since at least two
major versions (so since about five years now).  MicroPython's makefile
environment setup file ('py/mkenv.mk') already defines a variable called
'$(PYTHON)' that defaults to 'python3', so the Makefile was updated to
use that instead of hardcoding the interpreter name.  Without these
changes, building a firmware image on Ubuntu LTS fails with this error:

make: python: No such file or directory
make: *** [Makefile:95: build-ALIF_ENSEMBLE/firmware.toc.bin] Error 127

This also allows overriding the interpreter name to something else if
there's the need to perform tests with different interpreter versions or
the like.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit modifies the Alif port's Makefile to propagate to child make
tasks the number of parallel jobs to run.

On Ubuntu LTS 24.04, building the Alif port passing a parallel jobs
number to make's command line will result in the command emitting this
warning:

make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent
                  make rule.

And building the two cores' firmware images using one compile job at a
time instead of the number provided to the command line.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
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>
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.