Wykres commitów

102 Commity (b2ad7e238b4e6de86aef646d715cf9a8a5144807)

Autor SHA1 Wiadomość Data
Damien George 2ede7c6c21 esp32/boards: Change SDK config parameters from deprecated to new ones.
Signed-off-by: Damien George <damien@micropython.org>
2023-06-24 18:20:56 +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
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
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
UnexpectedMaker 3a7ad64267 esp32/boards: Add some missing board configs for two UM boards. 2023-05-19 22:30:42 +10:00
Glenn Moloney 7fa322afb8 esp32,esp8266: Add support for the Espressif ESP-NOW protocol.
ESP-NOW is a proprietary wireless communication protocol which supports
connectionless communication between ESP32 and ESP8266 devices, using
vendor specific WiFi frames.  This commit adds support for this protocol
through a new `espnow` module.

This commit builds on original work done by @nickzoic, @shawwwn and with
contributions from @zoland.  Features include:
- Use of (extended) ring buffers in py/ringbuf.[ch] for robust IO.
- Signal strength (RSSI) monitoring.
- Core support in `_espnow` C module, extended by `espnow.py` module.
- Asyncio support via `aioespnow.py` module (separate to this commit).
- Docs provided at `docs/library/espnow.rst`.

Methods available in espnow.ESPNow class are:
- active(True/False)
- config(): set rx buffer size, read timeout and tx rate
- recv()/irecv()/recvinto() to read incoming messages from peers
- send() to send messages to peer devices
- any() to test if a message is ready to read
- irq() to set callback for received messages
- stats() returns transfer stats:
    (tx_pkts, tx_pkt_responses, tx_failures, rx_pkts, lost_rx_pkts)
- add_peer(mac, ...) registers a peer before sending messages
- get_peer(mac) returns peer info: (mac, lmk, channel, ifidx, encrypt)
- mod_peer(mac, ...) changes peer info parameters
- get_peers() returns all peer info tuples
- peers_table supports RSSI signal monitoring for received messages:
    {peer1: [rssi, time_ms], peer2: [rssi, time_ms], ...}

ESP8266 is a pared down version of the ESP32 ESPNow support due to code
size restrictions and differences in the low-level API.  See docs for
details.

Also included is a test suite in tests/multi_espnow.  This tests basic
espnow data transfer, multiple transfers, various message sizes, encrypted
messages (pmk and lmk), and asyncio support.

Initial work is from https://github.com/micropython/micropython/pull/4115.
Initial import of code is from:
https://github.com/nickzoic/micropython/tree/espnow-4115.
2023-05-01 16:47:21 +10:00
Jim Mussared eb51ca4a11 esp32: Use extmod/modnetwork.c instead of port-specific version.
Rather than duplicating the implementation of `network`, this allows ESP32
to use the shared one in extmod.  In particular this gains access to
network.hostname and network.country.

Set default hostnames for various ESP32 boards.

Other than adding these two methods and the change to the default hostname,
there is no other user-visible change.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-03-01 01:26:54 +11:00
Jim Mussared 8b27482692 top: Update Python formatting to black "2023 stable style".
See https://black.readthedocs.io/en/stable/the_black_code_style/index.html

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-02 12:51:03 +11:00
Jim Mussared 6250337c9c ports: Make all network-capable boards use bundle-networking.
This will ensure that any board with networking support gets:
 - webrepl
 - mip
 - urequests
 - ntptime

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-01 12:42:06 +11:00
robert-hh c2ab1b5185 esp32/boards/OLIMEX_ESP32_POE: Remove id from and update board.json. 2023-01-28 15:29:01 +11:00
Clayton Cronk 54e85fe212 esp32/boards/GENERIC_UNICORE: Add board definition for unicore chips.
Tested to work on an ESP32-MINI-1, which is a single core ESP32-U4DWH.

Signed-off-by: Clayton Cronk <awesomecronk@gmail.com>
2023-01-19 22:38:02 +11:00
robert-hh 32a858e254 esp32/boards: Add board definition for Olimex ESP32 PoE boards.
The major setting is about the PHY interface configuration.  The
configuration matches the Olimex ESP32 Gateway as well.

