Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 1.16 #4897

Merged
merged 246 commits into from
Jun 23, 2021
Merged

Merge 1.16 #4897

merged 246 commits into from
Jun 23, 2021

Conversation

jepler
Copy link
Member

@jepler jepler commented Jun 18, 2021

Notable changes for CircuitPython:

  • In the Python core, OSError exceptions now support the ".errno" attribute
  • There has been a minor breaking change to a relative import exception: what was previously a ValueError was changed to ImportError, following the same change in CPython

dpgeorge and others added 30 commits April 20, 2021 21:39
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Improvements are:
- Default period is 1000ms with callback disabled.
- if period is not specified then it's not updated (previously, if period
  was not specified then it was set to -1 and running the timer callback as
  fast as possible, making the REPL unresponsive).
- Use uint64_t to compute delta_ms, and raise a ValueError if the period is
  too large.
- If callback is not specified then it's not updated.
- Specifying None for the callback will disable the timer.

Signed-off-by: Damien George <damien@micropython.org>
- unpack-dfu command no longer requies a secret key to be present
- pack-dfu command raises an exception if no secret key is found
This commit adds the errno attribute to exceptions, so code can retrieve
errno codes from an OSError using exc.errno.

The implementation here simply lets `errno` (and the existing `value`)
attributes work on any exception instance (they both alias args[0]).  This
is for efficiency and to keep code size down.  The pros and cons of this
are:

Pros:
- more compatible with CPython, less difference to document and learn
- OSError().errno will correctly return None, whereas the current way of
  doing it via OSError().args[0] will raise an IndexError
- it reduces code size on most bare-metal ports (because they already have
  the errno qstr)
- for Python code that uses exc.errno the generated bytecode is 2 bytes
  smaller and more efficient to execute (compared with exc.args[0]); so
  bytecode loaded to RAM saves 2 bytes RAM for each use of this attribute,
  and bytecode that is frozen saves 2 bytes flash/ROM for each use
- it's easier/shorter to type, and saves 2 bytes of space in .py files that
  use it (for each use)

Cons:
- increases code size by 4-8 bytes on minimal ports that don't already have
  the `errno` qstr
- all exceptions now have .errno and .value attributes (a cpydiff test is
  added to address this)

See also adafruit#2407.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
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>
Because "find_package(Python3 ...)" requires at least this version of
CMake.  And other features like GREATER_EQUAL and COMMAND_EXPAND_LISTS need
at least CMake 3.7 and 3.8 respectively.

Signed-off-by: Damien George <damien@micropython.org>
So this driver works on faster MCUs (that run this loop fast) with older,
slower SD cards.

Fixes issue adafruit#7129.

Signed-off-by: Damien George <damien@micropython.org>
It was made obsolete by commit c98c128.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
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 psf/black#1740

This commit makes the Python code in this repository conform to this rule.
Signed-off-by: Damien George <damien@micropython.org>
This introduces a new option, MICROPY_ERROR_REPORTING_NONE, which
completely disables all error messages.  To be used in cases where
MicroPython needs to fit in very limited systems.

Signed-off-by: Damien George <damien@micropython.org>
Reduces size of this port by about 3300 bytes, and demonstrates how to use
this feature.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Previously to this commit, Usart16ClockSelection was overwritten and
Usart234578ClockSelection was not set.
This commit re-enables the command-line make option "FROZEN_MANIFEST".  The
boards/*/mpconfigboard.cmake will now use the command-line FROZEN_MANIFEST
value if supplied.

Usage: make FROZEN_MANIFEST=~/foo/my-manifest.py
Signed-off-by: Damien George <damien@micropython.org>
This adds support for making static (ie not on the Python GC heap) soft
timers.  This can be useful for a board to define a custom background
handler, or eventually for BLE/network processing to use instead of systick
slots; it will be more efficient using soft timer for this.

The main issue with using the existing code for static soft timers is that
it would combine heap allocated and statically allocated soft_timer_entry_t
instances in the same pairing-heap data structure.  This would prevent the
GC from tracing some of the heap allocated entries (because the GC won't
follow pointers outside the heap).

This commit makes it so that soft timer entries are explicitly marked,
instead of relying on implicit marking by having the root of the pairing
heap in the root pointer section.  Also, on soft reset only the heap-
allocated soft timers are deleted from the pairing heap, leaving the
statically allocated ones.

Signed-off-by: Damien George <damien@micropython.org>
And use the same boardctrl.h header for both the application and mboot so
these constants are consistent.

Signed-off-by: Damien George <damien@micropython.org>
Commit 1e297c8 introduced a bug where the
very first reset-mode state on the LEDs was not shown, because prior to
that commit the first reset-mode state was the same as the initial LED
state (green on, others off) and update_reset_mode() was called after
setting this initial LED state.

This is fixed in this commit by changing the update_reset_mode() loop so
that it displays the current reset mode before doing the delay.

Signed-off-by: Damien George <damien@micropython.org>
A board can now use BUILDING_MBOOT at the Makefile-level to do things
conditional on building mboot, for example add source files to SRC_C.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
dpgeorge and others added 5 commits June 18, 2021 14:13
Commit 0abf6f8 removed _boot.py from the
manifest for the GENERIC_512K board because the build does not include a
filesystem.  But the main code expects _boot.py to be there and prints an
error if it's not.  So add a custom _boot.py, which just sets the
gc.threshold().

Signed-off-by: Damien George <damien@micropython.org>
It's not supported on older GCC versions.

Signed-off-by: Damien George <damien@micropython.org>
2.5 can be represented correctly in object representation C, but 2.3 cannot
(it is slightly truncated).

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
@jepler
Copy link
Member Author

jepler commented Jun 18, 2021

Unix tests pass locally, I'll let CI chew on the rest and see where we're at.

@jepler jepler marked this pull request as draft June 18, 2021 15:55
@jepler jepler marked this pull request as ready for review June 18, 2021 23:23
@jepler jepler requested a review from dhalbert June 18, 2021 23:23
@tannewt tannewt removed the request for review from dhalbert June 21, 2021 22:59
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking on this merge!

Please delete ports/zephyr, ports/rp2, ports/esp32 and ports/esp8266. We have our own ports and the extra folders confuse folks.

I delete tests/multi_{net,bluetooth} too since we don't use it.

We may want to delete tools/mpremote as well. I don't think it'll work with CircuitPython and I doubt we want to support it.

tools/pyboard.py Outdated Show resolved Hide resolved
@jepler
Copy link
Member Author

jepler commented Jun 22, 2021

@tannewt OK, got those all I think. Do you want me to try to "squash" this to a single merge commit, or did your recent experiences lead you to think that's not such a good idea?

@tannewt
Copy link
Member

tannewt commented Jun 22, 2021

No need to squash. It's funny with merge commits.

I see a ports/qemu-arm left that I forgot to list. For reference, I used this script to delete other ports: https://github.com/adafruit/circuitpython/blob/main/tools/merge_micropython.py#L13

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you!

@tannewt tannewt merged commit a7e353b into adafruit:main Jun 23, 2021
@ladyada
Copy link
Member

ladyada commented Jun 23, 2021

woo hoo!

@jepler jepler deleted the merge-1.16 branch November 3, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet