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

chore: merge upstream v1.23.0 #10

Merged
merged 409 commits into from
Jun 20, 2024
Merged

chore: merge upstream v1.23.0 #10

merged 409 commits into from
Jun 20, 2024

Conversation

cpswan
Copy link
Member

@cpswan cpswan commented Jun 20, 2024

Foundational work for #9

- What I did

Merged upstream v1.23.0

- How I did it

git remote add upstream https://github.com/micropython/micropython.git
git fetch upstream
git remote set-url upstream --push DISABLED
git checkout v1.23.0
git checkout -b v1.23.0
git checkout aes_ctr
git merge v1.23.0
git checkout -b aes_ctr_v1.23.0
git push

- Description for the changelog

chore: merge upstream v1.22.0

dpgeorge and others added 30 commits February 21, 2024 12:00
So this header file can expose declarations for contents of the `machine`
module even if that module is disabled.  Other parts of the system -- or
third-party code -- may need these declarations, for example when a single
component like MICROPY_PY_MACHINE_UART is enabled with MICROPY_PY_MACHINE
disabled.

Signed-off-by: Damien George <[email protected]>
It will only ever be read from, and in some cases (eg on esp8266) can
actually be in ROM.

Signed-off-by: Damien George <[email protected]>
Allows giving more specific advice, provides more links to other places to
ask questions, check details, etc.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
The patch enables SDRAM banks 1 and 2 to be accessible at 0xC0000000 and
0xD0000000 respectively (default mapping) or remapped to addresses
0x60000000 and 0x70000000.

Signed-off-by: iabdalkader <[email protected]>
When the websocket closes currently, it does not send a proper
"close"-frame, but rather encodes the 0x8800-sequence inside a binary
packet, which is wrong.  The close packet is a different kind of websocket
frame, according to https://www.rfc-editor.org/rfc/rfc6455.

This change resolves an error in Firefox when the websocket closes.

Signed-off-by: Felix Dörre <[email protected]>
Prior to commit 628abf8 which added IPv6
support, binding a socket with

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind(("", PORT))

was possible.  But, the empty string is not regarded as a valid IP address
by lwip.  This commit adds a special case for the empty IP string,
restoring the previous CPython-compatible behaviour.

Signed-off-by: Felix Dörre <[email protected]>
For boards with MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES and up.
This gets samd21 boards working (which need the vfs module in _boot.py),
B_L072Z_LRWAN1, and nrf boards with smaller MCUs that use CORE or BASIC
feature levels.

Signed-off-by: robert-hh <[email protected]>
Matches CPython behaviour.

Fixes issue micropython#11530.

Signed-off-by: Damien George <[email protected]>
This call used to be needed when there was an `emit_bc_pre()` function that
needed to be called at the start of each emitted bytecode.  But in
8e7745e that function was removed and now
the call to `mp_emit_bc_adjust_stack_size()` does nothing when adjusting by
0 entries, so it can be removed.

Signed-off-by: Damien George <[email protected]>
It's instead declared by the include of `py/mpthread.h`.

Signed-off-by: Damien George <[email protected]>
Because `mpthreadport.h` is included by `mpthread.h`.

Also remove unnecessary include of `mpthreadport.h` in esp32's `main.c`.

Signed-off-by: Damien George <[email protected]>
This test cannot run on boards that have a native USB REPL, so rename it to
indicate that its "special".  This makes it easier to run a subset of
tests, for example:

    ./run-multitests.py multi_bluetooth/ble*.py
    ./run-multitests.py multi_bluetooth/perf*.py
    ./run-multitests.py multi_bluetooth/stress*.py

Signed-off-by: Damien George <[email protected]>
This moves the runtime initialisation of `ble_hs_cfg` to happen after
`nimble_port_init()`. That is consistent with the order used in NimBLE
examples. On the ESP32 port this is needed because the ESP-IDF sets up
the default RAM secret store callbacks in its implementation of
`nimble_port_init()` (specifically, it calls `esp_nimble_init()` which
in turn calls `ble_store_ram_init()`). We want to override those with
our own callbacks to implement the `IRQ_[GS]ET_SECRET` events in Python.

Signed-off-by: Daniël van de Giessen <[email protected]>
This sets the BLE key distribution parameters at runtime. This isn't
needed in most ports since we already set the default values in
`extmod/nimble/syscfg/syscfg.h`; however in the ESP32 port that
headerfile is not used, and the default values in the ESP-IDF don't
enable key distribution nor can we change those defaults via
`sdkconfig`. Thus we're setting these values explicitly at runtime.

Signed-off-by: Daniël van de Giessen <[email protected]>
Pairing and bonding was fixed for the ESP32 in the two previous commits.

Signed-off-by: Daniël van de Giessen <[email protected]>
Otherwise C++ compilers may complain when this header is included in an
extern "C" block.

Signed-off-by: Damien George <[email protected]>
It's no longer supported by Emscripten (at least at 3.1.55).  And it's not
needed when the output is WASM, which it is by default.

Signed-off-by: Damien George <[email protected]>
Includes various bug fixes.

Signed-off-by: Damien George <[email protected]>
And enable codespell for this port in `pyproject.toml`.

Signed-off-by: Damien George <[email protected]>
The STATIC macro was introduced a very long time ago in commit
d5df6cd.  The original reason for this was
to have the option to define it to nothing so that all static functions
become global functions and therefore visible to certain debug tools, so
one could do function size comparison and other things.

This STATIC feature is rarely (if ever) used.  And with the use of LTO and
heavy inline optimisation, analysing the size of individual functions when
they are not static is not a good representation of the size of code when
fully optimised.

So the macro does not have much use and it's simpler to just remove it.
Then you know exactly what it's doing.  For example, newcomers don't have
to learn what the STATIC macro is and why it exists.  Reading the code is
also less "loud" with a lowercase static.

