Enables support for the ESP standard DTR/RTS based reboot to bootloader.
Switches from OTG to Serial/Jtag mode to workaround issue discussed
in: https://github.com/espressif/arduino-esp32/issues/6762
Signed-off-by: Andrew Leech <andrew@alelec.net>
Uses newer TinyUSB synopsys/dwc2 driver for esp32s2 and esp32s3 rather than
the IDF tinyusb component. This allows re-use of other tinyusb integration
code and features shared between ports.
Signed-off-by: Andrew Leech <andrew@alelec.net>
The cyw43-driver uses `printf` by default for `CYW43_PRINTF`, but on the
rp2 port `printf` only goes to a UART output and not to USB CDC.
By defining `CYW43_PRINTF` to `mp_printf`, all the messages from the
cyw43-driver are seen on USB CDC.
For example this allows `network.WLAN().config(trace=1)` to show async
WALN events.
Signed-off-by: Damien George <damien@micropython.org>
The `MICROPY_FORCE_PLAT_ALLOC_EXEC` config option was made obsolete by
commit 9796625457, so remove it.
Signed-off-by: Damien George <damien@micropython.org>
Zephyr v3.7.0 added a new feature to allow getting devices by their
devicetree node labels. Use this feature in the MicroPython Zephyr port
to simplify constructing machine module objects, including Pin, SPI,
I2C, and UART. It's still possible to use the more verbose device names
(e.g., gpio@400ff040, i2c@40066000, spi@4002c000), but now we can also
use their devicetree node labels (e.g., gpiob, i2c0, spi0).
Node labels aren't standardized across all SoC families because they
generally try to follow their respective SoC hardware user manual naming
convention, however many boards define common labels for devices routed
to Arduino headers (e.g., arduino_i2c, arduino_serial, and arduino_spi).
That means I2C("arduino_i2c") will work on quite a few boards (>100 in
the main Zephyr tree).
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Refactors Zephyr device lookup operations into a common helper function
to reduce boilerplate code that was repeated in multiple modules.
Suggested-by: Damien George <damien@micropython.org>
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.
Tested on frdm_k64f.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Zephyr v3.4.0 changed the SPI chip select from a pointer to a struct
member to allow using the existing SPI dt-spec macros in C++.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Zephyr v3.4.0 changed the declaration of the main function to return an
int to allow building Zephyr without the -ffreestanding compiler flag.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Zephyr v3.2.0 deprecated the devicetree label property as a base
property, which had been used as the device name string for
device_get_binding(). The device name string is now the devicetree node
name appended with its unit-address. Update Zephyr port documentation
to reflect this change.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Zephyr v3.2.0 deprecated include/zephyr/zephyr.h in favor of
include/zephyr/kernel.h since it only included that header.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Zephyr v3.1.0 moved all public headers to include/zephyr. Updates a few
Zephyr include paths that were missed in
4fd54a4756.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The ESP32 port contains a workaround to avoid having a certain function
in `py/parse.c` being generated incorrectly. The compiler in question
is not part of any currently supported version of ESP-IDF anymore, and the
problem inside the compiler (well, assembler in this case) has been
corrected a few years ago.
This commit removes all traces of that workaround from the source tree.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Necessary to fix "mpremote run" over hardware UART.
Bisect shows bug was introduced by d420b4e4, but looks like made more
complex by 01c046d2. Specifically: resetting and re-initialising the REPL
UART during soft reset clears the FIFO before it's done printing the "MPY:
soft reboot" line.
Fixed by adding a UART TX flush in the deinit path.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
lwIP was recently updated in a89ac9e24a
to STABLE-2_2_0_RELEASE, and this introduced a change in the configuration
variable `DHCP_DOES_ARP_CHECK`, renaming it to `LWIP_DHCP_DOES_ACD_CHECK`.
This commit fixes the ports lwIP settings to use the new configuration
option.
Without this option, connecting to a WiFi access-point takes about 12.5
seconds. With this option (ie disabling DHCP ARP checks) connecting takes
about 4 seconds.
Tested on an RPI_PICO_W and PYBD_SF2.
Signed-off-by: Damien George <damien@micropython.org>
This tracing was originally needed for three reasons:
1. To trace object/raw-code pointers embedded in native code, eg from
@micropython.native functions.
2. To trace pointers to BSS/rodata from relocated viper code.
3. For libffi tracing.
The tracing in point 1 was made unnecessary long ago in commit
7d4b6cc868 (see also commit
bbccb0f630 which removed scanning of native
code on the esp8266 port).
Since the previous commit, point 2 is no longer needed.
For point 3, this was made unnecessary in the recent commit
9796625457.
Signed-off-by: Damien George <damien@micropython.org>
Most ports using TinyUSB now schedule the USB tasks from the USB interrupt.
This commit updates the renesas-ra port to use this new pattern.
Signed-off-by: Andrew Leech <andrew@alelec.net>
The renesas-ra port board definitions contain auto-generated files which
are not easy to understand for someone unfamiliar with the port. This
commit adds some notes to the README to assist other developers who want to
work on these.
The configuration.xml file for the `ARDUINO_PORTENTA_C33` was provided by
@iabdalkader.
Signed-off-by: Andrew Leech <andrew@alelec.net>
The UART driver enables a pull-up on RX/CTS pins by default. This can
cause UART to fail to receive in certain situations, eg with RS485
transceivers.
This commit adds compile-time configuration options to set the pull mode on
the RX and CTS pins of each UART.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit clears the upper 32 bits of returned `uint32_t` values,
which are handled as `unsigned int`s by the MicroPython runtime and
thus could be extended to 64 bits on some platforms.
RV64 holds 32-bit values as signed integers when held in registers, but
the code handling the FFI unsigned int case did not take this into
account. That introduced test failures when a 32-bit value had its most
significant bit set, as when performing the value extension from 32 to
64 bits, the upper half of the value would be filled with ones.
On 32 bit platforms this change should be converted to a no-op, and
on other 64 bit platforms that aren't RISC-V it shouldn't hurt as the
value being manipulated is expected to only hold valid bits in its lower
half.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit removes custom FFI closures alloc/free functions, in favour
of using the tracked allocation facility to allocate memory for FFI
callback objects.
This stems from linking issues in the Arm port when updating LibFFI to
the latest stable version, as the overridden alloc/free functions didn't
replace LibFFI's (unlike in other ports). The original code did no
effective cleanup for allocated callback objects, so there is no real
impact when switching allocation strategy.
The tracked allocation feature used to be enabled only if the Bluetooth
stack integration was enabled. This commit also enables tracked
allocation support if FFI support is enabled.
Co-authored-by: Damien George <damien@micropython.org>
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Libffi is updated to the latest stable version (v3.4.6) as the version
of libffi that was linked by the repository predates the introduction of
RISC-V processors (both 32 and 64 bits).
This is necessary as the packaged version of libffi used by the CI for
RISC-V 64 turned out to simply not work correctly, whilst a source-built
version of libffi worked just fine.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds a new `RingIO` type which exposes the internal ring-buffer
code for general use in Python programs. It has the stream interface
making it similar to `StringIO` and `BytesIO`, except `RingIO` has a fixed
buffer size and is automatically safe when reads and writes are in
different threads or an IRQ.
This new type is enabled at the "extra features" ROM level.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This is for boards not covered by the Olimex ESP32 PoE implementation. The
major setting is about the PHY interface configuration.
Tested with esp-idf v5.0.4 and Olimex ESP32 EVB boards.
Signed-off-by: shiggy <mail@shiggytech.de>
Casting an ffi_arg to a signed int may truncate the value. E.g., when the
ffi_arg is 64-bit and the signed int is 32-bit. Also, casting an ffi_arg
to a larger signed type will not sign extend the value. E.g., when the
ffi_arg is 32-bit and the larger signed type is int64_t. If the value is
signed, it should be cast to ffi_sarg, which is the same size as ffi_arg.
Signed-off-by: Michael Sawyer <mjfsawyer@gmail.com>
This change helps detect if the filesystem is invalid, by also including
the first mount attempt within the try-except. Then the FAT is reformatted
if needed.
Fixes issue #15779.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
The `#if` check only checks that `MICROPY_PY_NETWORK_CYW43` and
`MICROPY_HW_PIN_EXT_COUNT` are defined. This is a reasonable assumption
for the Pico W, but causes conflicts if someone wants to attach an external
IO expander to their Pico W and have its pins appear as Pin objects.
This commit addresses this by adding the additional checks, letting board
builds include wireless but separately choose whether the external IO pins
come from the cyw43 or not.
Signed-off-by: Christopher Parrott <chris@pimoroni.com>
The STM32F429DISC board definition did not have DAC enabled, however the
micro/board supports it so this commit enables the feature.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
Some boards like the nrf52840dk crash immediatelly after boot when
k_yield() is executed in this function. It also makes the REPL randomly
lock up on other boards like the nucleo_wb55rg.
Signed-off-by: danicampora <danicampora@gmail.com>
So that more tests can run successfully, and so users by default have more
heap for applications. Thin minimal configuration still has a 16k GC heap.
Signed-off-by: Damien George <damien@micropython.org>