Skip to content

Commit dadd8d4

Browse files
committed
fix c6 build again
1 parent dfd7377 commit dadd8d4

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

‎platformio.ini‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,17 @@ monitor_speed = 115200
181181
[env:esp32-c6-N4]
182182
platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
183183
framework = arduino
184+
; C6 + NimBLE: pull r_os_mem* from libble_app (see script header).
185+
extra_scripts =
186+
pre:scripts/factory_config_gen.py
187+
pre:scripts/esp32c6_nimble_mempool_link.py
184188
build_flags =
185189
-DTARGET_ESP32
186190
#-DOPENDISPLAY_ZLIB_WINDOW_BITS=15
187191
-DOPENDISPLAY_ZLIB_USE_HEAP_WINDOW=1
188192
-DARDUINO_USB_MODE=1
189193
-DARDUINO_USB_CDC_ON_BOOT=1
190194
-DCONFIG_FREERTOS_WATCHDOG_TIMEOUT_S=120
191-
; C6 sdkconfig sets CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT, so
192-
; NimBLE-Arduino skips compiling os_mempool and expects r_os_mem* from
193-
; libble_app. Force-pull those objects — a single-pass link on GitHub
194-
; Actions otherwise leaves the refs undefined.
195-
-lble_app
196-
-Wl,-u,r_os_mempool_init
197-
-Wl,-u,r_os_memblock_get
198-
-Wl,-u,r_os_memblock_put
199195
board_build.filesystem = littlefs
200196
board_build.partitions = huge_app.csv
201197
board = esp32-c6-devkitm-1
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Force-link libble_app os_mempool for ESP32-C6 + NimBLE-Arduino.
2+
3+
C6 sdkconfig sets CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT, so
4+
NimBLE-Arduino skips compiling os_mempool and calls r_os_mem* instead.
5+
Those live in libble_app.a(os_mempool.c.o).
6+
7+
On Ubuntu (GitHub Actions), gcc uses --as-needed: an early -lble_app with
8+
no pending undefs is dropped, and a later single-pass never pulls
9+
os_mempool.c.o. Fix:
10+
1) Prepend -u so the undefs exist before any archive scan
11+
2) Append libble_app.a by absolute path after all objects/libs
12+
"""
13+
14+
from pathlib import Path
15+
16+
Import("env") # noqa: F821
17+
18+
env.Prepend(
19+
LINKFLAGS=[
20+
"-Wl,-u,r_os_mempool_init",
21+
"-Wl,-u,r_os_memblock_get",
22+
"-Wl,-u,r_os_memblock_put",
23+
]
24+
)
25+
26+
libs_dir = env.PioPlatform().get_package_dir("framework-arduinoespressif32-libs")
27+
ble_app = Path(libs_dir) / "esp32c6" / "lib" / "libble_app.a"
28+
if ble_app.is_file():
29+
env.Append(LINKFLAGS=[str(ble_app)])
30+
else:
31+
env.Append(LIBS=["ble_app"])

0 commit comments

Comments
 (0)