One other minor point in favour of removing it, is that it stops bugs with
`STATIC inline`, which should always be `static inline`.

Methodology for this commit was:

1) git ls-files | egrep '\.[ch]$' | \
   xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/"

2) Do some manual cleanup in the diff by searching for the word STATIC in
   comments and changing those back.

3) "git-grep STATIC docs/", manually fixed those cases.

4) "rg -t python STATIC", manually fixed codegen lines that used STATIC.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
Prune trailing whitespace across the whole project (almost), done
automatically with:

    grep -IUrl --color "[[:blank:]]$" --exclude-dir=.git --exclude=*.exp |\
        xargs sed -i 's/[[:space:]]*$//'

Exceptions:
- Skip third-party code in lib/ and drivers/cc3100/
- Skip generated code in bluetooth_init_cc2564C_1.5.c
- Preserve command output whitespace in docs, eg:
  docs/esp8266/tutorial/repl.rst

Signed-off-by: Phil Howard <[email protected]>
The default value is 0, which is compatible with the existing behaviour.
Implementing that required changes to eth.c as well.  The value of phy_addr
is added to the eth_t data type.

Tested with a STM32F767 and a STM32H750 device.

Signed-off-by: robert-hh <[email protected]>
The MAC clock was initialized both in eth_init() and eth_mac_init().  The
latter is not required.

Signed-off-by: robert-hh <[email protected]>
With LAN8742, LAN8720, LAN83825 and DP83848 as possible options, and the
symbols PHY_LAN8720, PHY_LAN8742, PHY_DP83825 and PHY_DP8348.  The default
is PHY_LAN8742 which is the existing behaviour.

The eth_init() parameters for the Portenta H7 board are set to phy_addr=0
and phy_type=LAN8742, which matches the previous defaults and the
schematics.

Tested with LAN8720 and DP83848 breakout boards at 10M Duplex and 100M
Duplex modes.

Signed-off-by: robert-hh <[email protected]>
The inline functions that these are wrappers around already account for
cache line size.

Signed-off-by: Angus Gratton <[email protected]>
The existing MPU_CONFIG_DISABLE macro enables the MPU region but disables
all access to it.

The rename is necessary to support an MPU_CONFIG_DISABLE macro that
actually disables the MPU region entirely.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
This new DMA API corrects possible cache coherency issues on chips with
D-Cache, when working with buffers at arbitrary memory locations (i.e.
supplied by Python code).

The API is used by SPI to fix an issue with corrupt data when reading from
SPI using DMA in certain cases.  A regression test is included (it depends
on external hardware connection).

Explanation:

1) It's necessary to invalidate D-Cache after a DMA RX operation completes
   in case the CPU reads (or speculatively reads) from the DMA RX region
   during the operation.  This seems to have been the root cause of issue
   micropython#13471 (only when src==dest for this case).

2) More generally, it is also necessary to temporarily mark the first and
   last cache lines of a DMA RX operation as "uncached", in case the DMA
   buffer shares this cache line with unrelated data.  The CPU could
   otherwise write the other data at any time during the DMA operation (for
   example from an interrupt handler), creating a dirty cache line that's
   inconsistent with the DMA result.

Fixes issue micropython#13471.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <[email protected]>
This commit adds support for the dual-analog-pads on STM32H7 parts.  These
pads/pins are called PA0_C/PA1_C/PC2_C/PC3_C in the datasheet.  They each
have an analog switch that can optionally connect them to their normal pin
(eg PA0).  When the switch is open, the normal and _C pin are independent
pins/pads.

The approach taken in this commit to make these _C pins available to Python
is:
- put them in their own, independent row in the stm32h7_af.csv definition
  file, with only the ADC column defined (they are separate machine.Pin
  entities, and doing it this way keeps make-pins.py pretty clean)
- allow a board to reference these pins in the board's pins.csv file by the
  name PA0_C etc (so a board can alias them, for example)
- these pins (when enabled in pins.csv) now become available like any other
  machine.Pin through both machine.Pin.board and machine.Pin.cpu
- BUT these _C pins have a separate pin type which doesn't have any
  methods, because they don't have any functionality
- these _C pins can be used with machine.ADC to construct the appropriate
  ADC object, either by passing the string as machine.ADC("PA0_C") or by
  passing the object as machine.ADC(machine.Pin.cpu.PA0_C)
- if a board defines both the normal and _C pin (eg both PA0 and PA0_C) in
  pins.csv then it must not define the analog switch to be closed (this is
  a sanity check for the build, because it doesn't make sense to close the
  switch and have two separate pins)

Signed-off-by: Damien George <[email protected]>
dpgeorge and others added 22 commits May 23, 2024 14:20
This adds support to use the Nagle algorithm implemented already in lwIP to
determine when TCP data should be sent.

As currently written, MicroPython will only create packets if there is <25%
remaining in the send buffer.  Using it, sending a small message of ~50
bytes will not trigger output of the message on the network.  So it will
remained queued until the TCP interval timer expires, which can be up to
500ms.

Using Nagle's algorithm, the first write, no matter how small, will
generate a packet on the network.  And sending lots of data still makes
efficient use of the link.

In addition to this, an application designer may choose to always create
packets for every write by setting the TCP_NODELAY socket option.  That's
also implemented in this commit.
This adds support for the TCP_NODELAY socket option for lwIP sockets.
Generally, TCP sockets use the Nagle algorithm and will send data when
an ACK is received or after all previously-sent data has already been
ACKed.

If the TCP_NODELAY option is set for a socket, every write to the socket
will trigger a packet to be sent.

Signed-off-by: Jared Hancock <[email protected]>
Also define `mp_type_bytearray`.  These all help to write native modules.

