The documentation used integers to specify Teensy board pins, which match
the board's silkscreen. But in Python code Dxx have to be used, since
integers are not accepted as a Pin identifier.
This commit changes the Pinout tables accordingly, consistent with the
other MIMXRT boards.
Signed-off-by: robert-hh <robert@hammelrath.com>
Use new Zephyr FS, and be a demonstration of that configuration.
This is still on-disk compatible with existing filesystems on the internal
flash.
Signed-off-by: Vdragon <mail@massdriver.space>
This allows using Zephyr's supported VFS and interface it to MicroPython's
VFS. That makes the MicroPython-side filesystem drivers unecessary, eg you
can disable LFS2 in MicroPython but still do LFS2 because it's using
Zephyr's.
An advantage of this is that the filesystem can be shared between Zephyr C
code and MicroPython.
Signed-off-by: Vdragon <mail@massdriver.space>
This option (currently only enabled for N6) allows the TX path to hold on
to a pbuf reference while the DMA accesses the pbuf's memory directly,
instead of copying the entire pbuf data into the internal buffers.
This is necessary to achieve gigabit speeds on the N6, although actually
achieving that speed requires higher up parts of the stack to be efficient
as well.
Signed-off-by: Damien George <damien@micropython.org>
RAM shared with DMA needs caching disabled, which is slower for the MCU to
access. So move these index variables (which are not shared with DMA) to
normal RAM.
Signed-off-by: Damien George <damien@micropython.org>
This MCU has a lot of memory and gigabit ethernet, so it benefits from
improved lwIP performance.
Signed-off-by: Damien George <damien@micropython.org>
The full Alif license texit is available in
`lib/alif_ensemble-cmsis-dfp/License.txt` if it's needed.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
If MICROPY_PY_THREAD is set, PendSV_Handler acquires a mutex and calls the
dispatch functions. If pendsv_schedule_dispatch is called by a higher
priority interrupt while the mutex is acquired by PendSV_Handler it's
possible for the dispatch to not be triggered.
Add a check for dispatch calls at the end of PendSV_Handler once the mutex
has been released.
Fixes issue #18365.
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
ESP32 requires initial high levels of the channels before starting the
count, in order to have 4 pulse for the first rotation.
Also add tests for encoder phases x2 and x4.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Changed the pin numbers used for the I2S rate testing as the pin numbers
used were incompatible with the limited GPIO pins availalbe on the
ESP32-C3, causing the tests to fail.
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
Temporarily switch from the espressif TinyUSB component to
a MicroPython fork where this fix has been cherry-picked:
https://github.com/hathach/tinyusb/pull/3293
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Instead, depend directly on espressif/tinyusb component
(which is otherwise transitively included via esp_tinyusb).
Turns out esp_tinyusb builds a bunch of source files with
symbols that conflict with our tinyusb symbols (i.e.
descriptors_control.c).
This only works because nothing in MicroPython causes the linker to include
the esp_tinyusb.a library, however in order to override the dcd_int_handler
(in following commit) this caused the linker to pull this library in and
break the build.
There's also a problematic header skew - TinyUSB component was building
with the tusb_config.h file from esp_tinyusb component, but we have our own
tusb_config.h file in shared/tinyusb. The changes in parent commit allow
us to build the TinyUSB component with our tusb_config.h header.
User-facing impacts are:
- Can no longer override USB VID & PID via sdkconfig, have to set
MICROPY_HW_USB_VID/PID instead (changes applied in this commit).
- esp32 boards will have the same USB serial number as other ports
(i.e. based on the hardware MAC address, not hard-coded).
Side effects include:
- CFG_TUD_DWC2_SLAVE_ENABLE is now set, DMA mode is disabled.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This is necessary so the ESP-IDF TinyUSB component can include
py/mpconfig.h, but is also a good design goal (less creep of symbols
into unrelated parts of the code).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Fixes problems with USB-CDC state after soft reset if USBDevice has been
active with the default USB-CDC driver also enabled.
This also brings ESP32 behaviour in line with RP2 and other ports, where
boot.py is executed before the runtime USB device is initialised. This
allows setting up a custom USB device in boot.py.
There is still a bug here, because calling tud_disconnect() doesn't cause
any UNPLUG or BUS_RESET events to arrive from TinyUSB - which means the USB
device state stays out of sync until we call mp_usbd_init() again...
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Not a functional change, but makes it easier to see that mp_usbd_init() is
available regardless of whether MICROPY_HW_ENABLE_USB_RUNTIME_DEVICE is
set.
Also adds a no-op inline mp_usbd_deinit() implementation, which means both
a port's calls to mp_usbd_init()/deinit() can both be guarded on the same
MICROPY_HW_ENABLE_USBDEV.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The current `esp32.RMT` class uses a legacy API from ESP-IDF 4.x. The
ESP-IDF 5.x offers a new API, which is overall better, and easier to
implement the RX side in the future. This commit updates the module and
the documentation, preserving the current MicroPython RMT API as much as
possible.
The bitstream RMT implementation was updated as well, since ESP-IDF does
not allow firmware to reference legacy and new APIs at the same time (it
resets right after boot with an error message, even if neither module is
imported).
The documentation is updated accordingly.
Signed-off-by: Elvis Pfutzenreuter <elvis.pfutzenreuter@gmail.com>
New board planned to be launched on Crowd Supply in late 2025. ESP32-based
core module with IEEE 802.3cg 10BASE-T1S Single Pair Ethernet networking
and power distribution over data lines.
Signed-off-by: Patrick Van Oosterwijck <patrick@silicognition.com>
Some boards support waking up via GPIO pins, but this is not currently
supported by MicroPython. This commit adds support for waking with GPIO in
a similar interface to waking with ext0, ext1, touch and ulp. This commit
adds documentation for this new function as well.
Signed-off-by: Meir Armon <meirarmon@gmail.com>
Only a problem when UART TX is also enabled and goes first (i.e. esp32
port) as sending 16384 bytes in one go triggers the timeout.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Running `ruff format tools/cc1` picks up `tools/cc1` which is a Python file
that does not have a .py file extension.
Signed-off-by: Christian Clauss <cclauss@me.com>
Signed-off-by: Damien George <damien@micropython.org>
Add abort setup code `nlr_set_abort` to the standard runtime executor.
This makes the standard runtime respond to abort signal without any further
modifications.
- When aborted, the program exits with 137 exit code (configurable, same as
posix sig abort), to differentiate from a normal shutdown.
- When exited by exception/crash, the program will exit with exit code 1
(configurable).
- When exited by exception KeyboardInterrupt, the program will exit with
exit code 130 (configurable, same as posix sig int).
- When exited with a exit code (from Python environment), this code is
propagated. When a different object is passed, exit code is set to 1 and
the value printed, to be consistent with Python docs:
https://python.readthedocs.io/en/latest/library/exceptions.html#SystemExit
Signed-off-by: John Smith <jsmith@jsmith.cz>
This commit lets the native emitter generate shorter code when clearing
exception objects on RV32.
Since there are no direct generic ASM functions to set a specific
immediate to a local variable, the native emitter usually generates an
immediate assignment to a temporary register and then a store of that
register into the chosen local variable. This pattern is also followed
when clearing certain local variables related to exception handling,
using MP_OBJ_NULL as the immediate value to set.
Given that at the moment MP_OBJ_NULL is defined to be 0 (with some other
spots in the native emitter that leverage that fact when checking the
state of the variables mentioned earlier), and that the RV32 CPU has a
dedicated register that is hardwired to read 0, a new method to set
local variables to MP_OBJ_NULL is introduced.
When generating RV32 code, the new macro will skip the intermediate
register assignment and directly uses the X0/ZERO register to set the
chosen local variable to MP_OBJ_NULL. Other platforms will still
generate the same code sequence as before this change.
This is a followup to 40585eaa8f.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This field exists to cache the lnotab field removed from v2 in #17639 by
ddf2c3afb1, and is now unused.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
This commit changes the sequences generated for not-equal and
less-than-or-equal comparisons, in favour of better replacements.
The new not-equal comparison generates a sequence of equal size but
without the burden of a jump to set the output value, this also had
the effect of reducing the size of the code generator as only two
opcodes need to be generated instead of three.
The less-than-or-equal sequence, on the other hand, is actually two
bytes shorter and does not contain any jumps. If Zcb opcodes can be
used for performing the final XOR operation then two more bytes could be
saved on each comparison. The same remarks about having a shorter
generator due to two opcodes being generated instead of three still
applies here.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit shortens register-indexed load/store emitter functions, by
reusing integer-indexed equivalent operations as part of the sequence
generation process.
Before these changes, register-indexed load/store emitters would follow
two steps to generate the sequence: generate opcodes to fix up the
register offset to make it point to the exact position in memory where
the operation should take place, and then perform the load/store
operation itself using 0 as an offset from the recalculated address
register.
Since there is already a generic optimised emitter for integer-indexed
load/stores, that bit of code can be reused rather than having an ad-hoc
implementation that is tailored to operate on an offset of 0. Removing
the custom emitter code in favour of calling the general integer-indexed
emitter saves around 150 bytes without any changes in the emitter
behaviour (generating the same opcode sequence and making use of future
improvement in that emitter too).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>