Skip to content

Test Update#14

Open
maxpromer wants to merge 6622 commits into
microBlock-IDE:masterfrom
micropython:master
Open

Test Update#14
maxpromer wants to merge 6622 commits into
microBlock-IDE:masterfrom
micropython:master

Conversation

@maxpromer

Copy link
Copy Markdown
Member

No description provided.

@iPAS

iPAS commented Aug 22, 2024

Copy link
Copy Markdown

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)

agatti and others added 29 commits June 11, 2026 23:41
This commit lets the "sys" module report the correct value of
"sys.platform" on FreeBSD systems.

The only two platforms known to the module were Darwin and Linux, with
the latter used as a fallback.  Now FreeBSD is also recognised as such,
with the appropriate string being set.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets the platform module recognise FreeBSD as its own thing.

A new entry in the libc is added, simply called "libc" (I didn't find
any more descriptive name out there), and the platform is reported as
"FreeBSD" when applicable.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes the `extmod/select_poll_fd` test get skipped on
FreeBSD.

The test depends on the maximum number of available file descriptors
being less than 6000, which is not the case on FreeBSD (it's ~120k).
Right now there's no way to query the value directly or an easy way to
get the output of `os.system("ulimit -n")`, so the test is skipped on
FreeBSD.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit allows natmod entry trampolines to possibly be smaller
depending on the offset between the `mpy_init` from the beginning of the
text segment.

x64 and x86 shared the same, fixed-size entry point opcode that covered
the whole 32-bits offset range.  With changes introduced in
0fd0843 the entry point may change its
length once all segments are laid out in the file, so optimised entry
point code sequences can be emitted depending on the jump distance.

These changes generate optimised entry point jump opcodes for 8-, and
32- bit offsets.  Depending on the size of the natmod and where the
compiler decides to put the `mpy_init` symbol this can help shortening
the output file by three bytes.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Useful to see why particular symbols have been pulled in.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Reduces binary, static RAM, and (probably) runtime memory usage.

Necessary mbedTLS fix to prevent it calling the non-reentrant gmtime(),
which allocates the time buffer on demand with newlib-nano.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
RP2040 issue is when watchdog timer expires while lightsleep is running:
the RP2040 will lock up during power-on startup.  This occurs because the
power-on state machine is configured to not re-initialize the ROSC and
lightsleep stopped the ROSC.  The fix is to configure the PSM to reset the
ROSC when the watchdog fires.  (Alternative fix would be to modify
lightsleep to not stop the ROSC, but that increases power consumption.)

RP2350 issue is the watchdog timer does not decrement while lightsleep is
running.  Once lightsleep returns the timer will start decrementing again.
This occurs because lightsleep clears the bit
CLOCKS_SLEEP_EN1_CLK_SYS_WATCHDOG_BITS while sleeping.  The fix is to set
this bit during lightsleep if the watchdog is enabled.

Fixes RP2040 issue #17228 and RP2350 issue #17229.

Signed-off-by: Carl Pottle <cpottle9@outlook.com>
The readblocks/writeblocks functions, both native and Python versions, must
return 0 on success and negative errno integer on error.

These native typedefs help to document that.

Signed-off-by: Damien George <damien@micropython.org>
These are only called by the vfs_blockdev implementation, so their return
value doesn't need to be a FATFS specific type.

Signed-off-by: Damien George <damien@micropython.org>
And make that 0 for success, negative errno integer for error.  And as a
consequence of this change the return value of the SDCard block device
Python bindings so they return an integer instead of a bool.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
This is what `vfs_blockdev.c` now expects, 0 for success and a negative
errno integer for failure.

Signed-off-by: Damien George <damien@micropython.org>
This reverts commit 5dc9eda.

This fix is no longer needed, now that all SDCard implementations return 0
for success and a negative integer for failure.

Signed-off-by: Damien George <damien@micropython.org>
This is only needed on ports that provide a fast native C function for
block device access.  Disabling it saves code on ports that don't use it.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Commit 8e2d6e00ffefbd42d52ba4d261775f5c64d1e219 changed the return type of
SDCard readblocks/writeblocks from a bool to an int.  So this test no
longer needs to support both of those types.

Signed-off-by: Damien George <damien@micropython.org>
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6 to 7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v6...v7)

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

Signed-off-by: dependabot[bot] <support@github.com>
This commit fixes mboot boot failures on NUCLEO-N657X0-Q boards with Rev B
silicon.  The STM32N657X0 chip has two silicon revisions that require
different FSBL signing header versions:
- Rev code Z (Cut 1.1) requires STM32_N6_HEADER_VERSION = 2.1
- Rev code B (Cut 2.0) requires STM32_N6_HEADER_VERSION = 2.3

Currently mpconfigboard.mk defaults to 2.1, causing Rev B boards to fail
booting after deploy-trusted.  The signing header version is updated to 2.3
in this commit.

