Wykres commitów

14893 Commity (68e0e889b43c4c381515691b689b5f02f037063f)

Autor SHA1 Wiadomość Data
Damien George 68e0e889b4 docs/esp32: Update esp32 docs based on IDF v5 changes.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:49 +10:00
Damien George 717060447f esp32/Makefile: Provide more IDF shortcuts.
And change erase_flash to erase-flash, because the former is deprecated
since IDF 4.4.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:37 +10:00
Damien George bccbaa92b1 esp32/network_wlan: Wait for WIFI_EVENT_STA_START after activating.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:37 +10:00
Glenn Moloney 2cc3711e5e esp32: In recv_cb, get espnow rssi from recv_info->rx_ctrl.
IDF v5.0 provides access to rssi value for received espnow packets via
recv_info arg to recv_cb().

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2023-06-23 15:34:22 +10:00
Damien George e4650125b8 esp32: Update port to support IDF v5.0.2.
This commit updates the esp32 port to work exclusively with ESP-IDF v5.
IDF v5 is needed for some of the newer ESP32 SoCs to work, and it also
cleans up a lot of the inconsistencies between existing SoCs (eg S2, S3,
and C3).

Support for IDF v4 is dropped because it's a lot of effort to maintain both
versions at the same time.

The following components have been verified to work on the various SoCs:

                ESP32     ESP32-S2  ESP32-S3  ESP32-C3
    build       pass      pass      pass      pass
    SPIRAM      pass      pass      pass      N/A
    REPL (UART) pass      pass      pass      pass
    REPL (USB)  N/A       pass      pass      N/A
    filesystem  pass      pass      pass      pass
    GPIO        pass      pass      pass      pass
    SPI         pass      pass      pass      pass
    I2C         pass      pass      pass      pass
    PWM         pass      pass      pass      pass
    ADC         pass      pass      pass      pass
    WiFi STA    pass      pass      pass      pass
    WiFi AP     pass      pass      pass      pass
    BLE         pass      N/A       pass      pass
    ETH         pass      --        --        --
    PPP         pass      pass      pass      --
    sockets     pass      pass      pass      pass
    SSL         pass      ENOMEM    pass      pass
    RMT         pass      pass      pass      pass
    NeoPixel    pass      pass      pass      pass
    I2S         pass      pass      pass      N/A
    ESPNow      pass      pass      pass      pass
    ULP-FSM     pass      pass      pass      N/A
    SDCard      pass      N/A       N/A       pass
    WDT         pass      pass      pass      pass

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-23 15:34:22 +10:00
Damien George 2af229c3cc esp32/modesp32: Remove esp32.hall_sensor function.
The hall sensor is no longer supported by IDF v5.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:22 +10:00
Damien George 1db40ed295 esp32/ppp_set_auth: Add pppapi_set_auth from ESP-IDF.
This function was made private/static in IDF commit
c67f4c2b4c2bb4b7740f988fc0f8a3e911e56afe, so it add back here.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:22 +10:00
Angus Gratton 7c929d4478 esp32: Switch from UART driver to UART HAL.
Allows registering UART interrupt again.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-06-23 15:34:22 +10:00
Damien George 18caf49a7f extmod/modbtree: Undefine queue macros before including berkeley-db.
To prevent warnings when building with ESP IDF v5.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:22 +10:00
Damien George 402fdc40fb extmod/modplatform: Set MICROPY_PLATFORM_ARCH on riscv platforms.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:34:22 +10:00
Damien George e7ae3ad92d extmod: Update to support mbedtls 3.x.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-23 15:22:27 +10:00
Duncan Lowther 41c91422f0
tests/extmod/framebuf: Fix buffer size issues.
Tests framebuf1 and framebuf2 do not take the need for byte-aligned
strides into consideration when calculating buffer lengths.
Accordingly, the buffers allocated are slightly too small. Fixed
buffer length calculations.

Signed-off-by: Duncan Lowther <Duncan.Lowther@glasgow.ac.uk>
2023-06-21 09:49:03 +01:00
Duncan Lowther bc2ed8c55a
tests/extmod/uctypes_array_assign_le: Fix buffer.
Structure descriptor in test extmod/uctypes_array_assign_le
is 6 bytes long, due to member "arr3" having length 4
(2 * UINT16) and offset 2, but only 5 bytes are allocated.
Increased buffer length to 6 bytes.