Signed-off-by: Brian Pugh <[email protected]>
Signed-off-by: Damien George <[email protected]>
Python code is no longer needed to implement keyword arguments in
`btree.open()`, it can now be done in C.

Signed-off-by: Damien George <[email protected]>
The `run-natmodtests.py` script now properly excludes tests that don't use
the corresponding native module.

Signed-off-by: Damien George <[email protected]>
Eventually this needs to be made a generic call to the underlying VFS.  But
for now this prevents `disk_ioctl()` crashing on non-FAT filesystems.

Signed-off-by: Damien George <[email protected]>
Otherwise escape characters like \s and \W won't work correctly.

Signed-off-by: Damien George <[email protected]>
And use `asyncio.new_event_loop()` where possible.  This change is needed
because CPython 3.12 deprecated the `get_event_loop()` function.

Signed-off-by: Damien George <[email protected]>
The three-argument form of `.throw()` is deprecated since CPython 3.12.  So
split out into separate tests (with .exp files) the parts of the generator
tests that test more than one argument.

Signed-off-by: Damien George <[email protected]>
The `cert` argument passed to the verify callback is actually a memoryview.
And the `depth` argument seems to start at 1 for the tested URL.

Signed-off-by: Damien George <[email protected]>
This brings in:
- fixes to: aiohttp, tarfile, lora, gzip
- fixes and improvements to aioble
- deprecation of cbor2 decoder and encoder modules
- new usb package
- new pyusb package

Signed-off-by: Damien George <[email protected]>
Otherwise CPython gives a deprecation warning.

This test is not actually testing inversion of bools, rather that bit of
the test is used to compute the pass/fail result.

Signed-off-by: Damien George <[email protected]>
CPython 3.12 implemented hashing for slices, so now differs to MicroPython.

Signed-off-by: Damien George <[email protected]>
In CPython 3.12 these invalid str/bytes/fstring escapes will issue a
SyntaxWarning, and so differ to MicroPython.

Signed-off-by: Damien George <[email protected]>
Signed-off-by: Damien George <[email protected]>
Dynamic USB devices, revamped webassembly port, openamp, tls, vfs modules

This release of MicroPython adds support for dynamic USB devices defined in
Python, adds new `openamp`, `tls` and `vfs` modules, completely revamps the
webassembly port to add proxying between JavaScript and Python, and
implements significant code size optimisations for frozen modules.  There
are also many other enhancements and bug fixes.  Keep reading for a more
detailed summary of the main changes.

After a lot of design, development and testing, MicroPython now has full
support for user-defined USB devices.  The interface is via a new
`machine.USBDevice` class, and this allows the user to specify the USB
descriptors and implement Python callbacks for USB endpoint transfers.
With this, any USB device can be implemented in pure Python.  While the
`machine.USBDevice` interface is low-level and complete, there is a
higher-level USB library in `micropython-lib` that allows easier
implementation of devices, with examples for keyboard, mouse, MIDI and
serial CDC.  This feature is currently available on rp2 and samd ports, and
other ports will follow in the future.

Support for the OpenAMP (asymmetric multiprocessing) protocol has been
added through the new `openamp` module.  This allows MicroPython to control
other CPU cores in the system, to load and start processes and communicate
with them through endpoints.  This feature is currently available on the
mimxrt and stm32 ports.

Two other new modules have been added: `vfs` and `tls`.  The `vfs` module
contains all VFS (virtual filesystem) related functions and classes, such
as `mount`, `umount` and `VfsFat`.  These were originally in the `os`
module but having them there is not compatible with CPython, so they have
been moved to their own dedicated module.  They still exist in the `os`
module for now but will eventually be removed from there, so it's
recommended to start using the `vfs` module from now on.  Similarly the new
`tls` module is an evolution of the `ssl` module, whereby all the existing
functionality in `ssl` has been moved to the `tls` module.  This is done
because MicroPython's SSL interface is becoming increasingly different to
CPython's and moving this SSL/TLS functionality to a new `tls` module gives
it room to grow and obtain new features that are useful for embedded
applications.  And compatibility with normal Python is still retained via a
pure Python implementation of the `ssl` module.  One new feature in the new
`tls` module is the ability to register a certificate verification
callback.

Other additions include more methods on the `deque` object so it is
doubly-ended and supports iteration, and support for half-float 'e' format
in `struct.pack`/`struct.unpack`.  Dynamic native modules have had some
additional runtime methods exposed, and the .mpy sub-version has been
increased from v6.2 to v6.3 (native code in .mpy files will need to be
recompiled, but bytecode does not and is still compatible).

There has also been significant code size optimisations for frozen modules.
A new internal `mp_proto_fun_t` type has been defined which allows the
common case of bytecode functions (as opposed to native code) to be stored
in frozen code without any additional overhead of the `mp_raw_code_t`
descriptor structure.  All firmware builds using frozen modules will see a
significant decrease in size.  Code size has also improved further for very
small targets by adding an option to remove the qstr hash bytes.

Internally in the source code the "STATIC" macro definition has been
removed.  Code should now just use "static" instead.  If you have C/C++
code that uses "STATIC" then either replace it with "static", or provide
your own #define to define "STATIC" as "static".  See commit
decf8e6 for details.

Mbedtls has been updated to version 3.5.1.  And network interface
constants, such as `IF_STA` and `SEC_WPA2`, have now been consolidated
across ports so they all live at the `WLAN` class level, for example
`network.WLAN.SEC_WPA2` (existing constants at the `network` module level
have been retained for backwards compatibility, but the new ones should be
preferred from now on).

The esp32 port has seen some important bug fixes in the BLE component, to
deinitialise without crashing, and increase the BLE task stack size.  This
port also uses the new I2S IDF driver, and supports IDF 5.0.5 and 5.2.
There is support to enter the bootloader via `machine.bootloader()` and a
new `esp32.mcu_temperature()`, for ESP32-C3/S2/S3 devices.

The rp2 port has added the new `machine.USBDevice` dynamic USB driver, and
has had firmware performance optimisations applied to critical parts of the
runtime and VM, giving about a 10% performance boost.  There is now direct
memory access to PIO and SPI FIFOs via proxy arrays, and bugs have been
fixed with threads, lightsleep and UART IRQ latency.

The stm32 port has integrated support for the new `openamp` module, which
is enabled on all Arduino boards.  And firmware for Arduino boards now
freeze in additional Arduino-specific library code.  There have been fixes
for internal flash writes on STM32H5 and STM32H7 MCUs (bank selection and
flashing of the last word in a buffer), an important fix to a SPI DMA
caching bug, an I2C clock enable fix for I2C4 on STM32F7 MCUs, and a fix
for the FDCAN source clock frequency on STM32G4 MCUs.  Mboot has added
support for a new raw filesystem, to allow simpler and more robust firmware
updates.

The webassembly port has seen a significant overhaul in its structure, and
is now built as a JavaScript .mjs module that exports a user-friendly
JavaScript-level API which is inspired by the API provided by Pyodide
(which is a version of CPython that runs in the browser).  This change is
motivated by the need to use MicroPython as an engine within Pyscript,
which is a platform for Python in the browser.  New features in the
webassembly port include proxying of objects between Python and JavaScript,
a `js` module to interface with the JavaScript namespace, a `jsffi` module
for miscellaneous proxy helpers, top-level async code, JavaScript driven
asyncio support, automatic growing of the Python heap, integration of
JavaScript and Python finalisation for global memory management, more
`time` module functions, and support for build variants (following the unix
port).

The change in code size since the previous release for various ports is
(absolute and percentage change in the text section):

       bare-arm:   -220  -0.383%
    minimal x86:   -341  -0.184%
       unix x64: +20168  +2.527%
          stm32:  -1692  -0.430%
         cc3200:   +256  +0.139%
        esp8266:  -8880  -1.260%
          esp32:  -3328  -0.194%
         mimxrt:   -408  -0.112%
     renesas-ra:   -464  -0.074%
            nrf:   -640  -0.341%
            rp2:  +5380  +1.626%
           samd:  +3224  +1.229%

The leading causes of these changes in code size are:
- bare-arm, minimal: disabling qstr hashing
- unix: updating mbedtls to version 3.5.1
- stm32: optimising size of frozen modules
- cc3200: addition of new `vfs` module, and bug fixes in the VM and array
  type
- esp8266: disabling unused `MICROPY_DEBUG_PRINTERS` and optimising frozen
  modules
- esp32, mimxrt, renesas-ra, nrf: optimising frozen modules
- rp2: addition of `machine.USBDevice`, enabling -O2 optimisations
- samd: addition of `machine.USBDevice`

Performance is effectively unchanged since the previous release on all
ports, except the rp2 port which sees a performance improvement of roughly
10%.

Thanks to everyone who contributed to this release: Amirreza Hamzavi,
Andrew Leech, Angus Gratton, Brian Pugh, Carlosgg, Christian Walther,
Damien George, Daniël van de Giessen, darc, Dash Peters, David Lechner,
Felix Dörre, iabdalkader, IhorNehrutsa, Iksas, J. Neuschäfer, Jared
Hancock, Jim Lipsey, Jim Mussared, Jochen Sprickerhof, Joey232, Jos
Verlinde, Kwabena W. Agyeman, Maarten van der Schrieck, Matt Trentini,
Matthias Urlichs, Michiel W. Beijen, MikeTeachman, Nicko van Someren,
Olivier Lenoir, Phil Howard, Rick Sorensen, robert-hh, Sebastian Romero,
Simon Wood, Stanislav Ponomarev, stijn, Takeo Takahashi, Trent Piepho,
Trent Warlaven, Vonasmic, YAMAMOTO Takashi, Yoctopuce.

MicroPython is a global Open Source project, and contributions were made
from the following timezones: -0800, -0700, -0600, -0500, -0300, +0000,
+0100, +0200, +0330, +0400, +0900, +1000, +1100.

The work done in this release was funded in part through GitHub Sponsors,
and in part by George Robotics, Espressif, Anaconda, Arduino, LEGO
Education, OpenMV and Planet Innovation.

What follows is a detailed list of all changes, generated from the git
commit history, and organised into sections.

Main components
===============

all:
- fix "reuse" and "overridden" spelling mistakes
- update bindings, ports and tests for mbedtls v3.5.1
- use mp_obj_malloc_with_finaliser everywhere it's applicable
- remove the "STATIC" macro and just use "static" instead
- prune trailing whitespace
- update extmod, ports, examples to build with new berkeley-db lib
- add pre-commit hook for codespell
- update copyright year range to include 2024
- ISSUE_TEMPLATE: convert issue templates to forms

