This is the minimum C interface to allow a modem driver to be built in
Python. Interface is simple, with the intention that the micropython-lib
driver is the main (only) consumer of it.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
No IRQHandlers were compiled in for this board.
Includes small consolidation of the same DMAMUX_ENABLE line for STM32G4,
STM32WB, STM32WL.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Switches default on the NUCLEO_WL55 board to use the HSE oscillator powered
from PB0_VDDTCXO pin.
Build-time configuration can select from MSI internal oscillator (previous
default), HSE via crystal, or HSE bypass with TCXO powered from PB0_VDDTCXO
pin (new default)
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This is a "normal" SPI peripheral with no external pins, to avoid having to
grow spi_obj[] for just this one board map it as SPI ID 3 (board has SPI
IDs 1,2 already).
Signed-off-by: Angus Gratton <angus@redyak.com.au>
At the Adafruit Metro M7 the pin GPIO_AD_13 is used for JTAG. Therefore
it is not configured for RTS at UART 2 and 3.
Signed-off-by: robert-hh <robert@hammelrath.com>
Looks like copy-paste from the stm32 make-pins.py, references a function
that is not present in the renesas-ra version.
Found by Ruff checking F821.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
subprocess.CalledProcessError() constructor arguments aren't documented,
but these are them. Even if they change, it's an improvement over a
non-existent exception name!
Found by Ruff checking F821.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
These files all use decorators (@asm_thumb, @asm_pio) that add names to the
function scope, that the linter cannot see.
It's useful to clear them in the file not in pyproject.toml as example code
will be copied and adapted elsewhere, and those developers may also use
Ruff (we hope!)
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The call to machine_uart_deinit_all() is needed to avoid a crash after soft
reset, if a UART had been used and data arrives before it is instantiated
again.
Signed-off-by: robert-hh <robert@hammelrath.com>
It should be that:
- duty_u16=0: output low, no pulse
- duty_u16=65536: output high, no pulse
That previously did not apply to all of the three PWM mechanisms of this
port. This commit fixes it.
Signed-off-by: robert-hh <robert@hammelrath.com>
When called without a handler, the IRQ data was not cleared. That caused a
crash at the second soft reset in a row.
Signed-off-by: robert-hh <robert@hammelrath.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>
This is difficult to implement on cmake-based ports, and having the list
of variants in mpconfigboard.{cmake,mk} duplicates information that's
already in board.json.
This removes the existing query-variants make target from stm32 & rp2
and the definition of BOARD_VARIANTS from the various board files.
Also renames the cmake variable to MICROPY_BOARD_VARIANT to match other
variables such as MICROPY_BOARD. The make variable stays as
BOARD_VARIANT.
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>
A previous commit removed the unix-specific select module implementation
and made unix use the common one.
This commit adds an optimisation so that the system poll function is used
when polling objects that have a file descriptor. With this optimisation
enabled, if code registers both file-descriptor-based objects, and non-
file-descriptor-based objects with select.poll() then the following occurs:
- the system poll is called for all file-descriptor-based objects with a
timeout of 1ms
- then the bare-metal polling implementation is used for remaining objects,
which calls into their ioctl method (which can be in C or Python)
In the case where all objects have file descriptors, the system poll is
called with the full timeout requested by the caller. That makes it as
efficient as possible in the case everything has a file descriptor.
Benefits of this approach:
- all ports use the same select module implementation
- the unix port now supports polling of all objects and matches bare metal
implementations
- it's still efficient for existing cases where only files and sockets are
polled (on unix)
- the bare metal implementation does not change
- polling of SSL objects will now work on unix by calling in to the ioctl
method on SSL objects (this is required for asyncio ssl support)
Note that extmod/vfs_posix_file.c has poll disable when the optimisation is
enabled, because the code is not reachable when the optimisation is used.
Signed-off-by: Damien George <damien@micropython.org>
The unix port has a custom select module which only works with objects that
have a file descriptor, eg files and sockets. On the other hand, bare
metal ports use the common extmod/modselect.c implementation of the select
module that supports polling of arbitrary objects, as long as those objects
provide a MP_STREAM_POLL in their ioctl implementation (which can be done
in C or Python).
This commit removes the unix-specific code and makes unix use the common
one provided by extmod/modselect.c instead. All objects with file
descriptors implement MP_STREAM_POLL so they continue to work.
Signed-off-by: Damien George <damien@micropython.org>
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>
This provides similar functionality to the former zlib.DecompIO and
especially CPython's gzip.GzipFile for both compression and decompression.
This class can be used directly, and also can be used from Python to
implement (via io.BytesIO) zlib.decompress and zlib.compress, as well as
gzip.GzipFile.
Enable/disable this on all ports/boards that zlib was previously configured
for.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This library used a mix of "tinf" and "uzlib" to refer to itself. Remove
all use of "tinf" in the public API.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
There are enough places that implement __exit__ by forwarding directly to
mp_stream_close that this saves code size.
For the cases where __exit__ is a no-op, additionally make their
MP_STREAM_CLOSE ioctl handled as a no-op.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This will be replaced with a new deflate module providing the same
functionality, with an optional frozen Python wrapper providing a
replacement zlib module.
binascii.crc32 is temporarily disabled.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
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>