Additionally, STM32CubeProgrammer v2.21.0 and later no longer auto-align
the binary payload to a 0x400-byte boundary.  The --align flag has been
added here, otherwise the signing step fails with an alignment error.

Signed-off-by: Mrpli <woe2468@outlook.com>
This commit adds native NLR support for the LoongArch64 platform.

Even though the setjmp/longjmp NLR implementation works, an
implementation tailored to MicroPython's needs is provided.  It should
be slightly faster and use less memory since it only saves the subset of
registers that are mentioned in the ABI as callee-saved, in addition to
a register that is simply marked as "reserved" in the same document.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit provides optimised function implementations for the GC
helper function to collect register values.

Both a generic C version and a pure assembler version are provided by
these changes, collecting the subset of callee-save registers mentioned
in the LoongArch64 ABI document (S0-S9).

As for the other platforms, it is preferable to use the assembler
version whenever possible, although both were found to be working.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets the Unix port use an optimised implementation of the
helper function that gathers CPU registers' values.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets the `platform` module correctly report whether an
interpreter was built targeting the LoongArch64 architecture.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds the necessary commands to the CI script to set up,
build, and run tests for the Unix port using LoongArch64 as a CPU target.

Following the rest of the Unix port targets,
`ci_unix_qemu_loong64_setup`, `ci_unix_qemu_loong64_build`, and
`ci_unix_qemu_loong64_run_tests` commands are now available.  Even
though the architecture has been supported by GCC, Linux, QEMU, LibFFI
and other support libraries for quite some time now, some workarounds
had to be put in place to make things work.

The CI image's Ubuntu version comes with two versions of the GCC
compiler and no installable meta-package.  Moreover, the compiler
binaries are tagged via a suffix, so the usual approach of setting
the `CROSS` variable when invoking make cannot be used.  This means
having to symlink the gcc and g++ binaries into something that can work
with that scheme.

On the execution side, the LoongArch64 binary format isn't in the binfmt
database.  That was worked around by creating a runner script that
invokes the interpreter via the appropriate QEMU binary.  This is enough
to let the test runner work with the current setup.

Both workarounds need to be revisited if things change when a new OS
image is used for running CI tasks.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds a new LoongArch64 variant to the Unix port's targets
list, using the same template as the rest of the targets already put
under test.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit updates the Unix port's supported targets list in the README
file, adding both RISC-V and LoongArch to said list.

Now that the LoongArch64 target is fully implemented as far as the Unix
port is concerned, is supported by LibFFI, and it is buildable both by
hand using `make` and by the CI script, it can safely be added to the
supported targets list.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
The existing entry covered ``range(-maxsize - 1, 0)`` (negative side)
but not the symmetric positive case raised in #17026, where
``range(sys.maxsize + 1, sys.maxsize + 2)`` raises OverflowError in
MicroPython while CPython accepts arbitrary integer arguments.

Add that example and update the description/cause so it is clearer
that the limitation is on the magnitude of the individual arguments
(they must fit in mp_int_t), not just on the size of the resulting
range.  ``tools/gen-cpydiff.py`` will regenerate the rendered table
from this file.

Fixes #17026.

Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
This was missing, and is easy to enable.

Signed-off-by: Damien George <damien@micropython.org>
Try to find the best prescaler/period combination that still fits within a
16-bit prescaler value, by making sure that the prescaler does not
overflow.  As a last resort, set the prescaler to its maximum value and
recalculate the period based on that.  If that doesn't work then the
requested frequency is too low, so raise an appropriate exception.

Signed-off-by: Damien George <damien@micropython.org>
This generalises the peripheral construction test so that it works on
PYBV1x, PYBLITEV10 and PYBD_SFx boards.  Also makes it use unittest.

Signed-off-by: Damien George <damien@micropython.org>
Gadgetoid and others added 30 commits July 17, 2026 23:28
Bring the port's runtime_init_clocks() in line with the pico-sdk
2.3.0 version, since it was originally derived from this function.

PLL_COMMON_REFDIV is deprecated in the SDK in favour of the separate
PLL_SYS_REFDIV and PLL_USB_REFDIV macros; use those so a board that
only sets the new per-PLL values is honoured, and so the port keeps
building if the deprecated macro is eventually removed.

Configure the divide-by-1 clocks (ref, sys, usb, adc, peri, hstx)
with clock_configure_undivided(), and clk_rtc with
clock_configure_int_divider(), as the SDK now does. Both avoid the
64-bit division that clock_configure() pulls in to compute a
fractional divider.

Drop the --wrap=runtime_init_clocks linker flag: the SDK declares
runtime_init_clocks() as __weak, so a plain strong definition in the
port overrides it, which makes the wrap redundant.

Also switch the HSTX guard to HAS_HSTX and take RTC_CLOCK_FREQ_HZ
from hardware/rtc.h, matching upstream. No functional change to the
clock configuration on existing boards.