py core:
- py.mk: remove extra build dir created for frozen_content
- qstr: add support for MICROPY_QSTR_BYTES_IN_HASH=0
- mpconfig: disable qstr hashing at minimum feature level
- builtinimport: simplify calls to stat_path()
- compile: fix potential Py-stack overflow in try-finally with return
- emitglue: reorder and resize members of mp_raw_code_t
- emitglue: provide a truncated mp_raw_code_t for non-asm code
- emitglue: simplify mp_raw_code_t's kind and scope_flags members
- emitglue: introduce mp_proto_fun_t as a more general mp_raw_code_t
- emitglue: include fun_data_len in mp_raw_code_t only when saving
- makeversionhdr.py: reinstate MICROPY_GIT_HASH in mpversion.h
- obj: change sizeof to offsetof in mp_obj_malloc_var macro
- obj: introduce mp_obj_malloc_with_finaliser to allocate and set type
- misc: remove m_new_obj[_var]_with_finaliser macros
- objfun: make mp_obj_new_fun_native/mp_obj_new_fun_asm static-inline
- objfun: split viper fun type out to separate mp_type_fun_viper type
- emitnative: simplify layout and loading of native function prelude
- objfun: support __name__ on native functions and generators
- objfun: inline mp_obj_code_get_name() into mp_obj_fun_get_name()
- emitglue: remove n_pos_args from DEBUG_printf
- builtinevex: fix setting globals for native functions in compile()
- compile: remove TODO about name mangling
- emitglue: make mp_emit_glue_assign_native's fun_data arg a const ptr
- mpconfig: change the default enable level for the vfs module
- emitbc: remove call to adjust Python stack by 0 entries
- mpstate: don't declare mp_thread_get_state()
- modthread: move thread state initialisation to shared function
- emitglue: add explicit cast of proto_fun to uint8_t pointer
- objstr: add a macro to define a bytes object at compile time
- stream: add mp_stream_seek() helper function
- stream: factor stream implementations
- objdeque: expand implementation to be doubly-ended and support iter
- asm: add ASM_NOT_REG and ASM_NEG_REG macros for unary ops
- asmxtensa: optimise asm_xtensa_mov_reg_i32_optimised() for tiny ints
- emitnative: implement viper unary ops positive, negative and invert
- binary: support half-float 'e' format in struct pack/unpack
- parse: zero out dangling parse tree pointer to fix potential GC leak
- compile: add option to allow compiling top-level await
- nlr: add "memory" to asm clobbers list in nlr_jump
- makeqstrdata.py: ensure that scope names get low qstr values
- dynruntime: add mp_binary_get_size/get_val_array/set_val_array
- persistentcode: bump .mpy sub-version to 6.3
- objfun: fix C++ compatibility with casting in inline functions
- obj: fix initialiser order in MP_DEFINE_CONST_OBJ_TYPE_NARGS_ macros
- objarray: fix use-after-free if extending a bytearray from itself
- nlrthumb: make non-Thumb2 long-jump workaround opt-in
- dynruntime: add mp_obj_exception_init function to create C exception
- dynruntime: export mp_load_method_maybe and mp_arg_parse_all* funcs

extmod:
- extmod.mk: disable uninitialized warnings in kf_rem_pio2.c
- asyncio: support gather of tasks that finish early
- modssl_mbedtls: fix cipher iteration in SSLContext.get_ciphers
- modssl_axtls: add SSLContext.load_cert_chain()
- modtls: move the native ssl module to tls
- modtls_mbedtls: implement cert verification callback for mbedtls
- modvfs: add new "vfs" module with mount/umount and Vfs classes
- btstack: reset pending_value_handle before calling write-done cb
- btstack: reset pending_value_handle before calling read-done cb
- modrandom: add integer type casts where appropriate
- modlwip: support IPv6
- network_wiznet5k: adjust IP types for IPv6
- vfs_posix_file: ensure file object has safe default fd
- modmachine: remove MICROPY_PY_MACHINE guard from header
- modwebsocket: fix websocket to send correct close frame
- modlwip: add back support for empty IP addresses
- asyncio: make current_task raise exception when there is no task
- nimble: override configuration options set in nimble_port_init
- nimble: enable key distribution to support bonding
- network_ninaw10: activate the NIC on demand
- network_ninaw10: set the proper security mode if none provided
- network_ninaw10: fix error messages
- modmachine: add MICROPY_PY_MACHINE_SIGNAL configuration option
- modmachine: add MICROPY_PY_MACHINE_MEMX configuration option
- modmachine: add MICROPY_PY_MACHINE_RESET configuration option
- nimble: check for active before setting address mode
- machine_usb_device: add support for Python USB devices
- libmetal: add MicroPython platform for libmetal
- modopenamp: add new OpenAMP module
- modopenamp_remoteproc: add new OpenAMP RemoteProc class
- os_dupterm: handle exception properly when it occurs in parallel
- modnetwork: implement IPv6 API to set and get NIC configuration
- network_wiznet5k: properly enable interrupt signal on w5100s
- add interface and security constants at WLAN class level
- modtls_axtls: add verify_mode and CERT_NONE constant
- modopenamp: set a default log handler for ports
- modopenamp: use metal logging functions exclusively
- modasyncio: make mp_asyncio_context variable public
- network_wiznet5k: properly enable socket buffers for W5100(S)
- modlwip: use Nagle algorithm and add support for TCP_NODELAY
- modos: only sync FAT filesystems using disk_ioctl

shared:
- timeutils: remove useless void-return
- tinyusb: don't disconnect on soft reset unless USB was active
- tinyusb: update some code comments for runtime USB
- tinyusb: increase default string descr max length to 40 chars
- tinyusb: fix dynamic USB control callbacks for wLength==0
- tinyusb: stall the CDC IN endpoint while disconnecting

drivers:
- dht: only build DHT driver if MICROPY_PY_MACHINE_PULSE enabled
- memory: add IS25LPWP064D chip to list of external flash devices

mpy-cross: no changes specific to this component/port

lib:
- cmsis: update to CMSIS 5.9.0
- mbedtls: update to mbedtls v3.5.1
- mbedtls_errors: update error list for latest mbedtls
- micropython-lib: update submodule to latest
- cyw43-driver: update driver to latest version v1.0.3
- open-amp: add OpenAMP submodule
- libmetal: add libmetal submodule
- berkeley-db-1.xx: update submodule URL and version
- arduino-lib: add Arduino's external library

Support components
==================

