The way CMake gathers the submodule list, it can quietly be empty
if the previous step fails. This makes it an explicit error.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Similar to other places, CMake will error out if this file
doesn't exist yet but we don't want this if we're only getting
the list of submodules.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
- ECHO_SUBMODULES=1 exits CMake early. With idf_component_manager 1.x this
seems to leave the managed_components directory in a state that causes
later builds to fail.
- Looks like the component manager isn't needed for this step, so disable
it. This invocation logs a warning (not visible in normal output) but
completes successfully and returns the correct list of submodules.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Add WIFI_AUTH_WPA3_ENTERPRISE and WIFI_AUTH_WPA2_WPA3_ENTERPRISE, and
update PPP callback signature for latest lwIP.
Co-authored-by: Daniel van de Giessen <daniel@dvdgiessen.nl>
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
The previous deploy.md refactors revealed that these boards had a different
"product" entry in boards.json compared to the name given in the board.md
file.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Includes fixing the flashing address for newer SoCs, as reported in
discussion https://github.com/orgs/micropython/discussions/16417
Also removes some redundant or out of date information, and adds links to
the Espressif esptool docs which are quite comprehensive.
Information about ESP32_GENERIC variants is moved to the board page, as it
only applies to that board.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Allows two source files (ports/esp32/boards/deploy.md and
deploy_nativeusb.md for boards with only native USB) for all esp32
installation steps, with templated chip name and flash offset inserted via
string formatting.
The new files add more text to explain the esptool.py port auto-detection,
remove the unnecessary -z feature (already enabled by default), and add
a bit of troubleshooting and port detection info.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This entry was originally used to override the firmware filenames generated
by the build server, but these days all filenames should match the board
directory name. So, remove the "id" entry and let the default be used.
This is a follow-up to 1a99f74063 (these
three boards were added after that change).
Signed-off-by: Damien George <damien@micropython.org>
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>
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>
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>
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>
When a wrapped symbol is provided in its own file, it's possible for the
linker to skip that file entirely and not return to it depending on the
order of libraries passed on the linker command line.
This is because these wrapped symbols create linker cycles (libmain_espXX
depends on liblwip but liblwip now also depends on libmain for the wrapped
functions in lwip_patch.c, for example.)
Linker failure for symbols in lwip_patch.c was reproducible if mDNS was
disabled in the board configuration.
This commit adds an explicit undefined symbol for each file, to ensure
the linker will add the wrapped objects on its first pass.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The esp32 port had network.STAT_ASSOC_FAIL for the same purpose,
but this is undocumented and different to all other ports. That
constant is now deprecated.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Closes#13178.
TouchPad confirmed working on both chips, and fixes the the ESP32-S3
reading constant max value. Was unable to reproduce the bug on ESP32-S2 but
this may be due to my test setup, and it still works with the fix.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
ESP32 has hardware V1 and S2/S3 has V2, and future chips
may have different versions.
This should still compile to the same binary before and after.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
- Previously the call to esp_wifi_set_channel() would be immediately
overridden by calling esp_wifi_config(...) with the previous channel set.
- AP interface doesn't seem to need more than esp_wifi_config(...) to work.
It will automatically configure 40MHz bandwidth and place the secondary
channel using similar logic to what was being explicitly calculated here.
- However, calling esp_wifi_set_channel() on the STA interface is necessary
if using this interface with ESP-NOW (without connecting to an AP). So
the esp_wifi_set_channel() call is kept in for this purpose. Without
this, tests/multi_espnow/70_channel.py fails.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Because the `ai_canonname` field is subsequently used.
ESP32_GENERIC_S3 (at least) crashes with IDF 5.2.3 without this set.
Signed-off-by: Damien George <damien@micropython.org>
This allows the stream to be set to `None`, which essentially stops all PPP
communication without disconnecting the session.
This allows replacing the stream on-the-fly to suspend it, for example to
send AT commands to a modem without completely disconnecting and
re-establishing the PPP connection:
uart = ppp.config('stream')
ppp.config(stream=None)
uart.write(b'+++')
# do some AT commands
uart.write(b'ATO\r\n')
ppp.config(stream=uart)
Any attempted communication by PPP while the stream is not connected will
register as simple packet loss to the LwIP stack because we return 0 for
any write calls, and protocols like TCP will then automatically handle
retrying.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
This makes the stream that the PPP object wraps, which is normally only set
once via the constructor, accessible and configurable via the
`ppp.config()` method.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
Removes the deprecated network.[AP|STA]_IF form from the esp32 port
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Seemingly ESP-IDF incorrectly marks RTC FAST memory region
as MALLOC_CAP_EXEC on ESP32-S2 when it isn't. This memory is
the lowest priority, so it only is returned if D/IRAM is exhausted.
Apply this workaround to treat the allocation as failed if it gives us
non-executable RAM back, rather than crashing.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
The cleanup in 548babf8 relies on some functions not available in older
ESP-IDF. Temporarily restore them, until we drop support for ESP-IDF <5.2.
PWM functionality should end up the same regardless of ESP-IDF version, and
also no different from MicroPython V1.23.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
These were added to the `network` module but not the `network.WLAN` class,
which is the new home for such constants.
Also:
- Mark the WLAN constants in the `network` module as deprecated, to be
removed in MicroPython 2.0.
- Move the static assert to the WLAN source code, to be close to where it
relates to.
Signed-off-by: Damien George <damien@micropython.org>
This commit fixes PWM configuration across C3, C6, S2 and S3 chips, which
was broken by 6d799378ba. Without this fix
the PWM frequency is limited to a maximum of 2446Hz (on S2 at least).
Signed-off-by: Andrew Leech <andrew@alelec.net>
This commit adds an extra bit of parameters validation to the SPI bus
constructor on ESP32. Passing 0 as the number of bits would trigger a
division by zero error when performing read/write operations on an SPI
bus created in such a fashion.
Fixes issue #5910.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
For in-tree builds, these are effectively equivalent. However for
out-of-tree builds it's preferable to have as little as possible in the
top-level CMakeLists.txt file (as the out-of-tree build needs its own
copy).
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
This fixes a regression introduced in commit
4247921c4e, where this ring-buffer polling
was accidentally put inside the `#if MICROPY_HW_ESP_USB_SERIAL_JTAG`.
Signed-off-by: Andrew Leech <andrew@alelec.net>
This is a workaround for a bug in ESP-IDF where the configuration setting
for maximum active TCP sockets (PCBs) is not applied.
Fixes cases where a lot of short-lived TCP connections can cause:
- Excessive memory usage (unbounded number of sockets in TIME-WAIT).
- Much higher risk of stalled connections due to repeated port numbers. The
maximum number of active TCP PCBs is reduced from 16 to 12 to further
reduce this risk (trade-off against possibility of TIME-WAIT
Assassination as described in RFC1337).
This is not a watertight fix for the second point: a peer can still reuse a
port number while a previous socket is in TIME-WAIT, and LWIP will reject
that connection (in an RFC compliant way) causing the peer to stall.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Regression introduced in 337742f.
The hang occurs because the esp32 port was calling "from ISR" port-layer
functions to set/clear the interrupt mask. FreeRTOS kernel therefore
doesn't know the CPU is in a critical section. In taskYIELD() the riscv
port layer blocks after yielding until it knows the yield has happened, and
would block indefinitely if IRQs are disabled (until INT WDT triggers).
Moving to the "public" portENTER_CRITICAL/portEXIT_CRITICAL API means that
FreeRTOS knows we're in a critical section and can react accordingly.
Adds a regression test for this case (should be safe to run on all ports).
On single core CPUs, this should result in almost exactly the same
behaviour apart from fixing this case.
On dual core CPUs, we now have cross-CPU mutual exclusion for atomic
sections. This also shouldn't change anything, mostly because all the code
which enters an atomic section runs on the same CPU. If it does change
something, it will be to fix a thread safety bug.
There is some risk that this change triggers a FreeRTOS crash where there
is a call to a blocking FreeRTOS API with interrupts disabled. Previously
this code might have worked, but was probably thread unsafe and would have
hung in some circumstances.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
In idf v5.2.1 if the port flag is set it's validated even on jobs that
don't access hardware like clean. This causes the job to fail if device
isn't connected.
Signed-off-by: Andrew Leech <andrew@alelec.net>