Commit Graph

740 Commits

Author SHA1 Message Date
Jeff Epler ef3ec93c8b Change the first byte of CircuitPython 'mpy' files to "C"
.. and also distinguish CircuitPython better in `mpy-cross --version`
2021-05-05 18:06:06 -05:00
Scott Shawcroft f0bb26d70f
Merge MicroPython 1.13 into CircuitPython 2021-05-04 18:06:33 -07:00
Artyom Skrobov 2d73ba2186 qstr: Use `const` consistently to avoid a cast. 2021-05-04 12:53:35 -04:00
Dan Halbert d2b558993e merge from main, including MicroPython 1.12 merge 2021-05-03 20:56:04 -04:00
Scott Shawcroft b35fa44c8a
Merge MicroPython 1.12 into CircuitPython 2021-05-03 14:01:18 -07:00
Jeff Epler dfa7c3d32d codeformat: Fix handling of `**`
After discussing with danh, I noticed that `a/**/b` would not match `a/b`.

After correcting this and re-running "pre-commit run --all", additional
files were reindented, including the codeformat script itself.
2021-04-30 15:30:13 -05:00
Jeff Epler e95e921ca1 codeformat: Fix filename matching
In #4683, tannewt noticed that uncrustify was not running on some
file in common-hal.

I investigated and found that it was not being run on a bunch of paths.

Rather than make incremental changes, I rewrote list_files to work
bsaed on regular expressions; these regular expressions are created from
the same git-style glob patterns.

I spot-checked some specific filenames after this change, and all looks good:

```
$ python3 tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py  ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
tools/codeformat.py -v --dry-run tests/basics/int_small.py ports/raspberrypi/common-hal/pulseio/PulseIn.c extmod/virtpin.c tests/thread/thread_exit1.py ports/raspberrypi/background.h extmod/re1.5/recursiveloop.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup extmod/virtpin.c ports/raspberrypi/background.h ports/raspberrypi/common-hal/pulseio/PulseIn.c
black --fast --line-length=99 -v tests/thread/thread_exit1.py
```
recursiveloop and int_small are excluded, while PulseIn, virtpin,
and background are included.

Testing running from a subdirectory (not _specifically_ supported though):
```
(cd ports && python3 ../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c)
../tools/codeformat.py -v --dry-run raspberrypi/common-hal/pulseio/PulseIn.c ../extmod/virtpin.c
uncrustify -c /home/jepler/src/circuitpython/tools/uncrustify.cfg -lC --no-backup ../extmod/virtpin.c raspberrypi/common-hal/pulseio/PulseIn.
```

As a side-effect, a bunch more files are re-formatted now. :-P
2021-04-30 10:48:08 -05:00
Dan Halbert b5efce12cd delete hid .py; undo some debugging changes 2021-04-29 23:05:31 -04:00
Dan Halbert f06d54524d merge from adafruit 2021-04-28 23:48:26 -04:00
Steve App 326dd7f0db tools/makemanifest.py: Show directory name if there is a FreezeError. 2021-04-29 12:36:07 +10:00
iabdalkader 0f78c36c5a tools/gen-cpydiff.py: Fix formatting of doc strings for new Black.
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-27 23:41:21 +10:00
Scott Shawcroft 76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
Dan Halbert c26e49c2e6 wip: starting to try to compile 2021-04-25 23:17:41 -04:00
Dan Halbert 9d1fcc3b14 merge from main 2021-04-25 10:27:52 -04:00
Damien George 178198a01d tools/pyboard.py: Support opening serial port in exclusive mode.
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-23 22:41:00 +10:00
Damien George ac1d01d43e tools/upip.py: Use .errno instead of .args[0] for OSError exceptions.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-23 22:03:46 +10:00
David Michieli 5669a60954 stm32/mboot: Allow unpacking dfu without secret key.
- 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-23 11:04:37 +10:00
Scott Shawcroft 09f7b43c64
Merge MicroPython 1.10 into CircuitPython 2021-04-21 15:59:17 -07:00
Damien George b74dc546fc tools/metrics.py: Add rp2 port to table of ports that can be built.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-20 21:39:53 +10:00
Scott Shawcroft b057fb8a4b
codeformat 2021-04-19 22:22:44 -07:00
Dan Halbert 51ccf8dc30 wip: revert usb_descriptor changes; use raw descriptors instead 2021-04-19 23:24:18 -04:00
Damien George a9bbf7083e tools/ci.sh: Build esp32 using IDF v4.0.2 and v4.3.
To test different IDF's, and also test building the GENERIC_S2 board.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-15 10:31:06 +10:00
Dan Halbert 2a58b667aa wip: incorporate new hid descriptor building 2021-04-12 23:42:48 -04:00
Scott Shawcroft 2a78a5154f
Merge pull request #4594 from Neradoc/patch-1
fix removing past releases from circuitpython.org
2021-04-12 15:46:04 -07:00
Neradoc b8d55d6dbf
fix removing past releases from circuitpython.org
When releasing a new stable, unstable releases would be left in because the past stable was removed.
2021-04-12 23:37:41 +02:00
Dan Halbert 3e5bc5a05d wip 2021-04-08 23:19:55 -04:00
Artyom Skrobov c3e40d50ab [qstr] Separate hash and len from string data
This allows the compiler to merge strings: e.g. "update",
"difference_update" and "symmetric_difference_update"
will all point to the same memory.