docs:
- samd/pinout: update pinout docs with fixed pin assignment
- develop/porting: fix argument type of mp_lexer_new_from_file()
- add note about position-only arguments in CPython vs MicroPython
- library/ssl: change wrap_socket args keyfile/certfile to key/cert
- library: move vfs functions and classes from os to vfs module docs
- reference/micropython2_migration.rst: add info about os and vfs
- use vfs module instead of os
- library/sys.rst: document implementation.version.releaselevel
- library/bluetooth: add note that ESP32 supports pairing/bonding
- library/openamp: document the new openamp module
- library/collections: update deque docs to describe new features
- library/rp2.DMA: add documentation for rp2 DMA support
- library/machine.RTC: add docs for RTC.memory() method
- reference/mpyfiles: document change in .mpy sub-version
- develop/optimizations: fix typo identified in issue 14391
- esp32/quickref: add note about different ESP32 varieties
- library/machine.USBDevice: update note about packages in mp-lib
- reference: document how to mip install packages from GitLab
- library/asyncio: document that ThreadSafeFlag now works on unix
- update copyright year range to include 2024

examples:
- embedding: add -fno-common to the sample compiler flags
- natmod/framebuf: enable FrameBuffer.poly method
- usb: add a very simple USBDevice example with host
- usb: add a USBDevice example implementing the DFU protocol
- network: rename SSL examples to start with https
- network: add example of HTTPS client using non-blocking socket
- usb: add README that points out the alternative usb modules
- natmod/features4: create custom FactorialError as exc example
- natmod/btree: make btree.open use mp_arg_parse_all for kwargs

tests:
- run-tests.py: remove machine_mem.py test from skip list
- thread: adjust thread tests so most are able to run on rp2 port
- thread: add a test for accuracy of sleep within a thread
- run-multitests.py: change to dir of test script when running it
- multi_net: generate smaller certs with 2048-bit RSA
- run-tests.py: add an option for running only the failed tests
- run-tests.py: remove unneeded argument from run_feature_check()
- run-tests.py: make repl test detection more correct
- run-tests.py: fix path-based special test detection
- extmod/machine_uart_tx.py: add a test for timing of UART.flush()
- move port-specific test directories into tests/ports/ directory
- ports/rp2: add rp2-specific tests with a test for rp2.DMA
- extmod/machine_i2s_rate.py: test multiple I2S instances
- extmod/asyncio_wait_task.py: add test for raise and delayed wait
- extmod: remove asyncio .exp files that match CPython output
- extmod/framebuf_polygon.py: replace sys.stdout.write with print
- ports/rp2/rp2_dma.py: tweak test to be more reliable
- use vfs module instead of os
- multi_bluetooth/ble_irq_calls.py: enhance test to test recursion
- ports/unix: add coverage test for frozen functions and generators
- cpydiff: add new CPy diff test for class name mangling
- multi_bluetooth: move ble_deepsleep to stress_deepsleep_reconnect
- basics: split MicroPython-specific deque tests to separate file
- float/float_struct_e.py: add specific test for struct 'e' type
- run-tests.py: support running webassembly tests via node
- ports/webassembly: add webassembly JS tests
- net_inet: add simpler tls sites test, and skip existing on axtls
- cpydiff: add a note about risk of resizing memoryview targets
- micropython/import_mpy_invalid.py: skip if target cant import mpy
- run-natmodtests.py: fix search for supported native tests
- extmod: fix regex strings to be of r"" type
- extmod: add .exp test files for asyncio.get_event_loop tests
- basics: split out generator.throw tests that pass multiple args
- net_hosted/ssl_verify_callback.py: make exp match actual output
- net_inet/tls_text_errors.py: tweak test for newer CPython version
- float: use "not" instead of ~ to invert bool value
- basics: add .exp file for slice_op test
- basics: move str/bytes tests that give SyntaxWarning to sep file

tools:
- gen-changelog.sh: exclude "-preview" tags from generated log
- mpremote: reduce dependency on importlib_metadata
- manifestfile.py: change library search to use a list of paths
- mpy-tool.py: fix static qstrs when freezing without qstr header
- mpy-tool.py: skip generating frozen mp_raw_code_t when possible
- manifestfile.py: add --unix-ffi option
- ci.sh: add Arduino GIGA to stm32 CI build
- mpy-tool.py: fix merging of more than 128 mpy files
- ci.sh: update webassembly CI tests
- manifestfile.py: fix freeze() when script is an empty iterable
- mpremote: add support to mip install from GitLab
- ci.sh: simplify selection of natmod tests to run

CI:
- workflows: bump actions/cache from 3 to 4
- workflows: run mimxrt and rp2 CI with space in repository path
- workflows: move Windows CI from AppVeyor to GitHub Actions
- workflows: bump setup-msbuild, setup-python, checkout versions
- workflows: initialise micropython-lib submodule for windows CI
- workflows: move codespell to a GitHub workflow, version it
- workflows: add comments where tool versions need to be in sync
- workflows: standardise formatting of ruff.yml
- workflows: add Biome workflow for JavaScript formatting/linting
- workflows: update coverage workflow to codecov-action@v4
- workflows: run code size workflow on shared or port code changes

The ports
=========

all ports:
- move MICROPY_PY_LWIP_ENTER/REENTER/EXIT defns to mphalport.h
- move MICROPY_INTERNAL_WFE definition to mphalport.h
- fix handling of paths containing spaces in Makefiles
- add LED pin aliases for all Arduino boards
- use vfs module instead of os
- on cold boot, enable USB after boot.py completes
- don't include mpthread.h in mpthreadport.h

bare-arm port: no changes specific to this component/port

cc3200 port: no changes specific to this component/port

embed port:
- fix alloca include for FreeBSD and NetBSD
- improve stack top estimation

esp8266 port:
- boards/ESP8266_GENERIC: disable MICROPY_DEBUG_PRINTERS
- Makefile: add support for C++ user C modules
- network_wlan: add interface and security WLAN constants

