This test can now run correctly with the native emitter because the
`thread()` function will run the scheduler during the call to
`time.sleep_ms(1)`.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This variant of `schedule.py` explicitly calls a zero sleep. The existing
variant is kept to ensure the scheduler is called between bytecodes.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This allows tests like `asyncio_event_queue.py` to succeed under the native
emitter when poll is enabled.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This test was ignored since 2020, which hid a new bug in the test for the
native emitter added in 2024. Hopefully other changes to the test will
make it more reliable.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
As of January 12 the default Python version changed from 3.9 to
3.12, and 3.12 has issues running the settrace tests.
3.13 seems to also have some issues, so setting 3.11 for now.
See https://github.com/actions/runner-images/issues/13468
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit fixes a test exercising complex numbers creation, working
around a deprecation introduced in CPython 3.14.
Creating complex numbers using a complex number as the real part in the
constructor is deprecated in CPython 3.14, but that construction method
is still supported by MicroPython and covered by tests. To work around
this, the specific constructor is extracted into its own test, providing
an expected output file recorded using CPython 3.11.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes tests exercising certain math functions' limit work
when using CPython 3.14 to validate the tests' output.
CPython 3.14 introduced more descriptive messages when math domain error
conditions are encountered rather than a single generic message. This
breaks the tests in question as MicroPython uses a single error message
when reporting these conditions (both to closely follow CPython and to
save firmware space).
The math domain tests now look for an error pattern that is compatible
with both CPython 3.14 and previous versions, converting messages in the
newer format into the previous one. This makes the tests' behaviour
under MicroPython comparable with CPython for the foreseeable future.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes tests that will always fail when using CPython 3.14
to get a known-good output to compare MicroPython's behaviour against.
Starting from CPython 3.14, statements inside a `finally` block that
will prevent the execution flow to reach the block's last statement will
raise a SyntaxWarning. That text would end up in the comparison data
and thus make known-good tests fail.
Given that those tests explicitly exercise flow control interruptions
in finally blocks, there is no real workaround that can be applied to
the tests themselves. Therefore those tests will now check
MicroPython's behaviour against expected output files recorded from
the tests' output with CPython 3.11.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
STM32CubeMX shows a conflict of UART5 with ETH MII.
However UART1 can be used with TX and RX on the pin headers.
PLL1Q is reduced from 200 to 100 MHz because it may be used for FDCAN
or SDMMC. FDCAN needs <= 150 MHz, and 100 MHz is enough for an SDCard
connected to pin headers to work reliably.
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
To connect STM32H7 that is in SLEEPD1 state (e.g. during REPL)
debuggers like st-flash or openocd must assert SRST.
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
Configuration:
- Clock is 8MHz from STLINK MCO, CPU runs at 400MHz
- REPL on USB and on UART connected to ST-Link interface
- Storage is configured for internal flash memory
- 3x LEDs and 1x user button
- Ethernet
Product page:
https://www.st.com/en/evaluation-tools/nucleo-h753zi.html
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
The existing linker script for F412 is renamed to separate F412xG (with
1MB RAM) from F412xE (with 512K).
Signed-off-by: Oliver Joos <oliver.joos@hispeed.ch>
The main functional change here is to make sure that the SDMMC1/2 clocks
are enabled in low power mode; they were not previously enabled for SD card
use, only WLAN. It doesn't hurt to unconditionally enable the clocks in
low power, like all the other peripherals.
Signed-off-by: Damien George <damien@micropython.org>
SPIRAM usually uses GPIO 9 and 10 on ESP32, so don't use them as default
UART pins.
Fixes issue #18544.
Signed-off-by: Damien George <damien@micropython.org>
"MicroPython" is sometimes misspelled as "Micropython". Add an explicit
check for that as part of CI (note that codespell doesn't consider case
when spelling, hence the need to do it this way).
Signed-off-by: Damien George <damien@micropython.org>
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>
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 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>
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 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>
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 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>
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>
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>
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>
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>
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 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 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 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>