The zephyr CI takes the most time out of all CI jobs, so remove the
standard qemu_x86 build to speed it up. The remaining builds should still
cover enough cases to catch errors.
Signed-off-by: Damien George <damien@micropython.org>
This used to be used to generate .rst docs from inline comments in the C
code (specifically for APIs) but is now unused.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
App the mp_ prefix to usbd_ symbols and files which are defined here and
not in TinyUSB.
rp2 only for now. This includes some groundwork for dynamic USB devices
(defined in Python).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
So that filesystems mounted with "mpremote mount" can have their files
iterated over, making them consistent with other files.
Signed-off-by: Damien George <damien@micropython.org>
The except handler for OSError didn't include the line that actually calls
os.listdir, so an invalid path wasn't handled correctly.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
In order for v1.19.1 to load a .mpy, the formerly-feature-flags which are
now used for the sub-version must be zero.
The sub-version is only used to indicate a native version change, so it
should be zero when emitting bytecode-only .mpy files.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This applies to nimble, btstack, axtls, mbedtls, lwip.
Rather than having the ports individually manage GIT_SUBMODULES for these
components, make extmod.mk append them when the relevant feature is
enabled.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This check used to just show the regular expression that failed to match,
but the rules are pretty subtle and hard to interpret from the regular
expression alone.
Add some basic checks for the main things that go wrong:
- Missing capitalisation.
- Missing full-stop.
- Missing path.
- Single-word subject.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The "signed-off" check assumes that the Signed-off-by: line is the last,
but there may me many lines of comments after this.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Note: at this time, the ssl module on pico_w never verifies the server
certificate. This means it does not actually provide a higher security
level than regular socket / http protocols.
Fixes in this commit are:
- Make --follow the default for "run" (accidentally changed in 68d094358).
- Add help strings for "repl": --capture --inject-file --inject-code
- Update help strings for "run".
- Fix encoding for --inject-code (accidentally broken in 68d094358).
- Remove ability to --no-follow for "eval". It was there previously because
it shared the same code path with "exec" and "run", but makes no sense
for "eval", so might as well remove.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Tweak the existing codeformat.py and verifygitlog.py to allow them to be
easily called by pre-commit.
(This turned out to be easier than using any existing pre-commit hooks,
without making subtle changes in the formatting.)
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Uncrustify versions are not mutually compatible:
1. Version 0.73 or newer produce slightly different formatting. It may be
possible to tweak these by adding more config items, but this will cause
older versions to error out with 'Unknown option'.
2. Version 0.75 prints a range of deprecation warnings due to config file
changes, and returns a non-zero exit code. These are actually fixable
as most are the default value, and pp_indent has changed from 'true' to '1'
which is backwards compatible. However issue 1 remains, so probably better
to have it fail explicitly.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This supports the same package sources as the new `mip` tool.
- micropython-lib (by name)
- http(s) & github packages with json description
- directly downloading a .py/.mpy file
The version is specified with an optional `@version` on the end of the
package name. The target dir, index, and mpy/no-mpy can be set through
command line args.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
No functional change other than to allow slightly more flexibility in how
--foo arguments are specified.
This removes all custom handling for --foo args in all commands and
replaces it with per-command argparse configs.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
No functional change.
This makes each built-in command defined by just a handler method and
simplifies a lot of the logic around tracking the board state.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Originally, black_bindings found each contiguous "//|" block and sent
it to black independently. This was slower than it needed to be.
Instead, swap the comment prefix: when running black, take off
"//|" prefixes and put "##|" prefixes on all un-prefixed lines.
Then, after black is run, do the opposite operation
This more than doubles the overall speed of "pre-commit run --all",
from 3m20s to 55s CPU time on my local machine (32.5s to under 10s
"elapsed" time)
It also causes a small amount of churn in the bindings, because
black now sees enough context to know whether one 'def' follows another
or ends the 'def's in a 'class'. In the latter case, it adds an extra
newline, which becomes a "//|" line.
I'm less sure why a trailing comma was omitted before down in
rp2pio/StateMachine.c but let's roll with it.
Updates all README.md and docs, and manifests to `require("mip")`.
Also extend and improve the documentation on freezing and packaging.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
My pings go out, and then they come back
```py
import os
import wifi
import ipaddress
wifi.radio.connect(os.getenv('WIFI_SSID'), os.getenv('WIFI_PASSWORD'))
ipv4 = ipaddress.ip_address("8.8.4.4")
print("Ping google.com: %f ms" % (wifi.radio.ping(ipv4)*1000))
```
This uses the frozentest.mpy that is also used by ports/minimal.
Also fixes two bugs that these new tests picked up:
- File extension matching in manifestfile.py.
- Handling of freeze_mpy results in makemanifest.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
frozentest.mpy was previously duplicated in ports/minimal and
ports/powerpc.
This needs to be re-generated on every .mpy version increase, so might as
well just have a single copy of it.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The intent is to allow us to make breaking changes to the native ABI (e.g.
changes to dynruntime.h) without needing the bytecode version to increment.
With this commit the two bits previously used for the feature flags (but
now unused as of .mpy version 6) encode a sub-version. A bytecode-only
.mpy file can be loaded as long as MPY_VERSION matches, but a native .mpy
(i.e. one with an arch set) must also match MPY_SUB_VERSION. This allows 3
additional updates to the native ABI per bytecode revision.
The sub-version is set to 1 because the previous commits that changed the
layout of mp_obj_type_t have changed the native ABI.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
This is a no-op for coverage and minimal.
The standard and dev variants have been merged and enable the same feature
set as a typical bare-metal board. And remove the CI for the dev build.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
When iterating over filesystem/folders with os.iterdir(), an open file
(directory) handle is used internally. Currently this file handle is only
closed once the iterator is completely drained, eg. once all entries have
been looped over / converted into list etc.
If a program opens an iterdir but does not loop over it, or starts to loop
over the iterator but breaks out of the loop, then the handle never gets
closed. In this state, when the iter object is cleaned up by the garbage
collector this open handle can cause corruption of the filesystem.
Fixes issues #6568 and #8506.
In case the version from pypi is installed or some other version is
available in sys.path, prepend `$(TOP)/mpy-cross` to sys.path instead.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Previous the build directory just used the board name, now make it use the
variant name too.
This shouldn't have any change because the existing directory should not
exist (all builds run by these scripts remove their build directory after
completion), but it makes debugging easier.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The metadata can be version, description, and license.
After executing a manifest, the top-level metadata can be queried, and also
each file output from the manifest will have the metadata of the
containing manifest.
Use the version metadata to "tag" files before freezing such that they have
__version__ available.
By default, don't include micropython-lib/unix-ffi in the search.
If unix_ffi=True is passed to require(), then include unix-ffi and make it
take precedence over the other locations (e.g. python-stdlib).
This does two things:
- Prevents non-unix builds from using unix-only packages.
- Allows the unix build to optionally use a more full-featured (e.g. ffi)
based package, even with the same name as one from e.g. stdlib.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
If an include path is a directory, then it implicitly grabs the manifest.py
file inside that directory. This simplifies most manifest.py files.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This splits the manifest file loading logic from makemanifest.py and
updates makemanifest.py to use it.
This will allow non-freezing uses of manifests, such as defining packages
and dependencies in micropython-lib.
Also adds additional methods to the manifest "API":
- require() - to get a package from micropython-lib.
- module() - to define a single-file module
- package() - to define a multi-file package
module() and package() should replace most uses of freeze() and can also
be also used in non-freezing scenarios.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Having two separate manifests is confusing. It's simpler to have the daily
builds use the same configuration as the stable, release builds.
Signed-off-by: Damien George <damien@micropython.org>
It has been about 8 years since support for this chip was added. Reasons
to remove it are:
- It is no longer easy to obtain this part.
- There are now many other options for WiFi.
- It's not a good use of developer time to maintain it.
Signed-off-by: Damien George <damien@micropython.org>
Rather than having the autobuild know about the particular variants, have
the mpconfigboard.mk describe them and make autobuild discover them
automatically.
Adds a "query-variants" target to stm32/Makefile to allow the set of
possible variants to be queried.
Removes pybv3 from the autobuild as this isn't use by the downloads page.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
- Add lib/wiznet5k into the 'make submodules' step.
- Split the stm32 builds for wiznet5k and cc3k.
- Run 'make .... clean' after making the wiznet5k build.
This allows a remote file to be edited locally by copying it over, running
the local editor, then copying it back.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The executable now lives in the build directory, and since the build
directory already contains the variant name there is no need to also add
it to the executable.
Signed-off-by: Damien George <damien@micropython.org>
Binaries built using the Make build system now no longer appear in the
working directory of the build, but rather in the build directory. Thus
some paths had to be adjusted.
Formerly, py/formatfloat would print whole numbers inaccurately with
nonzero digits beyond the decimal place. This resulted from its strategy
of successive scaling of the argument by 0.1 which cannot be exactly
represented in floating point. The change in this commit avoids scaling
until the value is smaller than 1, so all whole numbers print with zero
fractional part.
Fixes issue #4212.
Signed-off-by: Dan Ellis dan.ellis@gmail.com
* Tweak scroll area position so last line is complete and top is
under the title bar.
* Pick Blinka size based on the font to minimize unused space in
title bar. Related to #2791
* Update the title bar after terminal is started. Fixes#6078Fixes#6668
If a changed file is in frozen, supervisor, shared-bindings,
shared-module or common-hal, then compute board settings to
determine if it is impacted.
This should reduce the boards built for changes that are in those
directories.
- define CIRCUITPY_BUILD_EXTENSIONS to predefined values
- set CIRCUITPY_BUILD_EXTENSIONS in port and board config
- reuse the support matrix "get_settings_from_makefile" to get it
- move the existing port and board specific values
- remove the C3 specific board values because it's not the default
- update build_release_files.py to use get_settings_from_makefile
Formerly, py/formatfloat would print whole numbers inaccurately with
nonzero digits beyond the decimal place. This resulted from its strategy
of successive scaling of the argument by 0.1 which cannot be exactly
represented in floating point. The change in this commit avoids scaling
until the value is smaller than 1, so all whole numbers print with zero
fractional part.
Fixes issue #4212.
Signed-off-by: Dan Ellis dan.ellis@gmail.com
A recent build failed. The original error seemed to be during ci_fetch_deps
where a build message said
```
fatal: reference is not a tree: 346c936e14c6ea3a8d3d65cb1fa46202dc92999d
fatal: Unable to checkout '346c936e14c6ea3a8d3d65cb1fa46202dc92999d' in submodule path 'extmod/ulab'
```
(along with other problems), but this step didn't signal failure to
github actions.
By adding the check= parameter, a failure of the subprocess will cause
a CalledProcessError to be raised, which will make ci_fetch_deps exit with
nonzero status. In turn, this should let Actions understand that something
went wrong with this step, instead of waiting for some subsequent step(s)
to go wrong.
The CI scripts were using a PPA to get a backported version of uncrustify
on Ubuntu 20.04. However, this causes CI to intermittently fail due to
connection issues to launchpad.net or the key server.
Ubuntu 22.04 has a newer version of uncrustify removing the need for the
PPA. Ubuntu 22.04 is now in beta on GitHub actions, so it can be used.
Signed-off-by: David Lechner <david@pybricks.com>
Updates the Zephyr port build instructions and CI to use the latest Zephyr
release tag.
Tested on frdm_k64f.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This adds support for CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD
in `/.env`. When both are defined, CircuitPython will attempt to
connect to the network even when user code isn't running. If the
user code attempts to a network with the same SSID, it will return
immediately. Connecting to another SSID will disconnect from the
auto-connected network. If the user code initiates the connection,
then it will be shutdown after user code exits. (Should match <8
behavior.)
This PR also reworks the default displayio terminal. It now supports
a title bar TileGrid in addition to the (newly renamed) scroll area.
The default title bar is the top row of the display and is positioned
to the right of the Blinka logo when it is enabled. The scroll area
is now below the Blinka logo.
The Wi-Fi auto-connect code now uses the title bar to show its
state including the IP address when connected. It does this through
the "standard" OSC control sequence `ESC ] 0 ; <s> ESC \` where <s>
is the title bar string. This is commonly supported by terminals
so it should work over USB and UART as well.
Related to #6174
This tests the build when -O2 is used, which can lead to additional
compiler analysis and warnings.
Signed-off-by: Damien George <damien@micropython.org>
Frozen identifiers now include their full name hierarchy, eg their class
name. This makes it easier to understand the generated code.
Signed-off-by: Damien George <damien@micropython.org>
Now that the native qstr link table is gone, merging a native .mpy file
with a bytecode .mpy file is not as simple as concatenating the .mpy data.
The qstr_table and obj_table tables from all merged .mpy files must now be
joined together, because they are global to the .mpy file (and hence global
to the merged .mpy file). This means the bytecode needs to be be decoded,
qstr_table and obj_table indices updated to point to the correct entries in
the new tables, and then the bytecode re-encoded.
This commit makes this change to the merging feature in mpy-tool.py. This
can now merge an arbitrary number of bytecode .mpy files, and up to one
native .mpy file.
Signed-off-by: Damien George <damien@micropython.org>
This was made redundant by f2040bfc7e, which
also did not update this function for the change to qstr-opcode encoding,
so it does not work correctly anyway.
Signed-off-by: Damien George <damien@micropython.org>
Support for architecture-specific qstr linking was removed in
d4d53e9e11, where native code was changed to
access qstr values via qstr_table. The only remaining use for the special
qstr link table in persistentcode.c is to support native module written in
C, linked via mpy_ld.py. But native modules can also use the standard
module-level qstr_table (and obj_table) which was introduced in the .mpy
file reworking in f2040bfc7e.
This commit removes the remaining native qstr liking support in
persistentcode.c's load_raw_code function, and adds two new relocation
options for constants.qstr_table and constants.obj_table. mpy_ld.py is
updated to use these relocations options instead of the native qstr link
table.
Signed-off-by: Damien George <damien@micropython.org>
This enables the new `-X realtime` runtime option when running tests on
macOS. This causes MicroPython to configure all threads to be high
priority so that they are allowed to use high precision timers. This
makes tests that depend on the passage of time more likely to succeed.
CI tests that were disabled because of this are now enabled again.
Signed-off-by: David Lechner <david@pybricks.com>
The examples/natmod features0 and features1 examples now build and run on
ARMv6-M platforms. More complicated examples are not yet supported because
the compiler emits references to built-in functions like __aeabi_uidiv.
Signed-off-by: Damien George <damien@micropython.org>
Some architectures (like esp32 xtensa) cannot read byte-wise from
executable memory. This means the prelude for native functions -- which is
usually located after the machine code for the native function -- must be
placed in separate memory that can be read byte-wise. Prior to this commit
this was achieved by enabling N_PRELUDE_AS_BYTES_OBJ for the emitter and
MICROPY_EMIT_NATIVE_PRELUDE_AS_BYTES_OBJ for the runtime. The prelude was
then placed in a bytes object, pointed to by the module's constant table.
This behaviour is changed by this commit so that a pointer to the prelude
is stored either in mp_obj_fun_bc_t.child_table, or in
mp_obj_fun_bc_t.child_table[num_children] if num_children > 0. The reasons
for doing this are:
1. It decouples the native emitter from runtime requirements, the emitted
code no longer needs to know if the system it runs on can/can't read
byte-wise from executable memory.
2. It makes all ports have the same emitter behaviour, there is no longer
the N_PRELUDE_AS_BYTES_OBJ option.
3. The module's constant table is now used only for actual constants in the
Python code. This allows further optimisations to be done with the
constants (eg constant deduplication).
Code size change for those ports that enable the native emitter:
unix x64: +80 +0.015%
stm32: +24 +0.004% PYBV10
esp8266: +88 +0.013% GENERIC
esp32: -20 -0.002% GENERIC[incl -112(data)]
rp2: +32 +0.005% PICO
Signed-off-by: Damien George <damien@micropython.org>
Prior to this commit, even with unicode disabled .py and .mpy files could
contain unicode characters, eg by entering them directly in a string as
utf-8 encoded.
The only thing the compiler disallowed (with unicode disabled) was using
\uxxxx and \Uxxxxxxxx notation to specify a character within a string with
value >= 0x100; that would give a SyntaxError.
With this change mpy-cross will now accept \u and \U notation to insert a
character with value >= 0x100 into a string (because the -mno-unicode
option is now gone, there's no way to forbid this). The runtime will
happily work with strings with such characters, just like it already works
with strings with characters that were utf-8 encoded directly.
This change simplifies things because there are no longer any feature
flags in .mpy files, and any bytecode .mpy will now run on any target.
Signed-off-by: Damien George <damien@micropython.org>