Test Update#14
Open
maxpromer wants to merge 6421 commits into
Open
Conversation
|
The current version (before the incoming merge) has a bug while trying to compile ports/unix. I have to edit the code of the AXTLS library: -------------------------- ssl/os_port_micropython.h -------------------------- #define TTY_FLUSH() -#include "../../../extmod/crypto-algorithms/sha256.h" #define SHA256_CTX CRYAL_SHA256_CTX |
When a host closes and reopens the CDC serial port, the IN endpoint may remain stalled from a prior runtime USB disconnect (e.g. mpremote connect/disconnect cycles). Clear the stall on DTR high so the connection recovers without requiring a device reset. On DTR low (host close), flush the TX FIFO so stale data does not accumulate and block writes on the next connection. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The TinyUSB serial descriptor used a raw hex dump of all 12 UID bytes in sequential order (24-char lowercase), while the legacy USB stack and ST's onboard DFU bootloader use a condensed algorithm that selects 6 bytes with two additions (12-char uppercase). This mismatch caused the device to report a different serial number depending on which USB stack was active, breaking tools that identify devices by serial (e.g. udev rules, mpremote, dfu-util). Use the ST DFU bootloader algorithm for consistency. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Removes the need for -I$(TOP)/shared/tinyusb/ in the stm32 Makefile by using an explicit path in the two files that include mp_usbd.h outside of the shared/tinyusb/ directory itself. Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Selected for the specific MCU series, to reduce code duplication when referring to them. Signed-off-by: Damien George <damien@micropython.org>
Cortex-M33 and Cortex-M55 CPUs have both secure and non-secure addresses for most peripherals. Prior to this commit, the `stm` module was not taking this into account and instead of providing standard constants like `stm.RTC` it was providing both the _S and _NS set of peripherals, like `stm.RTC_S` and `stm.RTC_NS`. This makes it hard to write portable code which expectes things like `stm.RTC` to exist. Furthermore, Python code doesn't really have a way to know whether it's running in secure or non-secure mode, so doesn't know which peripheral registers to use (either _S or _NS). This commit addresses this issue by removing the constants ending in _S and _NS, and providing standard peripheral constants without any suffix. The address of the peripheral is chosen as the _S or _NS peripheral address depending on whether the firmware is built in secure or non-secure mode, respectively. The information about secure/non-secure mode is provide to `make-stmconst.py` by passing through the MCU CFLAGS. Signed-off-by: Damien George <damien@micropython.org>
Arduino boards are assigned different USB PIDs based on the MicroPython "variant" they're running. Enable overriding the USB pid at build time. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
- This is necessary if the USB MSC device is exposing the SD Card, as a USB operation might read/write SD. - However, rather than disabling USB interrupts (and all lower interrupts) unconditionally, we can check if MSC is enabled & SDCard is configured as one of the USB MSC LUNs. This happens to be necessary to reliably trigger SDCard DMA alignment bugs from hard ISRs. However, it's good to do anyhow - allows interrupt processing to continue while the CPU is blocked waiting for the SD operation. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Rename the existing dma_alignment test to spi_dma_align, as this one uses the SPI driver. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Will avoid corruption for unaligned reads, unless a SPI DMA operation is in progress at the same time (to be fixed separately). This fixes the unit test added in the parent commit. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Has been the default forever (or, at least, for a decade) and was removed entirely in a recent esptool release. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit adds mode, pull, drive parameters to the Pin repr function. This allows to serialize Pin object to str and restore the Pin object from the string. Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
When waking from deep sleep, it could be helpful to know what pins triggered the wake up since the wake pins could be configured to multiple pins. Signed-off-by: Meir Armon <meirarmon@gmail.com>
A board can #define MICROPY_HW_SDMMC_LDO_CHAN_ID in mpconfigboard.h for an internal LDO to control power to the SDMMC GPIO pins. This is needed to use SDIO 3.0, because the IO level has to switch between 3.3V and 1.8V. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
The ESP32-P4-Function-EV-Board uses LDO 4 for controlling SDMMC GPIO power. This is required to use SD cards with this board. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Can now call machine.SDCard(ldo=...) to specify LDO channel. Channel defaults to MICROPY_HW_SDMMC_LDO_CHAN_ID if defined, otherwise None (disabled). Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Also enable MICROPY_PY_NETWORK_LAN if SOC_EMAC_SUPPORTED is defined, which enables on ESP32-P4. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Fixes #19035. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
Prevent WiFi IP events from corrupting Ethernet status. Signed-off-by: Mo Nazemi <moh.nazemi@gmail.com>
To disable `machine.SoftI2C` set zero
#define MICROPY_PY_MACHINE_SOFTI2C (0)
in `ports/esp32/mpconfigport.h`.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
To disable `machine.SoftSPI` set zero in line
#define MICROPY_PY_MACHINE_SOFTSPI (0)
in file `ports/esp32/mpconfigport.h`.
Signed-off-by: Ihor Nehrutsa <Ihor.Nehrutsa@gmail.com>
Fixes bug where SPI can freeze if another DMA channel is tranferring to/from PSRAM. Fixes issue #18471. Signed-off-by: Dryw Wade <dryw.wade@sparkfun.com>
This commit reduces the instruction count for the inline assembler sequence used in `mp_hal_ticks_cpu` when building the firmware in RISC-V mode. The code used a two instruction sequence to set the value of the `mcountinhibit` CSR to a fixed bit pattern, in order to have the cycle counter always enabled. Whilst this works, it also has the side-effect of always inhibiting the instructions counter, which may not be wanted in certain applications. Since all we need to do is to clear one bit, rather than setting the whole register we can just use the `CSRRCI` opcode to clear bit 0 of the CSR instead. This is done in a single instruction and leaves other register bits alone. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit reduces the instructions count for the bitstream module's time-critical function setup procedure, when the firmware is built for RISC-V. The original code used a separate function with three opcodes to make sure the hardware cycle counter is turned on. However, all of that could be condensed in a single opcode placed in lieu of the function call. An instance of the `CSRRCI` opcode is placed in the function opcode stream to clear bit 0 of the `mcountinhibit` CSR. `CSRRCI` is supposed to also store the original value of the CSR into a register, but luckily `zero`/`x0` is a valid target so the opcode can be placed safely without disrupting the existing registers' state. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This prevents Python code from accidentally performing an operation that resizes the buffer. However, in the case that the build excludes memoryview, the crash is still possible. Closes: #17848 Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit adds `.deinit()` to the `machine.I2C` class, bringing it in line with both the target I2C class variant and the rest of the peripheral classes. Ports that want to allocate I²C bus entries dynamically can implement the `self.deinit()` method to add deallocation/cleanup code, otherwise this method is entirely optional to have. If no method is found in the port-provided object structure then calling `deinit()` on the object will do nothing, following what the `machine.SPI` object does. This addresses #19096. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Without this, the register address is not copied into the single buffer, and so the requested register address is garbage when the driver reads it. Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
USB 2.0 requires high-speed capable devices to provide a Device Qualifier descriptor. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit provides optimised function implementations for the GC helper function to collect register values. Both a generic C version and a pure assembler version are provided by these changes, collecting the subset of callee-save registers mentioned in the LoongArch64 ABI document (S0-S9). As for the other platforms, it is preferable to use the assembler version whenever possible, although both were found to be working. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets the Unix port use an optimised implementation of the helper function that gathers CPU registers' values. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets the `platform` module correctly report whether an interpreter was built targeting the LoongArch64 architecture. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds the necessary commands to the CI script to set up, build, and run tests for the Unix port using LoongArch64 as a CPU target. Following the rest of the Unix port targets, `ci_unix_qemu_loong64_setup`, `ci_unix_qemu_loong64_build`, and `ci_unix_qemu_loong64_run_tests` commands are now available. Even though the architecture has been supported by GCC, Linux, QEMU, LibFFI and other support libraries for quite some time now, some workarounds had to be put in place to make things work. The CI image's Ubuntu version comes with two versions of the GCC compiler and no installable meta-package. Moreover, the compiler binaries are tagged via a suffix, so the usual approach of setting the `CROSS` variable when invoking make cannot be used. This means having to symlink the gcc and g++ binaries into something that can work with that scheme. On the execution side, the LoongArch64 binary format isn't in the binfmt database. That was worked around by creating a runner script that invokes the interpreter via the appropriate QEMU binary. This is enough to let the test runner work with the current setup. Both workarounds need to be revisited if things change when a new OS image is used for running CI tasks. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds a new LoongArch64 variant to the Unix port's targets list, using the same template as the rest of the targets already put under test. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit updates the Unix port's supported targets list in the README file, adding both RISC-V and LoongArch to said list. Now that the LoongArch64 target is fully implemented as far as the Unix port is concerned, is supported by LibFFI, and it is buildable both by hand using `make` and by the CI script, it can safely be added to the supported targets list. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
The existing entry covered ``range(-maxsize - 1, 0)`` (negative side) but not the symmetric positive case raised in #17026, where ``range(sys.maxsize + 1, sys.maxsize + 2)`` raises OverflowError in MicroPython while CPython accepts arbitrary integer arguments. Add that example and update the description/cause so it is clearer that the limitation is on the magnitude of the individual arguments (they must fit in mp_int_t), not just on the size of the resulting range. ``tools/gen-cpydiff.py`` will regenerate the rendered table from this file. Fixes #17026. Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
This was missing, and is easy to enable. Signed-off-by: Damien George <damien@micropython.org>
Try to find the best prescaler/period combination that still fits within a 16-bit prescaler value, by making sure that the prescaler does not overflow. As a last resort, set the prescaler to its maximum value and recalculate the period based on that. If that doesn't work then the requested frequency is too low, so raise an appropriate exception. Signed-off-by: Damien George <damien@micropython.org>
This generalises the peripheral construction test so that it works on PYBV1x, PYBLITEV10 and PYBD_SFx boards. Also makes it use unittest. Signed-off-by: Damien George <damien@micropython.org>
These tests were originally written for PYBV1x and PYBLITEV10, and then adapted to PYBD_SFx and then further to NUCLEO_WB55. This commit adapts them even further to pass on: - NUCLEO_G0B1RE - NUCLEO_H723ZG - NUCLEO_L152RE - OPENMV_N6 Signed-off-by: Damien George <damien@micropython.org>
The native emitter cannot generate code for "raise" (re-raising) or "raise x from y" (exception chaining). Trying to generate such code can happen in normal programs, so raise an NotImplementedError instead of using an assert (that won't even be enabled in most production builds). And add a coverage test for this new exception. Signed-off-by: Damien George <damien@micropython.org>
This allows these tests to run with the native emitter. The only remaining raise-with-0-args are in tests than specifically check this re-raise behaviour. Signed-off-by: Damien George <damien@micropython.org>
This commit updates `extmod/ssl_keycert` and `extmod/tls_sslcontext_ciphers` tests to also pass even if the interpreter was built with terse error messages. Originally the tests assumed the error messages level was always higher than `MICROPY_ERROR_REPORTING_TERSE`, and thus expected a particular string pattern to appear in certain errors' output. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit updates the list of tests to skip if the error message level is less or equal to "terse", adding `cmdline/repl_paste`, `extmod/vfs_blockdev_invalid`, and `misc/sys_settrace_features`. In situations where space is at a premium usually the REPL isn't enabled. If it is, changes to REPL internals are usually also covered by other tests. Leaving `cmdline/repl_paste` out in this case is an acceptable compromise, and can be manually tested if it is really needed. On the other hand, `extmod/vfs_blockdev_invalid` is temporarily put in the skip list due to the kind of changes needed to make it work in the scenario tested here. Whilst the amount of changes isn't staggering, it may require migrating the test over to `unittest`, which is probably better left to a separate commit for another time. Finally, `sys.settrace`'s output varies depending on what the code actually does, and changing the way error messages are built and reported does impact on the final test output. This means that to keep the test being executed during regular CI jobs, the test could either be split into two separate files, one per error detail level, or the test runner be modified to match the expected output with different files depending on the error detail level. Regular expressions here won't help, as changes involve block of lines rather than parts of a single line at a time. The best compromise here is to skip this test unless there is one single source of truth when it comes to expected output. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds a new CI target for the Unix port, which is the `standard` variant being built with terse error messages. Even though it won't cover all possible tests failing with terse error messages (some occur only in the `coverage` build variant), this should be a good start for preventing new tests to not assume a particular error message level. To make things automated, the new target is also added to the regular CI jobs set in the Unix port's GitHub workflow file. This closes #17707. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Add the following new PATHS: * drivers/**/*.[ch] * examples/**/*.[ch] * shared/libc/*.[ch] Add an exclusion for "drivers/cc3100/*/*.[ch]". Add an exclusion for "shared/readline/*.[ch]". Update "extmod/nimble" path to include "**". Signed-off-by: Phil Howard <phil@gadgetoid.com>
Avoid getting fancy with MICROPY_MALLOC_USES_ALLOCATED_SIZE and make the function calls with/without this define explicit and readable. Signed-off-by: Phil Howard <github@gadgetoid.com>
Run code formatting to apply rules to: * drivers/**/*.[ch] * examples/**/*.[ch] * extmod/nimble/**/*.[ch] * shared/libc/*.[ch] Signed-off-by: Phil Howard <phil@gadgetoid.com>
Signed-off-by: Damien George <damien@micropython.org>
This commit updates the `make-memzip.py` utility to finish the migration to Python 3.x. The code still wasn't fully aware of how Python unified bytes and strings when it comes to I/O API. These changes help with that. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes the `make-memzip.py` utility more resilient in certain usage cases, which weren't accounted for in the original source. In some Linux distributions the `zip` command may not be available, although `unzip` could be. Unless the `zip` package is installed this script will fail with a generic "file not found" error, which has been addressed in these changes set. Also, the `zip` command by default adds a `.zip` suffix to archives, which wasn't accounted for. So, running `./make-memzip -z z1 -c z2 .` would fail, as the script would build `z1.zip` whilst the header generator attempted to open `z1` instead. This has now been fixed. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit modifies the native modules build system to use different
directories for different architectures.
Previously, the natmod build system would unconditionally put all build
data into a single directory (usually "$(PWD)/build" unless overridden),
and the static library runtime cache into another directory
("$(PWD)/.mpy_ld_cache"). That works if building is always done for a
single architecture or if a full clean is performed before switching
architectures, which sometimes is not wanted (collecting the runtime
cache may take quite some time depending on the module complexity, for
example).
With these changes, both the build directory and the runtime cache
directories are marked with the name of the architecture they target, so
for example "$(PWD)/build" becomes "$(PWD)/build_x64" (the same happens
to the cache directory name).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit makes a minor change to the native module build scripts, to make the intermediate MPY file keep the same file name it will have once the final pre-processing step takes place. A MPY file will retain its file name as the first QSTR entry in the file, and before these changes the name being written would be the one used for the intermediate MPY output file (ie. "$BUILDDIR/$MODNAME.native.mpy"). The `mpy-tool.py` preprocessing pass would keep that string intact but rename the file, so things wouldn't match in error tracebacks. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit adds an option to the MPY linker to brand generated file with a custom internal file name rather than the raw output path provided in the command line. MPY files, as part of their preambles, will contain a path name as the first entry in the constant string pool. However that may contain unneeded data (ie. sometimes the plain file name is enough) or it may have sensitive data in there (if an alternate build path is provided it may contain product code names or client names which should probably not be disclosed). Until now there was no provision to let users use a different internal path name. A new option was added to `mpy_ld.py`: "--source-name" which, if passed, will write the given string in the module file. If said option is not provided, generated MPY files will still carry the raw command line output path but stripped of all leading path segments. The example natmod makefiles have been updated to always provide that option whenever the final file name on the filesystem wouldn't match the internal MPY file name. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
MICROPY_PY_LWIP_PPP is used in only one place and is generally set to
the value of MICROPY_PY_NETWORK_PPP_LWIP. Remove the former.
extmod/lwip-include/lwipopts_common.h: Replace MICROPY_PY_LWIP_PPP
with MICROPY_PY_NETWORK_PPP_LWIP.
ports/mimxrt/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP.
ports/rp2/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP,
default MICROPY_PY_NETWORK_PPP_LWIP to
MICROPY_PY_LWIP.
ports/stm32/mpconfigport.h: Remove redundant MICROPY_PY_LWIP_PPP.
Signed-off-by: Phil Howard <github@gadgetoid.com>
mpconfigport.h: Default MICROPY_PY_NETWORK_PPP_LWIP to 1. Signed-off-by: Phil Howard <github@gadgetoid.com>
This updates the PATHS to include: - everything under `extmod/` - everything under `py/` (in case one day there are subdirs there...) - everything under `shared/` This makes sure that any C source files added anywhere under these directories will be formatted. Signed-off-by: Damien George <damien@micropython.org>
These need to be formatted due to the parent commit. Signed-off-by: Damien George <damien@micropython.org>
This reverts commit 6552836. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.