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>
This reverts commit 3c9546ea09.
I2CTarget now fits on ESP32-C6 because it's compiled with -Os, see commit
5b98126c21.
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>
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>
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>
This commit fixes a linking issue on certain Arm toolchains where
library code is compiled with exception support.
If a library with exception support is included in the MicroPython
build, the linker had no place to put the stack unwinding tables
necessary to perform exception handling at runtime. This change adds a
new section to the linkerscript (and therefore the final ELF file) where
that data can be placed into.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit extends the QEMU port's CPU error handler for the Arm target
by printing out in detail the ARMv7-M debug registers if the firmware is
compiled for such a target.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit introduces a new target for the QEMU port called
"MPS2_AN500", an ARMv7-M machine with a Cortex-M7 CPU and
single-/double-precision floating point unit.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit lets board use a different floating point mode rather than
the usual soft-float that was the original default for all QEMU-based
boards.
The configuration options are the same available in the "stm32" port.
Boards can set "MICROPY_FLOAT_IMPL" to either "float", "double", or
"none" to indicate which floating point mode they want, and optionally
"SUPPORTS_HARDWARE_FP_SINGLE" or "SUPPORTS_HARDWARE_FP_DOUBLE" can be
set to 1 to further indicate the hardware capabilities of the hardware
floating point unit, if present.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
When disconnecting from PPP the modem sends a confirmation. This message
is received, like all messages, through the poll() method. lwIP may then
immediately call our status callback with code PPPERR_USER to indicate
the connection was closed. Our callback then immediately proceeds to
free the PCB. Thus, during each new iteration of the loop in poll() we
must check if we haven't disconnected in the meantime to prevent calling
the pppos_input_tcpip with a PCB that is now NULL.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
If while a polling operation is active the stream is removed we should
stop polling data from that stream.
This was already the intended behaviour, but implemented incorrectly.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
These were regenerated by the NXP Config tool for v2.11.
The board_init update was needed to ensure CLOCK_SetMode() is run
at the appropriate time during startup.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
The official mcux-sdk follows a slightly different structure to the
current nxp_sdk submodule, with many drivers moved to a common location.
To ease updating the newer versions of the SDK and/or add new families
the nxp_sdk submodule has been updated to follow the structure of
mcux-sdk, just trimmed down to families used here to considerably
reduce the size.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
This is a pretty fundamental module, and even minimal ports like unix and
zephyr minimal have it enabled. So, enabled it by default at the lowest
feature level.
Most things in the `sys` module are configurable, and off by default, so it
shouldn't add too much to ports that don't already have it enabled (which
is just the minimal port).
Also note that `sys` is still disabled on the bare-arm port, to keep that
ultra minimal. It means we now have bare-arm without `sys` and the minimal
port with `sys`. That will allow different code size comparisons if/when
new `sys` features are added.
Signed-off-by: Damien George <damien@micropython.org>
This commit unifies the configuration of MICROPY_PY_CRYPTOLIB,
MICROPY_PY_HASHLIB_MD5 and MICROPY_PY_HASHLIB_SHA1, so they are enabled by
default if MICROPY_PY_SSL is enabled. This matches the existing
configuration of most of the ports.
With this change, all ports remain the same except:
- reneses-ra now enables MICROPY_PY_CRYPTOLIB, MICROPY_PY_HASHLIB_MD5 and
MICROPY_PY_HASHLIB_SHA1.
- rp2 now enables MICROPY_PY_HASHLIB_MD5.
Signed-off-by: Damien George <damien@micropython.org>
The specific problem seems to be that the runtime "Python stack frame"
function call is several times more expensive in stack usage when running
with UBSan on older GCC (observed on gcc 11.4 as used in CI, would get
'RuntimeError: maximum recursion depth exceeded' when running some tests
with UBSan enabled.)
Other stack usage (i.e. from pushing things on the stack in Python) stays
the same. Whatever causes the usage seems to be mostly gone in later GCC
versions.
Includes a refactor to apply the same stack size multipliers
for the default thread stack size same as the main stack size.
This goes in a new port-specific header as it depends on macros
in misc.h, so can't be in mpconfigport.h.
A side effect of this is that the default thread stack size is
now doubled on ARM, same as the main stack size.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Typo on line 29 (PYH instead of PHY).
Compilation failing, here is the output:
eth_phy.h:28: error: header guard 'MICROPY_INCLUDED_STM32_PHY_H'
followed by '#define' of a different macro [Werror=header-guard]
28 | #ifndef MICROPY_INCLUDED_STM32_PHY_H
eth_phy.h:29: note: 'MICROPY_INCLUDED_STM32_PYH_H' is defined here;
did you mean 'MICROPY_INCLUDED_STM32_PHY_H'?
29 | #define MICROPY_INCLUDED_STM32_PYH_H
Signed-off-by: Tico06 <e.grammatico@gmail.com>
The generated binary file was missing this section, which caused a hard
fault when loading bin or dfu firmware (eg on ARDUINO_GIGA).
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
For STM32H5, to use 12-bit DAC, the DMA parameter should set:
- Actual DMA source datawidth to CTR1.
- The length is the amount of data to be transferred from source to
destination in bytes.
Also, this commit modifies the (dummy) definition of DMA_CIRCULAR for
STM32H5 to prevent conflict with data width specification.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.
Tested on max32690fthr and frdm_k64f.
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
The HP and HE CPUs have double-precision hardware floating point, so can
use the armv7emdp architecture.
This allows frozen code to use native/viper/asm_thumb decorators.
Fixes issue #17896.
Signed-off-by: Damien George <damien@micropython.org>
They are enabled when SSL/mbedTLS is included in the firmware. These new
features cost around +1400 bytes of code size.
Signed-off-by: Damien George <damien@micropython.org>
The LPRTC peripheral is a 32-bit counter with a 16-bit prescaler. It's
configured here to count at 1Hz (to get maximum date range) and then the
prescaler value is used to get 30 microsecond resolution. That's
essentially a 32+15=47-bit counter.
Signed-off-by: Damien George <damien@micropython.org>
This factors code out of the ports and into the common `time.localtime`
implementation in `extmod/modtime.c`. That helps to reduce code
duplication, prevent errors in implementation, and reduce code size on
some ports (mimxrt and stm32 at least).
Signed-off-by: Damien George <damien@micropython.org>
It's only used once, in the same file it's defined, and making it static
reduces code size.
Along with this, the associated example code comment in `ports/unix/main.c`
has been removed.
Signed-off-by: Damien George <damien@micropython.org>
This gets the recursive stress-tests working on this port.
For relatively small Python functions the maximum recursive depth is about
150 nested calls.
Signed-off-by: Damien George <damien@micropython.org>
If PPP is still connected, freeing the PCB will fail and thus instead we
should trigger a disconnect and wait for the lwIP callback to actually
free the PCB.
When PPP is not connected we should check if the freeing failed, warn
the user if so, and only mark the connection as inactive if not.
When all this happens during garbage collection the best case is that
the PPP connection is already dead, which means the callback will be
called immediately and cleanup will happen correctly. The worst case is
that the connection is still alive, thus we are unable to free the PCB
(lwIP won't let us) and it remains referenced in the netif_list, meaning
a use-after-free happens later when lwIP traverses that linked list.
This change does not fully prevent that, but it *does* improve how the
PPP.active(False) method on the ESP32 port behaves: It no longer
immediately tries to free (and fails), but instead triggers a disconnect
and lets the cleanup happen correctly through the status callback.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
The status callback runs on the lwIP tcpip_thread, and thus must use the
non-thread-safe API because the thread-safe API would cause a deadlock.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
A small follow-up to 3b1e22c669, in which
the entire PPP implementation was reworked to more closely resemble the
extmod version. One of the differences between extmod and the ESP32 port
is that the ESP32 port uses the thread-safe API, but in that changeset
the PPP input function was accidentally changed to use the non-safe API.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Also future-proofs this code for other chips. Apart form C6 and C2, all
currently supported chips use APB clock for GPTIMER_CLK_SRC_DEFAULT.
ESP32-C2 uses 40MHz PLL but APB_CLK_FREQ was 26MHz.
ESP32-C6 uses 80MHz PLL but APB_CLK_FREQ was 40MHz.
Implementation now gets the correct frequency from ESP-IDF.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Otherwise the PLL is not enabled. These changes are adapted from
`timer_legacy.h` in ESP-IDF.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This setting was missed in df05caea6c. It's
needed for this port to pass its `tests/ports/renesas-ra/modtime.py` test.
Signed-off-by: Damien George <damien@micropython.org>
I2CTarget costs about 8k of flash size on ESP32-S2, and about 11k on
ESP32-C6. The ESP32-C6 only has about 8k remaining, so disable I2CTarget
on that SoC until more flash can be made available.
Signed-off-by: Damien George <damien@micropython.org>
This describes the ROMFS location and size in Pico SDK's binary declaration
format, so it can be read from a .uf2 file for use with various tools.
Signed-off-by: Phil Howard <github@gadgetoid.com>
Adds a Python override of the `machine` module, which delegates to the
built-in module and adds an implementation of `Counter` and `Encoder`,
based on the `esp32.PCNT` class.
Original implementation by: Jonathan Hogg <me@jonathanhogg.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Add a new `esp32.PCNT` class that provides complete, low-level support to
the ESP32 PCNT pulse counting hardware units.
This can be used as a building block to implement the higher-level
`machine.Counter` and `machine.Encoder` classes.
This is enabled by default on all OG, S2, S3, C6 boards, but not on C3 (as
the PCNT peripheral is not supported).
Original implementation by: Jonathan Hogg <me@jonathanhogg.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Angus Gratton <angus@redyak.com.au>