| Age | Commit message (Collapse) | Author |
|
This commit adds a new workflow step to the CI, to test the debug
emitter provided by mpy-cross. The checks being done are limited to
make sure that the debug emitter does not crash and emits opcodes for a
simple test file that is guaranteed to work for all configurations.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit adds custom command completion functions for both the zsh
and fish shell.
The behaviour for those new completions follow the existing completion
for the bash shell, including the way to generate the completion alias
(with appropriately named command line switches).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit adds a `--json` option to `mpy-tool.py`, in order to generate
Compiler-Explorer-compatible JSON annotation information for the bytecode
disassembly. Some of this information might be theoretically possible to
parse out from the text itself, but not all of it is, e.g. disambiguating
child references with non-unique simple names.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Running `ruff format tools/cc1` picks up `tools/cc1` which is a Python file
that does not have a .py file extension.
Signed-off-by: Christian Clauss <cclauss@me.com>
Signed-off-by: Damien George <damien@micropython.org>
|
|
This commit adapts the stm32 port to allow switching from STM USB stack to
TinyUSB stack.
Using TinyUSB improves consistancy with other MicroPython ports and brings
in the ability to use the runtime USB definition support recently added to
other TinyUSB based ports.
By default the existing STM USB stack is used. TinyUSB can be enabled in a
board configuration with:
#define MICROPY_HW_TINYUSB_STACK (1)
Or, it can be enabled from the command line with:
make -C ports/stm32 CFLAGS_EXTRA='-DMICROPY_HW_TINYUSB_STACK=1'
Signed-off-by: Andrew Leech <andrew@alelec.net>
|
|
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 <a.gatti@frob.it>
|
|
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 <a.gatti@frob.it>
|
|
Setting RTS/DTR raises "Inappropriate ioctl for device" for pts devices.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
This makes the version string consistent with the one used in code, see
commit 9e89c752cb.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
|
|
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 will show a line for both the reference and comparison, e.g.,
Reference: zephyr/boards: Add PocketBeagle 2 rev A1… [00a926e99e]
Comparison: metrics: Tersely show the commi… [merge of c7ac411e22]
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>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
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>
|
|
Regression from 449866cb0af3fc547df6538a6552517cc8974616.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
It was removed (possibly inadvertently)
in 4c55b0879b38b373b44e84552d6754b7842b5b72
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
This is a necessary step to allow cleanly building the xtensa port during
CI, as it's undesirable to apply the esp-idf environment settings while
building other ports.
PRE_CMD_<letter> can be used to override the command, or add a command if
not otherwise specified. Note that <letter> is case sensitive.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
For instance, to compare HEAD to origin/master on only the minimal x86
build, use
PORTS_TO_CHECK=m REFERENCE=origin/master tools/ci.sh code_size_build
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Changes of interest could be in emitted mpy frozen files.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Don't simply hard-code a parallelism of 3 for the build.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Abbreviating these doesn't really save space in the docs, as the code
blocks in the next row are always wider than the column headings.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
With all the preceeding improvements to the test suite, it's now possible
to just run `make VARIANT=minimal test` -- which is equivalent to just
`./run-tests.py` -- on the unix minimal variant.
Signed-off-by: Damien George <damien@micropython.org>
|
|
With the recent improvements to the test suite, and fixes for `pow`, the
full test suite can now be run (and appropriate tests will be automatically
skipped).
Signed-off-by: Damien George <damien@micropython.org>
|
|
The problem with ESP board spurious reset happens at disconnect time on
Windows (clearing DTR before RTS triggers a reset).
Previous workarounds tried to detect possible ESP boards and apply the
correct DTR and RTS settings when opening the port.
Instead, we can manually clear RTS before closing the port and thereby
avoid the reset issue. Opening the port can keep the default behaviour
(RTS & DTR both set).
close() is called from a finally block in the mpremote main module
(via do_disconnect()) - so this should always happen provided the Python
process isn't terminated by the OS.
One additional workaround is needed to prevent a spurious reset first time
a Silicon Labs CP210x-based ESP board is opened by mpremote after
enumeration.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This showed up some interesting errors (hopefully all fixed now).
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Add support to `tools/metrics.py` to compute the size delta of mpy-cross,
alongside the sizes of port firmware. This is an easy and cheap addition
because mpy-cross is usually built before the ports are.
Although the size of mpy-cross is not critical, it's still a nice
indication of how changes affect code size, and helps to eliminate any
unwanted increases in mpy-cross.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is needed to correctly stop after an error in a CI step when running
`ci.sh` as a script.
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
This adds a QEMU-based bare metal RISC-V 64 bits port. For the time being
only QEMU's "virt" 64 bits board is supported, using the lp64 ABI and the
RV64IMC architecture.
The port's README is also updated to keep track of these changes.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
MPY files can now hold data to be run on RV64IMC. This can be
accomplished by passing the `-march=rv64imc` flag to mpy-cross.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This makes it easier to run a sequence of ci steps locally. A help message
is also provided.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
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 <jepler@gmail.com>
|
|
The DTR quirk workaround from dea949e86 is needed for the Espressif
Serial/JTAG device, but not for TinyUSB - in fact DTR must be set for
TinyUSB to correctly determine if the serial port is open (and leads to
issues with lost bytes otherwise).
See discussion in PR #17999.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This is recommended by Espressif, and it's the only way to ensure
everyone builds the same set of component versions.
The awkward part is that updating the ESP-IDF version will churn a line
in each of these files (and possibly other changes).
Adds a build-time check for lock file changes, which is either a warning or
a hard error depending on the value of MICROPY_MAINTAINER_BUILD
flag (introduced in previous commit).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This allows us to have some things which are fatal errors in CI or nightly
builds, but warnings in normal developer builds.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
The `thread/thread_gc1.py` test is a constant source of spurious failures
in Github CI.
This commit adds it to the list of tests skipped when running on Github CI
using either macos, qemu_riscv64, qemu_mips, or qemu_arm, to help reduce
the overall false positive rate and improve the predictive value of the
test fail indication.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
This commit lets "tools/mpy-tool.py" extract MPY segments into their own
files, one file per segment.
A pair of new command line arguments were added, namely "-e"/"--extract"
that takes a filename prefix to use as a base for the generated files'
name, and "--extract-only" that - combined with "--extract" - allows
selecting which kinds of segment should be dumped to the filesystem.
So, for example, assuming there's a file called "module.mpy", running
"./mpy-tool.py --extract segments module.mpy" would yield a series of
files with names like "segments_0_module.py_QSTR_module.py.bin",
"segments_1_module.py_META__module_.bin",
"segments_2_module.py_QSTR_function.bin", etc. In short the file name
format is "<base>_<count>_<sourcefile>_<segmentkind>_<segmentname>.bin",
with <segmentkind> being META, QSTR, OBJ, or CODE. Source file names
and segment names will only contain characters in the range
"a-zA-Z0-9_-." to avoid having output file names with unexpected
characters.
The "--extract-only" option can accept one or more kinds, separated by
commas and treated as case insensitive strings. The supported kinds
match what is currently handled by the "MPYSegment" class in
"tools/mpy-tool.py": "META", "QSTR", "OBJ", and "CODE". The absence of
this command line option implies dumping every segment found.
If "--extract" is passed along with "--merge", dumping is performed
after the merge process takes place, in order to dump all possible
segments that match the requested segment kinds.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit lets CI extend the testing scope of the QEMU Arm target, by
letting it perform the usual battery of tests (interpreter and natmods)
also on hardfp targets.
The default board for Arm testing lacks hardware floating point support,
so natmods weren't tested in that specific configuration. With the
introduction of the "MPS_AN500" QEMU target, now this is made possible
as said board emulates a Cortex-M7 machine with a single- and
double-precision floating point unit.
To reduce the impact on build times, the "ci_qemu_build_arm_thumb" CI
step was split in two: "ci_qemu_build_arm_thumb_softfp" and
"ci_qemu_build_arm_thumb_hardfp" - so hopefully those can run in
parallel whenever possible.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
Clang and gcc>=14 can use __has_feature() to detect if a sanitizer
is enabled, but older GCC has no mechanism - need to set a macro
explicitly for this to be recognised.
Necessary for increasing some resource limits in sanitizer builds.
Important not to use to avoid real issues!
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Also rewrite the sanitizer argument variables to not assume a variant.
longlong variant currently fails in this config, due to a bug fixed
in follow-up commit.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.
Tested on max32690fthr and frdm_k64f.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
|
|
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
|
|
Co-authored-by: David Lechner <david@pybricks.com>
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
|
|
This is a fix for utf-8 decoding errors that are thrown when non-utf-8
content is received. For instance during a reboot of an ESP8266 module.
The fix is to handle conversion errors by replacing illegal characters.
Note that these illegal characters most often occur during an MCU reboot
sequence when the MCU is using baudrates different from 115200.
Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
|