summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
9 hoursgithub/workflows: Add esp32 to code size report.HEADorigin/masterorigin/HEADmasterJeff Epler
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>
9 hoursgithub/workflows: Introduce and use ci_esp32_idf_ver helper.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
4 daystools/ci.sh: Run natmod tests as part of CI for Unix/RV64.Alessandro Gatti
This commit updates the test procedure for the Unix port targeting the RV64 platform to also run the battery of native modules test that is part of the QEMU port. Unfortunately this required a few changes to the CI setup since the Unix port was still using an older version of Ubuntu LTS than the RISC-V natmods build infrastructure expects. Updating the OS version just for the RV64 Unix target brought a couple of issues when building the code (an extra package is now needed to let FFI build) and running tests (QEMU binfmt support requires a new setup). Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
4 daysqemu: Enable loading natmods on RV64.Alessandro Gatti
This commit lets the QEMU port's VIRT_RV64 board load and run native modules, via the appropriate configuration changes in mpconfigport.h. Now the CI test job for the QEMU/RV64 port can also run natmods and see whether they actually work, so the CI tasks script has been updated to bring RV64 to parity with RV32 as far as CI checks go. Documentation was also updated, since now all supported boards in the QEMU port should be able to run natmod tests. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
6 daystools/mpy_ld.py: Add RV64 natmod support.Alessandro Gatti
This commit adds the ability to compile native modules for the RV64 platform, using "rv64imc" as its architecture name (eg. "make ARCH=rv64imc" should build a RV64 natmod). The rest of 64-bits relocations needed to build a native module are now implemented, and all sample native modules build without errors or warnings. The same Picolibc caveats on RV32 also apply on RV64, thus the documentation was updated accordingly. RV64 native modules are also built as part of the CI process, but not yet executed as the QEMU port is not yet able to load and run them. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
6 daystools/mpy_ld.py: Fix handling of R_RISCV_TLSDESC_LOAD_LO12.Alessandro Gatti
This commit fixes handling of the R_RISCV_TLSDESC_LOAD_LO12 RISC-V object file relocation, fixing a couple of mistakes in its usage. The condition check for TLS relocations presence and their rejection when found in object files skipped checking for R_RISCV_TLSDESC_LOAD_LO12 relocations, which is part of the set of unsupported TLS relocations and thus needing an object file rejection. Interestingly, that relocation name constant was actually misspelled in the file - since it was skipped in the list of relocations being checked its wrong name did pass unnoticed until now. This is not a critical change as the linker will raise an error about an unknown relocation type rather than report a more descriptive message to the user, but it's nice to have nonetheless. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
6 daystools/mpy_ld.py: Fix R_RISCV_GOT32_PCREL handling.Alessandro Gatti
This commit fixes the implementation of the R_RISCV_GOT32_PCREL RISC-V relocation type when linking native modules for RV32IMC. The previous implementation of R_RISCV_GOT32_PCREL ended up not being fully updated when the initial RV32 support was checked in. Said relocation was not emitted in the sample natmods that ship with the MicroPython source tree, and since they're the testbed for CI jobs that should check RV32 natmod support, this was not caught. On the other hand, nobody raised an issue about this problem yet, so hopefully it didn't cause much trouble. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
2025-12-04tools/autobuild: Make firmware destination directory configurable.Damien George
The destination directory for the firmware built by `autobuild.sh` is currently hard-coded to `/tmp/autobuild-firmware-$$`. Now that there are many boards built by this script, the `/tmp` partition can run out of space. This commit makes the destination directory configurable via the `MICROPY_AUTOBUILD_DEST` environment variable. Signed-off-by: Damien George <damien@micropython.org>
2025-12-01rp2/boards/WEACTSTUDIO_RP2350B_CORE: Add board.pinout.Matt Trentini
This adds an ANSI-rendered pinout for the WeAct Studio RP2350B Core board. Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
2025-12-01esp32/boards/ESP32_GENERIC_P4: Add board definition for ESP32P4.Vincent1-python
Includes a base variant with LAN, and C5_WIFI and C6_WIFI variants with LAN, WiFi and BLE. And builds this board in the esp32 CI, to cover the P4 support. Signed-off-by: Vincent1-python <pywei201209@163.com> Signed-off-by: Angus Gratton <angus@redyak.com.au> Signed-off-by: Damien George <damien@micropython.org>
2025-11-30tools/ci.sh: Build all stm32 MCU families in stm32 CI functions.Damien George
Currently the CI for stm32 only tests building about half of the available MCU families. This commit adds the remaining families to the stm32 CI jobs. Signed-off-by: Damien George <damien@micropython.org>
2025-11-30tools/ci.sh: Install latest ARM toolchain for stm32 CI.Damien George
This is needed to build Cortex-M55 (STM32N6) based boards. Signed-off-by: Damien George <damien@micropython.org>
2025-11-27github/workflows: Test mpy-cross debug emitter.Alessandro Gatti
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>
2025-11-26tools/ci.sh: Add zsh and fish shell completion support.Alessandro Gatti
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>
2025-11-24tools/mpy-tool.py: Add Compiler Explorer JSON output.Anson Mansfield
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>
2025-11-17tools/ci.sh: Build ESP32_GENERIC_C5 as part of esp32 CI.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-11-05tools/cc1: Fix ruff lint check with list length.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2025-11-05tools/cc1: Apply ruff formatting to cc1 script.Christian Clauss
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>
2025-10-31stm32/usb: Add support for using TinyUSB stack.Andrew Leech
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>
2025-10-24tools/mpy-tool.py: Add architecture flags to disassembly output.Alessandro Gatti
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>
2025-10-24py/persistentcode: Add architecture flags compatibility checks.Alessandro Gatti
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>
2025-10-24tools/mpremote: Fix exception when using pts.iabdalkader
Setting RTS/DTR raises "Inappropriate ioctl for device" for pts devices. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2025-10-23tools/autobuild: Use same length Git hash abbreviation in file names.Daniël van de Giessen
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>
2025-10-23tools/ci.sh: Use a better default reference ref in code_size_build.Jeff Epler
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>
2025-10-23tools/metrics.py: Tersely show the commits in the size report.Jeff Epler
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>
2025-10-23tools/ci.sh: Cross build 64-bit windows on Linux.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-22tools/ci.sh: Init micropython-lib submodule for zephyr build.Damien George
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>
2025-10-08tools/ci: Fix typo of pipefail.Angus Gratton
Regression from 449866cb0af3fc547df6538a6552517cc8974616. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-10-08tools/ci.sh: Re-add IGNORE_ERRORS to ci_code_size_build.Jeff Epler
It was removed (possibly inadvertently) in 4c55b0879b38b373b44e84552d6754b7842b5b72 Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-08tools/ci.sh: Return to old branch after code_size_build.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-08tools/metrics.py: Allow pre_cmd to set up environment.Jeff Epler
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>
2025-10-08tools/ci.sh: Let code_size_build be customized via environment.Jeff Epler
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>
2025-10-08tools/metrics.py: When cleaning also clean mpy-cross.Jeff Epler
Changes of interest could be in emitted mpy frozen files. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-08tools/ci.sh: Exit with error if zcat fails during ci_esp8266_setup.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-08tools/ci.sh: Add and use new ci_code_size_report function.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-08tools/ci.sh: Manipulate pipefail better.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-08tools/metrics.py: Use all CPUs during comparison builds.Jeff Epler
Don't simply hard-code a parallelism of 3 for the build. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-10-03docs: Label table columns as "CPython output" and "MicroPython output".Angus Gratton
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>
2025-10-02tools/ci.sh: Enable the full test suite for unix minimal variant.Damien George
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>
2025-10-01tools/ci.sh: Enable all possible tests on zephyr CI.Damien George
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>
2025-10-01tools/mpremote: Workaround ESP DTR/RTS reset quirk at disconnect time.Angus Gratton
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>
2025-09-28github/workflows: Add 32-bit OBJ_REPR_B CI job.Jeff Epler
This showed up some interesting errors (hopefully all fixed now). Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-09-26tools/ci.sh: Add `--bash-completion` option.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-09-24tools/metrics.py: Compute mpy-cross size as part of size metrics.Damien George
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>
2025-09-22tools/ci.sh: Fix missing `set -e` when run as a script.Jeff Epler
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>
2025-09-19qemu/riscv64: Add new QEMU RV64 port.Alessandro Gatti
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>
2025-09-19mpy-cross: Add RISC-V RV64IMC support in MPY files.Alessandro Gatti
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>
2025-09-18tools/ci.sh: Make this script runnable as command.Jeff Epler
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>
2025-09-15tools: Remove unneeded future imports.Jeff Epler
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2025-09-15all: Remove Python 2.7 support.Jeff Epler
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>