The rp2 port was enabling SSL and had finalizers enabled via the "extra
features" level, but missed explicitly enabling `MICROPY_PY_SSL_FINALISER`
(like esp32, stm32, and mimxrt did).
This commit makes `MICROPY_PY_SSL_FINALISER` default to enabled if
finalizers are enabled, and removes the explicit setting of this for
esp32, stm32, mimxrt (because they all use the "extra features" level).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This should have been added in 4815af75bc
when the variants were combined. The original non-USB variant got this
implicitly, and therefore was not in mpconfigvariant.h
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Board names need to be unique across ports, and GENERIC clashes with
the ESP8266 (which will be renamed to ESP8266_GENERIC).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows switching between variants without clobbering the build
output.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This was used to override the firmware filename generated by the build
server (to match the historical name before board definitions existed).
Now we're making everything use the board definition name (i.e. the
directory name).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is to support a future change to add the variant name to the build
directory and therefore should be the same style as the board name.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
To be consistent with the other partitions files (which have the "-
{2,8,16,32}MiB" suffix). Also renames partitions-ota.csv.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Unsure of the history of the ESP32_S2_WROVER board (and why it wasn't
named GENERIC_S2_...) but now it's a variant of the generic S2 board.
Also removes the non-existent CONFIG_USB_AND_UART from all S2 boards.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
As the IDF no longer supports earlier revisions of the C3 by default, we
now just explicitly support rev 3+ and enable USB (which wasn't supported
in earlier revisions).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Otherwise the compiler may inline the gc_collect_inner() function and/or
remove the recursion, which is necessary to spill all the windowed
registers to the C stack.
Signed-off-by: Damien George <damien@micropython.org>
Via MICROPY_GC_SPLIT_HEAP_AUTO feature flag added in previous commit.
Tested on ESP32 GENERIC_SPIRAM and GENERIC_S3 configurations, with some
worst-case allocation patterns and the standard test suite.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Also shrinks the "prefer internal" threshold to 8KB, any allocation larger
than this will try PSRAM first.
Change the mbedTLS config to use regular malloc() as well, instead of
internal only. The default is set to internal-only due to to potential
physical security issue of readout via PSRAM on the original ESP32.
However, as MicroPython runs from plaintext flash and all other context is
in the MP heap of PSRAM then it's hard to see how worsens physical security
for MP.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit:
- Finds a common set of board feature tags and maps existing features to
that reduced set.
- Removes some less-useful board feature tags.
- Ensures all MCUs are specified correctly.
- Ensures all boards have a vendor (and fixes some vendor names).
This is to make the downloads page show a less intimidating set of filters.
Work done in conjunction with Matt Trentini <matt.trentini@gmail.com>.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Listing the IDF version number in the board description is not as important
as it once was, when the IDF was still undergoing a lot of changes. Now,
all builds use IDF 5.x and it's possible to query the exact version with
platform.platform().
Signed-off-by: Damien George <damien@micropython.org>
Otherwise constructing an invalid SPI instance (eg machine.SPI(3)) will
mess up machine.SPI(2)'s state before it's detected that it's an invalid
SPI id.
Signed-off-by: Damien George <damien@micropython.org>
On ESP32C3 it's not doing anything. On ESP32S3 the original code prevented
prevented machine.SPI(1) from working.
Signed-off-by: Damien George <damien@micropython.org>
SPI3_HOST is not a macro but rather an enum, so use SOC_SPI_PERIPH_NUM to
detect if it's defined.
Fixes issue #11919.
Signed-off-by: Damien George <damien@micropython.org>
Previously this was explicitly enabled on esp32/stm32/renesas/mimxrt/samd,
but didn't get a default feature level because it wasn't in py/mpconfig.h.
With this commit it's now enabled at the "extra features" level, which adds
rp2, unix-standard, windows, esp8266, webassembly, and some nrf boards.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This changes the ESP32 WDT implementation to use a custom handle so that it
becomes possible to reset the WDT from a thread.
By default esp_task_wdt_add subscribes the task_id of the current task.
That means that if we're running in a different task we are unable to reset
the WDT, which prevents feeding the WDT from a thread directly, or even
from a timer (which may randomly run in a different task when there's
multiple threads).
As an added bonus, the name we set makes the error clearly specify that it
was the user-specified WDT that reset the chip.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Since commit beeb74 we already check in modussl_mbedtls whether this
function is provided by the ESP-IDF before calling it, thus we no longer
need to define it here in order to compile.
Removing it so that if CONFIG_MBEDTLS_DEBUG is defined we do not cause any
'multiple definition' compile errors.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Implement a standard machine.bootloader() method for ESP32-series devices.
No default implementation, each board can enable it as required.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Some targets like the ESP32-S3 use the IDF Component Manager to provide
additional dependencies to the build. Make sure to include these extra
components when collecting properties used by MicroPython-specific build
steps, like qstr preprocessing.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This adds named-pins support to the esp32 port, following other ports.
Since the name of esp32 CPU pins is just GPIOx, where x is an integer, the
Pin.cpu dict is not supported and CPU pins are just retrieved via their
existing integer "name" (the cost of adding Pin.cpu is about 800 bytes,
mostly due to the additional qstrs).
What this commit supports is the Pin.board dict and constructing a pin by
names given by a board. These names are defined in a pins.csv file at the
board level. If no such file exists then Pin.board exists but is empty.
As part of this commit, pin and pin IRQ objects are optimised to reduce
their size in flash (by removing their gpio_num_t entry). The net change
in firmware size for this commit is about -132 bytes.
Signed-off-by: Damien George <damien@micropython.org>
This applies to all machine modules which have pins as arguments. Since
machine_pin_get_id() calls pin_find(), these pin arguments may be at the
moment either integer objects or Pin objects. That allows for instance to
write
uart = UART(1, tx=Pin(4), rx=Pin(5))
instead of
uart = UART(1, tx=4, rx=5)
which is consistent with other ports. Since this handling is done at a
single place in the code, extending that scheme to accept strings for named
pins is easy.
Signed-off-by: robert-hh <robert@hammelrath.com>
The new machine_pin_find() function accepts a Pin object and a integer
object as input and returns a pin object. That can be extended later to
accept a string object, once named pins are supported.
Signed-off-by: robert-hh <robert@hammelrath.com>
The legacy driver was deprecated in IDF v5, and crashes when the ISR
handler is called. Instead of fixing the legacy code, this commit reworks
the machine.Timer class to use the low-level HAL driver.
Tested on ESP32, ESP32S2, ESP32S3 and ESP32C3. Behaviour is the same as it
was before this commit, except the way the Timer object is printed, it now
gives more useful information (timer id, mode, period in ms).
Fixes issue #11970.
Signed-off-by: Damien George <damien@micropython.org>
This is a fix for commit bccbaa92b1:
- Should only wait for WIFI_EVENT_STA_START when invoked on the STA_IF
interface.
- The WIFI_EVENT_STA_START event is generated every time the STA_IF
interface is set active(True) and it was previously inactive, ie. not
only after calling esp_wifi_start().
- Also wait for WIFI_EVENT_STA_STOP when deactivating the interface.
- Also wait for relevant AP events.
Fixes issue #11910.
Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
Enabling mDNS put this firmware over the limit of the OTA partition size,
so tweak the compiler settings to reduce the firmware size.
Signed-off-by: Damien George <damien@micropython.org>
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>
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>
This function was made private/static in IDF commit
c67f4c2b4c2bb4b7740f988fc0f8a3e911e56afe, so it add back here.
Signed-off-by: Damien George <damien@micropython.org>
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>
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>