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)

AJMansfield and others added 29 commits September 11, 2025 11:21
This commit documents and verifies the current absence of
`__init_subclass__` functionality, in anticipation of a possible future
PEP487 'metaclasses lite' patch.

The main `core_class_initsubclass.py` test verifies if the method is
automatically called, while the other three verify other orthogonal
properties it should have: if the method is an implicit classmethod; if
MicroPython supplies the base case for the usual recursive function body
the PEP encourages; and if kwargs inheritance parameters work correctly.

Signed-off-by: Anson Mansfield <[email protected]>
This adds the ability to expose CPU-specific features/extensions to
scripts when the `platform` module is compiled in, by implementing
`platform.processor()`.   Right now this is only available on
bare-metal RV32 and RV64.

Signed-off-by: Alessandro Gatti <[email protected]>
Do not try to read/write again after timeout happened once.

Fixes issue #17611.

Signed-off-by: robert-hh <[email protected]>
Before, it was ignored.  Tested with ESP32, ESP32S3, ESP32C6.

Signed-off-by: robert-hh <[email protected]>
Avoiding the double timeout when used with the UART class.
`stream.readinto1()` returns after the first timeout.

Fixes issue #17611.

Signed-off-by: robert-hh <[email protected]>
As suggested by @dpgeorge adding a `stream_write_generic()` function.

Tested the different write timeouts with a RP2 using flow control.  Tested
support of the additional arguments of `uart.write()`.

Signed-off-by: robert-hh <[email protected]>
The margin of 64 bytes is needed to get `micropython/extreme_exc.py` to
pass when run via-mpy.

Signed-off-by: Damien George <[email protected]>
Python 2.7 has been EOL since January 2020.

Ubuntu oldoldlts (Focal Fossa, 20.04) has Python 3.8.  Debian oldoldstable
(Buster, from 2019) has Python 3.7.  RHEL 8 (from 2019) has Python 3.6.

It's easier than ever to install a modern Python using uv.

Given this, it seems like a fine idea to drop Python 2.7 support.

Even though the build is not tested on Python as old as 3.3, I left
comments stating that "3.3+" is the baseline Python version.  However, it
might make sense to bump this to e.g., 3.10, the oldest Python 3 version
used during CI. Or, using uv or another method actually test on the oldest
Python interpreter that is desirable to support (uv goes back to Python 3.7
easily; in October 2025, the oldest supported Python interpreter version
will be 3.10)

Signed-off-by: Jeff Epler <[email protected]>
This commit adds tests to benchmark the performance of class instantiation.

Signed-off-by: Anson Mansfield <[email protected]>
This commit also includes a fix to the `var-6.2-instance-speciallookup.py`
test originally added by 82db5c8 / #16806, as the `__getattr__` method
actually does not trigger a class's special lookups flag as originally
believed.

Signed-off-by: Anson Mansfield <[email protected]>
This adds an internal_bench benchmark that benchmarks ordered map linear
scan cache performance.

Signed-off-by: Anson Mansfield <[email protected]>
Without this, the wy-alert block pushed all the content
to the right, making the locally built pages nearly illegible.

Signed-off-by: Jeff Epler <[email protected]>
This adds comments documentign the meaning of the type flag bits
`MP_TYPE_FLAG_IS_SUBCLASSED` and `MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS`,
for consistency with the comments added later on documenting the other
flags.

These flags were were originally made part of the public API in
c3450ef. This block of doc comments
was only added later on when `MP_TYPE_FLAG_EQ_NOT_REFLEXIVE`,
`MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE`, and `MP_TYPE_FLAG_EQ_HAS_NEQ_TEST`
were added in 9ec1caf.

Signed-off-by: Anson Mansfield <[email protected]>
MP_OBJ_SMALL_INT_VALUE would give erroneous results, such as assertion
failures in the coverage build and other oddities like:

    >>> s = socket.socket()
    >>> s.recv(3.14)
    MemoryError: memory allocation failed, allocating 4235896656 bytes

Signed-off-by: Jeff Epler <[email protected]>
These are convenience targets for running specific tests as a developer.
They are more useful that invoking run-tests directly as they take account
of the VARIANT= specified on the make command-line.

For instance, you can run all tests matching the regular expression "int"
with `make VARIANT=... test//int`.

The new targets are all documented in README.md.

Signed-off-by: Jeff Epler <[email protected]>
- Required for aarch64 zephyr port targets to build.
- Tested with PocketBeagle 2 [0] A53 cores.

[0]: https://docs.zephyrproject.org/latest/boards/beagle/pocketbeagle_2/doc/index.html

Signed-off-by: Ayush Singh <[email protected]>
The option '-s' (--diff-score) or '-m' (--diff-time) fails when the
specified result contains tests that was skipped or failed.