Signed-off-by: Duncan Lowther <Duncan.Lowther@glasgow.ac.uk>
2023-06-21 09:48:37 +01:00
Duncan Lowther ae77836370
extmod/modbinascii: Fix buffer length error.
The mod_binascii_a2b_base64() function allocates a buffer which may be
too small. It needs to be no less than three-quarters of the input
length, but is calculated as (<length> / 4) * 3 + 1, which may be less
due to integer division. Changed to (<length> * 3) / 4 + 1.

Signed-off-by: Duncan Lowther <Duncan.Lowther@glasgow.ac.uk>
2023-06-21 09:48:11 +01:00
Duncan Lowther 25fb651566
lib/oofatfs: Fix speculative read in create_name.
Signed-off-by: Duncan Lowther <Duncan.Lowther@glasgow.ac.uk>
2023-06-21 09:47:44 +01:00
Jim Mussared ca79b49619 extmod/asyncio/uasyncio.py: Add backwards-compatible uasyncio alias.
This allows existing code that does `import uasyncio` or
`import uasyncio as asyncio` to continue working.

It uses the same lazy-loading as asyncio to prevent loading of unused
features.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 18:37:34 +10:00
Jim Mussared 7979a4d267 ports: In machine_i2s.c, rename uasyncio to asyncio.
Mostly updates comments, but also renames the UASYNCIO enum value to
ASYNCIO.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 18:36:54 +10:00
Jim Mussared d975bb1f27 examples/hwapi: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 18:36:54 +10:00
Jim Mussared 9092909bf5 docs: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 18:36:54 +10:00
Jim Mussared 6027c41c8f tests: Rename uasyncio to asyncio.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 17:33:03 +10:00
Jim Mussared 2fbc08c462 extmod/asyncio: Rename uasyncio to asyncio.
The asyncio module now has much better CPython compatibility and
deserves to be just called "asyncio".

This will avoid people having to write `from uasyncio import asyncio`.

Renames all files, and updates port manifests to use the new path. Also
renames the built-in _uasyncio to _asyncio.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 17:33:03 +10:00
Damien George ed962f1f23 tests/float: Test domain errors for more combos of args to math funcs.
Instead of having a special set of arguments to test for each math-module
function, just test all functions with all sets of arguments.  This gives
improved test cases to prevent regressions.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-18 12:45:55 +10:00
Damien George 47dc7d0130 esp32,esp8266: Allow Ctrl-C to interrupt the corrupt-fs while loop.
Commit c046b23ea2 prevented frozen boot code
from being interrupted by Ctrl-C, but that means a corrupt filesystem will
forever lock up an esp32/esp8266 board.  This commit fixes that by
explicitly enabling Ctrl-C before running the forever loop.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 12:19:57 +10:00
Damien George 0908d00453 tools/ci.sh: Add a H5 board to stm32 CI build.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:09:37 +10:00
Damien George 6f74146bc1 stm32/boards/STM32H573I_DK: Add H5 board definition files.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:09:37 +10:00
Damien George 56a22ddc8b stm32/octospi: Add preliminary support for OCTOSPI peripheral.
It currently operates in 1-line (SPI) mode only.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:09:37 +10:00
Damien George ec4232b32e stm32/boards: Add ld, af.csv and hal_conf_base.h files for H5 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:09:37 +10:00
Damien George 61339aa506 stm32: Add initial support for H5 MCUs.
This commit adds initial support for STM32H5xx MCUs.  The following
features have been confirmed to be working on an STM32H573:
- UART over REPL and USB CDC
- USB CDC and MSC
- internal flash filesystem
- machine.Pin
- machine.SPI transfers with DMA
- machine.ADC
- machine.RTC
- pyb.LED
- pyb.Switch
- pyb.rng
- mboot

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:09:20 +10:00
Damien George bd7196e123 lib/stm32lib: Update library for H5 v1.0.0.
Changes in this new library version are:
- Add H5 HAL at v1.0.0.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:56 +10:00
Damien George f7f8332ddf stm32/machine_adc: Handle ADC resolution less than 8 bits on all MCUs.
All MCUs can have 6-bit resolution; see adc_cr_to_bits_table.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:55 +10:00
Damien George 92d2de82e2 stm32/usbd_conf: Treat G0 USB periph as MICROPY_HW_USB_IS_MULTI_OTG=0.
The G0 USB peripheral behaves more like MICROPY_HW_USB_IS_MULTI_OTG=0 than
that config =1.  This fixes the configuration of the PMA FIFO buffers.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:53 +10:00
Damien George b839acc7d9 stm32/main: Start UART REPL as early as possible.
For debugging purposes, to see output from other peripherals.

