Age | Commit message (Collapse) | Author |
|
This commit documents and verifies the current absence of
`__init_subclass__` functionality, in anticipation of a possible future
PEP487 'metaclasses lite' patch.
The main `core_class_initsubclass.py` test verifies if the method is
automatically called, while the other three verify other orthogonal
properties it should have: if the method is an implicit classmethod; if
MicroPython supplies the base case for the usual recursive function body
the PEP encourages; and if kwargs inheritance parameters work correctly.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
This condition corresponds to invalid asm code like
```
@micropython.asm_rv32
def l():
a=di(a2, a2, -1)
```
and possibly other forms where nodes[0] is not a STRUCT.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
The calls signature for gc_malloc was changed in
5ed578e5b48730606536ded9a711223ae9a70262, without cleaning up existing
code on the rationale that the previous bool is automatically converted
to an int with the same meaning.
This commit goes back and cleans up existing invocations to make their
behavior more readable in a modern context.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Cleans up 24234937747e6d7fd920d21358fb26b826398e1a, and fixes builds
that include LFS but not MICROPY_ENABLE_FINALISER.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
The Git hash is embedded in the version number. The hash is abbreviated by
Git. This commit changes the length of the Git hash abbreviation to a
fixed number, so that the length of the version string no longer varies
based on external factors (it can still vary, but will now be at least 10
characters).
This change is made because builds of the same MicroPython commit on
multiple machines were sometimes giving a version string with different
lengths, eg due to commits on other local branches having a clashing
abbreviated hash. This change may also help the code size report to be
more consistent, because it will less often be impacted by random changes
in the version string length, at the cost of always being a few bytes
longer.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
|
|
The DTR quirk workaround from dea949e86 is needed for the Espressif
Serial/JTAG device, but not for TinyUSB - in fact DTR must be set for
TinyUSB to correctly determine if the serial port is open (and leads to
issues with lost bytes otherwise).
See discussion in PR #17999.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Makes machine.UART objects static instances (similar to other ports), adds
machine_uart_deinit_all() function for cleanup on soft reset.
- Fixes the case where the OS-level uart_event_task is leaked
(along with 2KB of heap) when a UART object is garbage collected
(including after a soft reset).
- Fixes hard fault if a previous UART irq() fires after the UART object is
garbage collected (including after a soft reset), but before any new UART
object is instantiated for the same UART number.
- Constructing multiple UART objects for the same UART now returns the
same instance multiple times, not different instances.
- Was also able to streamline deinit/init to only install the driver once,
rather than install-with-defaults/uninstall/reinstall.
Alternative would be to add a finaliser, but this is more consistent
with how most other UART objects are implemented.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This is related to the previous commit (where due to the new config flag
this loop could end up stuck indefinitely if the USB host was
disconnected). The previous loop could maybe still get stuck if the
low-level USB state and the high-level USB state got out of sync. (Not
clearly possible, but hard to say definitely not possible.)
To be "belts and braces" careful:
- Always run mp_usbd_task() each time around the loop to progress the
state.
- Always evaluate the timeout if we fail to write anything to the FIFO.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This flag is in the main branch of TinyUSB, included in Espressif since
their v0.18.0~3 component release (but it's not actually in TinyUSB v0.18.0
release).
Setting the flag is needed for the USB device not to block waiting for
space in the FIFO if the host is disconnected.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This is recommended by Espressif, and it's the only way to ensure
everyone builds the same set of component versions.
The awkward part is that updating the ESP-IDF version will churn a line
in each of these files (and possibly other changes).
Adds a build-time check for lock file changes, which is either a warning or
a hard error depending on the value of MICROPY_MAINTAINER_BUILD
flag (introduced in previous commit).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This allows us to have some things which are fatal errors in CI or nightly
builds, but warnings in normal developer builds.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Reported to fix issues reported with serial corruption when interacting
with MicroPython from macOS hosts.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
This commit fixes the build issues in the ESP32 port that arise when
explicitly disabling USB CDC support.
The USB support code gated the USB serial number retrieval behind the
USB CDC support definition, even though all USB devices must be able to
be queried for their serial number.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit fixes the build issues in the SAMD port that arise when
explicitly disabling USB CDC support.
The console code assumed CDC support is always enabled even if it was
disabled in mpconfigport.h. These changes make accessing CDC
conditional to that support configuration being enabled.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit fixes the build issues in the MIMXRT port that arise when
explicitly disabling USB CDC support.
The console code assumed CDC support is always enabled even if it was
disabled in mpconfigport.h. These changes make accessing CDC
conditional to that support configuration being enabled.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit fixes the linking issues in the RP2 port that arise when
explicitly disabling USB CDC support.
The console input ringbuffer needs to be made available if dupterm
support is enabled, and the console character input function would
always attempt to read from the input ringbuffer even if CDC support is
disabled and the console isn't bound to any UART.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit makes possible building MicroPython with USB CDC support
disabled.
The original code does support such a configuration but missed a few
spots where build errors would arise. These changes fix the remaining
issues, fixing also warnings caused by the changes needed to make the
build succeed.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
A fast host (eg Mac M4) may request the status for the SET_ADDRESS before
TinyUSB gets to process it. This is because TinyUSB does not handle events
inside the USB ISR, rather it waits for the top-level thread to process
them. Fix that by setting the USB device address as soon as
TUSB_REQ_SET_ADDRESS comes in.
This patch follows the corresponding upstream fix:
https://github.com/alifsemi/tinyusb/commit/fc40ea7fc6e6bd49baad6b504c88bb6a37c7a191
Signed-off-by: Damien George <damien@micropython.org>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
All the existing `machine.UART` tests in extmod and extmod_hardware are
converted to use the new `target_wiring` scheme, which removes a lot of
duplicated board-specific settings.
All the existing boards that were supported by these UART tests now have
their own `target_wiring` file. Some configurations are board specific (eg
NUCLEO_WB55) and others are port specific.
Signed-off-by: Damien George <damien@micropython.org>
|
|
There are currently a few "hardware" tests that need external board
connections to be made for them to work, such as bridging a pair of pins.
For example, all tests in `tests/extmod_hardware` need some kind of
connection.
Along with the physical connections -- which are different for each board
-- there needs to be corresponding Python settings, eg which UART instance
to use and which pins for TX/RX.
These settings are currently hard-coded in each test file. That has a few
problems:
- settings are repeated, eg all the UART tests have pretty much the same
settings code duplicated across them
- changing the settings means changing many files
- adding a new board means adding a lot of code
- the tests get bigger and bigger with each new board that they support,
meaning they may not fit on targets with a small amount of RAM (that's
already the case with `tests/extmod_hardware/machine_pwm.py`)
- if you have a custom board you have to manually edit the test to add your
own settings
This commit aims to solve all the above problems by splitting the board-
specific settings out into separate files, one for each board (or port).
They are placed in the `tests/target_wiring/` directory. The
`run-tests.py` test runner then loads the appropriate configuration for the
target that is being tested, sends it to the board so it's available as
`import target_wiring` (without needing a filesystem), and then executes
the test. Note tht only tests that need `target_wiring` have it loaded.
This commit adds support for this `target_wiring` scheme.
Signed-off-by: Damien George <damien@micropython.org>
|
|
That's useful to know the exact board that's being tested.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This is, eg, `ZEPHYR_NUCLEO_WB55RG`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
This makes the rp2-specific lightsleep test more lenient, so it passes.
This test was added in PR #16454 / 69993daa5c2eae6055f0b3b2330e95e78d6e3738
and even back then it did not pass reliably on RP2040. The issue is that
threads can race each other to enter lightsleep mode, and when one of them
actually stops the CPU clock the other thread is stopped as well.
Depending on whether the other thread was just entering or just exiting
lightsleep itself, the total duration of all sleeps can vary and can be as
small as 2*T.
Therefore, adjust the minimum to allow 2*T.
`machine.lightsleep()` is anyway 1) specified only to wait at most the
given time; and 2) not well specified when multiple threads call it at the
same time. So it seems OK to make the test more lenient.
Work done in collaboration with @projectgus.
Signed-off-by: Damien George <damien@micropython.org>
|
|
As required by the datasheet.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
STM32L4 uses the same I2C controller as STM32WB. Change `defined(STM32WB)`
to `defined(STM32L4) || defined(STM32WB) ` in relevant files.
Also remove the dummy definition of I2C2_BASE for STM32L432xx. It's now
provided by the dummy definition in `i2cslave.h`.
Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
Signed-off-by: Damien George <damien@micropython.org>
|
|
Saves code size for the same functionality.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
This is intended to be equivalent to the unlock in
shared/runtime/pyexec.c.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
This reverts commit 3c9546ea0911b50d4b85ad4046864c90f84b3fd3.
I2CTarget now fits on ESP32-C6 because it's compiled with -Os, see commit
5b98126c21f8eaa996e258761a291a7a88624082.
Signed-off-by: Damien George <damien@micropython.org>
|
|
I2S works on the ESP32-C6, and it now has enough space to fit.
Signed-off-by: Jimisola Laursen <jimisola@jimisola.com>
Signed-off-by: Damien George <damien@micropython.org>
|
|
Same optimisation that was applied to C6 in the parent commit, now applied
to all RISC-V boards.
+------------+------------+------------+------------+
| Size | Before | After | Delta |
+------------+------------+------------+------------+
| C2 Binary | 1680384 | 1494224 | -186160 |
| C2 D/IRAM | 83710 | 79080 | -4630 |
| C3 Binary | 1833328 | 1636624 | -196704 |
| C3 D/IRAM | 139608 | 131896 | -7712 |
+------------+------------+------------+------------+
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Reduces ESP32_GENERIC_C6 application flash size from 2024432 to
1813216 (206KB smaller).
Also has benefit of reducing D/IRAM size, increasing free memory at
runtime (167187 to 148584, -18603 bytes).
Most of this savings comes from building with -Os instead of -O2,
but about 10KB comes from using the SPI flash functions from the ROM.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
|
|
Signed-off-by: Damien George <damien@micropython.org>
|
|
These were missed in 2bba507148e8a751123257fa2b075c70d67e1160 because they
didn't use the `os.stat` pattern.
Signed-off-by: Damien George <damien@micropython.org>
|
|
The unix port doesn't have `micropython.alloc_emergency_exception_buf()`
but it's still possible to run and pass this test. So make that call
optional.
Signed-off-by: Damien George <damien@micropython.org>
|
|
And the existing "-t" option is changed to "-m" (shorthand for the
"--diff-time" option).
Signed-off-by: Damien George <damien@micropython.org>
|
|
Following the similar change to `run-tests.py` and `run-multitests.py`.
What was previously, eg, `-p -d /dev/ttyACM0` is now `-t a0`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
Back in commit 8978102f3595ae321484a6be44c1dcf25c8909a9 (see PR #16111) the
`run-tests.py` script was changed to use an improved way of selecting the
test instance, eg:
$ ./run-tests.py -t a0
that would run on /dev/ttyACM0. This has been a very nice improvement,
makes it easier to specify the target.
This commit updates `run-multitests.py` to use the same scheme. It
previously used `-i` but now that's changed to `-t`.
Signed-off-by: Damien George <damien@micropython.org>
|
|
So it can be reused by other test runners.
Signed-off-by: Damien George <damien@micropython.org>
|
|
These files are only built on demand for developers, and it is a quick
process.
Without FORCE, a sequence like this would leave the developer with an
outdated `main.pp` to inspect:
make build-standard/main.pp
touch input.h
make build-standard/main.pp # Rebuilds now, wouldn't have before
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Re-organize `mp_parse_num_integer()` (for longlong) slightly so that the
most negative 64-bit integer can be parsed.
Fixes issue #17932.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
These functions were removed in 6c9fca2 for v1.9.3. This commit removes
their declarations as well.
See-also: 6c9fca2aa911e31f6c1b48d3b950b4dc058473d4
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
The `thread/thread_gc1.py` test is a constant source of spurious failures
in Github CI.
This commit adds it to the list of tests skipped when running on Github CI
using either macos, qemu_riscv64, qemu_mips, or qemu_arm, to help reduce
the overall false positive rate and improve the predictive value of the
test fail indication.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
This commit lets "tools/mpy-tool.py" extract MPY segments into their own
files, one file per segment.
A pair of new command line arguments were added, namely "-e"/"--extract"
that takes a filename prefix to use as a base for the generated files'
name, and "--extract-only" that - combined with "--extract" - allows
selecting which kinds of segment should be dumped to the filesystem.
So, for example, assuming there's a file called "module.mpy", running
"./mpy-tool.py --extract segments module.mpy" would yield a series of
files with names like "segments_0_module.py_QSTR_module.py.bin",
"segments_1_module.py_META__module_.bin",
"segments_2_module.py_QSTR_function.bin", etc. In short the file name
format is "<base>_<count>_<sourcefile>_<segmentkind>_<segmentname>.bin",
with <segmentkind> being META, QSTR, OBJ, or CODE. Source file names
and segment names will only contain characters in the range
"a-zA-Z0-9_-." to avoid having output file names with unexpected
characters.
The "--extract-only" option can accept one or more kinds, separated by
commas and treated as case insensitive strings. The supported kinds
match what is currently handled by the "MPYSegment" class in
"tools/mpy-tool.py": "META", "QSTR", "OBJ", and "CODE". The absence of
this command line option implies dumping every segment found.
If "--extract" is passed along with "--merge", dumping is performed
after the merge process takes place, in order to dump all possible
segments that match the requested segment kinds.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This was missed as part of the transition to make_new a mp_obj_type_t slot.
See also: 94beeabd2ee179d587942046555833e022241f24
Signed-off-by: David Schneider <schneidav81@gmail.com>
|