This patch ignores "skipped: " or "failed: " message.

Signed-off-by: Yuuki NAGAO <[email protected]>
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](actions/github-script@v7...v8)

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

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5...v6)

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

Signed-off-by: dependabot[bot] <[email protected]>
This makes it easier to run a sequence of ci steps locally.  A help message
is also provided.

Signed-off-by: Jeff Epler <[email protected]>
For NUCLEO-F401RE, FLASH_LATENCY_2 can be specified for flash latency
because it runs at 84MHz.

Signed-off-by: Yuuki NAGAO <[email protected]>
For NUCLEO-G474RE, FLASH_LATENCY_4 can be specified instead of
FLASH_LATENCY_8 because it runs at 170MHz.

Signed-off-by: Yuuki NAGAO <[email protected]>
For STM32G4, hardware I2C can implement same as STM32L4 for machine.I2C.
This commit makes to be able to use of hardware I2C in machine.I2C.

Tested on NUCLEO-G474RE.

Signed-off-by: Yuuki NAGAO <[email protected]>
iabdalkader and others added 30 commits October 24, 2025 17:31
Using the newly added `uart_rx_any()` and system ticks functions.

Signed-off-by: iabdalkader <[email protected]>
This is a Cortex-M55 board.

Signed-off-by: iabdalkader <[email protected]>
Setting RTS/DTR raises "Inappropriate ioctl for device" for pts devices.

Signed-off-by: iabdalkader <[email protected]>
This is consistent with the other ports (see py/mkrules.mk) and makes
more sense overall because it makes everything which is compiled use
the same flags; until now all compilation steps which ran before or in
absence of FreezeModules (e.g. qstr generation, compiling a single file
on the command line or in the IDE) would use different PP defs.  This
didn't happen to cause any issues apparently but it's just more
consistent/safer to not do that.

Signed-off-by: stijn <[email protected]>
32-bit floats are needed for object representation C.

Signed-off-by: iabdalkader <[email protected]>
STM32H7A3 has 2MB internal flash and each sector size is 8KB.

Signed-off-by: Yuuki NAGAO <[email protected]>
For STM32H7, the following macro's value are different by ADC's version:
* ADC_CAL_ADDRESS
* ADC_CAL1
* TEMPSENSOR_CAL2_ADDR

Using macros defined by HAL become less dependent on ADC's version.

Signed-off-by: Yuuki NAGAO <[email protected]>
STM32H7A3 uses PA11, PA12 to enable USB function via built-in USB OTG port
on NUCLEO board.

Signed-off-by: Yuuki NAGAO <[email protected]>
This change adds NUCLEO_H7A3ZI_Q Core Board support to the STM32 port.

NUCLEO_H7A3ZI_Q:
https://www.st.com/en/evaluation-tools/nucleo-h7a3zi-q.html

This board uses STM32H7A3ZI:
https://www.st.com/en/microcontrollers-microprocessors/stm32h7a3zi.html

Signed-off-by: Yuuki NAGAO <[email protected]>
This commit extends the MPY file format in a backwards-compatible way to
store an encoded form of architecture-specific flags that have been
specified in the "mpy-cross" command line, or that have been explicitly
set as part of a native emitter configuration.

The file format changes are as follows:

* The features byte, previously containing the target native
  architecture and the minor file format version, now claims bit 6 as a
  flag indicating the presence of an encoded architecture flags integer
* If architecture flags need to be stored, they are placed right after
  the MPY file header.

This means that properly-written MPY parsers, if encountering a MPY file
containing encoded architecture flags, should raise an error since no
architecture identifiers have been defined that make use of bits 6 and
7 in the referenced header byte.  This should give enough guarantees of
backwards compatibility when this feature is used (improper parsers were
subjected to breakage anyway).

The encoded architecture flags could have been placed at the end, but:

* Having them right after the header makes the architecture
  compatibility checks occur before having read the whole file in memory
  (which still happens on certain platforms as the reader may be backed
  by a memory buffer), and prevents eventual memory allocations that do
  not take place if the module is rejected early
* Properly-written MPY file parsers should have checked the upper two
  bits of the flags byte to be actually zero according to the format
  specification available right before this change, so no assumptions
  should have been made on the exact order of the chunks for an
  unexpected format.

The meaning of the architecture flags value is backend-specific, with
the only common characteristic of being a variable-encoded unsigned
integer for the time being.

The changes made to the file format effectively limit the number of
possible target architectures to 16, of which 13 are already claimed.
There aren't that many new architectures planned to be supported for the
lifetime of the current MPY file format, so this change still leaves
space for architecture updates if needed.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit introduces the MPY architecture flags checking code specific
for the RV32 target, currently checking for the only additional
extension that is supported by the runtime: Zba.

