| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
| |
Rename `bthci` to `bthci_uart` for consistency with the CYW43 driver and to
distinguish it from HCI backends that use a different transport.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
|
|
|
|
| |
Required in MICROPY_PREVIEW_VERSION_2.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
|
|
|
|
|
|
| |
Required in MICROPY_PREVIEW_VERSION_2.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The cyw43-driver now provides the Bluetooth initialisation code, making
`drivers/cyw43/cywbt.c` obsolete. To use the new code a port must enable
the `CYW43_ENABLE_BLUETOOTH_OVER_UART` option.
Some ports have yet to migrate to the new code, so in the meantime they can
explicitly add the old source to their source list and continue to use it
without change.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
| |
This file is part of the updated cyw43-driver. It will only be used if
`CYW43_USE_SPI` is enabled.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than having Make calling CMake to generate a list of submodules and
then run a Make target (which is complex and prone to masking other
errors), implement the submodule update logic in CMake itself.
Internal CMake-side changes are that GIT_SUBMODULES is now a CMake list,
and the trigger variable name is changed from ECHO_SUBMODULES to
UPDATE_SUBMODULES.
The run is otherwise 100% a normal CMake run now, so most of the other
special casing can be removed.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
|
|
|
|
|
|
|
|
|
| |
This is needed if you chdir to a ROMFS and want to query your current
directory.
Prior to this change, using `os.getcwd()` when in a ROMFS would raise:
AttributeError: 'VfsRom' object has no attribute 'getcwd'
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
| |
This extends the existing `vfs.mount()` function to accept zero arguments,
in which case it returns a list of tuples of mounted filesystem objects
and their mount location.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
|
|
| |
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Allocation of a large compression window may fail, and in that case keep
the `DeflateIO` state consistent so its other methods (such as `close()`)
still work. Consistency is kept by only updating the `self->write` member
if the window allocation succeeds.
Thanks to @jimmo for finding the bug.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
| |
These are now supported by cyw43-driver.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
| |
This function will attempt to create a `VfsRom` instance and mount it at
location "/rom" in the filesystem.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
| |
This is a generic interface to allow querying and modifying the read-only
memory area of a device, if it has such an area.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Testing with ROMFS shows that it is relatively easy to end up with a
corrupt filesystem on the device -- eg due to the ROMFS deploy process
stopping half way through -- which could lead to hard crashes. Notably,
there can be boot loops trying to mount a corrupt filesystem, crashes when
importing modules like `os` that first scan the filesystem for `os.py`, and
crashing when deploying a new ROMFS in certain cases because the old one is
removed while still mounted.
The main problem is that `mp_decode_uint()` has an loop that keeps going as
long as it reads 0xff byte values, which can happen in the case of erased
and unwritten flash.
This commit adds full bounds checking in the new `mp_decode_uint_checked()`
function, and that makes all ROMFS filesystem accesses robust.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
| |
This commit upgrades from codespell==2.2.6 to the current codespell==2.4.1,
adding emac to the ignore-words-list.
Signed-off-by: Christian Clauss <cclauss@me.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit enables support for DTLS, i.e. TLS over datagram transport
protocols like UDP. While support for DTLS is absent in CPython, it is
worth supporting it in MicroPython because it is the basis of the
ubiquitous CoAP protocol, used in many IoT projects.
To select DTLS, a new set of "protocols" are added to SSLContext:
- ssl.PROTOCOL_DTLS_CLIENT
- ssl.PROTOCOL_DTLS_SERVER
If one of these is set, the library assumes that the underlying socket is a
datagram-like socket (i.e. UDP or similar).
Our own timer callbacks are implemented because the out of the box
implementation relies on `gettimeofday()`.
This new DTLS feature is enabled on all ports that use mbedTLS.
This commit is an update to a previous PR #10062.
Addresses issue #5270 which requested DTLS support.
Signed-off-by: Keenan Johnson <keenan.johnson@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Despite the code comments claiming one is sufficient, the mDNS application
is capable of using up to twelve timers. Three per IP protocol are started
at once in `mdns_start_multicast_timeouts_ipvX`, then another two per
protocol can be started in `mdns_handle_question`. Further timers can be
started for two additional callbacks.
Having certain timers, such as `MDNS_MULTICAST_TIMEOUT`, fail to start due
to none being free will break mDNS forever as the app will never realize
it's safe to transmit a packet. Therefore, this commit goes somewhat
overkill and allocates the maximal amount of timers; it's uncertain if all
can run simultaneously, or how many callback timers are needed.
Each timer struct is 16 bytes on standard 32 bit builds. Plus, say, 8
bytes of allocater overhead, that's 288 more bytes of RAM used which
shouldn't be too horrible. Users who don't need mDNS can manually disable
it to recover the RAM if necessary.
This fixes mDNS on W5500_EVB_PICO (among other boards). Before, mDNS would
work for a bit after connection until the host's cache expired a minute or
two later. Then the board would never respond to further queries. With
this patch, all works well.
Signed-off-by: Thomas Watson <twatson52@icloud.com>
|
|
|
|
|
|
|
|
|
|
| |
It's not necessary to support this, which allows an arbitrary memory
address to be specified and potentially allows invalid memory accesses.
Requiring an object with the buffer protocol is safer, and also means that
the length of the region is always specified.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit implements a small subset of the CPython `marshal` module. It
implements `marshal.dumps()` and `marshal.loads()`, but only supports
(un)marshalling code objects at this stage. The semantics match CPython,
except that the actual marshalled bytes is not compatible with CPython's
marshalled bytes.
The module is enabled at the everything level (only on the unix coverage
build at this stage).
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On mbedTLS ports with non-baremetal configs (mostly esp32, technically also
unix port), mbedTLS memory is allocated from the libc heap. This means an
old SSL socket may be holding large SSL buffers and preventing a new SSL
socket from being allocated.
As a workaround, trigger a GC pass and retry before failing outright.
This was originally implemented as a global mbedTLS calloc function, but
there is complexity around the possibility of C user modules calling into
mbedTLS without holding the GIL. It would be interesting to try making a
generic version for any malloc which fails, but this would require checking
for a Python thread and probably making the GIL recursive.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
|
|
|
|
|
|
|
|
|
| |
This lwIP configuration file has options that are common to all ports, and
the ports are updated to use this file. This change is a no-op, the lwIP
configuration remains the same for the four ports using this common file.
This reduces code duplication, keeps the ports in sync, and makes it easier
to update the configuration for all ports at once.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
| |
For IPv6 connections, the peer address was previously defined as only the
first four bytes of the IP address. For IPv6 addresses, this resulted in an
incorrect IPv4 address. For instance, receiving a packet via `::recvfrom`
from `'fe80::87:e7ff:fe48:629a'` is returned as having a peer address of
`'254.128.0.0'`
Signed-off-by: Jared Hancock <jared.hancock@centeredsolutions.com>
|
|
|
|
| |
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
|
|
|
|
|
|
| |
To prevent compiler warnings.
Signed-off-by: Yoctopuce <dev@yoctopuce.com>
|
|
|
|
| |
Signed-off-by: Yoctopuce <dev@yoctopuce.com>
|
|
|
|
|
|
|
|
| |
If the file can be memory mapped (because it responds to the buffer
protocol) then return a memory-reader that directly references the ROM data
of the file.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit defines a new ROMFS filesystem for storing read-only files that
can be memory mapped, and a new VfsRom driver. Files opened from this
filesystem support the buffer protocol. This allows naturally getting the
memory-mapped address of the file using:
- memoryview(file)
- uctypes.addressof(file)
Furthermore, if these files are .mpy files then their content can be
referenced in-place when importing. Such imports take up a lot less RAM
than importing from a normal filesystem. This is essentially dynamically
frozen .mpy files, building on the revamped v6 .mpy file format.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
| |
Enabled by default. Useful for ports that need the VFS but don't have any
writable filesystems.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
| |
So they don't return a negative number for an address (prior to this fix
they would return negative addresses for values that were larger than the
maximum small-int value).
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
| |
This commit lets the platform module report a more accurate architecture
name when running on a RISC-V 64 bits platform.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
|
|
|
|
|
|
|
|
|
| |
libmetal source files already have the build directory prefix, because
they're auto-generated inside the build directory. When they're added
to `SRC_THIRDPARTY_C`, another build directory prefix is added resulting
in the object files being generated in a nested build directory.
This patch strips the build directory prefix before adding libmetal's
source files.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This commit adds code to distinguish between regular Linux and Android,
also adding a specific entry for the platform libc. The reported libc
is marked as "bionic" and its version matches the Android platform API
version (there are no definitions for a specific bionic version).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
|
|
|
|
|
|
|
| |
This commit adds support to distinguish between GCC and Clang to report
the appropriate compiler version. Usually Clang also disguises itself
as GCC for compatibility reasons, but these changes look for
Clang-specific definitions first to avoid that problem.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
|
|
|
|
|
|
| |
This commit adds a new platform architecture name for Arm CPUs running
in 64 bits mode ("aarch64"). The 32 bits name is left as "arm" to
maintain compatibility with existing code.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a bug in FrameBuffer.ellipse where it goes into an infinite loop
if both radii are 0.
This fixes the bug with a simple pre-check to see if both radii are 0, and
in that case sets a single pixel at the center. This is consistent with the
behaviour of the method when called with just one of the radii set to 0,
where it will draw a horizontal or vertical line of 1 pixel width.
The pixel is set with setpixel_checked so it should handle out-of-bounds
drawing correctly.
This fix also includes three new tests: one for the default behaviour, one
for drawing out-of-bounds, and one for when the sector mask is 0.
Fixes issue #16053.
Signed-off-by: Corran Webster <cwebster@unital.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Configuring the AP for cyw43 writes to some buffers that are only sent to
the modem when the interface is brought up. This means you can't configure
the AP after calling active(True), the new settings seem to be accepted but
the radio doesn't change.
This is different to the WLAN behaviour on other ports. The esp8266 port
requires calling active(True) on the AP before configuring, even.
Fix this by bouncing the AP interface after a config change, if it's
active. Configuring with active(False) still works the same as before.
Adds a static variable to track interface active state, rather than relying
on the LWIP interface state. This is because the interface state is updated
by a driver callback and there's a race: if code calls active(True) and
then config(a=b) then the driver doesn't know it's active yet and the
changes aren't correctly applied.
It is possible this pattern will cause the AP to come up briefly with the
default "PICOabcd" SSID before being reconfigured, however (due to the
aforementioned race condition) it seems like this may not happen at all
before the new config is applied.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
|
|
|
|
|
| |
The `num_stas` was uninitialised and if it happened to take the value 0
then no results were returned. It now has the correct maximum value.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
| |
This function is documented to return True if any stations are connected to
the AP. Without this fix it returns True whenever the driver has brought
the AP interface up.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit f4ab9d924790581989f2398fe30bbac5d680577f inadvertently broke some
Python block devices, for example esp32 and stm32 SDCard classes. Those
classes return a bool from their `readblocks` and `writeblocks` methods
instead of an integer errno code. With that change, both `False` and
`True` return values are now be interpreted as non-zero and hence the block
device call fails.
The fix in this commit is to allow a bool and explicitly convert `True` to
0 and `False` to `-MP_EIO`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows the stream to be set to `None`, which essentially stops all PPP
communication without disconnecting the session.
This allows replacing the stream on-the-fly to suspend it, for example to
send AT commands to a modem without completely disconnecting and
re-establishing the PPP connection:
uart = ppp.config('stream')
ppp.config(stream=None)
uart.write(b'+++')
# do some AT commands
uart.write(b'ATO\r\n')
ppp.config(stream=uart)
Any attempted communication by PPP while the stream is not connected will
register as simple packet loss to the LwIP stack because we return 0 for
any write calls, and protocols like TCP will then automatically handle
retrying.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
|
|
|
|
|
|
|
|
| |
This makes the stream that the PPP object wraps, which is normally only set
once via the constructor, accessible and configurable via the
`ppp.config()` method.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
|
|
|
|
|
|
|
| |
This follows the behaviour of unix MicroPython (POSIX sockets) and the
esp32 port.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
| |
Recent versions of NimBLE (since release 1.6.0) removed this variable; see
https://github.com/apache/mynewt-nimble/commit/7cc8c08d67d52b373eeeec6b33b113192cf2e996.
We never used it except in an assert, so remove those asserts to make the
code compatible with newer NimBLE versions (eg for the esp32 port).
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
| |
This was missed in 628abf8f25a7705a2810fffe2ca6ae652c532896. The the bug
was that, when IPv6 is enabled, the `sizeof(ip_addr_t)` is much larger than
IPv4 size, which is what's needed for IGMP addressing.
Fixes issue #16100.
Signed-off-by: Damien George <damien@micropython.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit enables the implementation of alternative mbedTLS cryptography
functions, such as ECDSA sign and verify, in pure Python. Alternative
functions are implemented in Python callbacks, that get invoked from
wrapper functions when needed. The callback can return None to fall back
to the default mbedTLS function.
A common use case for this feature is with secure elements that have
drivers implemented in Python. Currently, only the ECDSA alternate sign
function wrapper is implemented.
Tested signing with a private EC key stored on an NXP SE05x secure element.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
|
|
|
|
|
| |
This is necessary for mbedTLS callbacks that do not carry any user state,
so those callbacks can be customised per SSL context.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The LwIP interface is removed in wiznet5k_deinit() which is called as part
of the init sequence. Therefore, if using mDNS, then the interface will
need to be re-added when bringing the interface up.
Additionally, this allows to set the hostname from MicroPython code prior
to bringing the interface up and mDNS responding to the (new) hostname.
This allows the hostname to be configured and saved on the flash or be
based on dynamic information such as the MAC or unique_id().
Signed-off-by: Jared Hancock <jared.hancock@centeredsolutions.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a fix for issue #15944, and handles corner cases in the FrameBuffer
code when using stride values where the last line's stride may extend past
the end of the underlying buffer. This commit includes extra tests for
these corner cases.
For example a GS8 format FrameBuffer with a width of 8, height of 2 and
stride of 10 should be able to fit into a buffer of size 18 (10 bytes for
the first horizontal line, and 8 bytes for the second -- the full 10 bytes
are not needed).
Similarly a 1 by 9 FrameBuffer in MONO_VLSB format with a stride of 10
should be able to fit into a buffer of length 11 (10 bytes for the first
8 lines, and then one byte for the 9th line.
Being able to do this is particularly important when cropping the corner of
an existing FrameBuffer, either to copy a sprite or to clip drawing.
Signed-off-by: Corran Webster <cwebster@unital.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In MSVC debug builds with debug error reporting set to showing a dialog (to
allow attaching the debugger), any application which imports the logging
module and leaves the default handlers would result in this dialog because
logging.shutdown is called at exit and that flushes the default handler
which has stderr as its stream.
This commit fixes that by not fsync'ing stdin/out/err.
Also adds a comment related to checking whether a file is stdin/out/err,
which is difficult to fix properly.
Signed-off-by: stijn <stijn@ignitron.net>
|
|
|
|
|
|
|
|
|
|
|
| |
- Code size saving as all of these functions are very similar.
- Resolves the "TODO" of the plain read and write functions not propagating
errors. An error in the underlying block device now causes VFatFs to
return EIO, for example.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|