Age | Commit message (Collapse) | Author |
|
The PYBD boards use an F7xx which has an errata 2.4.3:
Memory-mapped read operations may fail when timeout counter is enabled
This is unfortunate because it means that once QSPI memory-mapped flash is
accessed the QSPI peripheral will leave the CS pin active (low) forever,
which increases power consumption of the SPI flash chip (because it's
active and waiting for commands). The exact amount of power increase
depends on the flash, but the PYBD_SFx increase by about 2.5mA.
Previously this increase in power only happened when QSPI flash was needed,
eg on PYBD_SF2 when mbedtls or nimble libraries were used. On PYBD_SF6
it's actually never used.
But with the introduction of ROMFS which lives in the QSPI flash, the
memory is always access on start up to see if the ROMFS contains a valid
image (it must read the memory to find out). That means these boards
always consume about 2.5mA more after starting up (compared to when ROMFS
is disabled).
The fix in this commit is to explicitly restart the QSPI memory mapped mode
during the start up process. More precisely, the restart is done after
querying the ROMFS and just before trying to execute `boot.py`. That's the
right location to keep power consumption permanently down if the QSPI is
never used (eg ROMFS image doesn't exist).
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
|
|
Signed-off-by: Herwin Grobben <h.grobben@aemics.nl>
|
|
Signed-off-by: Herwin Grobben <h.grobben@aemics.nl>
|
|
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
On stm32, the startup code attempts to mount the configured filesystem. If
there is an existing littlefs filesystem that's suitable corrupted it's
possible for the reported blocksize to be incorrect here:
uint32_t block_size = lfs2_fromle32(superblock->block_size);
This `block_size` (which is read from the filesystem iteself) is used to
create the len argument passed to `pyb_flash_make_new()`. In that function
the len arg is validated to be a mutliple of the underlying hardware block
size, as well as not bigger than the physical flash. Any failure is raised
as a ValueError. This exception is not caught currently in main, it flows
up to the high level assert / startup failure.
As this occurs before `boot.py` is run, the users (potentially frozen)
application code doesn't have any opportunity to detect and handle the
issue.
This commit adds a helper function which attempts to create a block device,
and on error returns `None` instead of raising an exception. Using this in
main means that a potentially corrupt filesystem will simply remain
unmounted, and the application can handle the issue safely.
The fix here also handles the case where the littlefs filesystem is valid
but the autodetection code (which detects the filesystem size) does not
work correctly. In that case it will retry mounting the filesystem using
the whole size of the block device.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
|
|
The rp2 port has an incomplete mDNS implementation. The code in `main.c`
calls `mdns_resp_init()` which opens the UDP socket for mDNS. However, no
code in the cyw43 driver makes the proper calls to `mdns_resp_add_netif()`
and `mdns_resp_remove_netif()` to send the announce packets. The wiznet5k
driver does make these calls and was used as a model for these changes.
This commit attempts to address this by very small changes to the
`ports/rp2/cyw43_configport.h` file. The change uses new cyw43 driver
hooks to map the driver macros `CYW43_CB_TCPIP_INIT_EXTRA` and
`CYW43_CB_TCPIP_DEINIT_EXTRA` to the appropriate lwIP mDNS calls.
Fixes issue #15297.
Signed-off-by: Mark Seminatore <nebula_peeps4t@icloud.com>
|
|
This prevents printing the lengthy command and makes the build output a
little cleaner.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This prevents printing the lengthy command and makes the build output a
little cleaner.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
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>
|
|
If a ROMFS is mounted then "/rom/lib" is usually in `sys.path` before the
writable filesystem's "lib" entry. The ROMFS directory cannot be installed
to, so skip it if found.
Signed-off-by: Damien George <damien@micropython.org>
|
|
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>
|
|
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
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>
|
|
Addresses some TODOs in this file.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Because 2-arg `next()` is implemented, and now enabled at the basic feature
level.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is a pretty fundamental built-in and having CPython-compatible
behaviour is beneficial. The code size increase is not much, and
ports/boards can still disable it if needed to save space.
Addresses issue #5384.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
The buffer was be reset on every call to uart.init(). If no sizes were
given, the buffer was set to the default size 256. That made problems
e.g. with PPP.
This commit fixes it, keeping the buffer size if not deliberately changed
and allocating new buffers only if the size was changed. Cater for changes
of the bits value, which requires a change to the buffer size.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
The buffer was be reset on every call to uart.init(). If no sizes were
given, the buffer was set to the default size 256. That made problems e.g.
with PPP.
This commit fixes it, keeping the buffer size if not deliberately changed
and allocating new buffers only if the size was changed.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Changes:
- Move setting of PendSV priority to pendsv_init().
- Call pendsv_init() from CPU1 as well, to ensure priority is the same.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
A better indication of whether a cyw43 event is pending is the actual flag
in the PendSV handler table. (If this fails, could also use the GPIO
interrupt enabled register bit).
This commit was needed of a previous version of the fix in the parent
commit, but it turned out not strictly necessary for the current version.
However, it's still a good clean up.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
There's a very odd but predictable sequence of events that breaks Wi-Fi
when using both cores:
1) CPU1 calls pendsv_suspend() - for example sleep() causes
a softtimer node to be inserted, which calls pendsv_suspend().
2) CYW43 sends wakeup IRQ. CPU0 GPIO IRQ handler schedules PendSV
and disables the GPIO IRQ on CPU0, to re-enable after
cyw43_poll() runs and completes.
3) CPU0 PendSV_Handler runs, sees pendsv is suspended, exits.
4) CPU1 calls pendsv_resume() and pendsv_resume() sees PendSV
is pending and triggers it on CPU1.
5) CPU1 runs PendSV_Handler, runs cyw43_poll(), and at the end
it re-enables the IRQ *but now on CPU1*.
However CPU1 has GPIO IRQs disabled, so the CYW43 interrupt never runs
again...
The fix in this commit is to always enable/disable the interrupt on CPU0.
This isn't supported by the pico-sdk, but it is supported by the hardware.
Fixes issue #16779.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
It's common with write-only SPI displays for MISO to be repurposed as a
register select or data/command pin.
While that was possible by setting up the pin after a call to
`machine.SPI()` this change makes `machine.SPI(miso=None)` explicit.
Signed-off-by: Phil Howard <github@gadgetoid.com>
|
|
If the "spi_id" arg is not supplied and then the board default specified by
PICO_DEFAULT_SPI will be used.
Signed-off-by: Phil Howard <github@gadgetoid.com>
|
|
When PICO_DEFAULT_I2C is not set require an I2C bus ID instead of
using -1 as a default, which would fail with a cryptic:
"I2C(-1) doesn't exist"
Signed-off-by: Phil Howard <github@gadgetoid.com>
|
|
Some rp2 boards include WiFi, at least with the very popular Pico W and
Pico 2 W. New users frequently ask how to set up WiFi and are confused
because it's not covered in the quickref.
This commit adds the wlan section, copied and modified with notes from the
ESP32 quickref.
Signed-off-by: Matt Trentini <matt.trentini@gmail.com>
|
|
The IOTNODE_LORAWAN_RP2350 has an SD card and we want users to be able to
`import sdcard` without copying `sdcard.py` over to their board.
Signed-off-by: Malcolm McKellips <malcolm.mckellips@sparkfun.com>
|
|
The preferred/correct spelling is "SparkFun" so this commit updates all of
the existing SparkFun board definitions with that spelling.
|
|
stm32's QSPI driver supports memory-mapped mode. The memory-mapped flash
can also be erased/written to. To support both these modes, it switches in
and out of memory-mapped mode during an erase/write.
If the flash is erased/written and then switched back to memory mapped
mode, the cache related to the memory-mapped region that changed must be
invalidated. Otherwise subsequent code may end up reading old data.
That cache invalidation is currently not being done, and this commit fixes
that.
This bug has been around ever since QSPI memory-mapped mode existed, but
it's never really been observed because it's not common to use flash in
memory-mapped mode and also erase/write it. Eg PYBD_SF2 uses the
memory-mapped flash in read-only mode to store additional firmware.
But since the introduction of ROMFS, things changed. The `vfs.rom_ioctl()`
command can erase/write memory-mapped flash.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
Make the final step of the deploy more detailed.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Since all boards are configured to have a I2C(0), SPI(0) and UART(1), these
can be set as default devices, allowing the instantiation of I2C(), SPI(),
UART() without an id argument.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Set the default timeout to 50000 us. The default used to be 0, causing the
NXP I2C driver to silently stop working in case of a non-responding device.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
The buffer would be reset on every call to `uart.init()`. If no sizes were
given, the buffer would be set to the default size 256. That made problems
e.g. with PPP. Also, the RX buffer was not stored at the UART object and
not visible to GC as being in use. Then a `gc.collect()` would eventually
free the buffer.
This commit fixes those issues, keeping the buffer size if not deliberately
changed and allocating new buffers only if the size was changed.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
The flash devices used by the MIMXRT board are specified either with 3ns or
5 ns CS setup and hold time. Since a single configuration file is used for
all boards, use 5ns instead of 3ns to be safe, even if there were no
problems so far.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Changes:
- The duplicate LPUART_Init call was not needed, just an edit fail.
- Allow a port to disable UART.irq(). Some code for configuration stays,
but the respective UART IRQ is not enabled. Calling uart.irq() will
cause an exception by extmod/machine_uart.c.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
PPP is now enabled on all boards with Ethernet support. PPP could be
enabled for other boards without Ethernet like the Teensy 4.0 as well in a
second step. Enabling for MIMXRT101x boards is hardly possible due to the
large RAM demand of lwIP.
Tested with a Teensy 4.1 board and a SimCom A7608 GPRS/LTE modem.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
There is plenty of room in the MIMXRT board flash, so it can be enabled.
Tested with:
- MIMXRT1176_EVK
- MIMXRT1061 (Teensy 4.1)
- MIMXRT1010 (Olimex RT1010)
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Matching the generic documentation.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
This is a board based on the i.MX RT1011 in breadboard-friendly shape. A
good basic board with 16M flash and regular pinout, providing access to
many GPIO_nn and GPIO_AD_nn Pins.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
This commit removes the assumption made by the CI scripts that the
system-provided python executable is simply named "python". The scripts
will now look for a binary called "python3" first, and then fall back to
"python" if that is not found.
Whilst this is currently the case for the CI environment, there are no
guarantees for this going forward. For example minimal CI environments
set up by some developers, using the same base OS, have their python
executable called "python3".
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit expands the CI tests by checking whether the example native
modules are able to be built for the Xtensa architecture.
This was made possible by the changes to mpy_ld that allow symbol
resolution across standard compiler-provided libraries.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit introduces an additional symbol resolution mechanism to the
natmod linking process. This allows the build scripts to look for required
symbols into selected libraries that are provided by the compiler
installation (libgcc and libm at the moment).
For example, using soft-float code in natmods, whilst technically possible,
was not an easy process and required some additional work to pull it off.
With this addition all the manual (and error-prone) operations have been
automated and folded into `tools/mpy_ld.py`.
Both newlib and picolibc toolchains are supported, albeit the latter may
require a bit of extra configuration depending on the environment the build
process runs on. Picolibc's soft-float functions aren't in libm - in fact
the shipped libm is nothing but a stub - but they are inside libc. This is
usually not a problem as these changes cater for that configuration quirk,
but on certain compilers the include paths used to find libraries in may
not be updated to take Picolibc's library directory into account. The bare
metal RISC-V compiler shipped with the CI OS image (GCC 10.2.0 on Ubuntu
22.04LTS) happens to exhibit this very problem.
To work around that for CI builds, the Picolibc libraries' path is
hardcoded in the Makefile directives used by the linker, but this can be
changed by setting the PICOLIBC_ROOT environment library when building
natmods.
Signed-off-by: Volodymyr Shymanskyy <vshymanskyi@gmail.com>
Co-authored-by: Alessandro Gatti <a.gatti@frob.it>
|
|
Add `pyexec_vstr()` to execute Python code from a vstr source.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|