The function 'mp_thread_init_state()' has been added to 'py/runtime.h'
with commit #bc424dd in micropython/micropython:
'py/modthread: Move thread state initialisation to shared function.'
So use that function instead of defining own function in
'ports/unix/mpbtstackport_usb.c'.
Signed-off-by: Yasmin Bosch <development@yasmin-bosch.de>
ports/unix/mpbtstackport_usb.c:
"lib/btstack/platform/posix/btstack_run_loop_posix.c"
is now used instead of
"lib/btstack/platform/embedded/btstack_run_loop_embedded.c".
Additional code has been added to make it work.
Now also a log file "/tmp/hci_dump.pklg" could be activated by setting
"MICROPY_BLUETOOTH_BTSTACK_HCI_DUMP=1".
The "Makefile" and "mpbtstackport_common.c" has been changed accordingly.
Signed-off-by: Yasmin Bosch <development@yasmin-bosch.de>
Added a "ports/unix/btstack_config.h" for a workaround:
If "MICROPY_BLUETOOTH_BTSTACK_USB" is set and "ENABLE_SCO_OVER_HCI"
is not defined there is a compiler error:
../../lib/btstack/platform/libusb/hci_transport_h2_libusb.c:1354:13:
error: ‘signal_sco_can_send_now’ defined but not used
Because the problem is in an external code a workaround is done by
defining MICROPY_BLUETOOTH_BTSTACK_USB in the added "btstack_config.h".
The "ports/unix/Makefile" has been changed so that the "btstack_config.h"
will be included.
Signed-off-by: Yasmin Bosch <development@yasmin-bosch.de>
There is a code that evaluates "HAVE_LIBUSB" and then sets
"MICROPY_BLUETOOTH_BTSTACK_USB" and "MICROPY_BLUETOOTH_BTSTACK_H4"
accordingly.
That code has been moved before "include $(TOP)/extmod/extmod.mk"
to be effective.
Details:
"include $(TOP)/extmod/extmod.mk" will
"include $(TOP)/extmod/btstack/btstack.mk"
and that in turn sets
"MICROPY_BLUETOOTH_BTSTACK_USB ?= 0"
"MICROPY_BLUETOOTH_BTSTACK_H4 ?= 1"
Signed-off-by: Yasmin Bosch <development@yasmin-bosch.de>
This provides a MicroPython-specific berkeley-db configuration in
extmod/berkeley-db/berkeley_db_config_port.h, and cleans up the include
path for this library.
Fixes issue #13092.
Signed-off-by: Damien George <damien@micropython.org>
This updates the berkeley-db-1.xx submodule URL to a repository hosted
under the micropython organisation, and makes the following changes:
- Moves the berkeley-db header files to a single directory within the
submodule, and references all these headers with a much fuller path,
which prevents symbol clashes (eg with esp32 and queue.h).
- Removes unused/non-working files from berkeley-db, which removes all
symlinks in that repo (symlinks don't play well under Windows).
- Allows injecting an external configuration header into berkeley-db, so
the configuration doesn't have to be provided by -Dxx=yy flags to the
compiler (and possibly clashing with other symbols).
- Removes the advertising clause from the BSD 4-clause license of
berkeley-db (see relevant commit and README.Impt.License.Change for
details).
Signed-off-by: Damien George <damien@micropython.org>
When an exception is handled and the stream is closed, but while this
happens, another exception occurs or dupterm is deactivated for another
reason, the initial deactivation crashes, because its dupterm is removed.
Co-authored-by: Damien George <damien@micropython.org>
Signed-off-by: Felix Dörre <felix@dogcraft.de>
RemoteProc provides an API to load firmware and control remote processors.
Note: port-specific operations must be implemented to support this class.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This module implements OpenAMP's basic initialization and shared resources
support, and provides support for OpenAMP's RPMsg component, by providing
an `endpoint` type (a logical connection on top of RPMsg channel) which can
be used to communicate with the remote core.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Add a MicroPython platform for libmetal, based on the generic platform.
The MicroPython platform uses common mp_hal_xxx functions and allows ports
to customize default configurations for libmetal.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
OpenAMP framework provides a standard inter processor communications
infrastructure for RTOS and bare metal environments. There are 3 major
components in OpenAMP: libmetal, remoteproc and RPMsg. libmetal provides
abstraction of the low-level underlying hardware, remoteproc is used for
processor Life Cycle Management (LCM) like loading firmware, starting,
stopping a core etc., and RPMsg is a bus infrastructure that enables Inter
Processor Communications (IPC) between different cores.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This new machine-module driver provides a "USBDevice" singleton object and
a shim TinyUSB "runtime" driver that delegates the descriptors and all of
the TinyUSB callbacks to Python functions. This allows writing arbitrary
USB devices in pure Python. It's also possible to have a base built-in
USB device implemented in C (eg CDC, or CDC+MSC) and a Python USB device
added on top of that.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Previously USB was always enabled, but this created some conflicts when
adding guards to other files on other ports.
Note the configuration with USB disabled hasn't been tested and probably
won't build or run without further work.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
`BLE().config(addr_mode=...)` is not safe to call if the NimBLE stack is
not yet active (because it tries to acquire mutexes which should be
initialized first).
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Disabled by default, but enabled on all boards that previously had
`MICROPY_PY_MACHINE_BARE_METAL_FUNCS` enabled.
Signed-off-by: Damien George <damien@micropython.org>
If no security mode is provided, use WPA for station and WEP for AP. Note
only WEP is supported in AP mode.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Activate the NIC on calls to connect() or config() if it's not already
active. This change makes the NINA NIC more in line with CYW43 and other
NICs, which allow configuring the NIC before or after it is activated.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
Added a 4MiB flash partitioning variant for ESP32S3: adds support for 4MiB
discrete flash boards or ESP32-S3FH4R2 with embedded 4MiB flash based ones.
Tested on the waveshare ESP32-S3 Mini w/ESP32-S3FH4R2.
Signed-off-by: Stanislav Ponomarev <me@stasponomarev.com>
If the `timeout_char` parameter is not given, we should still configure the
UART to ensure the UART is always initialized consistently. So the default
of 0 gets applied correctly, or if, for example, the baudrate was changed
the char timeout isn't still based on the old baudrate causing weird
behaviour, etc.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Prior to this commit, the pin defined for power would be used by the
esp_idf driver to reset the PHY. That worked, but sometimes the MDIO
configuration started before the power was fully settled, leading to an
error.
With the change in this commit, the power for the PHY is independently
enabled in network_lan.c with a 100ms delay to allow the power to settle.
A separate define for a reset pin is provided, even if the PHY reset
pin is rarely connected.
Fixes issue #14013.
Signed-off-by: robert-hh <robert@hammelrath.com>
On these targets it's possible to enter the bootloader by setting a bit in
an RTC register before resetting.
Structure it in a way that a board can still provide a custom bootloader
handler. The handler here will be the default if none is provided, for any
board based on the supported targets.
Signed-off-by: Trent Piepho <tpiepho@gmail.com>
Currently only the Arduino Nano ESP32 defines a machine.bootloader handler
for ESP32. All other boards will intentionally hang.
There is no error message, nor is a NotImplementedError raised. There's no
indication if Micropython has crashed, or if the bootloader was entered but
USB is not working, which is a real problem the ESP32 bootloader has. It's
not possible escape from this hang with ^C or any other means besides
physical access to the reset pin or the ability to cycle power.
Change this to only define an implementation of machine.bootloader() when
there is a handler for it.
Signed-off-by: Trent Piepho <tpiepho@gmail.com>
The new IDF v5.2 deprecated the task cleanup callback we use, so support
for the new option has been implemented in the previous commit. This also
requires a change in the sdkconfig, via a new variable
${SDKCONFIG_IDF_VERSION_SPECIFIC} which is used in all mpconfigboard.cmake
files to include an extra sdkconfig file based on the IDF version in use.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
The legacy I2S "shim" is removed and replaced by the new I2S driver. The
new driver fixes a bug where mono audio plays only in one channel.
Application code size is reduced by 2672 bytes with this change. Tested on
ESP32, ESP32+spiram, ESP32-S3 using example code from
https://github.com/miketeachman/micropython-i2s-examples
Signed-off-by: Mike Teachman <mike.teachman@gmail.com>