esp32 port:
- modsocket: use all supplied arguments to socket.getaddrinfo()
- boards/UM_FEATHERS3: use read_uv() for accurate battery voltage
- network_ppp: make PPP support optional
- mpnimbleport: release the GIL while doing NimBLE port deinit
- increase NimBLE task stack size and overflow detection headroom
- machine_i2c: fix build warnings when I2C is disabled
- machine_hw_spi: combine argument parsing for constructor and init
- boards: add missing named digital pins for Arduino Nano ESP32
- machine_i2s: integrate new I2S IDF driver
- add support for IDF version v5.0.5
- add support for IDF version v5.2
- add IDF-version-specific sdkconfig
- mpconfigport: don't hang when machine.bootloader isn't supported
- modmachine: support bootloader on ESP32-S2/S3/C2/C3
- network_lan: add a separate argument to set PHY power pin
- machine_uart: always configure timeout_char setting in init()
- boards/ESP32_GENERIC_S3: add 4MiB partitioning board variant
- workaround IDF issue placing ISR ringbuf functions in IRAM
- main: check if main GC heap allocation failed
- network_wlan: add interface and security WLAN constants
- modesp32: add mcu_temperature() function for C3/S2/S3 devices
- panichandler: print support information on panic
- add support for TCP_NODELAY

mimxrt port:
- mphalport: remove redundant NVIC/IRQ defines
- mpbthciport: add missing extmod/modmachine.h header
- boards: fix __VECTOR_TABLE link issue with CMSIS 5.9.0
- modmachine: fix deepsleep wakeup pin ifdef
- fix header include guard names
- mpconfigport: enable cryptolib and hashlib md5
- define the MICROPY_HW_ENABLE_USBDEV macro
- set the security mode for the default WiFi AP
- add support for OpenAMP

minimal port:
- allow compiling on macOS
- use printf instead of echo -e

nrf port:
- modules/os/microbitfs: sweep the filesystem if any free chunk found
- fix _start() build issue with CMSIS 5.9.0
- boards: add named pins for Arduino Nano 33 BLE
- boards: enable MICROPY_HW_ENABLE_USBDEV on boards with USB CDC
- Makefile: allow external board definitions
- modules/machine: enable code formatting
- fix non-running LFCLK
- modules/machine: catch exceptions from pin interrupts
- modules/machine/pwm: tag a PWM device as used in the constructor
- main: fix build of microbit when SD is enabled
- Makefile: clean up dangling LIBS declaration
- mpconfigport: enable MICROPY_NLR_THUMB_USE_LONG_JUMP on nRF51xx

pic16bit port: no changes specific to this component/port

powerpc port: no changes specific to this component/port

qemu-arm port:
- mpconfigport: use MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES

renesas-ra port:
- ra: fix SysTick clock source
- ra: remove unnecessary min_delay() declaration
- boards/ARDUINO_PORTENTA_C33: fix the RTC clock source
- ra/ra_i2c: fix 1 byte and 2 bytes read issue
- fix spelling mistakes found by codespell
- boards: add named pins for Arduino Portenta C33
- boards/ARDUINO_PORTENTA_C33: add Arduino's external library

rp2 port:
- rp2_flash: lockout second core only when doing flash erase/write
- mutex_extra: implement additional mutex functions
- mpthreadport: fix race with IRQ when entering atomic section
- rp2_dma: fix fetching 'write' buffers for writing not reading
- provide direct memory access to PIO and SPI FIFOs via proxy arrays
- machine_uart: fix event wait in uart.flush() and uart.read()
- mpconfigport: allow MICROPY_PY_THREAD to be disabled by a board
- mpthreadport: make result of thread.get_ident() a non-zero integer
- machine_uart: fix potential race condition in interrupt handling
- boards/ARDUINO_NANO_RP2040_CONNECT: increase flash storage space
- change machine.I2S and rp2.DMA to use shared DMA IRQ handlers
- boards: add named digital pins for Arduino Nano RP2040 Connect
- enable support for Python USB devices
- CMakeLists: apply O2 optimisation to map, mpz and vm source code
- modmachine: prevent lock-up when lightsleep() called within thread
- README: fix typo, improve sentence about building with other boards
- boards/W5500_EVB_PICO: update incorrect url in board.json

samd port:
- remove the MICROPY_PY_MACHINE_RTC config option
- mcu/samd21: reorganize and enable more firmware features
- mcu: fix wrong EIC table entries in pin-af-table.csv
- mpconfigport: simplify and consolidate config options
- mcu/samd21: enable MICROPY_STACK_CHECK on SAMD21
- enable support for Python USB devices
- README: fix incorrect port directory name
- boards: enable MICROPY_HW_DFLL_USB_SYNC on appropriate boards
- mcu: update clock config after changes to USB
- samd_spiflash: allow configuring the flash SPI baudrate
- samd_qspiflash: avoid reading status byte 2 when not available
- mcu: guard static function with appropriate #if

