File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,21 +181,17 @@ monitor_speed = 115200
181181[env:esp32-c6-N4]
182182platform = https://github.com/pioarduino/platform-espressif32/releases/download/stable/platform-espressif32.zip
183183framework = 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
184188build_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
199195board_build.filesystem = littlefs
200196board_build.partitions = huge_app.csv
201197board = esp32-c6-devkitm-1
Original file line number Diff line number Diff line change 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" ])
You can’t perform that action at this time.
0 commit comments