This uses MP_REGISTER_ROOT_POINTER() to register the readline_history root
pointer array used by shared/readline.c and removes the registration from
all mpconfigport.h files.
This also required adding a new MICROPY_READLINE_HISTORY_SIZE config option
since not all ports used the same sized array.
Signed-off-by: David Lechner <david@pybricks.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@intel.com>
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.
Signed-off-by: Damien George <damien@micropython.org>
For ports with MICROPY_VFS and MICROPY_PY_IO enabled their configuration
can now be simplified to use the defaults for mp_import_stat and
mp_builtin_open.
This commit makes no functional change, except for the following minor
points:
- the built-in "open" is removed from the minimal port (it previously did
nothing)
- the duplicate built-in "input" is removed from the esp32 port
- qemu-arm now delegates to VFS import/open
Signed-off-by: Damien George <damien@micropython.org>
The following changes are made:
- If MICROPY_VFS is enabled then mp_vfs_import_stat and mp_vfs_open are
automatically used for mp_import_stat and mp_builtin_open respectively.
- If MICROPY_PY_IO is enabled then "open" is automatically included in the
set of builtins, and points to mp_builtin_open_obj.
This helps to clean up and simplify the most common port configuration.
Signed-off-by: Damien George <damien@micropython.org>
This replaces occurences of
foo_t *foo = m_new_obj(foo_t);
foo->base.type = &foo_type;
with
foo_t *foo = mp_obj_malloc(foo_t, &foo_type);
Excludes any places where base is a sub-field or when new0/memset is used.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
These files that are reformatted only now fall under the list of files to
apply uncrustify/black formatting to.
Signed-off-by: Damien George <damien@micropython.org>
This follows the CPython change: https://bugs.python.org/issue21455
Socket listen backlog defaults to 2 if not given, based on most bare metal
targets not having many resources for a large backlog. On UNIX it defaults
to SOMAXCONN or 128, whichever is less.
The disk_access header was moved to a different path in Zephyr v2.6.0.
The old path was deprecated for two releases (v2.6.0 and v2.7.0) and
will no longer be supported after Zephyr v2.7.0.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The inclusion of `umachine` in the list of built-in modules is now done
centrally in py/objmodule.c. Enabling MICROPY_PY_MACHINE will include this
module.
As part of this, all ports now have `umachine` as the core module name
(previously some had only `machine` as the name).
Signed-off-by: Damien George <damien@micropython.org>
CONFIG_USB was removed in Zephyr v2.7.0 after some Kconfig rework that
made it sufficient to use CONFIG_USB_DEVICE_STACK only.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Updates the Zephyr port to get the UART console device from devicetree
instead of Kconfig. The Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME
was removed in Zephyr v2.7.0.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The reboot header was moved to a different path in Zephyr v2.6.0. The
old path was deprecated for two releases (v2.6.0 and v2.7.0) and will no
longer be supported after Zephyr v2.7.0.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
As a prerequisite to upgrading to Zephyr v2.7.0, upgrade the minimum
CMake version required for the Zephyr port to 3.20.0.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
If MICROPY_PY_SYS_PATH_ARGV_DEFAULTS is enabled (which it is by default)
then sys.path and sys.argv will be initialised and populated with default
values. This keeps all bare-metal ports aligned.
Signed-off-by: Damien George <damien@micropython.org>
The zephyr port doesn't support SoftI2C so it's not enabled, and the legacy
I2C constructor check can be removed.
Signed-off-by: Damien George <damien@micropython.org>
This allows the write to trigger a notification or indication, but only to
subscribed clients. This is different to gatts_notify/gatts_indicate,
which will unconditionally notify/indicate.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Adds support for hardware SPI to the zephyr port. Consistent with other
ports, such as rp2 and stm32, we only implement the SPI protocol functions
(init and transfer). Explicit sck/mosi/miso selection is not supported
and new SPI instances are initialized with default values.
Currently only advertising and scanning are supported, using the ring
buffer for events (ie not synchronous events at this stage).
The ble_gap_advertise.py multi-test passes (tested on a nucleo_wb55rg
board).
Signed-off-by: Damien George <damien@micropython.org>
Zephyr's default value for CONFIG_NET_SOCKETS_POSIX_NAMES was changed
from false to true between Zephyr v2.5.0 and v2.6.0. This caused
conflicts in MicroPython, which uses the zsock_ prefixed functions, so
disable it.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Zephyr's Kconfig symbols and defaults for SDHC/SDMMC disk drivers and
the disk access subsystem were reworked between Zephyr v2.5.0 and
v2.6.0. Update MicroPython accordingly.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This board does not work with CONFIG_NETWORKING enabled. And
CONFIG_CONSOLE_SUBSYS is enabled so that ctrl-C works.
Signed-off-by: Damien George <damien@micropython.org>
And ctrl-C can now interrupt a time.sleep call. This uses Zephyr's k_poll
API to wait efficiently for an event signal, and an optional semaphore.
Signed-off-by: Damien George <damien@micropython.org>
The following simple usocket example throws an error EINVAL on connect
import usocket
s = usocket.socket()
s.connect(usocket.getaddrinfo('www.micropython.org', 80)[0][-1])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 22] EINVAL
Fixing the context parameter in calls of net_context_get_family() and
net_context_get_type(), the connect works fine.
Tested on a nucleo_h743zi board.
Refactors the zephyr build infrastructure to build MicroPython as a
cmake target, using the recently introduced core cmake rules.
This change makes it possible to build the zephyr port like most other
zephyr applications using west or cmake directly. It simplifies building
with extra cmake arguments, such as specifying an alternate conf file or
adding an Arduino shield. It also enables building the zephyr port
anywhere in the host file system, which will allow regressing across
multiple boards with the zephyr twister script.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Disables frozen source modules in the zephyr port. They are deprecated
in the makefile rules and not implemented in the new cmake rules.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>