Wykres commitów

15852 Commity (master)

Autor SHA1 Wiadomość Data
Damien George 3c445f6636 py/emitnative: Implement viper unary ops positive, negative and invert.
Signed-off-by: Damien George <damien@micropython.org>
2024-03-19 10:31:36 +11:00
Damien George b50efbd0e3 py/asmxtensa: Optimise asm_xtensa_mov_reg_i32_optimised() for tiny ints.
Signed-off-by: Damien George <damien@micropython.org>
2024-03-19 10:31:36 +11:00
Damien George f52b0d0ff1 py/asm: Add ASM_NOT_REG and ASM_NEG_REG macros for unary ops.
ASM_NOT_REG is optional, it can be synthesised by xor(reg, -1).
ASM_NEG_REG can also be synthesised with a subtraction, but most
architectures have a dedicated instruction for it.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-19 10:31:36 +11:00
Damien George d92dff881c docs/library/collections: Update deque docs to describe new features.
Signed-off-by: Damien George <damien@micropython.org>
2024-03-19 10:09:11 +11:00
Damien George c9016b4979 tests/basics: Split MicroPython-specific deque tests to separate file.
So that the MicroPython-specific behaviour can be isolated, and the CPython
compatible test don't need a .exp file.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-19 10:08:32 +11:00
Damien George bf18ddd989 tools/mpy-tool.py: Fix merging of more than 128 mpy files.
The argument to MP_BC_MAKE_FUNCTION (raw code index) was being encoded as a
byte instead of a variable unsigned int.  That meant that if there were
more than 128 merged mpy files the encoding would be invalid.

Fix that by using `mp_encode_uint(idx)` to encode the raw code index.  And
also use `Opcode` constants for the opcode values to make it easier to
understand the code.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-19 10:08:05 +11:00
Dash Peters 7dff38fdc1 py/objdeque: Expand implementation to be doubly-ended and support iter.
Add `pop()`, `appendleft()`, and `extend()` methods, support iteration
and indexing, and initializing from an existing sequence.

Iteration and indexing (subscription) have independent configuration flags
to enable them.  They are enabled by default at the same level that
collections.deque is enabled (the extra features level).