Tested with esp-idf v4.2.4 and Olimex ESP32 POE boards.
2023-01-19 20:24:06 +11:00
Red_M 1290329415 esp32/boards/GENERIC_S3_SPIRAM_OCT: Add ESP32S3 board with Octal SPIRAM. 2022-12-19 13:29:33 +11:00
Jim Mussared b705732d5f esp32/boards/GENERIC_S3_SPIRAM: Enable BLE.
Follow up to 8a91c719 to no longer explicitly disable BLE in
mpconfigport.h.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-11-23 09:42:54 +11:00
PGE 8a91c71966 esp32/boards/GENERIC_S3_SPIRAM: Enable BLE support. 2022-11-15 23:40:42 +11:00
Jim Mussared 924a3e03ec top: Replace upip with mip everywhere.
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>
2022-09-30 17:34:03 +10:00
Jim Mussared d84c6ef0e8 ports: Use micropython-lib version of drivers in manifests. 2022-09-08 11:27:05 +10:00
Jim Mussared 203dae41fb all: Update all manifest.py files to use new features.
Changes in this commit:
- Manifest include's now use the directory path where possible (no longer
  necessary to include the manifest.py file explicitly).
- Add manifest.py for all drivers and components that are referenced by
  port/board manifests.
- Replace all uses of freeze() with package()/module(), except for port and
  board modules.
- Use opt=3 everywhere, for consistency and to reduce code size.
- Use require() instead of include() for all micropython-lib references.
- Remove support for optional board-level manifest.py in mimxrt port, to
  make it behave the same as other ports (the board must set
  FROZEN_MANIFEST to a custom manifest.py, which can optionally include the
  default, port-level manifest).
- Also reinstates modules that were accidentally removed from the esp8266
  512k build in fbe9417b90.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
2022-09-05 18:43:18 +10:00
Damien George 730e975091 esp32/boards: Merge manifest_release modules into standard manifest.
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>
2022-08-30 11:34:34 +10:00
Ian Davies fbe9417b90 extmod/ntptime: Factor out ntptime module from esp8266 port.
The ntptime module was previously only included in the ESP8266 port.  This
commit factors that module out into the extmod directory, makes it support
different epochs, and includes it in the rp2 port.
2022-08-06 00:08:32 +10:00
Christian Walther cf550ad9d1 esp32/boards: Increase 512 bytes limit on ULP programs to 2040.
Allow esp32.ULP.load_binary() to use the maximum amount of memory available
again, which is 2040 bytes unless MICROPY_HW_RTC_USER_MEM_MAX is
customized.

This value regressed in 3d49b157b8
2022-06-23 17:24:59 +10:00
Algy Tynan 5dac142a1a esp32/boards/LILYGO_TTGO_LORA32: Remove ID from TTGO Lora32 board json.
Generic ID creates an incorrect link on the MicroPython download page.
Remove the ID to fix the link.

Signed-off-by: Algy Tynan <algy@tynan.io>
2022-05-19 16:45:18 +10:00
Michael Himing a1abf51a9d esp32/boards/UM_FEATHERS3: Use correct sdkconfig.board. 2022-05-19 16:43:59 +10:00
Stephane Smith ae3d5289a5 esp32/boards: Compile GENERIC_SPIRAM and UM_TINYPICO with -Os.
These boards do not build with IDF v4.4 because the section .iram0.text
does not fit in region iram0_0_seg.  Enabling SPIRAM increases the code
size so use -Os instead of -O2 to build these boards.

Fixes issue #8260.
2022-04-14 16:06:41 +10:00
Damien George fe9eaf12f3 esp32: Add MICROPY_HW_ENABLE_UART_REPL and enable on generic S2/S3.
Some S2/S3 modules don't use the native USB interface but instead have an
external USB-UART.  To make the GENERIC_S3/S3 firmware work on these boards
the UART REPL is enabled in addition to the native USB CDC REPL.

Fixes issues #8418 and #8524.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-14 14:39:20 +10:00
Damien George be25e333df esp32/boards: Add test manifest to test freezing during build.
Includes tests for freezing @micropython.native and @micropython.viper
code.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-14 14:06:38 +10:00
iabdalkader 5682595d75 esp32: Allow overriding cmake frozen manifest from the command line.
If MICROPY_FROZEN_MANIFEST is set from the cmake command line, then it will
override the default and any manifest set by the board.
2022-04-04 23:49:10 +10:00
Algy Tynan afceb56ee2 esp32/boards: Add support for LilyGO LoRa32 boards.
Boards use ESP32-PICO-D4.

