This commit adds support for RV32IMC native modules, as in embedding native
code into a self-contained MPY module and and make its exported functions
available to the MicroPython environment.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
The ESP32C6 has only one timer in each of the two groups. Also add a check
for valid timer numbers.
Addresses issue #16438.
Signed-off-by: robert-hh <robert@hammelrath.com>
A return value of 0 from Python-level `ioctl()` means success, but if
that's returned unconditionally it means that the method supports all
ioctl calls, which is not true. Returning 0 without doing anything can
potentially lead to a crash, eg for MP_STREAM_SEEK which requires returning
a value in the passed-in struct pointer.
This commit makes it so that all `ioctl()` methods respond only to
MP_STREAM_CLOSE, ie they return -1 (indicating error) for all other ioctl
calls.
Signed-off-by: Damien George <damien@micropython.org>
Support was added in commit 5f2d05d, this updates the docs to match.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
As cyw43 pins might be dynamic, add a function that returns if a pin is
reserved. This is used by `MICROPY_HW_PIN_RESERVED` to prevent the pin IRQ
from being reset across a soft-reset.
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
The cyw43 pins used to be hardcoded and `CYW43_PIN_WL_HOST_WAKE` and
`CYW43_PIN_WL_REG_ON` were in the `pico_w.h` board header.
This has been changed so the board header just defines the "default
version of the pins, e.g. `CYW43_DEFAULT_PIN_WL_HOST_WAKE`,
`CYW43_DEFAULT_PIN_WL_REG_ON` etc.
Set the pin values in `cyw43_configport.`h so `cyw43-driver` sees them and
allow them to be changed at runtime (dynamic) if required.
Signed-off-by: Peter Harper <peter.harper@raspberrypi.com>
This commit makes the argument ordering of `machine.RTC.init()` the same
for all the ports that implement arguments to this method: cc3200, esp32,
mimxrt and samd. The cc3200 argument ordering is used, which matches the
documentation.
Also document the availability and the differing semantics for the stm32
and renesas-ra port.
Signed-off-by: robert-hh <robert@hammelrath.com>
This is not part of the common machine API. It's dropped on the mimxrt
port and kept only on the cc3200 port for legacy.
Also show the port availability of `RTC.now()` in the documentation.
Signed-off-by: robert-hh <robert@hammelrath.com>
Running unittest-based tests with --via-mpy is currently broken, because
the unittest test needs the module to be named `__main__`, whereas it's
actually called `__injected_test`.
Fix this by changing the name when the file is opened.
Signed-off-by: Damien George <damien@micropython.org>
The expressions for the `micropy_hw_hse_value` etc variables may contain
parenthesis, eg `micropy_hw_hse_value = ((25) * 1000000)`. To handle such
a case, simplify the regex and always use `eval(found)` to evaluate the
expression.
Signed-off-by: Damien George <damien@micropython.org>
Adds board profile for the WeAct F411 'blackpill' which is a quite popular
low cost ST dev board. This board also has optional spiflash so can be
purchased in a few different configurations.
Builds for v3.1 with no SPI Flash by default. Includes variants for
different board versions and spi flash sizes.
Signed-off-by: Andrew Leech <andrew@alelec.net>
Similar to the ESP32 builds, but needs additional step to pass the
ccache directory through to the Zephyr container.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This image is 15GB so in theory this may be faster, although
in testing the improvement is either non-existent or marginal.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Can save several minutes downloading the Zephyr docker image and/or cloning
repo from GitHub. Cache keyed on the Zephyr version, which AFAIK is the
only determinant for the workspace contents.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
So they don't return a negative number for an address (prior to this fix
they would return negative addresses for values that were larger than the
maximum small-int value).
Signed-off-by: Damien George <damien@micropython.org>
The existing EXTI IRQ handlers are moved from `stm32_it.c` to `extint.c` to
keep them with related code. A macro is defined to make it easier to
define the handler function that handles one line, and correct handlers
added for STM32H5xx MCUs.
Also, to prevent errors in the future, `MP_STATIC_ASSERT(<irqn> > 0)` is
added to each handler function to check that the correct `IRQn` constant is
used, which corresponds to the handler function name.
Signed-off-by: Damien George <damien@micropython.org>
This is enabled by default, but disabled when MICROPY_PREVIEW_VERSION_2 is
enabled. The intention is that these methods and constants are deprecated
in MicroPython 2.x.
Signed-off-by: Damien George <damien@micropython.org>
This allows importing from the VFS, and enables the following 7 additional
tests: builtin_execfile, io_iobase, json_dump_iobase, import_mpy_invalid,
import_mpy_native, import_mpy_native_gc, vfs_userfs.
Signed-off-by: Damien George <damien@micropython.org>
On 64-bit systems this should have no effect.
On 32-bit systems it will force 64-bit file sizes and fixes directory
listing on certain 32-bit ports. This option should work on pretty much
all 32-bit systems these days.
Signed-off-by: Damien George <damien@micropython.org>
This adds a hardware test for `machine.PWM`. It requires a jumper wire
between two pins, uses `machine.PWM` to output on one of them, and
`machine.time_pulse_us()` to time the PWM on the other pin (some boards
test more than one pair of pins).
It times both the high and low duty cycle (and hence the frequency) for a
range of PWM frequencies and duty cycles (including full on and full off).
Currently supported on:
- esp32 (needs a minor hack for initialisation, and some tests still fail)
- esp8266 (passes for frequencies 1kHz and less)
- mimxrt / Teensy 4.0 (passes)
- rp2 (passes)
- samd21 (passes for frequencies 2kHz and less)
Signed-off-by: Damien George <damien@micropython.org>
Now we only support the case of
!CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP, can simplify
the cleanup code.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This reverts commit 27279e69b4
(plus removes some additional references to the
SDKCONFIG_IDF_VERSION_SPECIFIC CMake variable.)
Relevant sdkconfig options are added into sdkconfig.base now
that IDF >=5.2.0 is required.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Specifically, remove all conditional compilation for these earlier versions
and change the idf_component.yml specifiers to require >=5.2.0.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
When threading is disabled, the pending events handling code would wait
for an incoming interrupt once there's no more work to do. This bit of
code was Xtensa-specific and wouldn't compile on a RISC-V based MCU.
This commit provides the RISC-V equivalent to that part of the code,
allowing to make threadless MicroPython builds on RISC-V based MCUs.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This updates esp32 code where appropriate to replace ifdef's based on a
list of specific chips with a feature SOC_* definition. This should
simplify adding new esp32-* chips in future, deferring chip feature support
to the IDF.
Signed-off-by: Andrew Leech <andrew@alelec.net>
MicroPython relies on a number of submodules for third party and chip
vendor libraries. Users need to check these out before building their
desired ports and Github Actions CI here needs to clone them all multiple
times for every build. Many of these are getting significantly larger over
time, slowing down usage and consuming more disk space.
Newer versions of git have features to avoid pulling all historic / blob
data which can have a significant impact of total data use. This commit
uses a standard feature of git to do a partial clone, with automatic
fallback to previous behavior on error.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The current documentation for the `machine.RTC` class contains information
about the `RTC.cancel` method for cancelling pending alarms.
However only two ports (cc3200 and mimxrt) implement this functionality
but under a different name: `RTC.alarm_cancel`. The mimxrt port also
implements `RTC.cancel` but it is aliased to `RTC.alarm_cancel` anyway.
To maintain naming consistency, this commit updates the documentation to
officially define `RTC.alarm_cancel` as the method to call to cancel
pending alarms and deprecates mimxrt's `RTC.cancel` implementation.
`RTC.cancel` in the mimxrt port is thus scheduled for removal in
MicroPython v2.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets the platform module report a more accurate architecture
name when running on a RISC-V 64 bits platform.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes a warning occurring on Clang when calling
`__builtin___clear_cache` with non-void pointers for its start and end
memory area locations. The code now uses a char pointer for the end
location, and it still builds without warnings on GCC.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit fixes a compile error happening on Clang when building the
generic gchelper code for AArch32.
Clang would raise a warning regarding undefined variable access when
aliasing a variable to an existing CPU register. The fix is pretty
crude but it works - it simply disables the warning in question for the
AArch32 gchelper collection function. Care was taken to make sure the
code would also compile on GCC without warnings of sorts.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Use an explicit cast to suppress the implicit conversion which started
popping up in recent compiler versions (and wasn't there yet in 07bf3179).
Signed-off-by: stijn <stijn@ignitron.net>
Similar to esp32. Previously rp2 could build verbose by passing VERBOSE=1,
which is picked up by Makefiles generated from CMake.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Allows verbose build to work the same on esp32 port as other ports.
To minimise copy/paste, split the BUILD_VERBOSE section of mkenv.mk
out to its own verbose.mk and include this in the port Makefile.
Signed-off-by: Angus Gratton <angus@redyak.com.au>