Shaves ~1KB off the image size, and potentially allows
bigger savings if qstr attrs are initialized in qstr_init(),
and not stored in the image.
2021-04-06 12:58:42 -04:00
Damien George d35f12f5ca tools/metrics.py: Fix esp32 output filename due to move to CMake.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-06 12:50:19 +10:00
Dan Halbert 0357af1726 Put mouse before gamepad due to MacOS being finicky 2021-04-04 21:48:54 -04:00
Neradoc 12b0ee0a3e add alias boards and bus_device to the support matrix
add list with manual brand names for aliases
the new info in the support_matrix is used in build_board_info.py
2021-04-02 13:36:06 +02:00
Damien George d87f42b0e5 examples/usercmodules: Simplify user C module enabling.
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-01 16:27:38 +11:00
Michael O'Cleirigh 17b1f82121 tools/ci.sh: Build user C modules for esp32.
Builds the esp32 port against the example C and CXX modules.

Signed-off-by: Michael O'Cleirigh <michael.ocleirigh@rivulet.ca>
2021-04-01 15:44:10 +11:00
Dan Halbert c41639f30a add en_GB translation to builds 2021-03-31 15:09:55 -04:00
Dan Halbert c9f2591d7c Turn off remote wakeup in USB configuration descriptor 2021-03-31 10:12:16 -04:00
Phil Howard 5976ea02a5 tools/ci.sh: Add CI for CMake USER_C_MODULE support.
Builds the rp2 port against the example C and CXX modules.

Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31 00:28:52 +11:00
Neradoc 38072a139e no default value for support_matrix[board_id]
will raise an error during build if things as not as expected
as suggested by @jepler
2021-03-29 19:03:35 +02:00
Neradoc f143e5d049 fix list of modules for alias boards 2021-03-29 12:25:25 +02:00
Scott Shawcroft aec0ef3cbf
Switch devices.h to nvm.toml data 2021-03-25 09:57:18 -07:00
Neradoc 6b89883797 sort languages in a way that is not case sensitive 2021-03-25 02:57:04 +01:00
Neradoc 36f91fe022 implement issue #4470
move the language allow list to generate_download_info() and use it there too
2021-03-24 23:39:47 +01:00
Jeff Epler b9a973c8e0 codeformat: Do search&replace without sed 2021-03-15 19:23:16 -05:00
Jeff Epler 253385d9b7 codeformat: use pathlib for correct(-er) processing of * vs ** in globs 2021-03-15 18:10:43 -05:00
Jeff Epler 0403a2cca5 codeformat: Run sed only on requested files
When running from pre-commit, we believe the different invocations of
sed were racing with each other, sometimes leaving zero-byte files in
the filesystem (ow)
2021-03-15 18:10:43 -05:00
Jeff Epler ed61e8955d codeformat: require filenames, filter them by include/exclude lists 2021-03-15 18:10:43 -05:00
Jeff Epler d0e3848b24 codeformat: Exclude specified files even from commandline, for pre-commit 2021-03-15 18:10:43 -05:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
microDev 090b6ba42f
update pre-commit
- add formatting check
- add translations check
2021-03-15 19:26:29 +05:30
Damien George 6129b8e401 tests: Rename run-tests to run-tests.py for consistency.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 19:56:09 +11:00
Jeff Epler bddd6b013d build_release_files: Only build languages in an allow-list 2021-03-01 15:28:58 -06:00
Damien George cdaec0dcaf tools/pydfu.py: Support DFU files with elements of zero size.
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-23 14:33:31 +11:00
Jeff Epler 144acfcb98 USB descriptors: Save flash storage for serial number
This saves about 60 bytes (Feather M4 went from 45040 -> 45100 bytes free)
66 bytes of data eliminated, but 6 bytes paid back to initialize the length
field.
2021-02-21 21:24:49 -06:00
iTitou d334d781e1 tools/verifygitlog.py: Show required format regexp in error message.
Signed-off-by: iTitou <moiandme@gmail.com>
2021-02-21 15:55:44 +11:00
David Michieli 2eed9780ba stm32/mboot: Add unpack-dfu command to mboot_pack_dfu.py tool.
This command unpacks a previously packed DFU file, writing out a DFU which
should be the same as the original (before packing).
2021-02-17 11:36:44 +11:00
Dan Halbert c26de0136a works! no timeouts 2021-02-16 17:39:36 -05:00
Maureen Helm 56a36899bd tools/ci.sh: Update zephyr docker image to v0.11.13.
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-16 09:01:05 -06:00
Maureen Helm f573e73bae zephyr: Build MicroPython as a cmake target.
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-16 18:49:30 +11:00
Maureen Helm 2aa57931a6 zephyr: Update to zephyr v2.5.0.
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-16 18:38:13 +11:00
Jim Mussared 566020034f tools/makemanifest.py: Allow passing option args to include().
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-16 17:24:21 +11:00
Damien George aa3d6b6aa5 tools/ci.sh: Change esp32 CI to work with idf.py and IDF v4.0.2.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-15 16:40:11 +11:00
Brianna Laugher d128999938 tools: Add filesystem action examples to pyboard.py help.
Signed-off-by: Brianna Laugher <brianna.laugher@gmail.com>
2021-02-13 14:37:28 +11:00
Dan Halbert d54b5861a3 wip 2021-02-12 19:01:14 -05:00
Damien George c9260dda23 rp2: Use local tinyusb instead of the one in pico-sdk.
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-02-12 12:56:28 +11:00
Dan Halbert f0564b4986 merge from upstream; complicated webusb merge 2021-02-11 18:50:02 -05:00
foamyguy 5c3371bd1a fix bitmap_font path in display resource gen 2021-02-05 18:05:37 -06:00
Dan Halbert 0802b22ed6 usb descriptors all set; rework of enabling for USB devices 2021-02-04 19:23:40 -05:00
Kevin Banks 1352938504 Changed URL 2021-02-04 16:35:42 -06:00
FiriaCTO e72069e241
Fix typo in comment
descriptors should be plural