Also add tests for checking new behavior.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-18 14:10:14 +11:00
Damien George cd8eea2ae9 all: Update extmod, ports, examples to build with new berkeley-db lib.
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>
2024-03-16 12:19:12 +11:00
Damien George 305707b281 lib/berkeley-db-1.xx: Update submodule URL and version.
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>
2024-03-16 12:12:48 +11:00
Felix Dörre 01c31ea804 extmod/os_dupterm: Handle exception properly when it occurs in parallel.
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>
2024-03-16 10:59:03 +11:00
Damien George fb3820e3d6 nrf/boards: Enable MICROPY_HW_ENABLE_USBDEV on boards with USB CDC.
These boards were broken by 9d0d262be0.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-16 00:40:39 +11:00
Damien George df2ff0c355 LICENSE: Add libmetal and open-amp to 3rd-party license list.
Signed-off-by: Damien George <damien@micropython.org>
2024-03-15 18:11:28 +11:00
iabdalkader 486ca3a688 tools/ci.sh: Add Arduino GIGA to stm32 CI build.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader e5ca06a06f docs/library/openamp: Document the new openamp module.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader 864e4596bf stm32/boards/ARDUINO_PORTENTA_H7: Enable OpenAMP.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader fc97343639 stm32/boards/ARDUINO_NICLA_VISION: Enable OpenAMP.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader c859978da3 stm32/boards/ARDUINO_GIGA: Enable OpenAMP.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader 09eb4caccb stm32: Implement port backend for OpenAMP's remoteproc.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader 13297d8c3a stm32: Implement port backend for libmetal.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader 81aba8253a extmod/modopenamp_remoteproc: Add new OpenAMP RemoteProc class.
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>
2024-03-15 18:11:28 +11:00
iabdalkader 14dae42fe7 extmod/modopenamp: Add new OpenAMP module.
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>
2024-03-15 18:11:28 +11:00
iabdalkader 162054be85 stm32/mpu: Add MPU config for shared, uncached memory region.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
Damien George b726022509 py/stream: Factor stream implementations.
So there's only one location that does the ioctl(MP_STREAM_SEEK) call.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-15 18:11:28 +11:00
iabdalkader 85028aadab py/stream: Add mp_stream_seek() helper function.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 18:11:28 +11:00
iabdalkader 61ee59ad89 extmod/libmetal: Add MicroPython platform for libmetal.
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>
2024-03-15 18:11:28 +11:00
iabdalkader f6213ffc5c lib/libmetal: Add libmetal submodule.
libmetal provides an abstraction of the underlying hardware, to support
other OpenAMP components.

Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15 17:35:39 +11:00
iabdalkader 5bed292c06 lib/open-amp: Add OpenAMP submodule.
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>
2024-03-15 17:35:13 +11:00
Angus Gratton 7f5d8c4605 samd: Enable support for Python USB devices.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-15 14:24:52 +11:00
Angus Gratton 0baa3b5528 rp2: Enable support for Python USB devices.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-15 14:24:52 +11:00
Angus Gratton 9d0d262be0 extmod/machine_usb_device: Add support for Python USB devices.
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>
2024-03-15 14:22:11 +11:00
Angus Gratton 43904acea8 mimxrt: Define the MICROPY_HW_ENABLE_USBDEV macro.
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>
2024-03-15 13:37:42 +11:00
Angus Gratton 47e84751fb py/objstr: Add a macro to define a bytes object at compile time.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-15 13:37:31 +11:00
Kwabena W. Agyeman fff66c3069 mimxrt/mpconfigport: Enable cryptolib and hashlib md5.
Signed-off-by: Kwabena W. Agyeman <kwagyeman@live.com>
2024-03-15 13:24:23 +11:00
Daniël van de Giessen 58a596f4a9 extmod/nimble: Check for active before setting address mode.
`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>
2024-03-15 12:59:58 +11:00
Damien George bfc3dde2c9 extmod/modmachine: Add MICROPY_PY_MACHINE_RESET configuration option.
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>
2024-03-15 12:04:37 +11:00
Damien George dd134e4836 extmod/modmachine: Add MICROPY_PY_MACHINE_MEMX configuration option.
Enabled by default.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-15 12:04:34 +11:00
Damien George 23ccbcf230 extmod/modmachine: Add MICROPY_PY_MACHINE_SIGNAL configuration option.
Enabled by default.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-15 12:04:25 +11:00
iabdalkader c231c89651 extmod/network_ninaw10: Fix error messages.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-14 18:26:41 +01:00
iabdalkader 2b6f81f2b9 extmod/network_ninaw10: Set the proper security mode if none provided.
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>
2024-03-14 17:40:25 +11:00
iabdalkader 8b4a21cd64 extmod/network_ninaw10: Activate the NIC on demand.
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>
2024-03-14 17:40:18 +11:00
Damien George d712feb68a stm32/sdram: Fix MPU config to use MPU_CONFIG_NOACCESS.
Followup to 2345c1a04e.

Signed-off-by: Damien George <damien@micropython.org>
2024-03-09 10:50:43 +11:00
Stanislav Ponomarev bedb649edf esp32/boards/ESP32_GENERIC_S3: Add 4MiB partitioning board variant.
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>
2024-03-09 10:37:46 +11:00
Daniël van de Giessen 20f85fb26e esp32/machine_uart: Always configure timeout_char setting in init().
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>
2024-03-08 17:09:17 +11:00
robert-hh cdfc6c159f esp32/network_lan: Add a separate argument to set PHY power pin.
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>
2024-03-08 16:55:08 +11:00
Trent Piepho af67be7adc esp32/modmachine: Support bootloader on ESP32-S2/S3/C2/C3.
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>
2024-03-08 15:55:17 +11:00
Trent Piepho 9fc450689b esp32/mpconfigport: Don't hang when machine.bootloader isn't supported.
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>
2024-03-08 15:54:44 +11:00
Daniël van de Giessen 27279e69b4 esp32: Add IDF-version-specific sdkconfig.
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>
2024-03-08 14:05:39 +11:00
Daniël van de Giessen d6176c1f5e esp32: Add support for IDF version v5.2.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-08 14:05:38 +11:00
Daniël van de Giessen c92683d67c esp32: Add support for IDF version v5.0.5.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-03-08 14:05:15 +11:00
MikeTeachman 0b145fdc2d esp32/machine_i2s: Integrate new I2S IDF driver.
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>
2024-03-08 13:31:02 +11:00