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

commit f2f23e5e1e999797582b0625f683c7ce34a58268
Author: raiden00pl <[email protected]>
AuthorDate: Wed Oct 14 10:35:12 2026 +0200

    wireless/bluetooth/nimble: Bump NimBLE and build with Mbed TLS.
    
    Bump NIMBLE_REF to the current upstream master. Upstream NimBLE dropped
    its bundled TinyCrypt and now uses Mbed TLS for the Security Manager
    and mesh crypto, so select CRYPTO_MBEDTLS with the AES, CMAC, ECP, ECDH
    and P-256 options NimBLE needs and link the mbedtls library instead of
    compiling TinyCrypt. Default MBEDTLS_MINIMAL on with NimBLE so only
    these are built; without it nrf5340-dk:sdc_nimble_cpunet no longer fits
    in flash.
    
    Follow the other upstream changes: the RAM key store was replaced by
    the config store, and new host sources (ble_cs.c, ble_eatt.c,
    ble_iso.c) are added. BLE_SOCK_USE_NUTTX became the BLE_SOCK_TYPE
    choice.
    
    Keep TinyCrypt as the legacy NIMBLE_TINYCRYPT option, now off by
    default, for a migration period. It needs NIMBLE_REF set to a NimBLE
    version before the Mbed TLS switch.
    
    Tested: nrf52832-dk:sdc_nimble with make and CMake.
    
    Assisted-by: Claude:claude-opus-5-5
    Signed-off-by: raiden00pl <[email protected]>
---
 crypto/mbedtls/Kconfig                            |  1 +
 wireless/bluetooth/nimble/CMakeLists.txt          | 11 +++++++++--
 wireless/bluetooth/nimble/Kconfig                 | 16 +++++++++++++---
 wireless/bluetooth/nimble/Makefile.nimble         |  2 ++
 wireless/bluetooth/nimble/include/syscfg/syscfg.h |  6 +++++-
 5 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/crypto/mbedtls/Kconfig b/crypto/mbedtls/Kconfig
index f256eb0d5..5adf0d5df 100644
--- a/crypto/mbedtls/Kconfig
+++ b/crypto/mbedtls/Kconfig
@@ -17,6 +17,7 @@ config MBEDTLS_VERSION
 
 config MBEDTLS_MINIMAL
        bool "Minimal configuration"
+       default y if NIMBLE && !NIMBLE_TINYCRYPT
        default n
        ---help---
                Disable optional modules and features by default. Only options
diff --git a/wireless/bluetooth/nimble/CMakeLists.txt 
b/wireless/bluetooth/nimble/CMakeLists.txt
index d8b6596b0..6d4620668 100644
--- a/wireless/bluetooth/nimble/CMakeLists.txt
+++ b/wireless/bluetooth/nimble/CMakeLists.txt
@@ -87,8 +87,10 @@ if(CONFIG_NIMBLE)
       mynewt-nimble/nimble/host/src/ble_att_clt.c
       mynewt-nimble/nimble/host/src/ble_att_cmd.c
       mynewt-nimble/nimble/host/src/ble_att_svr.c
+      mynewt-nimble/nimble/host/src/ble_cs.c
       mynewt-nimble/nimble/host/src/ble_dtm.c
       mynewt-nimble/nimble/host/src/ble_eddystone.c
+      mynewt-nimble/nimble/host/src/ble_eatt.c
       mynewt-nimble/nimble/host/src/ble_gap.c
       mynewt-nimble/nimble/host/src/ble_gattc.c
       mynewt-nimble/nimble/host/src/ble_gatts.c
@@ -114,6 +116,7 @@ if(CONFIG_NIMBLE)
       mynewt-nimble/nimble/host/src/ble_hs_startup.c
       mynewt-nimble/nimble/host/src/ble_hs_stop.c
       mynewt-nimble/nimble/host/src/ble_ibeacon.c
+      mynewt-nimble/nimble/host/src/ble_iso.c
       mynewt-nimble/nimble/host/src/ble_l2cap.c
       mynewt-nimble/nimble/host/src/ble_l2cap_coc.c
       mynewt-nimble/nimble/host/src/ble_l2cap_sig.c
@@ -127,7 +130,8 @@ if(CONFIG_NIMBLE)
       mynewt-nimble/nimble/host/src/ble_store_util.c
       mynewt-nimble/nimble/host/src/ble_uuid.c
       mynewt-nimble/nimble/host/util/src/addr.c
-      mynewt-nimble/nimble/host/store/ram/src/ble_store_ram.c)
+      mynewt-nimble/nimble/host/store/config/src/ble_store_config.c
+      mynewt-nimble/nimble/host/store/config/src/ble_store_config_conf.c)
 
   set(SRCS ${SRCS_PORTING} ${SRCS_NPL} ${SRCS_TRANSPORT} ${SRCS_SERVICES}
            ${SRCS_HOST})