Added pins for hardware versions v1.0, v1.2, v1.6 and v2.0.

Signed-off-by: Algy Tynan <algy@tynan.io>
2022-03-22 00:19:36 +11:00
wemos 1a0bd352d3 esp32/boards: Add LOLIN C3 MINI ESP32-C3 based board. 2022-03-22 00:11:02 +11:00
Jonathan Hogg 3b9de192be esp32/boards/UM_TINYPICO: Remove use of PULL_HOLD.
Change APA102 power handling to not use the (now removed) PULL_HOLD
constant.
2022-03-21 23:59:48 +11:00
Damien George 546e213265 esp32/boards: Add specific deploy instructions for S3 variant.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-25 16:52:58 +11:00
Seon Rozenblum aca40127bf esp32/boards: Add three UM ESP32-S3 based boards. 2022-02-09 00:13:10 +11:00
ubi de feo ea5744fd8d esp32/boards: Provide custom deploy_c3.md for ESP32-C3 boards.
This fixes the flash address for installation on ESP32-C3.
2022-01-22 11:18:50 +11:00
jason 357078504d esp32: Pin MicroPython to core 1 again.
This follows up on #5489, where we changed the esp32 core pinning to core 0
in order to work around an issue with IDF < 4.2.0.  Now that IDF > 4.2.0 is
available, we allow pinning back to core 1, which eliminates some
problematic callback latency with WiFi enabled.

NimBLE is also pinned to core 1 - the same core as MicroPython - when using
IDF >=4.2.
2022-01-22 00:10:16 +11:00
Jonathan Hogg 63438a31bb esp32/machine_adcblock: Add new machine.ADCBlock class and update ADC.
Rework the ADC implementation to follow the improved ADC/ADCBlock API.
This adds support for calibrated voltage readings and the ADC2 block.  The
ADC API is backwards compatible with what it was before this change.

Resolves #6219.
2022-01-21 22:55:24 +11:00
Damien George ff0227fa0d esp32/boards/GENERIC_D2WD: Build with -Os optimisation.
This board has only 2MiB of flash so the build needs to be reduced in size
to fit.  Commit 549448e8bb made all boards
build with -O2 by default (for performance) so this overrides that default.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-09 11:25:37 +11:00
Damien George df3f59ca4b ports: Update board.json files to link to new board images.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-07 11:33:28 +11:00
Tomas Vanek 9aa151e3f3 esp32/boards: Remove SPI pin defaults from GENERIC S2/S3 boards.
Default SPI pins are now correctly assigned by machine_hw_spi.c even for S2
and S3.  mpconfigboard.h files define defaults with flipped SPI(1) and
SPI(2) to workaround a bug in machine_hw_spi.c - the bug is fixed.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-15 15:53:17 +11:00
Jim Mussared 678f4b959f esp32/boards/GENERIC_S3: Enable BLE on ESP32 S3.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-11-26 11:58:12 +11:00
Seon Rozenblum 1904833e0c esp32: Add SDCard support for S3, and a GENERIC_S3_SPIRAM board.
Also add support for GPIO 47 and 48 on S3 boards.
2021-11-19 14:05:55 +11:00
Mike Causer 7f14344428 ports: Add images, features and urls to board.json. 2021-10-28 15:25:38 +11:00
Mike Causer 07ea1afe74 esp32/boards/ESP32_S2_WROVER: Link to specific deploy_s2 instructions. 2021-10-28 12:58:58 +11:00
Mike Causer 3ace779e8e esp32/boards/LOLIN_S2_PICO: Add LOLIN_S2_PICO board definition files. 2021-10-28 12:58:50 +11:00
Seon Rozenblum 5b9c9cd097 esp32/boards: Update board and deploy metadata for UM_xxx boards. 2021-10-28 11:32:13 +11:00
Mike Causer 5bb14c4e46 esp32/boards/LOLIN_S2_MINI: Add image to board.json. 2021-10-28 09:51:04 +11:00
Jim Mussared 910e9f9111 esp32: Add specific deploy_s2.md instructions for esp32-s2.
In particular the UM S2 boards (and update the features list).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-28 09:47:47 +11:00
Jim Mussared e359b077dd ports: Add board.json for all boards.
This will be used by https://micropython.org/download/ to generate the
full listing of boards and firmware files.

