This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 8c8152915 wireless/bluetooth: namespace NimBLE host symbols
8c8152915 is described below
commit 8c81529153f6bc3bef3cb0e607dd687fa73dde6f
Author: Jackson-gjh <[email protected]>
AuthorDate: Sat Nov 7 14:03:19 2026 +0800
wireless/bluetooth: namespace NimBLE host symbols
The external NimBLE Host and the Espressif Bluetooth Controller export
os_msys_init(), ble_sm_alg_gen_dhkey(), and ble_sm_alg_gen_key_pair().
Linking both components into one ESP32-C6 image therefore fails with
multiple-definition errors.
Apply private compile definitions to the NimBLE target when Espressif
BLE is enabled. Add the equivalent CFLAGS to Makefile.nimble for the
Make build. This namespaces both the definitions and all internal NimBLE
Host references without changing symbols in other targets.
With this change, the ESP32-C6 image linked successfully. Hardware
testing then completed a BLE connection, GATT service discovery, and
Battery Level read from the NimBLE peripheral example.
Assisted-by: Codex:gpt-5
Signed-off-by: Jackson-gjh <[email protected]>
---
wireless/bluetooth/nimble/CMakeLists.txt | 8 ++++++++
wireless/bluetooth/nimble/Makefile.nimble | 9 +++++++++
2 files changed, 17 insertions(+)
diff --git a/wireless/bluetooth/nimble/CMakeLists.txt
b/wireless/bluetooth/nimble/CMakeLists.txt
index 1c02e1727..f0b81f2ff 100644
--- a/wireless/bluetooth/nimble/CMakeLists.txt
+++ b/wireless/bluetooth/nimble/CMakeLists.txt
@@ -23,6 +23,14 @@
if(CONFIG_NIMBLE)
nuttx_add_library(nimble)
+ if(CONFIG_ESPRESSIF_BLE)
+ target_compile_definitions(
+ nimble
+ PRIVATE os_msys_init=nimble_host_os_msys_init
+ ble_sm_alg_gen_dhkey=nimble_host_ble_sm_alg_gen_dhkey
+ ble_sm_alg_gen_key_pair=nimble_host_ble_sm_alg_gen_key_pair)
+ endif()
+
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/mynewt-nimble)
FetchContent_Declare(
mynewt-nimble
diff --git a/wireless/bluetooth/nimble/Makefile.nimble
b/wireless/bluetooth/nimble/Makefile.nimble
index 7a38e9b04..d4bf7a9aa 100644
--- a/wireless/bluetooth/nimble/Makefile.nimble
+++ b/wireless/bluetooth/nimble/Makefile.nimble
@@ -34,6 +34,15 @@ ifneq ($(CONFIG_NIMBLE_MESH),)
NIMBLE_CFG_MESH = 1
endif
+# Namespace NimBLE Host symbols that are also provided by the Espressif
+# Bluetooth Controller.
+
+ifneq ($(CONFIG_ESPRESSIF_BLE),)
+CFLAGS += -Dos_msys_init=nimble_host_os_msys_init
+CFLAGS += -Dble_sm_alg_gen_dhkey=nimble_host_ble_sm_alg_gen_dhkey
+CFLAGS += -Dble_sm_alg_gen_key_pair=nimble_host_ble_sm_alg_gen_key_pair
+endif
+
# Skip files that don't build for this port
NIMBLE_IGNORE += $(NIMBLE_ROOT)/porting/nimble/src/hal_timer.c