The warnings inside "mpy-cross" have also been removed since now there
is a way to reject incompatible MPY files at runtime.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit extends "mpy-tool.py"'s disassembly output of a given MPY
file (triggered via the "-d" command line option) to include newly added
fields.

Now the target architecture for the chosen MPY file is printed out to
screen in human-readable format and, if present, architecture-specific
flags.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit extends "mpy-cross"'s parsing of the architecture flags
value command line, allowing raw integer values as well as flag strings.

Integers can be represented as either decimal, binary, or hexadecimal
values, using the usual C language prefixes to mark non-base 10 values.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit adds the currently supported architecture flags value as the
upper part of "sys.implementation._mpy".

This had the side effect of perturbing quite a bit of testing
infrastructure and invalidating documentation related to MPY files.  To
make the test suite run successfully and keep the documentation in sync
the following changes have been made:

* The target info feature check file now isolates eventual architecture
  flags and adds them as a separate field
* The test runner now picks up the new architecture flags field, reports
  it to STDOUT if needed and stores it for future uses
* Relevant test files for MPY files import code had to be updated to
  mask out the architecture flags bits in order to perform correctly
* MPY file format documentation was updated to show how to mask off and
  properly display the architecture flags information.

This works out of the box if the flag bits can fit in a smallint value
once merged with the MPY file header value.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit extends the "micropython/import_mpy_native_gc" test with a
pre-built serialised MPY file built for RV32.

Before this commit, the test was skipped on said platform due to the
lack of a known-good MPY file to test the import procedure against.
Now the test is executed as part of the general CI test checks.

The MPY file's Makefile script was also updated to cater for modern
Linux environments where the required Python interpreter's command name
isn't "python", but "python3" instead (this occurs when using the past
two LTS Ubuntu releases for example).  This is the same kind of change
made in 31a008c.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit lets "run-tests.py" use the encoded architecture flags
provided by the interpreter when invoking "mpy-cross".

If architecture flags are detected, they're mapped into the necessary
strings needed by "mpy-cross"'s "-march-flags" argument, so that tests
will always use all available extensions reported by the target.

Currently this is limited to the RV32 platform, as it is the only one
that is making use of this facility as of now.  This also lets the QEMU
port remove forced arguments to "mpy-cross" when running the test suite.

Signed-off-by: Alessandro Gatti <[email protected]>
This commit introduces a test file (along with its necessary data) to
test MPY files pass/reject cases, due to either mismatching architecture
flag requirements or unneeded "no-flags" values set.

Signed-off-by: Alessandro Gatti <[email protected]>
While clarifying the meaning of the arguments to `mp_quicksort`, I noticed
that by pre-adjusting the `head` argument similar to what was already done
for `tail`, code size could be saved by eliminating repeated calculation of
`h + 1`.

Signed-off-by: Jeff Epler <[email protected]>
Changes in this commit:
- Change ticks overhead value for SAMD51.  The value was too large and thus
  timing was quite bad.  At 120Mhz it's now within +/- 30ns.
- Set the pin to output mode.  That way, all Pin identifiers are accepted
  as argument, not only Pin objects.

Tested with ItsyBitsy M4 and M0 boards.

Signed-off-by: robert-hh <[email protected]>
There are multiple RP2350 boards missing RISC-V builds.  Some were missing
entries in their `board.json` or a CMake file altogether.  This commit
fixes them.

Signed-off-by: Craftzman7 <[email protected]>
Added STM32N6 with HAL1.2.0
Added STM32U5 with HAL1.8.0
Updated STM32WB from HAL1.10.0 to HAL1.23.0

Signed-off-by: Andrew Leech <[email protected]>
This change adds STM32U5 support to the STM32 port.
STM32U5A5ZJ: https://www.st.com/ja/microcontrollers-microprocessors/stm32u5a5zj.html

Signed-off-by: Yuuki NAGAO <[email protected]>
This change adds NUCLEO-U5A5ZJ-Q support to the STM32 port.
NUCLEO-U5A5ZJ-Q: https://www.st.com/ja/evaluation-tools/nucleo-u5a5zj-q.html
This board use STM32U5A5ZJ: https://www.st.com/ja/microcontrollers-microprocessors/stm32u5a5zj.html

Signed-off-by: Yuuki NAGAO <[email protected]>
Implemented the keyword-only parameter `invert` for the `UART.init` method
in accordance with the docs:
- added constants `UART.INV_TX` and `UART.INV_RX`
- added the new `invert` keyword parameter to the `uart_init` function
- adapted the `uart_init` call
- added invert setting to `uart_print` output

The feature applies only to STM32H7.

Signed-off-by: ennyKey <[email protected]>
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.