@@ -183,7 +187,7 @@ if(CONFIG_NIMBLE)
       mynewt-nimble/nimble/host/services/ipss/include
       mynewt-nimble/nimble/host/services/lls/include
       mynewt-nimble/nimble/host/services/tps/include
-      mynewt-nimble/nimble/host/store/ram/include
+      mynewt-nimble/nimble/host/store/config/include
       mynewt-nimble/nimble/transport/include
       mynewt-nimble/porting/nimble/include)
 
@@ -192,6 +196,9 @@ if(CONFIG_NIMBLE)
                   mynewt-nimble/nimble/transport/socket/include)
 
   target_include_directories(nimble PUBLIC include ${INCLUDES})
+  if(NOT CONFIG_NIMBLE_TINYCRYPT)
+    target_link_libraries(nimble PRIVATE mbedtls)
+  endif()
 
   target_compile_options(nimble PUBLIC -Wno-undef -Wno-format
                                        -Wno-unused-but-set-variable)
diff --git a/wireless/bluetooth/nimble/Kconfig 
b/wireless/bluetooth/nimble/Kconfig
index 5aa2b1023..cf0bd947f 100644
--- a/wireless/bluetooth/nimble/Kconfig
+++ b/wireless/bluetooth/nimble/Kconfig
@@ -6,6 +6,12 @@
 config NIMBLE
        bool "Apache NimBLE (BLE host-layer)"
        default n
+       select CRYPTO_MBEDTLS if !NIMBLE_TINYCRYPT
+       select MBEDTLS_AES_C if !NIMBLE_TINYCRYPT
+       select MBEDTLS_CMAC_C if !NIMBLE_TINYCRYPT
+       select MBEDTLS_ECP_C if !NIMBLE_TINYCRYPT
+       select MBEDTLS_ECDH_C if !NIMBLE_TINYCRYPT
+       select MBEDTLS_ECP_DP_SECP256R1_ENABLED if !NIMBLE_TINYCRYPT
        depends on !WIRELESS_BLUETOOTH_HOST
        ---help---
                Enable Apache NimBLE Bluetooth Low Energy
@@ -15,7 +21,7 @@ if NIMBLE
 
 config NIMBLE_REF
        string "Version"
-       default "b6831813cfe6da9b25c8be7136b40ce060bf9710"
+       default "e00b85ccfc49abbaf1731bb3eddaa6340d07ab52"
        ---help---
                Git ref name to use when downloading from NimBLE repo
 
@@ -43,8 +49,12 @@ config NIMBLE_DEBUG_INFO
 endif # DEBUG_FEATURES
 
 config NIMBLE_TINYCRYPT
-       bool "Apache NimBLE tinycrypt support"
-       default y
+       bool "Apache NimBLE tinycrypt support (legacy)"
+       default n
+       ---help---
+               Build with the TinyCrypt bundled in NimBLE versions before the
+               switch to Mbed TLS. Set NIMBLE_REF to such a version. Kept only
+               for migration and will be removed.
 
 config NIMBLE_MESH
        bool "Apache NimBLE mesh support"
diff --git a/wireless/bluetooth/nimble/Makefile.nimble 
b/wireless/bluetooth/nimble/Makefile.nimble
index 0b86a8263..7a38e9b04 100644
--- a/wireless/bluetooth/nimble/Makefile.nimble
+++ b/wireless/bluetooth/nimble/Makefile.nimble
@@ -26,6 +26,8 @@ NIMBLE_ROOT = 
$(APPDIR)/wireless/bluetooth/nimble/mynewt-nimble
 
 ifneq ($(CONFIG_NIMBLE_TINYCRYPT),)
 NIMBLE_CFG_TINYCRYPT = 1
+else
+NIMBLE_CFG_MBEDTLS = 1
 endif
 
 ifneq ($(CONFIG_NIMBLE_MESH),)
diff --git a/wireless/bluetooth/nimble/include/syscfg/syscfg.h 
b/wireless/bluetooth/nimble/include/syscfg/syscfg.h
index 38f919693..75a9d416a 100644
--- a/wireless/bluetooth/nimble/include/syscfg/syscfg.h
+++ b/wireless/bluetooth/nimble/include/syscfg/syscfg.h
@@ -40,7 +40,11 @@
 
 /* NimBLE NuttX specific configuration **************************************/
 
-#define MYNEWT_VAL_BLE_SOCK_USE_NUTTX        (1)
+#ifdef CONFIG_NIMBLE_TINYCRYPT
+#  define MYNEWT_VAL_BLE_SOCK_USE_NUTTX      (1)
+#else
+#  define MYNEWT_VAL_BLE_SOCK_TYPE__nuttx    (1)
+#endif
 #define MYNEWT_VAL_NEWT_FEATURE_LOGCFG       (1)
 
 /* NimBLE user specific configuration ***************************************/

Reply via email to