Also reset the pyb_stdio_uart state at the end of soft reset, in case it
points to a heap-allocated object.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:49 +10:00
Damien George fb1bdf0ff2 stm32/make-stmconst.py: Support structs with names ending in _t.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:41 +10:00
Damien George 68b09abc45 stm32/Makefile: Pass relevant CPU flags to assembler.
Needed for compiling gchelper_thumb2 on cortex-m33.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:34 +10:00
Damien George bf9ca0bb33 py/mkrules.mk: Allow $(AFLAGS) to set flags to $(AS).
Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:02:15 +10:00
Damien George 33b403dfb4 tools/ci.sh: Build PICO_W board as part of rp2 CI.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Peter Harper 856e08b193 rp2/boards/PICO_W: Enable Bluetooth Low Energy support.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Peter Harper ba83f6d50c extmod/btstack: Fix marking of static addresses in set_random_address.
Marking address as static was not applied to all code paths.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Peter Harper a459eaf3e6 rp2/mpbthciport: Cancel existing alarms.
Cancel any existing poll alarm before add a new one.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Peter Harper 888a15cda3 rp2: Add Bluetooth support via cyw43.
Using BTstack with CYW43 for Pico W.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Peter Harper 35182a8688 extmod/btstack: Add cmake support for BTstack.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Damien George 1de335f7ff lib/pico-sdk: Update to version 1.5.1.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 22:20:20 +10:00
Damien George 825a95713e lib/btstack: Update to v1.5.6.2.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 19:23:27 +10:00
Damien George ca3807081a lib/cyw43-driver: Update driver to latest version v1.0.1.
Includes a fix for combined BT+WiFi when using SPI transport.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 19:23:27 +10:00
Jared Hancock b3cd41dd4b py/lexer: Allow conversion specifiers in f-strings (e.g. !r).
PEP-498 allows for conversion specifiers like !r and !s to convert the
expression declared in braces to be passed through repr() and str()
respectively.

This updates the logic that detects the end of the expression to also stop
when it sees "![rs]" that is either at the end of the f-string or before
the ":" indicating the start of the format specifier. The "![rs]" is now
retained in the format string, whereas previously it stayed on the end
of the expression leading to a syntax error.

Previously: `f"{x!y:z}"` --> `"{:z}".format(x!y)`
Now: `f"{x!y:z}"` --> `"{!y:z}".format(x)`

Note that "!a" is not supported by `str.format` as MicroPython has no
`ascii()`, but now this will raise the correct error.

Updated cpydiff and added tests.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-14 19:11:04 +10:00
Damien George 5ce1a03a78 py/makemoduledefs.py: Automatically declare delegation attr functions.
So that the delegation functions don't need to be put somewhere global,
like in mpconfigport.h.  That would otherwise make it hard for extension
modules to use delegation.

Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 19:03:46 +10:00
Damien George 44295c9daa py/makemoduledefs.py: Fix declaring multiple module delegations.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-14 19:03:29 +10:00
David Lechner b02a5fa10a py/nlraarch64: Fix dangerous use of input register.
Starting with 2757acf6, the `top` variable in `nlr_jump()` in
`nlraarch64.c` was assigned to register `x19` by the compiler.  However,
the assembly code writes over that register with

    ldp x19, x20, [%0,  #32]

since `%0` is now `x19`. This causes the next line

    ldp lr,  x9,  [%0,  #16]

to load the wrong values.

To fix the issue, we move the value of the `top` variable from an unknown
register to a known register at the beginning of the asm code then only use
known/hard-coded registers after that.

Fixes issue #11754.

Signed-off-by: David Lechner <david@pybricks.com>
2023-06-14 17:43:44 +10:00
David Lechner 8cf9898dd3 py/parsenum: Fix typo in #endif comment.
This fixes a `#endif` comment to exactly match the `#if`.

Signed-off-by: David Lechner <david@pybricks.com>
2023-06-14 17:32:01 +10:00
Wilko Nienhaus 034502bc72 esp32/esp32_ulp: Fix ULP (FSM) support for S2 and S3.
This change enables the ULP (FSM) for all ESP32 variants rather than
requiring it to be enabled for each board specifically.

It also ensures the correct header file is included for each variant.

Lastly, it updates the IDF version we're builing against to v4.4.2, as that
version contains important fixes to make the ULP actually work on S2/S3
chips. See: https://github.com/espressif/esp-idf/commit/a0e3d48

Signed-off-by: Wilko Nienhaus <wilko.nienhaus@gmail.com>
2023-06-14 16:41:03 +10:00