Age | Commit message (Collapse) | Author |
|
This commit enables generation of Zba opcodes by the native emitter
for the Pico2, as its RISC-V implementation supports both of those
extensions (see section 3.8 of the RP2350 datasheet).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit enables the usage of the Zba address generation opcodes in
the QEMU port when targeting the "VIRT_RV32" board, which emulates a
generic RV32 target.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit adds support for Zba opcodes to the RV32 inline assembler.
Three new opcodes were added, SH1ADD, SH2ADD, and SH3ADD, which performs
a scaled addition (by 1, 2, or 3 bits respectively). At the moment only
qemu's VIRT_RV32 and rp2's RPI_PICO2/RPI_PICO2_W ports support these
opcodes (the latter only when using the RISCV variant).
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit adds a new command line switch to inform the RV32 emitter to
use Zba opcodes in its output.
A new implementation-specific option was introduced, called
"-march-flags", that will contain a list of additional
architecture-specific flags to pass to the chosen native emitter
implementation.
At the moment only the RV32 emitter can make use of this command line
facility: if the architecture flags string equals to "zba"
(case-sensitive), then the native emitter will emit Zba opcodes if it
has a chance to do so.
At the moment there is no check on whether additional architecture flags
using to build a MPY file are compatible with the target the output code
is run on, so use this with caution.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit adds optional support for selected Zba opcodes (address
generation) to speed up Viper and native code generation on MCUs where
those opcodes are supported (namely RP2350).
Right now support for these opcodes is opt-in, as extension detection
granularity on the RISC-V platform is still a bit in flux. Relying on
the 'B' bit in the MISA register may yield both false positives and
false negatives depending on the RISC-V implementation the check runs
on.
As a side-effect of Zba support, regular non-byte load/stores have been
made shorter by two bytes. Whilst this makes code using Zba take up the
same space as non-Zba code, the former will still be faster as it will
have to process just one instruction instead of two, without stalling
registers between the shift and the addition needed to compute the final
offset.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This commit introduces a way for mpy-cross to pass a set of options to
the chosen emitter.
This is achieved by adding an opaque pointer to the dynamic compiler
state structure that is only accessed by emitters that have a need to
receive options from mpy-cross when generating code. That's a way to
make this feature possible without breaking any existing code or
emitter, and without re-engineering the compiler entry point function
(together with passing the options struct downstream until it's time to
emit code).
The main use case for this is letting the RV32 emitter know which
optional extensions it can generate code with, to be able to emit better
suited code for the platform in use.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
This adds a QEMU-based bare metal RISC-V 64 bits port. For the time being
only QEMU's "virt" 64 bits board is supported, using the lp64 ABI and the
RV64IMC architecture.
The port's README is also updated to keep track of these changes.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
MPY files can now hold data to be run on RV64IMC. This can be
accomplished by passing the `-march=rv64imc` flag to mpy-cross.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
Use constants from the HAL instead of literal numbers to select which
peripheral clocks are enabled during low power mode.
Signed-off-by: Damien George <damien@micropython.org>
|
|
For NUCLEO boards that does not have HSE crystal, HSEState should set
RCC_HSE_BYPASS to use HSE clock from ST-LINK 8MHz.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
|
|
UART prescaler value should set up correctly to initialize LPUART with low
baudrate for STM32G0/G4/H5. This can be implemented similarly to
STM32H7/N6/WB.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
|
|
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
|
|
For STM32G4, hardware I2C can implement same as STM32L4 for machine.I2C.
This commit makes to be able to use of hardware I2C in machine.I2C.
Tested on NUCLEO-G474RE.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
|
|
For NUCLEO-G474RE, FLASH_LATENCY_4 can be specified instead of
FLASH_LATENCY_8 because it runs at 170MHz.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
|
|
For NUCLEO-F401RE, FLASH_LATENCY_2 can be specified for flash latency
because it runs at 84MHz.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
|
|
This makes it easier to run a sequence of ci steps locally. A help message
is also provided.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)
---
updated-dependencies:
- dependency-name: actions/setup-python
dependency-version: '6'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
|
|
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 8.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v8)
---
updated-dependencies:
- dependency-name: actions/github-script
dependency-version: '8'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
|
|
The option '-s' (--diff-score) or '-m' (--diff-time) fails when the
specified result contains tests that was skipped or failed.
This patch ignores "skipped: " or "failed: " message.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
|
|
- Required for aarch64 zephyr port targets to build.
- Tested with PocketBeagle 2 [0] A53 cores.
[0]: https://docs.zephyrproject.org/latest/boards/beagle/pocketbeagle_2/doc/index.html
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
|
|
These are convenience targets for running specific tests as a developer.
They are more useful that invoking run-tests directly as they take account
of the VARIANT= specified on the make command-line.
For instance, you can run all tests matching the regular expression "int"
with `make VARIANT=... test//int`.
The new targets are all documented in README.md.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
MP_OBJ_SMALL_INT_VALUE would give erroneous results, such as assertion
failures in the coverage build and other oddities like:
>>> s = socket.socket()
>>> s.recv(3.14)
MemoryError: memory allocation failed, allocating 4235896656 bytes
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
This adds comments documentign the meaning of the type flag bits
`MP_TYPE_FLAG_IS_SUBCLASSED` and `MP_TYPE_FLAG_HAS_SPECIAL_ACCESSORS`,
for consistency with the comments added later on documenting the other
flags.
These flags were were originally made part of the public API in
c3450effd4c3a402eeccf44a84a05ef4b36d69a0. This block of doc comments
was only added later on when `MP_TYPE_FLAG_EQ_NOT_REFLEXIVE`,
`MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE`, and `MP_TYPE_FLAG_EQ_HAS_NEQ_TEST`
were added in 9ec1caf42e7733b5141b7aecf1b6e58834a94bf7.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Without this, the wy-alert block pushed all the content
to the right, making the locally built pages nearly illegible.
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
This adds an internal_bench benchmark that benchmarks ordered map linear
scan cache performance.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
This commit also includes a fix to the `var-6.2-instance-speciallookup.py`
test originally added by 82db5c8 / #16806, as the `__getattr__` method
actually does not trigger a class's special lookups flag as originally
believed.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
This commit adds tests to benchmark the performance of class instantiation.
Signed-off-by: Anson Mansfield <amansfield@mantaro.com>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Signed-off-by: Jeff Epler <jepler@unpythonic.net>
|
|
Python 2.7 has been EOL since January 2020.
Ubuntu oldoldlts (Focal Fossa, 20.04) has Python 3.8. Debian oldoldstable
(Buster, from 2019) has Python 3.7. RHEL 8 (from 2019) has Python 3.6.
It's easier than ever to install a modern Python using uv.
Given this, it seems like a fine idea to drop Python 2.7 support.
Even though the build is not tested on Python as old as 3.3, I left
comments stating that "3.3+" is the baseline Python version. However, it
might make sense to bump this to e.g., 3.10, the oldest Python 3 version
used during CI. Or, using uv or another method actually test on the oldest
Python interpreter that is desirable to support (uv goes back to Python 3.7
easily; in October 2025, the oldest supported Python interpreter version
will be 3.10)
Signed-off-by: Jeff Epler <jepler@gmail.com>
|
|
The margin of 64 bytes is needed to get `micropython/extreme_exc.py` to
pass when run via-mpy.
Signed-off-by: Damien George <damien@micropython.org>
|
|
As suggested by @dpgeorge adding a `stream_write_generic()` function.
Tested the different write timeouts with a RP2 using flow control. Tested
support of the additional arguments of `uart.write()`.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Avoiding the double timeout when used with the UART class.
`stream.readinto1()` returns after the first timeout.
Fixes issue #17611.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Before, it was ignored. Tested with ESP32, ESP32S3, ESP32C6.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
Do not try to read/write again after timeout happened once.
Fixes issue #17611.
Signed-off-by: robert-hh <robert@hammelrath.com>
|
|
This adds the ability to expose CPU-specific features/extensions to
scripts when the `platform` module is compiled in, by implementing
`platform.processor()`. Right now this is only available on
bare-metal RV32 and RV64.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
|
|
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>
|