Skip to content

Add P4X EV and fix C6 and others with BLE and WiFi#11004

Merged
dhalbert merged 2 commits into
adafruit:mainfrom
tannewt:p4x_ev
May 15, 2026
Merged

Add P4X EV and fix C6 and others with BLE and WiFi#11004
dhalbert merged 2 commits into
adafruit:mainfrom
tannewt:p4x_ev

Conversation

@tannewt
Copy link
Copy Markdown
Member

@tannewt tannewt commented May 14, 2026

Add the P4X EV function board def and correct the Makefile's linker scripts to use the correct mapping. (It was including both and finding the wrong thing.)

This also fixes the C6 and others boot loop issue. It was due to reorganization of the coex functionality to using a new startup init function that we missed. Fixes #10994

Tested on P4X EV Function board and C6 DevKitM.

tannewt and others added 2 commits May 14, 2026 16:21
This includes fixes to the Makefile to support the v3 P4.
IDF commit ea84e9118d5 ("fix(esp_coex): move coex init from esp_system
to esp_coex component", 2026-03-10, between v6.0-dev-5454 and current
submodule HEAD v6.0-dev-5728) relocates the ESP_SYSTEM_INIT_FN entry
init_coexist out of components/esp_system/startup_funcs.c and into
components/esp_coex/src/coexist.c. It also adds an esp_coex_init_include_func
hook and `target_link_libraries(... INTERFACE "-u esp_coex_init_include_func")`
to esp_coex/CMakeLists.txt to force the linker to retain the new
compilation unit.

CircuitPython's ports/espressif/Makefile does its own final link
(--start-group ... --end-group around the expanded .a list) and never
consumes the INTERFACE link options that CMake emits for esp_coex, so
the hook is dropped. With coexist.c.obj absent from the link,
init_coexist never runs, esp_coex_adapter_register() and coex_pre_init()
are skipped, and the ROM-side coex_schm_env_ptr stays NULL. The first
wifi-init call to coex_schm_register_callback then dereferences
NULL+0x10, panicking with a Load access fault (MEPC in ROM, MCAUSE=5,
MTVAL=0x10, RA inside coex_schm_register_callback).

Observed on espressif_esp32c6_devkitm_1_n4 during boot, right after
`wifi:Init dynamic rx buffer num: 32`. Pre-IDF6 builds (e.g. the older
S3 build still on IDF5) link init_coexist transitively through
libesp_system.a and don't hit this.

Add `-u esp_coex_init_include_func` to REGISTRATION_FUNCTIONS so our
explicit -u list matches what esp_coex's CMakeLists.txt expects. Gate
on CIRCUITPY_WIFI and skip esp32s2/esp32p4 because IDF's Kconfig only
compiles coexist.c when ESP_COEX_SW_COEXIST_ENABLE is set
((WIFI && BT) || (WIFI && 802.15.4) || (BT && 802.15.4)); on those
targets the symbol does not exist and the -u would fail to resolve.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@tannewt tannewt requested a review from dhalbert May 14, 2026 23:30
Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the coex fix on a Metro ESP32-S3, which also had the problem. Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESP-IDF v6.0.1 causes bootloop on wifi or BLE startup

2 participants