aboutsummaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2021-04-27tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.iabdalkader
Since version 21.4b0, Black now processes one-line docstrings by stripping leading and trailing spaces, and adding a padding space when needed to break up """"; see https://github.com/psf/black/pull/1740 This commit makes the Python code in this repository conform to this rule.
2021-04-23tools/pyboard.py: Support opening serial port in exclusive mode.Damien George
This is now the default, but can be overridden with CLI `--no-exclusive`, or constructing `Pyboard(..., exclusive=False)`. Signed-off-by: Damien George <damien@micropython.org>
2021-04-23tools/upip.py: Use .errno instead of .args[0] for OSError exceptions.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-23stm32/mboot: Allow unpacking dfu without secret key.David Michieli
- unpack-dfu command no longer requies a secret key to be present - pack-dfu command raises an exception if no secret key is found
2021-04-20tools/metrics.py: Add rp2 port to table of ports that can be built.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-15tools/ci.sh: Build esp32 using IDF v4.0.2 and v4.3.Damien George
To test different IDF's, and also test building the GENERIC_S2 board. Signed-off-by: Damien George <damien@micropython.org>
2021-04-06tools/metrics.py: Fix esp32 output filename due to move to CMake.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-01examples/usercmodules: Simplify user C module enabling.Damien George
It's a bit of a pitfall with user C modules that including them in the build does not automatically enable them. This commit changes the docs and examples for user C modules to encourage writers of user C modules to enable them unconditionally. This makes things simpler and covers most use cases. See discussion in issue #6960, and also #7086. Signed-off-by: Damien George <damien@micropython.org>
2021-04-01tools/ci.sh: Build user C modules for esp32.Michael O'Cleirigh
Builds the esp32 port against the example C and CXX modules. Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-03-31tools/ci.sh: Add CI for CMake USER_C_MODULE support.Phil Howard
Builds the rp2 port against the example C and CXX modules. Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-12tests: Rename run-tests to run-tests.py for consistency.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-23tools/pydfu.py: Support DFU files with elements of zero size.Damien George
Instead of raising a ZeroDivisionError, this tool now just skips any elements in the DFU file that have zero size. Signed-off-by: Damien George <damien@micropython.org>
2021-02-21tools/verifygitlog.py: Show required format regexp in error message.iTitou
Signed-off-by: iTitou <moiandme@gmail.com>
2021-02-17stm32/mboot: Add unpack-dfu command to mboot_pack_dfu.py tool.David Michieli
This command unpacks a previously packed DFU file, writing out a DFU which should be the same as the original (before packing).
2021-02-16tools/ci.sh: Update zephyr docker image to v0.11.13.Maureen Helm
Updates the zephyr docker image to the latest, v0.11.13. This updates CI to use zephyr SDK v0.12.2 and GCC v10.2.0 for the zephyr port. Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16zephyr: Build MicroPython as a cmake target.Maureen Helm
Refactors the zephyr build infrastructure to build MicroPython as a cmake target, using the recently introduced core cmake rules. This change makes it possible to build the zephyr port like most other zephyr applications using west or cmake directly. It simplifies building with extra cmake arguments, such as specifying an alternate conf file or adding an Arduino shield. It also enables building the zephyr port anywhere in the host file system, which will allow regressing across multiple boards with the zephyr twister script. Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16zephyr: Update to zephyr v2.5.0.Maureen Helm
Updates the zephyr port build instructions and CI to use the latest zephyr release tag. Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2021-02-16tools/makemanifest.py: Allow passing option args to include().Jim Mussared
This allows customising which features can be enabled in a frozen library. e.g. `include("path.py", extra_features=True)` in path.py: options.defaults(standard_features=True) if options.standard_features: # freeze standard modules. if options.extra_features: # freeze extra modules. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-02-15tools/ci.sh: Change esp32 CI to work with idf.py and IDF v4.0.2.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-13tools: Add filesystem action examples to pyboard.py help.Brianna Laugher
Signed-off-by: Brianna Laugher <brianna.laugher@gmail.com>
2021-02-12rp2: Use local tinyusb instead of the one in pico-sdk.Damien George
So that all MicroPython ports that use tinyusb use the same version. Also requires fewer submodule checkouts when building rp2 along with other ports that use tinyusb. Signed-off-by: Damien George <damien@micropython.org>
2021-01-30tools: Remove obsolete upip bootstrap script.stijn
The upip module is frozen into ports supporting it, and it is included in the source tree, so there is no need to get it from PyPi. Moreover the PyPi package referred to is an out-of-date version of upip which is basically unrelated to our upip.py because the source is taken from a fork of micropython-lib instead of this repository.
2021-01-30tools/makemanifest.py: Add check that freeze path is a directory.Jim Mussared
Avoids accidentally writing freeze("path/to/file.py") and getting unexpected results.
2021-01-30github/workflows: Add workflow to verify commit message format.stijn
Using the new tools/verifygitlog.py script.
2021-01-30tools/verifygitlog.py: Add script for verifying commit message format.stijn
The main rules enforced are: - At most 72 characters in the subject line, with a ": " in it. - At most 75 characters per line in the body. - No "noreply" email addresses.
2021-01-30github/workflows: Add CI workflow for rp2 port.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29tools/mpy-tool.py: List frozen modules in MICROPY_FROZEN_LIST_ITEM.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29tools/ci.sh: For ci_code_size_setup, update apt to install gcc-multilib.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-01-24tools/ci.sh: For code size build, fetch history of master branch only.Damien George
It's not necessary to fetch all branches. Signed-off-by: Damien George <damien@micropython.org>
2021-01-18tools/ci.sh: Pip install pyhy for stm32 builds.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-12-14tools/ci.sh: Use pip-install to get latest version of esptool.py.Damien George
Because the version included in xtensa-lx106-elf-standalone.tar.gz needs Python 2 (and pyserial for Python 2). Signed-off-by: Damien George <damien@micropython.org>
2020-12-14tools/ci.sh: Put echo of CI path in a separate function.Damien George
Because the setup functions may print other information which should not be added to the path. Signed-off-by: Damien George <damien@micropython.org>
2020-12-07stm32/Makefile: Change -O0 to -Og for DEBUG=1 builds.Damien George
The -Og optimisation level produces a more realistic build, gives a better debugging experience, and generates smaller code than -O0, allowing debug builds to fit in flash. This commit also assigns variables in can.c to prevent warnings when -Og is used, and builds a board in CI with DEBUG=1 enabled. Signed-off-by: Damien George <damien@micropython.org>
2020-12-01tools/pyboard.py: Add fast raw-paste mode.Damien George
This commit adds support to pyboard.py for the new raw REPL paste mode. Note that this new pyboard.py is fully backwards compatible with old devices (it detects if the device supports the new raw REPL paste mode). Signed-off-by: Damien George <damien@micropython.org>
2020-11-29tools/ci.sh: Add helper script to run CI tasks.Damien George
The aim is for this script to be used on any CI platform, as well as run locally. Signed-off-by: Damien George <damien@micropython.org>
2020-10-20tools/upip.py: Support explicit port number in host.awachtler
Adding a port number other then 443 to a PyPI URL may be needed if a local server like devpi is used.
2020-09-11tools: Write msvc-compatible frozen content.stijn
The msvc compiler doesn't accept zero-sized arrays so let the freezing process generate compatible C code in case no modules are found and the involved arrays are all empty. This doesn't affect the functionality in any way because those arrays only get accessed when mp_frozen_mpy_names contains names, i.e. when modules are actually found.
2020-09-09tools/mpy-tool.py: Fix merge of multiple mpy files to POP_TOP correctly.Damien George
MP_BC_CALL_FUNCTION will leave the result on the Python stack, so that result must be discarded by MP_BC_POP_TOP. Signed-off-by: Damien George <damien@micropython.org>
2020-08-29all: Update Python code to conform to latest black formatting.Damien George
Updating to Black v20.8b1 there are two changes that affect the code in this repository: - If there is a trailing comma in a list (eg [], () or function call) then that list is now written out with one line per element. So remove such trailing commas where the list should stay on one line. - Spaces at the start of """ doc strings are removed. Signed-off-by: Damien George <damien@micropython.org>
2020-08-22tools/makemanifest.py: Use os.makedirs to make path for generated files.Damien George
The existing implementation of mkdir() in this file is not sophisticated enough to work correctly on all operating systems (eg Mac can raise EISDIR). Using the standard os.makedirs() function handles all cases correctly. Signed-off-by: Damien George <damien@micropython.org>
2020-08-21tools/mpy-tool.py: Fix offset of line number info.Martin Milata
Signed-off-by: Martin Milata <martin@martinmilata.cz>
2020-08-21tools/pyboard.py: Replace eval() of received data with alternative.Michael Buesch
Prior to this commit, pyboard.py used eval() to "parse" file data received from the board. Using eval() on received data from a device is dangerous, because a malicious device may inject arbitrary code execution on the PC that is doing the operation. Consider the following scenario: Eve may write a malicious script to Bob's board in his absence. On return Bob notices that something is wrong with the board, because it doesn't work as expected anymore. He wants to read out boot.py (or any other file) to see what is wrong. What he gets is a remote code execution on his PC. Proof of concept: Eve: $ cat boot.py _print = print print = lambda *x, **y: _print("os.system('ls /; echo Pwned!')", end="\r\n\x04") $ ./pyboard.py -f cp boot.py : cp boot.py :boot.py Bob: $ ./pyboard.py -f cp :boot.py /tmp/foo cp :boot.py /tmp/foo bin chroot dev home lib32 media opt root sbin sys usr boot config etc lib lib64 mnt proc run srv tmp var Pwned! There's also the possibility that the device is malfunctioning and sends random and possibly dangerous data back to the PC, to be eval'd. Fix this problem by using ast.literal_eval() to parse the received bytes, instead of eval(). Signed-off-by: Michael Buesch <m@bues.ch>
2020-08-08tools/makemanifest.py: Print nicely formatted errors from mpy-cross.Damien George
If mpy-cross exits with an error be sure to print that error in a way that is readable, instead of a long bytes object. Signed-off-by: Damien George <damien@micropython.org>
2020-07-26tools/makemanifest.py: Use errno.EEXIST instead of number 17.Damien George
To make this code more portable, across different platforms. Signed-off-by: Damien George <damien@micropython.org>
2020-07-20lib/mbedtls_errors: Add code to patch mbedtls for shortened error strs.Thorsten von Eicken
The file `mbedtls_errors/mp_mbedtls_errors.c` can be used instead of `mbedtls/library/error.c` to give shorter error strings, reducing the build size of the error strings from about 12-16kB down to about 2-5kB.
2020-07-01Revert "tools/pydfu.py: Respect longer timeouts requested by DFU dev..."Andrew Leech
This reverts commit 4d6f60d4286b3e6ea8c9fb0141ba13e4978882b6. This implementation used the timeout as a maximum amount of time needed for the operation, when actually the spec and other tools suggest that it's the minumum delay needed between subsequent USB transfers.
2020-06-30tools/pydfu.py: Respect longer timeouts requested by DFU device/mboot.Andrew Leech
2020-06-24tools/makemanifest.py: Support freezing a subdirectory recursively.Damien George
This adds support for freezing an entire directory while keeping the directory as part of the import path. For example freeze("path/to/library", "module") will recursively freeze all scripts in "path/to/library/module" and have them importable as "from module import ...". Signed-off-by: Damien George <damien@micropython.org>
2020-06-19tools/uncrustify: Enable more opts to remove space between func and '('.David Lechner
With only `sp_func_proto_paren = remove` set there are some cases where uncrustify misses removing a space between the function name and the opening '('. This sets all of the related options to `force` as well.
2020-06-18tools/codeformat.py: Include extmod/{btstack,nimble} in code formatting.Damien George
Signed-off-by: Damien George <damien@micropython.org>