This adds a -f/--force option to the "cp" command, which forces
unconditional copies, in particular does not check the hash.
Signed-off-by: Damien George <damien@micropython.org>
These tests are specifically for the command-line interface and cover:
- resume/soft-reset/connect/disconnect
- mount
- fs cp,touch,mkdir,cat,sha256sum,rm,rmdir
- eval/exec/run
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
Makes the filesystem command give standard error messages rather than
just printing the exception from the device.
Makes the distinction between CommandError and TransportError clearer.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Changes in this commit:
- Adds transport API `fs_hashfile` to compute the hash of a file with given
algorithm.
- Adds commands `mpremote <...>sum file` to compute and print hashes of
various algorithms.
- Adds shortcut `mpremote sha256sum file`.
- Uses the hash computation to improve speed of recursive file copy to
avoid copying a file where the target is identical.
For recursive copy, if possible it will use the board's support (e.g.
built-in hashlib or hashlib from micropython-lib), but will fall back to
downloading the file and using the local implementation.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
This introduces a Python filesystem API on `Transport` that is implemented
entirely with eval/exec provided by the underlying transport subclass.
Updates existing mpremote filesystem commands (and `edit) to use this API.
Also re-implements recursive `cp` to allow arbitrary source / destination.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
This is a step towards making the transport expose a Python API rather than
functions that mostly print to stdout.
Most use cases of `transport.eval()` are to get some state back from the
device, so have it return as a value directly by default.
Updates uses of `transport.eval()` to remove the parse argument where it
now isn't needed, make the `rtc` command use eval/exec, and update the
`mip` command to use eval's parsing.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
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>
Allowing passing keyword arguments to a native base's __init__, i.e.
`make_new` in the C code. Previously only positional arguments were
allowed.
The main trade-off in this commit is that every call to the native base's
`make_new` is now going to be preceded by a call to
`mp_map_init_fixed_table` even though most of what that does is unused and
instead it merely serves as a way to pass the number of keyword arguments.
Fixes issue #15465.
Signed-off-by: stijn <stijn@ignitron.net>
Enables support for the ESP standard DTR/RTS based reboot to bootloader.
Switches from OTG to Serial/Jtag mode to workaround issue discussed
in: https://github.com/espressif/arduino-esp32/issues/6762
Signed-off-by: Andrew Leech <andrew@alelec.net>
Uses newer TinyUSB synopsys/dwc2 driver for esp32s2 and esp32s3 rather than
the IDF tinyusb component. This allows re-use of other tinyusb integration
code and features shared between ports.
Signed-off-by: Andrew Leech <andrew@alelec.net>
The cyw43-driver uses `printf` by default for `CYW43_PRINTF`, but on the
rp2 port `printf` only goes to a UART output and not to USB CDC.
By defining `CYW43_PRINTF` to `mp_printf`, all the messages from the
cyw43-driver are seen on USB CDC.
For example this allows `network.WLAN().config(trace=1)` to show async
WALN events.
Signed-off-by: Damien George <damien@micropython.org>
The version of the assembly code for the GC helper that was committed
ended up being a version that had an opcode typo in.
The code was tested and working, but an undo operation too many when
cleaning up the file before committing checked in the wrong version.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
The `MICROPY_FORCE_PLAT_ALLOC_EXEC` config option was made obsolete by
commit 9796625457, so remove it.
Signed-off-by: Damien George <damien@micropython.org>
Zephyr v3.7.0 added a new feature to allow getting devices by their
devicetree node labels. Use this feature in the MicroPython Zephyr port
to simplify constructing machine module objects, including Pin, SPI,
I2C, and UART. It's still possible to use the more verbose device names
(e.g., gpio@400ff040, i2c@40066000, spi@4002c000), but now we can also
use their devicetree node labels (e.g., gpiob, i2c0, spi0).
Node labels aren't standardized across all SoC families because they
generally try to follow their respective SoC hardware user manual naming
convention, however many boards define common labels for devices routed
to Arduino headers (e.g., arduino_i2c, arduino_serial, and arduino_spi).
That means I2C("arduino_i2c") will work on quite a few boards (>100 in
the main Zephyr tree).
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Refactors Zephyr device lookup operations into a common helper function
to reduce boilerplate code that was repeated in multiple modules.
Suggested-by: Damien George <damien@micropython.org>
Signed-off-by: Maureen Helm <maureen.helm@analog.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@analog.com>
Zephyr v3.4.0 changed the SPI chip select from a pointer to a struct
member to allow using the existing SPI dt-spec macros in C++.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Zephyr v3.4.0 changed the declaration of the main function to return an
int to allow building Zephyr without the -ffreestanding compiler flag.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Zephyr v3.2.0 deprecated the devicetree label property as a base
property, which had been used as the device name string for
device_get_binding(). The device name string is now the devicetree node
name appended with its unit-address. Update Zephyr port documentation
to reflect this change.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Zephyr v3.2.0 deprecated include/zephyr/zephyr.h in favor of
include/zephyr/kernel.h since it only included that header.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Zephyr v3.1.0 moved all public headers to include/zephyr. Updates a few
Zephyr include paths that were missed in
4fd54a4756.
Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The ESP32 port contains a workaround to avoid having a certain function
in `py/parse.c` being generated incorrectly. The compiler in question
is not part of any currently supported version of ESP-IDF anymore, and the
problem inside the compiler (well, assembler in this case) has been
corrected a few years ago.
This commit removes all traces of that workaround from the source tree.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Necessary to fix "mpremote run" over hardware UART.
Bisect shows bug was introduced by d420b4e4, but looks like made more
complex by 01c046d2. Specifically: resetting and re-initialising the REPL
UART during soft reset clears the FIFO before it's done printing the "MPY:
soft reboot" line.
Fixed by adding a UART TX flush in the deinit path.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit fixes the addition of a stray separator before the number
when printing an MPZ-backed integer and the first group is three digits
long.
This fixes#8984.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
lwIP was recently updated in a89ac9e24a
to STABLE-2_2_0_RELEASE, and this introduced a change in the configuration
variable `DHCP_DOES_ARP_CHECK`, renaming it to `LWIP_DHCP_DOES_ACD_CHECK`.
This commit fixes the ports lwIP settings to use the new configuration
option.
Without this option, connecting to a WiFi access-point takes about 12.5
seconds. With this option (ie disabling DHCP ARP checks) connecting takes
about 4 seconds.
Tested on an RPI_PICO_W and PYBD_SF2.
Signed-off-by: Damien George <damien@micropython.org>
This tracing was originally needed for three reasons:
1. To trace object/raw-code pointers embedded in native code, eg from
@micropython.native functions.
2. To trace pointers to BSS/rodata from relocated viper code.
3. For libffi tracing.
The tracing in point 1 was made unnecessary long ago in commit
7d4b6cc868 (see also commit
bbccb0f630 which removed scanning of native
code on the esp8266 port).
Since the previous commit, point 2 is no longer needed.
For point 3, this was made unnecessary in the recent commit
9796625457.
Signed-off-by: Damien George <damien@micropython.org>
- 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>
A positive result here can result in eventual memory corruption
as littlefs expects the result of a cache read/write function to be
0 or a negative integer for an error.
Closes#13046
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Most ports using TinyUSB now schedule the USB tasks from the USB interrupt.
This commit updates the renesas-ra port to use this new pattern.
Signed-off-by: Andrew Leech <andrew@alelec.net>
The renesas-ra port board definitions contain auto-generated files which
are not easy to understand for someone unfamiliar with the port. This
commit adds some notes to the README to assist other developers who want to
work on these.
The configuration.xml file for the `ARDUINO_PORTENTA_C33` was provided by
@iabdalkader.
Signed-off-by: Andrew Leech <andrew@alelec.net>