stm32 port:
- mboot: improve detection of invalid flash erase/write
- mboot: improve mass erase to erase all non-protected pages
- flash: remove commented-out flash functions
- flash: simplify sector calculation for homogeneous flash layout
- flash: change flash_erase to only erase a single sector at a time
- flashbdev: don't rely on flash sector id
- flash: factor and simplify erase code
- flash: fix sector and bank calculation for H5 and H7 MCUs
- mboot/Makefile: revert change to BOARD_DIR that removed abspath
- disable qstr hashing on small boards
- boards/ARDUINO_PORTENTA_H7: add pin configuration for SPI1
- modos: allow disabling MICROPY_PY_MACHINE_UART
- spi: allow disabling MICROPY_PY_MACHINE_SPI
- main: allow disabling MICROPY_PY_MACHINE
- Makefile: ignore uninitialised variable warning in H5 HAL SD code
- mboot: generate FLASH_LAYOUT_STR at runtime on H5 MCUs
- mpbthciport: allow building with MICROPY_PY_MACHINE_UART disabled
- sdram: support remapping FMC memory banks
- network_lan: allow defining phy_addr in the LAN constructor
- eth: remove redundant ETH clock enable code
- network_lan: add the phy_type=x keyword option to network.LAN()
- simplify D-cache clean and invalidate macros
- mpu: rename MPU_CONFIG_DISABLE to MPU_CONFIG_NOACCESS
- dma: add D-cache protection for DMA RX operations, including SPI
- add support for dual-analog-pad "_C" pins on H7 MCUs
- boards: add named digital and analog pins for Arduino boardrs
- sdram: fix MPU config to use MPU_CONFIG_NOACCESS
- mpu: add MPU config for shared, uncached memory region
- implement port backend for libmetal
- implement port backend for OpenAMP's remoteproc
- boards/ARDUINO_GIGA: enable OpenAMP
- boards/ARDUINO_NICLA_VISION: enable OpenAMP
- boards/ARDUINO_PORTENTA_H7: enable OpenAMP
- mboot: add support for a raw filesystem
- boards/LEGO_HUB_NO6: move robust logic to mboot
- boards/LEGO_HUB_NO6: use a raw filesystem for mboot to update fw
- stm32.mk: enable _Float16 support on MCUs with hardware floats
- boards/ARDUINO_GIGA: add Arduino's external library
- boards/ARDUINO_NICLA_VISION: add Arduino's external library
- boards/ARDUINO_PORTENTA_H7: add Arduino's external library
- README: update list of supported STM32 series
- set the security mode for the default WiFi AP
- mpremoteprocport: use metal logging functions
- boards/LEGO_HUB_NO6: write key after writing elements
- boards/LEGO_HUB_NO7: add robust update logic to mboot
- flash: fix writing final words to flash on H5 and H7 MCUs
- mboot: buffer the correct amount of bytes for a flash write
- i2c: fix clock enable for I2C4 on STM32F7 MCUs
- pyb_can: fix STM32G4 FDCAN source clock frequency

unix port:
- variants: prefer unix-ffi packages when loading the manifest
- input: flush the prompt after writing it to stdout
- don't include system headers when features are disabled
- variants: don't use native _Float16 type

webassembly port:
- Makefile: remove --memory-init-file from linker options
- include lib in sys.path
- move MP_JS_EPOCH init to library postset
- implement MICROPY_PY_RANDOM_SEED_INIT_FUNC
- enable time localtime, gmtime, time, time_ns
- use POSIX write for output and add stderr
- add support for enabling MICROPY_GC_SPLIT_HEAP_AUTO
- clean up Makefile and add variant support
- add JavaScript proxying, and js and jsffi modules
- implement runPythonAsync() for top-level async code
- implement runCLI() for a Node-based CLI
- implement replInit() and replProcessChar()
- variants/pyscript: add pyscript variant
- update README.md to describe latest changes
- library: fix formatting and style for Biome
- proxy_c: ensure return value of async fun is passed to JS
- proxy_js: promote Python thenable to a Promise
- proxy_js: allow a Python proxy of a function to be undone
- api: fix waiting for Emscripten module to be loaded
- api: allocate code data on C heap when running Python code
- objjsproxy: fix handling of thrown value into JS generator
- proxy_c: fix proxy then reject handling
- proxy_c: fix then-continue to convert reason to throw value
- modjsffi: add jsffi.async_timeout_ms
- add JavaScript-based asyncio support
- api: inject asyncio.run if needed by the script
- api: fix importing micropython.mjs module from node REPL
- proxy_c: reject promises with a PythonError instance
- proxy_c: only proxy across resolve/reject funs when needed
- objjsproxy: fix proxying in arguments to JS new function
- objpyproxy: implement JS iterator protocol for Py iterables
- api: resolve thenables returned from runPythonAsync
- proxy_c: support more than 4 args when JS calls Py func
- asyncio: fix case where a Promise is resolved with no arg
- proxy_c: ensure objs thrown into generators are exceptions
- proxy_js: convert JS undefined and JS null to Py None
- mpconfigport: enable importing of .mpy files
- proxy_js: revert back to converting Py None to JS null
- proxy_js: create a special "undefined" type for Python
- proxy_c: return undefined if dict lookup failed on JS side
- objjsproxy: make jsproxy_it keep ref to jsproxy
- proxy_c: don't return value of a void function
- track the current depth of calls to external C functions
- set GC threshold and do top-level GC collect when possible
- add C-level finaliser to JsProxy object
- register PyProxy objects for JS-side finalisation
- modjsffi: add mem_info function to get detailed stats

windows port:
- windows_mphal: fix mp_hal_delay_ms() so it runs events
- Makefile: fix float exact int formatting on 32-bit mingw

zephyr port: no changes specific to this component/port
@cpswan cpswan requested review from gkc and realvarx June 20, 2024 13:21
@cpswan cpswan self-assigned this Jun 20, 2024
@realvarx
Copy link

realvarx commented Jun 20, 2024

With the official release of v1.23.0, we should change the header that activates AES CTR. More details can be found in #8

This might be needed too:
https://github.com/micropython/micropython/blob/master/ports/unix/mbedtls/mbedtls_config_port.h#L30

But inside the rp2 port:
https://github.com/micropython/micropython/blob/master/ports/rp2/mbedtls/mbedtls_config_port.h

@cpswan
Copy link
Member Author

cpswan commented Jun 20, 2024

@realvarx ack, but first I'd like to get this merged so the underlying pieces are in place.

@cpswan cpswan merged commit 4de7ca7 into aes_ctr Jun 20, 2024
1 check passed
@cpswan cpswan deleted the aes_ctr_v1.23.0 branch June 20, 2024 14:28
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.