Co-authored-by: Dan Halbert <halbert@halwitz.org>
2021-02-04 16:18:36 -06:00
Kevin Banks 4d90f198ec (I could have sworn I deleted that line...) 2021-02-03 18:54:03 -06:00
Kevin Banks f2067730cb Code cleanup and added a WEBUSB_README file 2021-02-03 18:51:48 -06:00
Kevin Banks 215a56c920 Merge branch 'main' into webusb (trying to get CI back online) 2021-02-03 16:48:28 -06:00
Kevin Banks 00926b687a Trying to keep two ARM builds from overflowing their FLASH 2021-02-03 11:16:19 -06:00
Kevin Banks 1a9e4f5613 Restored accidentally deleted character 2021-02-01 18:51:11 -06:00
Kevin Banks 817ca39f59 ITF_NUM_VENDOR is now automatically computed at run-time 2021-02-01 18:35:58 -06:00
stijn c2b5bfcc0c tools: Remove obsolete upip bootstrap script.
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-30 14:39:22 +11:00
Jim Mussared 2aecf378be tools/makemanifest.py: Add check that freeze path is a directory.
Avoids accidentally writing

    freeze("path/to/file.py")

and getting unexpected results.
2021-01-30 14:15:33 +11:00
stijn 37c2f507a0 github/workflows: Add workflow to verify commit message format.
Using the new tools/verifygitlog.py script.
2021-01-30 14:09:21 +11:00
stijn d48860c7dd tools/verifygitlog.py: Add script for verifying commit message format.
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-30 14:08:29 +11:00
Damien George b8f4c623f9 github/workflows: Add CI workflow for rp2 port.
Signed-off-by: Damien George <damien@micropython.org>
2021-01-30 00:42:29 +11:00
Damien George fe16e785fe tools/mpy-tool.py: List frozen modules in MICROPY_FROZEN_LIST_ITEM.
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Damien George 5d68b5e22c tools/ci.sh: For ci_code_size_setup, update apt to install gcc-multilib.
Signed-off-by: Damien George <damien@micropython.org>
2021-01-29 23:57:10 +11:00
Kevin Banks 63f9b12fe6 Partially hard-coded VENDOR descriptor has been added. First build to be accessed via WebUSB. NOTE - had to disable HID (EndPoint shortage?) 2021-01-28 20:22:31 -06:00
Scott Shawcroft 9325509b54
Fix blinka release PR language list 2021-01-27 14:08:52 -08:00
Kevin Banks 1b031508e1 BOS and MS_OS_2.0 descriptors have been added. Still more descriptor work TODO. 2021-01-26 20:43:19 -06:00
Kevin Banks fbfb7b68cc Most of the code we need has been pulled in from the tinyusb webusb_serial demo. Still LOTS to do regarding descriptors. 2021-01-25 20:37:58 -06:00
Damien George 203e1d2a65 tools/ci.sh: For code size build, fetch history of master branch only.
It's not necessary to fetch all branches.

Signed-off-by: Damien George <damien@micropython.org>
2021-01-24 15:02:20 +11:00
Kevin Banks 9ce33a5771 Now generates the WebUSB URL Descriptor. Still need to generate the Vendor Descriptors. 2021-01-22 08:16:10 -06:00
Scott Shawcroft 733094aead
Add initial RP2040 support
The RP2040 is new microcontroller from Raspberry Pi that features
two Cortex M0s and eight PIO state machines that are good for
crunching lots of data. It has 264k RAM and a built in UF2
bootloader too.

Datasheet: https://pico.raspberrypi.org/files/rp2040_datasheet.pdf
2021-01-20 19:16:56 -08:00
Kevin Banks 84d7a0da9d Initial steps, mostly via clone and modify. 2021-01-20 20:24:42 -06:00
Damien George de2374cdc6 tools/ci.sh: Pip install pyhy for stm32 builds.
Signed-off-by: Damien George <damien@micropython.org>
2021-01-18 12:43:01 +11:00
Jeff Epler 537a4daabd mark script as executable 2020-12-29 14:06:32 -06:00
Damien George ee52f89224 tools/ci.sh: Use pip-install to get latest version of esptool.py.
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-14 13:09:33 +11:00
Damien George 69262a11dc tools/ci.sh: Put echo of CI path in a separate function.
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-14 13:05:43 +11:00
Damien George cb1bb7592e stm32/Makefile: Change -O0 to -Og for DEBUG=1 builds.
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-07 22:27:38 +11:00
Damien George a59282b9bf tools/pyboard.py: Add fast raw-paste mode.
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-12-01 22:35:13 +11:00
Damien George 547e8a9fe7 tools/ci.sh: Add helper script to run CI tasks.
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-11-29 22:21:28 +11:00
Dan Halbert 65e2fe4654 fix stub problems; touch up doc 2020-11-27 23:27:15 -05:00
Scott Shawcroft b9bec87f29
Update build board info.
* Don't add full urls because they are too large.
* Remove the unstable version when it starts with the current
  version.
2020-11-18 17:38:06 -08:00
sw23 ad166ca479 Fixing make stub warnings and mypy issuesmak 2020-10-29 20:15:34 -04:00
awachtler 56e0932485 tools/upip.py: Support explicit port number in host.
Adding a port number other then 443 to a PyPI URL may be needed if a local
server like devpi is used.
2020-10-20 12:44:30 +11:00
Scott Shawcroft 29af7068d4
Ignore duplicate USB PID for prerelease version 2020-09-30 11:33:54 -07:00