Jackson-gjh opened a new pull request, #3988:
URL: https://github.com/apache/nuttx-apps/pull/3988

   ## Summary
   
   Namespace three external NimBLE Host symbols when it is built together with
   the Espressif Bluetooth Controller.
   
   ## Problem
   
   The external NimBLE Host and the Espressif Controller both provide these
   global symbols:
   
   ```text
   os_msys_init
   ble_sm_alg_gen_dhkey
   ble_sm_alg_gen_key_pair
   ```
   
   An ESP32-C6 configuration with both `CONFIG_NIMBLE=y` and
   `CONFIG_ESPRESSIF_BLE=y` therefore fails at link time with three
   multiple-definition errors.
   
   ## Fix
   
   Add private compile definitions to the whole `nimble` target under
   `CONFIG_ESPRESSIF_BLE`:
   
   ```cmake
   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
   ```
   
   Applying the definitions target-wide keeps each NimBLE definition and every
   internal reference consistent. Keeping them private prevents the aliases from
   changing symbols in other targets. Other platforms are unaffected.
   
   ## Testing
   
   Hardware and versions:
   
   - ESP32-C6 revision v0.2
   - NuttX `43f7f34b995`
   - NuttX Apps `b3d9d96bf`
   - Apache NimBLE `3932e99f43041f28dcf25c42a0f06e4584774dd8`
   - `examples/nimble_bleprph`
   - Bleak client on Windows
   
   Before this change, the image failed to link because all three symbols were
   defined by both components. With this change, the image built and linked. Its
   linker map contains the original Controller symbols and the namespaced NimBLE
   Host symbols as separate entries.
   
   The image was flashed to ESP32-C6. The client connected, completed GATT
   discovery, and read Battery Level:
   
   ```text
   connected=True
   service=00001811-0000-1000-8000-00805f9b34fb
   service=0000180f-0000-1000-8000-00805f9b34fb
   service=59462f12-9543-9999-12c8-58b459a2712d
   battery_level=68
   ```
   
   Device output included:
   
   ```text
   connection established; status=0
   mtu update event; conn_handle=0 cid=4 mtu=256
   disconnect; reason=531
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to