Optionally supports a board.md for additional customisation of the
download page, as well as deploy.md for flashing instructions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-27 14:04:53 +11:00
Damien George 549448e8bb esp32: Enable optimisations and move code to iRAM to boost performance.
This commit enables some significant optimisations for esp32:
- move the VM to iRAM
- move hot parts of the runtime to iRAM (map lookup, load global/name,
  mp_obj_get_type)
- enable MICROPY_OPT_LOAD_ATTR_FAST_PATH
- enable MICROPY_OPT_MAP_LOOKUP_CACHE
- disable assertions
- change from -Os to -O2 for compilation

It's hard to measure performance on esp32 due to external flash and
hardware caching.  But this set of changes improves performance compared to
master by (on a TinyPICO with the GENERIC build, using IDF 4.2.2, running
at 160MHz):

diff of scores (higher is better)
N=100 M=100    esp32-master -> esp32-perf       diff      diff% (error%)
bm_chaos.py           71.28 ->     268.08 :  +196.80 = +276.094% (+/-0.04%)
bm_fannkuch.py        44.10 ->      69.31 :   +25.21 = +57.166% (+/-0.01%)
bm_fft.py           1385.27 ->    2538.23 : +1152.96 = +83.230% (+/-0.01%)
bm_float.py         1060.94 ->    3900.62 : +2839.68 = +267.657% (+/-0.03%)
bm_hexiom.py          10.90 ->      32.79 :   +21.89 = +200.826% (+/-0.02%)
bm_nqueens.py       1000.83 ->    2372.87 : +1372.04 = +137.090% (+/-0.01%)
bm_pidigits.py       288.13 ->     664.40 :  +376.27 = +130.590% (+/-0.46%)
misc_aes.py          102.45 ->     345.69 :  +243.24 = +237.423% (+/-0.01%)
misc_mandel.py      1016.58 ->    2121.92 : +1105.34 = +108.731% (+/-0.01%)
misc_pystone.py      632.91 ->    1801.87 : +1168.96 = +184.696% (+/-0.08%)
misc_raytrace.py      76.66 ->     281.78 :  +205.12 = +267.571% (+/-0.05%)
viper_call0.py       210.63 ->     273.17 :   +62.54 = +29.692% (+/-0.01%)
viper_call1a.py      208.45 ->     269.51 :   +61.06 = +29.292% (+/-0.00%)
viper_call1b.py      185.44 ->     228.25 :   +42.81 = +23.086% (+/-0.01%)
viper_call1c.py      185.86 ->     228.90 :   +43.04 = +23.157% (+/-0.01%)
viper_call2a.py      207.10 ->     267.25 :   +60.15 = +29.044% (+/-0.00%)
viper_call2b.py      173.76 ->     209.42 :   +35.66 = +20.523% (+/-0.00%)

Five tests have more than 3x speed up (200%+).

The performance of the tests bm_fft, bm_pidigits and misc_aes now scale
with CPU frequency (eg changing frequency to 240MHz boosts the performance
of these by 50%), which means they are no longer influenced by timing of
external flash access.  (The viper_call* tests did previously scale with
CPU frequency, and they still do.)

Turning off assertions reduces code size by about 80k, and going from -Os
to -O2 costs about 100k, so the net change in code size (for the GENERIC
board) is about +20k.

If a board wants to enable assertions, or use -Os instead of -O2, that's
still possible by overriding the sdkconfig parameters.

Signed-off-by: Damien George <damien@micropython.org>
2021-10-16 00:07:11 +11:00
Stewart Bonnick 0d9429f44c esp32/boards: Add LOLIN_S2_MINI ESP32-S2 board.
To support Lolin S2 Mini ESP32-S2 Variant board.  More information about
this board can be found at https://www.wemos.cc/en/latest/s2/s2_mini.html
2021-09-21 22:49:51 +10:00
patrick 4cfd85eb4a esp32/boards: Add board definition for ESP32-S2-WROVER module. 2021-09-19 16:49:35 +10:00