Signed-off-by: Phil Howard <github@gadgetoid.com>
Without -fno-math-errno the compiler must keep sqrt()/sqrtf() as library
calls so they can set errno on a domain error, even though the Cortex-M33
FPU has a single VSQRT.F32 instruction. MicroPython's math module
detects domain errors via isnan/isinf checks on the result rather than
errno, so disabling errno here is safe and lets sqrt leverage hardware.

Benchmarked on a Pico 2 (RP2350, perfbench N=150 M=100, avg of 3):
misc_mandel (complex abs() in its inner loop) improves by ~12%, with no
measurable change to non-sqrt benchmarks and a slightly smaller binary.

Signed-off-by: Phil Howard <github@gadgetoid.com>
The combination of 8d6ce0f and
111d2e9 produced a build failure for
RP2350 targets.  But it did not actually fail the build due to a
regression introduced by e6380fa.

Fix the rp2 build issue by including `hardware_powman`.

Signed-off-by: Damien George <damien@micropython.org>
rp2/CMakeLists.txt: Use quoted literals for the BTstack
and oofatfs config files, so the escaped double quotes don't
break syntax highlighting in VSCode and GitHub's web UI.

Signed-off-by: Phil Howard <github@gadgetoid.com>
The bundled TinyUSB device endpoint-transfer API gained a trailing
bool is_isr argument on usbd_edpt_xfer()/usbd_edpt_xfer_fifo() and on
the matching dcd_edpt_xfer()/dcd_edpt_xfer_fifo() driver entry points,
and the stm32_fsdev driver was split into a shared fsdev_common.c.
Adapt the in-tree users so the bump builds across ports:

- extmod/machine_usb_device.c: pass is_isr=false on the
  USBDevice.submit_xfer() path (never an ISR), guarded by
  TUSB_VERSION_NUMBER so ports building against an older bundled
  TinyUSB (e.g. esp32 via ESP-IDF) still compile.
- ports/alif/tinyusb_port: the port's custom dcd driver takes the
  new argument on both entry points (unused by this driver).
- ports/stm32: build the new lib/tinyusb fsdev_common.c, which
  provides the PMA/btable helpers used by dcd_stm32_fsdev.c.

Signed-off-by: Andrew Leech <andrew@alelec.net>
4KB CDC buffers max out USB packet movement performance with HS USB.

Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
Works for bytes.decode() and str constructor.

Previously ascii arg was treated the same as utf8, now only 7-bit
bytes are treated as valid ascii characters.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
bytes() constructor uses the same code path.

Also brings over the same supported encodings check for the
bytes constructor that already exists for str.encode().

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Partially this is documenting some additional limitations
added recently now that the encoding argument is not totally
ignored.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Latest mDNS is 1.11.3 but it adds quite a lot of code size and static RAM
usage. This version seems to fix our ESP32-H2 build issue without as much
bloat.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This reverts commit 67f7fdd.

Updated mdns component (in parent commit) no longer fails to compile.

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

Signed-off-by: Angus Gratton <angus@redyak.com.au>
May save a small amount of resources as this chip has no Wi-Fi.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Fixes exception when doing "mpremote cp file :"
or "mpremote mip install os-path", when
os.stat() returns stat_result namedtuple instead of plain tuple.

This is the case if one has done "mip install os-path"
Ref micropython/micropython-lib@f4cfc3c

Example exception:

    ValueError: malformed node or string on line 1:
     Call(func=Name(id='stat_result', ctx=Load()), args=[],
     keywords=[keyword(arg='st_mode',
       value=Constant(value=16384, kind=None)), ...
     keyword(arg='st_ctime', value=Constant(value=0, kind=None))])

Issue found by @snowkoli

Signed-off-by: Jon Nordby <jononor@gmail.com>
Without leading ./ then will get error like this:

    < env: ‘test_errno.sh’: No such file or directory

Signed-off-by: Jon Nordby <jononor@gmail.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
The MicroPython application runs on CM33 core in non-secure mode.
The core boot sequence requires the secure mode to start the
non-secure mode. This minimal application is located in the secboot
directory.
The board bsp-cfg directory includes the PSOC Edge SDK generated
sources for a given board support package.

The following modules are already enabled:
  - time
  - VFS (LFS2)
  - machine.Pin
  - machine.UART
  - machine.RTC

This enablement is a collective work of the following contributors:

Co-authored-by: Damien George <damien@micropython.org>
Co-authored-by: Eder Julian <Julian.Eder@infineon.com>
Co-authored-by: IFX-Anusha <Anusha.TR@infineon.com>
Co-authored-by: NikhitaR-IFX <nikhita.rajasekhar@infineon.com>
Co-authored-by: Ramya Subramanyam <ramya.subramanyam@infineon.com>
Co-authored-by: zhanglinjing <Linjing.Zhang@infineon.com>

Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
Signed-off-by: jaenrig-ifx <enriquezgarcia.external@infineon.com>
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.