diff --git a/components/bt/CMakeLists.txt b/components/bt/CMakeLists.txt index b6f73e0ced..31981a3807 100644 --- a/components/bt/CMakeLists.txt +++ b/components/bt/CMakeLists.txt @@ -26,6 +26,7 @@ if(CONFIG_BT_ENABLED) list(APPEND include_dirs include/esp32c2/include) endif() + # Common list(APPEND include_dirs common/osi/include) @@ -35,7 +36,9 @@ if(CONFIG_BT_ENABLED) list(APPEND include_dirs common/api/include/api common/btc/profile/esp/blufi/include - common/btc/profile/esp/include) + common/btc/profile/esp/include + porting/mem/ + ) list(APPEND srcs "common/btc/core/btc_alarm.c" @@ -56,7 +59,9 @@ if(CONFIG_BT_ENABLED) "common/osi/mutex.c" "common/osi/thread.c" "common/osi/osi.c" - "common/osi/semaphore.c") + "common/osi/semaphore.c" + "porting/mem/bt_osi_mem.c" + ) # Host Bluedroid if(CONFIG_BT_BLUEDROID_ENABLED) @@ -352,12 +357,7 @@ if(CONFIG_BT_ENABLED) "host/bluedroid/stack/smp/smp_l2c.c" "host/bluedroid/stack/smp/smp_main.c" "host/bluedroid/stack/smp/smp_utils.c") - if(CONFIG_IDF_TARGET_ESP32H2 OR CONFIG_IDF_TARGET_ESP32C2) - list(APPEND srcs - "host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c" - "host/nimble/nimble/porting/nimble/src/os_msys_init.c" - "host/nimble/port/src/esp_nimble_mem.c") - endif() + list(APPEND srcs "common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c") @@ -466,68 +466,53 @@ if(CONFIG_BT_ENABLED) endif() - # Nimble - # Nimble common - if(CONFIG_BT_NIMBLE_ENABLED OR - (CONFIG_BT_CONTROLLER_ENABLED AND (CONFIG_IDF_TARGET_ESP32C2 OR CONFIG_IDF_TARGET_ESP32H2))) - list(APPEND srcs - "host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c" - "host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c" - "host/nimble/nimble/porting/nimble/src/os_cputime_pwr2.c" - "host/nimble/nimble/porting/nimble/src/hal_timer.c" - "host/nimble/nimble/porting/nimble/src/os_msys_init.c" - "host/nimble/nimble/porting/nimble/src/nimble_port.c" - "host/nimble/port/src/esp_nimble_mem.c" - "host/nimble/esp-hci/src/esp_nimble_hci.c" - "host/nimble/nimble/porting/nimble/src/os_cputime.c" - ) - list(APPEND include_dirs - host/nimble/nimble/porting/nimble/include - host/nimble/port/include - host/nimble/nimble/nimble/include - host/nimble/nimble/porting/npl/freertos/include - host/nimble/esp-hci/include - ) + if(CONFIG_IDF_TARGET_ESP32C2 OR CONFIG_IDF_TARGET_ESP32H2) - if(NOT CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS) + if(CONFIG_BT_CONTROLLER_ENABLED) + list(APPEND srcs + "porting/npl/freertos/src/npl_os_freertos.c" + "porting/nimble/src/os_msys_init.c" + ) list(APPEND include_dirs - host/nimble/nimble/ext/tinycrypt/include) - - list(APPEND srcs "host/nimble/nimble/ext/tinycrypt/src/utils.c" - "host/nimble/nimble/ext/tinycrypt/src/sha256.c" - "host/nimble/nimble/ext/tinycrypt/src/ecc.c" - "host/nimble/nimble/ext/tinycrypt/src/ctr_prng.c" - "host/nimble/nimble/ext/tinycrypt/src/ctr_mode.c" - "host/nimble/nimble/ext/tinycrypt/src/aes_decrypt.c" - "host/nimble/nimble/ext/tinycrypt/src/aes_encrypt.c" - "host/nimble/nimble/ext/tinycrypt/src/ccm_mode.c" - "host/nimble/nimble/ext/tinycrypt/src/ecc_dsa.c" - "host/nimble/nimble/ext/tinycrypt/src/cmac_mode.c" - "host/nimble/nimble/ext/tinycrypt/src/ecc_dh.c" - "host/nimble/nimble/ext/tinycrypt/src/hmac_prng.c" - "host/nimble/nimble/ext/tinycrypt/src/ecc_platform_specific.c" - "host/nimble/nimble/ext/tinycrypt/src/hmac.c" - "host/nimble/nimble/ext/tinycrypt/src/cbc_mode.c") + porting/include + porting/mem/ + porting/nimble/include + porting/npl/freertos/include + porting/transport/include + ) endif() if(CONFIG_BT_LE_HCI_INTERFACE_USE_UART) list(APPEND srcs - "host/nimble/nimble/porting/nimble/src/hal_uart.c" - ) - list(APPEND include_dirs - host/nimble/nimble/nimble/transport/uart/include - ) - else() - list(APPEND include_dirs - host/nimble/nimble/nimble/transport/ram/include + "porting/transport/uart/hci_uart.c" ) endif() + + + if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS)) + list(APPEND include_dirs + porting/ext/tinycrypt/include + ) + list(APPEND srcs "porting/ext/tinycrypt/src/utils.c" + "porting/ext/tinycrypt/src/sha256.c" + "porting/ext/tinycrypt/src/ecc.c" + "porting/ext/tinycrypt/src/ctr_prng.c" + "porting/ext/tinycrypt/src/ctr_mode.c" + "porting/ext/tinycrypt/src/aes_decrypt.c" + "porting/ext/tinycrypt/src/aes_encrypt.c" + "porting/ext/tinycrypt/src/ccm_mode.c" + "porting/ext/tinycrypt/src/ecc_dsa.c" + "porting/ext/tinycrypt/src/cmac_mode.c" + "porting/ext/tinycrypt/src/ecc_dh.c" + "porting/ext/tinycrypt/src/hmac_prng.c" + "porting/ext/tinycrypt/src/ecc_platform_specific.c" + "porting/ext/tinycrypt/src/hmac.c" + "porting/ext/tinycrypt/src/cbc_mode.c") + endif() endif() - - if(CONFIG_BT_NIMBLE_ENABLED) list(APPEND include_dirs @@ -606,26 +591,42 @@ if(CONFIG_BT_ENABLED) "host/nimble/nimble/nimble/host/store/config/src/ble_store_nvs.c" ) - if(CONFIG_IDF_TARGET_ESP32) + list(APPEND srcs + "host/nimble/nimble/porting/nimble/src/nimble_port.c" + "host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c" + ) + list(APPEND include_dirs + porting/include + host/nimble/nimble/porting/nimble/include + host/nimble/port/include + ) + + if(NOT((CONFIG_IDF_TARGET_ESP32C2 OR CONFIG_IDF_TARGET_ESP32H2) AND CONFIG_BT_CONTROLLER_ENABLED)) list(APPEND srcs "host/nimble/nimble/porting/nimble/src/endian.c" "host/nimble/nimble/porting/nimble/src/os_mempool.c" "host/nimble/nimble/porting/nimble/src/mem.c" - "host/nimble/nimble/porting/nimble/src/os_mbuf.c") - elseif(CONFIG_IDF_TARGET_ESP32C3) - list(APPEND srcs - "host/nimble/nimble/porting/nimble/src/endian.c" - "host/nimble/nimble/porting/nimble/src/os_mempool.c" - "host/nimble/nimble/porting/nimble/src/mem.c" - "host/nimble/nimble/porting/nimble/src/os_mbuf.c") - elseif(CONFIG_IDF_TARGET_ESP32S3) - list(APPEND srcs - "host/nimble/nimble/porting/nimble/src/endian.c" - "host/nimble/nimble/porting/nimble/src/os_mempool.c" - "host/nimble/nimble/porting/nimble/src/mem.c" - "host/nimble/nimble/porting/nimble/src/os_mbuf.c") + "host/nimble/nimble/porting/nimble/src/os_mbuf.c" + "host/nimble/nimble/porting/nimble/src/os_msys_init.c" + "host/nimble/nimble/porting/npl/freertos/src/npl_os_freertos.c" + ) + list(APPEND include_dirs + host/nimble/nimble/porting/npl/freertos/include + host/nimble/nimble/porting/nimble/include + host/nimble/nimble/nimble/include + ) endif() + if(CONFIG_IDF_TARGET_ESP32 OR CONFIG_IDF_TARGET_ESP32C3 OR CONFIG_IDF_TARGET_ESP32S3 OR TRUE) + list(APPEND srcs + "host/nimble/esp-hci/src/esp_nimble_hci.c" + ) + list(APPEND include_dirs + host/nimble/esp-hci/include + ) + endif() + + list(APPEND srcs "common/btc/profile/esp/blufi/nimble_host/esp_blufi.c") diff --git a/components/bt/Kconfig b/components/bt/Kconfig index 390a6f80f5..8f98c38eaf 100644 --- a/components/bt/Kconfig +++ b/components/bt/Kconfig @@ -45,7 +45,6 @@ menu "Bluetooth" bool "Enabled" help This option is recommended for Bluetooth controller usecases - This option is recommended for Bluetooth controller usecases config BT_CONTROLLER_DISABLED bool "Disabled" diff --git a/components/bt/controller/esp32c2/Kconfig.in b/components/bt/controller/esp32c2/Kconfig.in index 4c6db12eb4..a7b8c5c466 100644 --- a/components/bt/controller/esp32c2/Kconfig.in +++ b/components/bt/controller/esp32c2/Kconfig.in @@ -22,6 +22,11 @@ menu "HCI Config" help Set the port number of HCI UART + config BT_LE_HCI_UART_FLOWCTRL + bool "HCI uart Hardware Flow ctrl" + depends on BT_LE_HCI_INTERFACE_USE_UART + default n + config BT_LE_HCI_UART_TX_PIN int "HCI uart Tx gpio" depends on BT_LE_HCI_INTERFACE_USE_UART @@ -32,12 +37,15 @@ menu "HCI Config" depends on BT_LE_HCI_INTERFACE_USE_UART default 10 - config BT_LE_HCI_UART_TASK_STACK_SIZE - int "HCI uart task stack size" - depends on BT_LE_HCI_INTERFACE_USE_UART - default 1000 - help - Set the size of uart task stack + config BT_LE_HCI_UART_RTS_PIN + int "HCI uart RTS gpio" + depends on BT_LE_HCI_UART_FLOWCTRL + default 4 + + config BT_LE_HCI_UART_CTS_PIN + int "HCI uart CTS gpio" + depends on BT_LE_HCI_UART_FLOWCTRL + default 5 config BT_LE_HCI_UART_BAUD int "HCI uart baudrate" @@ -46,58 +54,120 @@ menu "HCI Config" help HCI uart baud rate 115200 ~ 1000000 + choice BT_LE_HCI_UART_PARITY + prompt "select uart parity" + depends on BT_LE_HCI_INTERFACE_USE_UART + default BT_LE_HCI_UART_UART_PARITY_DISABLE + + config BT_LE_HCI_UART_UART_PARITY_DISABLE + bool "PARITY_DISABLE" + help + UART_PARITY_DISABLE + config BT_LE_HCI_UART_UART_PARITY_EVEN + bool "PARITY_EVEN" + help + UART_PARITY_EVEN + config BT_LE_HCI_UART_UART_PARITY_ODD + bool "PARITY_ODD" + help + UART_PARITY_ODD + endchoice + + config BT_LE_HCI_UART_TASK_STACK_SIZE + int "HCI uart task stack size" + depends on BT_LE_HCI_INTERFACE_USE_UART + default 1000 + help + Set the size of uart task stack endmenu -config BT_LE_CONTROLLER_TASK_STACK_SIZE - int "Controller task stack size" - default 5120 if BLE_MESH - default 4096 - help - This configures stack size of NimBLE controller task - -config BT_LE_LL_RESOLV_LIST_SIZE - int "BLE LL Resolving list size" - range 1 5 if IDF_TARGET_ESP32C2 - default 4 - help - Configure the size of resolving list used in link layer. - -menuconfig BT_LE_SECURITY_ENABLE - bool "Enable BLE SM feature" +menuconfig BT_LE_50_FEATURE_SUPPORT + bool "Enable BLE 5 feature" depends on !BT_NIMBLE_ENABLED default y help - Enable BLE sm feature + Enable BLE 5 feature -config BT_LE_SM_LEGACY - bool "Security manager legacy pairing" - depends on BT_LE_SECURITY_ENABLE +config BT_LE_LL_CFG_FEAT_LE_2M_PHY + bool "Enable 2M Phy" + depends on BT_LE_50_FEATURE_SUPPORT default y help - Enable security manager legacy pairing + Enable 2M-PHY -config BT_LE_SM_SC - bool "Security manager secure connections (4.2)" - depends on BT_LE_SECURITY_ENABLE +config BT_LE_LL_CFG_FEAT_LE_CODED_PHY + bool "Enable coded Phy" + depends on BT_LE_50_FEATURE_SUPPORT default y help - Enable security manager secure connections + Enable coded-PHY -config BT_LE_SM_SC_DEBUG_KEYS - bool "Use predefined public-private key pair" - default n - depends on BT_LE_SECURITY_ENABLE && BT_LE_SM_SC - help - If this option is enabled, SM uses predefined DH key pair as described - in Core Specification, Vol. 3, Part H, 2.3.5.6.1. This allows to - decrypt air traffic easily and thus should only be used for debugging. - -config BT_LE_LL_CFG_FEAT_LE_ENCRYPTION - bool "Enable LE encryption" - depends on BT_LE_SECURITY_ENABLE +config BT_LE_EXT_ADV + bool "Enable extended advertising" + depends on BT_LE_50_FEATURE_SUPPORT default y help - Enable encryption connection + Enable this option to do extended advertising. Extended advertising + will be supported from BLE 5.0 onwards. + +if BT_LE_EXT_ADV + config BT_LE_MAX_EXT_ADV_INSTANCES + int "Maximum number of extended advertising instances." + range 0 4 + default 1 if BT_LE_EXT_ADV + default 0 + depends on BT_LE_EXT_ADV + help + Change this option to set maximum number of extended advertising + instances. Minimum there is always one instance of + advertising. Enter how many more advertising instances you + want. + + config BT_LE_EXT_ADV_MAX_SIZE + int "Maximum length of the advertising data." + range 0 1650 + default 1650 if BT_LE_EXT_ADV + default 0 + depends on BT_LE_EXT_ADV + help + Defines the length of the extended adv data. The value should not + exceed 1650. + + config BT_LE_ENABLE_PERIODIC_ADV + bool "Enable periodic advertisement." + default y + depends on BT_LE_EXT_ADV + help + Enable this option to start periodic advertisement. + + config BT_LE_PERIODIC_ADV_SYNC_TRANSFER + bool "Enable Transer Sync Events" + depends on BT_LE_ENABLE_PERIODIC_ADV + default y + help + This enables controller transfer periodic sync events to host + +endif + +config BT_LE_MAX_PERIODIC_SYNCS + int "Maximum number of periodic advertising syncs" + depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED + + range 0 3 + default 1 if BT_LE_ENABLE_PERIODIC_ADV + default 0 + help + Set this option to set the upper limit for number of periodic sync + connections. This should be less than maximum connections allowed by + controller. + +config BT_LE_MAX_PERIODIC_ADVERTISER_LIST + int "Maximum number of periodic advertiser list" + depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED + range 1 5 + default 5 if BT_LE_50_FEATURE_SUPPORT + help + Set this option to set the upper limit for number of periodic advertiser list. menu "Memory Settings" depends on !BT_NIMBLE_ENABLED @@ -170,6 +240,57 @@ menu "Memory Settings" get dropped endmenu +config BT_LE_CONTROLLER_TASK_STACK_SIZE + int "Controller task stack size" + default 5120 if BLE_MESH + default 4096 + help + This configures stack size of NimBLE controller task + +config BT_LE_LL_RESOLV_LIST_SIZE + int "BLE LL Resolving list size" + range 1 5 + default 4 + help + Configure the size of resolving list used in link layer. + +menuconfig BT_LE_SECURITY_ENABLE + bool "Enable BLE SM feature" + depends on !BT_NIMBLE_ENABLED + default y + help + Enable BLE sm feature + +config BT_LE_SM_LEGACY + bool "Security manager legacy pairing" + depends on BT_LE_SECURITY_ENABLE + default y + help + Enable security manager legacy pairing + +config BT_LE_SM_SC + bool "Security manager secure connections (4.2)" + depends on BT_LE_SECURITY_ENABLE + default y + help + Enable security manager secure connections + +config BT_LE_SM_SC_DEBUG_KEYS + bool "Use predefined public-private key pair" + default n + depends on BT_LE_SECURITY_ENABLE && BT_LE_SM_SC + help + If this option is enabled, SM uses predefined DH key pair as described + in Core Specification, Vol. 3, Part H, 2.3.5.6.1. This allows to + decrypt air traffic easily and thus should only be used for debugging. + +config BT_LE_LL_CFG_FEAT_LE_ENCRYPTION + bool "Enable LE encryption" + depends on BT_LE_SECURITY_ENABLE + default y + help + Enable encryption connection + config BT_LE_CRYPTO_STACK_MBEDTLS bool "Override TinyCrypt with mbedTLS for crypto computations" default y @@ -180,99 +301,10 @@ config BT_LE_CRYPTO_STACK_MBEDTLS Enable this option to choose mbedTLS instead of TinyCrypt for crypto computations. -menuconfig BT_LE_50_FEATURE_SUPPORT - bool "Enable BLE 5 feature" - depends on !BT_NIMBLE_ENABLED - default y - help - Enable BLE 5 feature - -config BT_LE_LL_CFG_FEAT_LE_2M_PHY - bool "Enable 2M Phy" - depends on BT_LE_50_FEATURE_SUPPORT - default y - help - Enable 2M-PHY - -config BT_LE_LL_CFG_FEAT_LE_CODED_PHY - bool "Enable coded Phy" - depends on BT_LE_50_FEATURE_SUPPORT - default y - help - Enable coded-PHY - -config BT_LE_EXT_ADV - bool "Enable extended advertising" - depends on BT_LE_50_FEATURE_SUPPORT - default n - help - Enable this option to do extended advertising. Extended advertising - will be supported from BLE 5.0 onwards. - -if BT_LE_EXT_ADV - config BT_LE_MAX_EXT_ADV_INSTANCES - int "Maximum number of extended advertising instances." - range 0 4 - default 1 if BT_LE_EXT_ADV - default 0 - depends on BT_LE_EXT_ADV - help - Change this option to set maximum number of extended advertising - instances. Minimum there is always one instance of - advertising. Enter how many more advertising instances you - want. - - config BT_LE_EXT_ADV_MAX_SIZE - int "Maximum length of the advertising data." - range 0 1650 - default 1650 if BT_LE_EXT_ADV - default 0 - depends on BT_LE_EXT_ADV - help - Defines the length of the extended adv data. The value should not - exceed 1650. - - config BT_LE_ENABLE_PERIODIC_ADV - bool "Enable periodic advertisement." - default y - depends on BT_LE_EXT_ADV - help - Enable this option to start periodic advertisement. - - config BT_LE_PERIODIC_ADV_SYNC_TRANSFER - bool "Enable Transer Sync Events" - depends on BT_LE_ENABLE_PERIODIC_ADV - default y - help - This enables controller transfer periodic sync events to host - -endif - -config BT_LE_MAX_PERIODIC_SYNCS - int "Maximum number of periodic advertising syncs" - depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED - - range 0 8 if !IDF_TARGET_ESP32C2 - range 0 3 if IDF_TARGET_ESP32C2 - default 1 if BT_LE_ENABLE_PERIODIC_ADV - default 0 - help - Set this option to set the upper limit for number of periodic sync - connections. This should be less than maximum connections allowed by - controller. - -config BT_LE_MAX_PERIODIC_ADVERTISER_LIST - int "Maximum number of periodic advertiser list" - depends on BT_LE_50_FEATURE_SUPPORT && IDF_TARGET_ESP32C2 && !BT_NIMBLE_ENABLED - range 1 5 - default 5 if BT_LE_50_FEATURE_SUPPORT - help - Set this option to set the upper limit for number of periodic advertiser list. - config BT_LE_WHITELIST_SIZE int "BLE white list size" - range 1 5 if IDF_TARGET_ESP32C2 - default 5 if IDF_TARGET_ESP32C2 + range 1 15 + default 12 depends on !BT_NIMBLE_ENABLED help @@ -295,10 +327,8 @@ config BT_LE_LL_SCA config BT_LE_MAX_CONNECTIONS int "Maximum number of concurrent connections" depends on !BT_NIMBLE_ENABLED - range 1 8 if IDF_TARGET_ESP32H2 - default 3 if IDF_TARGET_ESP32H2 - range 1 2 if IDF_TARGET_ESP32C2 - default 2 if IDF_TARGET_ESP32C2 + range 1 2 + default 2 help Defines maximum number of concurrent BLE connections. For ESP32, user is expected to configure BTDM_CTRL_BLE_MAX_CONN from controller menu diff --git a/components/bt/controller/esp32h2/Kconfig.in b/components/bt/controller/esp32h2/Kconfig.in index 6a2540f9b0..d855b791d5 100644 --- a/components/bt/controller/esp32h2/Kconfig.in +++ b/components/bt/controller/esp32h2/Kconfig.in @@ -22,6 +22,11 @@ menu "HCI Config" help Set the port number of HCI UART + config BT_LE_HCI_UART_FLOWCTRL + bool "HCI uart Hardware Flow ctrl" + depends on BT_LE_HCI_INTERFACE_USE_UART + default n + config BT_LE_HCI_UART_TX_PIN int "HCI uart Tx gpio" depends on BT_LE_HCI_INTERFACE_USE_UART @@ -32,12 +37,15 @@ menu "HCI Config" depends on BT_LE_HCI_INTERFACE_USE_UART default 10 - config BT_LE_HCI_UART_TASK_STACK_SIZE - int "HCI uart task stack size" - depends on BT_LE_HCI_INTERFACE_USE_UART - default 1000 - help - Set the size of uart task stack + config BT_LE_HCI_UART_RTS_PIN + int "HCI uart RTS gpio" + depends on BT_LE_HCI_UART_FLOWCTRL + default 4 + + config BT_LE_HCI_UART_CTS_PIN + int "HCI uart CTS gpio" + depends on BT_LE_HCI_UART_FLOWCTRL + default 5 config BT_LE_HCI_UART_BAUD int "HCI uart baudrate" @@ -46,112 +54,33 @@ menu "HCI Config" help HCI uart baud rate 115200 ~ 1000000 + choice BT_LE_HCI_UART_PARITY + prompt "select uart parity" + depends on BT_LE_HCI_INTERFACE_USE_UART + default BT_LE_HCI_UART_UART_PARITY_DISABLE + + config BT_LE_HCI_UART_UART_PARITY_DISABLE + bool "PARITY_DISABLE" + help + UART_PARITY_DISABLE + config BT_LE_HCI_UART_UART_PARITY_EVEN + bool "PARITY_EVEN" + help + UART_PARITY_EVEN + config BT_LE_HCI_UART_UART_PARITY_ODD + bool "PARITY_ODD" + help + UART_PARITY_ODD + endchoice + + config BT_LE_HCI_UART_TASK_STACK_SIZE + int "HCI uart task stack size" + depends on BT_LE_HCI_INTERFACE_USE_UART + default 1000 + help + Set the size of uart task stack endmenu -config BT_LE_CONTROLLER_TASK_STACK_SIZE - int "Controller task stack size" - default 5120 if BLE_MESH - default 4096 - help - This configures stack size of NimBLE controller task - -config BT_LE_LL_RESOLV_LIST_SIZE - int "BLE LL Resolving list size" - range 1 5 if IDF_TARGET_ESP32C2 - default 4 - help - Configure the size of resolving list used in link layer. - -menuconfig BT_LE_SECURITY_ENABLE - bool "Enable BLE SM feature" - depends on !BT_NIMBLE_ENABLED - default y - help - Enable BLE sm feature - -config BT_LE_SM_LEGACY - bool "Security manager legacy pairing" - depends on BT_LE_SECURITY_ENABLE - default y - help - Enable security manager legacy pairing - -config BT_LE_SM_SC - bool "Security manager secure connections (4.2)" - depends on BT_LE_SECURITY_ENABLE - default y - help - Enable security manager secure connections - -config BT_LE_SM_SC_DEBUG_KEYS - bool "Use predefined public-private key pair" - default n - depends on BT_LE_SECURITY_ENABLE && BT_LE_SM_SC - help - If this option is enabled, SM uses predefined DH key pair as described - in Core Specification, Vol. 3, Part H, 2.3.5.6.1. This allows to - decrypt air traffic easily and thus should only be used for debugging. - -config BT_LE_LL_CFG_FEAT_LE_ENCRYPTION - bool "Enable LE encryption" - depends on BT_LE_SECURITY_ENABLE - default y - help - Enable encryption connection - -menu "Memory Settings" - depends on !BT_NIMBLE_ENABLED - config BT_LE_ACL_BUF_COUNT - int "ACL Buffer count" - default 24 - help - The number of ACL data buffers. - - config BT_LE_ACL_BUF_SIZE - int "ACL Buffer size" - default 255 - help - This is the maximum size of the data portion of HCI ACL data packets. - It does not include the HCI data header (of 4 bytes) - - config BT_LE_HCI_EVT_BUF_SIZE - int "HCI Event Buffer size" - default 257 if BT_LE_EXT_ADV - default 70 - help - This is the size of each HCI event buffer in bytes. In case of - extended advertising, packets can be fragmented. 257 bytes is the - maximum size of a packet. - - config BT_LE_HCI_EVT_HI_BUF_COUNT - int "High Priority HCI Event Buffer count" - default 30 - help - This is the high priority HCI events' buffer size. High-priority - event buffers are for everything except advertising reports. If there - are no free high-priority event buffers then host will try to allocate a - low-priority buffer instead - - config BT_LE_HCI_EVT_LO_BUF_COUNT - int "Low Priority HCI Event Buffer count" - default 8 - help - This is the low priority HCI events' buffer size. Low-priority event - buffers are only used for advertising reports. If there are no free - low-priority event buffers, then an incoming advertising report will - get dropped -endmenu - -config BT_LE_CRYPTO_STACK_MBEDTLS - bool "Override TinyCrypt with mbedTLS for crypto computations" - default y - depends on !BT_NIMBLE_ENABLED - select MBEDTLS_ECP_RESTARTABLE - select MBEDTLS_CMAC_C - help - Enable this option to choose mbedTLS instead of TinyCrypt for crypto - computations. - menuconfig BT_LE_50_FEATURE_SUPPORT bool "Enable BLE 5 feature" depends on !BT_NIMBLE_ENABLED @@ -176,7 +105,7 @@ config BT_LE_LL_CFG_FEAT_LE_CODED_PHY config BT_LE_EXT_ADV bool "Enable extended advertising" depends on BT_LE_50_FEATURE_SUPPORT - default n + default y help Enable this option to do extended advertising. Extended advertising will be supported from BLE 5.0 onwards. @@ -224,8 +153,7 @@ config BT_LE_MAX_PERIODIC_SYNCS int "Maximum number of periodic advertising syncs" depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED - range 0 8 if !IDF_TARGET_ESP32C2 - range 0 3 if IDF_TARGET_ESP32C2 + range 0 3 default 1 if BT_LE_ENABLE_PERIODIC_ADV default 0 help @@ -235,16 +163,148 @@ config BT_LE_MAX_PERIODIC_SYNCS config BT_LE_MAX_PERIODIC_ADVERTISER_LIST int "Maximum number of periodic advertiser list" - depends on BT_LE_50_FEATURE_SUPPORT && IDF_TARGET_ESP32C2 && !BT_NIMBLE_ENABLED + depends on BT_LE_50_FEATURE_SUPPORT && !BT_NIMBLE_ENABLED range 1 5 default 5 if BT_LE_50_FEATURE_SUPPORT help Set this option to set the upper limit for number of periodic advertiser list. +menu "Memory Settings" + depends on !BT_NIMBLE_ENABLED + + config BT_LE_MSYS_1_BLOCK_COUNT + int "MSYS_1 Block Count" + default 12 + help + MSYS is a system level mbuf registry. For prepare write & prepare + responses MBUFs are allocated out of msys_1 pool. For NIMBLE_MESH + enabled cases, this block count is increased by 8 than user defined + count. + + config BT_LE_MSYS_1_BLOCK_SIZE + int "MSYS_1 Block Size" + default 256 + help + Dynamic memory size of block 1 + + config BT_LE_MSYS_2_BLOCK_COUNT + int "MSYS_2 Block Count" + default 24 + help + Dynamic memory count + + config BT_LE_MSYS_2_BLOCK_SIZE + int "MSYS_2 Block Size" + default 320 + help + Dynamic memory size of block 2 + + config BT_LE_ACL_BUF_COUNT + int "ACL Buffer count" + default 24 + help + The number of ACL data buffers. + + config BT_LE_ACL_BUF_SIZE + int "ACL Buffer size" + default 255 + help + This is the maximum size of the data portion of HCI ACL data packets. + It does not include the HCI data header (of 4 bytes) + + config BT_LE_HCI_EVT_BUF_SIZE + int "HCI Event Buffer size" + default 257 if BT_LE_EXT_ADV + default 70 + help + This is the size of each HCI event buffer in bytes. In case of + extended advertising, packets can be fragmented. 257 bytes is the + maximum size of a packet. + + config BT_LE_HCI_EVT_HI_BUF_COUNT + int "High Priority HCI Event Buffer count" + default 30 + help + This is the high priority HCI events' buffer size. High-priority + event buffers are for everything except advertising reports. If there + are no free high-priority event buffers then host will try to allocate a + low-priority buffer instead + + config BT_LE_HCI_EVT_LO_BUF_COUNT + int "Low Priority HCI Event Buffer count" + default 8 + help + This is the low priority HCI events' buffer size. Low-priority event + buffers are only used for advertising reports. If there are no free + low-priority event buffers, then an incoming advertising report will + get dropped +endmenu + +config BT_LE_CONTROLLER_TASK_STACK_SIZE + int "Controller task stack size" + default 5120 if BLE_MESH + default 4096 + help + This configures stack size of NimBLE controller task + +config BT_LE_LL_RESOLV_LIST_SIZE + int "BLE LL Resolving list size" + range 1 5 + default 4 + help + Configure the size of resolving list used in link layer. + +menuconfig BT_LE_SECURITY_ENABLE + bool "Enable BLE SM feature" + depends on !BT_NIMBLE_ENABLED + default y + help + Enable BLE sm feature + +config BT_LE_SM_LEGACY + bool "Security manager legacy pairing" + depends on BT_LE_SECURITY_ENABLE + default y + help + Enable security manager legacy pairing + +config BT_LE_SM_SC + bool "Security manager secure connections (4.2)" + depends on BT_LE_SECURITY_ENABLE + default y + help + Enable security manager secure connections + +config BT_LE_SM_SC_DEBUG_KEYS + bool "Use predefined public-private key pair" + default n + depends on BT_LE_SECURITY_ENABLE && BT_LE_SM_SC + help + If this option is enabled, SM uses predefined DH key pair as described + in Core Specification, Vol. 3, Part H, 2.3.5.6.1. This allows to + decrypt air traffic easily and thus should only be used for debugging. + +config BT_LE_LL_CFG_FEAT_LE_ENCRYPTION + bool "Enable LE encryption" + depends on BT_LE_SECURITY_ENABLE + default y + help + Enable encryption connection + +config BT_LE_CRYPTO_STACK_MBEDTLS + bool "Override TinyCrypt with mbedTLS for crypto computations" + default y + depends on !BT_NIMBLE_ENABLED + select MBEDTLS_ECP_RESTARTABLE + select MBEDTLS_CMAC_C + help + Enable this option to choose mbedTLS instead of TinyCrypt for crypto + computations. + config BT_LE_WHITELIST_SIZE int "BLE white list size" - range 1 5 if IDF_TARGET_ESP32C2 - default 5 if IDF_TARGET_ESP32C2 + range 1 15 + default 12 depends on !BT_NIMBLE_ENABLED help @@ -267,10 +327,8 @@ config BT_LE_LL_SCA config BT_LE_MAX_CONNECTIONS int "Maximum number of concurrent connections" depends on !BT_NIMBLE_ENABLED - range 1 8 if IDF_TARGET_ESP32H2 - default 3 if IDF_TARGET_ESP32H2 - range 1 2 if IDF_TARGET_ESP32C2 - default 2 if IDF_TARGET_ESP32C2 + range 1 8 + default 3 help Defines maximum number of concurrent BLE connections. For ESP32, user is expected to configure BTDM_CTRL_BLE_MAX_CONN from controller menu @@ -302,3 +360,24 @@ config BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF default 0 if !BT_NIMBLE_ENABLED default 1 if BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EN default 0 if BT_LE_COEX_PHY_CODED_TX_RX_TLIM_DIS + +config BT_LE_SLEEP_ENABLE + bool "Enable BLE sleep" + default n + help + Enable BLE sleep + +choice BT_LE_WAKEUP_SOURCE + prompt "BLE light sleep wakeup source" + depends on BT_LE_SLEEP_ENABLE + default BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER + config BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER + bool "Use ESP timer to wakeup CPU" + help + Use esp timer to wakeup CPU + + config BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER + bool "Use BLE rtc timer to wakeup CPU" + help + Use BLE rtc timer to wakeup CPU +endchoice diff --git a/components/bt/host/nimble/Kconfig.in b/components/bt/host/nimble/Kconfig.in index cbd2ec2464..5ca36d225c 100644 --- a/components/bt/host/nimble/Kconfig.in +++ b/components/bt/host/nimble/Kconfig.in @@ -315,8 +315,8 @@ endmenu config BT_NIMBLE_HS_FLOW_CTRL bool "Enable Host Flow control" depends on BT_NIMBLE_ENABLED - default n if BT_SOC_SUPPORT_5_0 - default y + default y if IDF_TARGET_ESP32 + default n help Enable Host Flow control @@ -605,10 +605,8 @@ config BT_NIMBLE_COEX_PHY_CODED_TX_RX_TLIM_EFF config BT_NIMBLE_WHITELIST_SIZE int "BLE white list size" depends on BT_NIMBLE_ENABLED - range 1 15 if !IDF_TARGET_ESP32C2 - default 12 if !IDF_TARGET_ESP32C2 - range 1 5 if IDF_TARGET_ESP32C2 - default 5 if IDF_TARGET_ESP32C2 + range 1 15 + default 12 help BLE list size