feat(ble/controller): Reduce bin size and IRAM for BLE rom code

This commit is contained in:
zhiweijian
2025-04-21 20:22:34 +08:00
parent 644e38fb7a
commit 1d739291ca
13 changed files with 201 additions and 107 deletions

View File

@@ -30,7 +30,7 @@ extern "C" {
*
* @note Please do not modify this value
*/
#define ESP_BT_CTRL_CONFIG_VERSION 0x02502230
#define ESP_BT_CTRL_CONFIG_VERSION 0x02505080
/**
* @brief Internal use only
@@ -268,7 +268,7 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
#define BT_CTRL_RUN_IN_FLASH_ONLY (0)
#endif
#if (BT_CTRL_RUN_IN_FLASH_ONLY == 1)
#if defined(CONFIG_BT_CTRL_DTM_ENABLE)
#define BT_CTRL_DTM_ENABLE CONFIG_BT_CTRL_DTM_ENABLE
@@ -288,20 +288,11 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
#define BT_CTRL_BLE_TEST (0)
#endif
#if defined (CONFIG_BT_NIMBLE_SECURITY_ENABLE) || defined (CONFIG_BT_BLE_SMP_ENABLE)
#ifdef CONFIG_BT_NIMBLE_SECURITY_ENABLE
#define BLE_SECURITY_ENABLE (CONFIG_BT_NIMBLE_SECURITY_ENABLE)
#endif //CONFIG_BT_NIMBLE_SECURITY_ENABLE
#ifdef CONFIG_BT_BLE_SMP_ENABLE
#define BLE_SECURITY_ENABLE (CONFIG_BT_BLE_SMP_ENABLE)
#endif //CONFIG_BT_BLE_SMP_ENABLE
#else
#if defined (CONFIG_BT_CTRL_BLE_SECURITY_ENABLE)
#define BLE_SECURITY_ENABLE (CONFIG_BT_CTRL_BLE_SECURITY_ENABLE)
#else
#define BLE_SECURITY_ENABLE (0)
#endif
#endif // (CONFIG_BT_NIMBLE_SECURITY_ENABLE) || (CONFIG_BT_BLE_SMP_ENABLE)
#if defined (CONFIG_BT_CTRL_BLE_SCAN)
#define BT_CTRL_BLE_SCAN CONFIG_BT_CTRL_BLE_SCAN
@@ -309,13 +300,11 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
#define BT_CTRL_BLE_SCAN (0)
#endif
#if defined (CONFIG_BT_CTRL_BLE_ADV)
#define BT_CTRL_BLE_ADV CONFIG_BT_CTRL_BLE_ADV
#else
#define BT_CTRL_BLE_MASTER (1)
#define BT_CTRL_DTM_ENABLE (1)
#define BT_CTRL_BLE_TEST (1)
#define BLE_SECURITY_ENABLE (1)
#define BT_CTRL_BLE_SCAN (1)
#endif // (BT_CTRL_RUN_IN_FLASH_ONLY == 1)
#define BT_CTRL_BLE_ADV (0)
#endif
#ifdef CONFIG_BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
#define BLE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED CONFIG_BT_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS
@@ -384,11 +373,12 @@ typedef void (* esp_bt_hci_tl_callback_t) (void *arg, uint8_t status);
.dtm_en = BT_CTRL_DTM_ENABLE, \
.enc_en = BLE_SECURITY_ENABLE, \
.qa_test = BT_CTRL_BLE_TEST, \
.master_en = BT_CTRL_BLE_MASTER, \
.connect_en = BT_CTRL_BLE_MASTER, \
.scan_en = BT_CTRL_BLE_SCAN, \
.ble_aa_check = BLE_CTRL_CHECK_CONNECT_IND_ACCESS_ADDRESS_ENABLED, \
.ble_log_mode_en = BLE_LOG_MODE_EN, \
.ble_log_level = BLE_LOG_LEVEL, \
.adv_en = BT_CTRL_BLE_ADV, \
}
#else
@@ -508,14 +498,15 @@ typedef struct {
uint8_t ble_llcp_disc_flag; /*!< Flag indicating whether the Controller disconnects after Instant Passed (0x28) error occurs. Configurable in menuconfig.
- The Controller does not disconnect after Instant Passed (0x28) by default. */
bool run_in_flash; /*!< True if the Controller code is in flash (flash model); false otherwise (default). Configurable in menuconfig. */
bool dtm_en; /*!< In the flash mode, True if the DTM feature is enabled; false otherwise (default). Configurable in menuconfig. */
bool enc_en; /*!< In the flash mode, True if the encryption feature is enabled (default); false otherwise. Configurable in menuconfig. */
bool qa_test; /*!< In the flash mode, True if the QA test feature is enabled; false otherwise (default). Configurable in menuconfig.*/
bool master_en; /*!< In the flash mode, True if the master feature is enabled (default); false otherwise. Configurable in menuconfig.*/
bool scan_en; /*!< In the flash mode, True if the scan feature is enabled (default); false otherwise. Configurable in menuconfig.*/
bool dtm_en; /*!< True if the DTM feature is enabled; false otherwise (default). Configurable in menuconfig. */
bool enc_en; /*!< True if the encryption feature is enabled (default); false otherwise. Configurable in menuconfig. */
bool qa_test; /*!< True if the QA test feature is enabled; false otherwise (default). Configurable in menuconfig.*/
bool connect_en; /*!< True if the connection feature is enabled (default); false otherwise. Configurable in menuconfig.*/
bool scan_en; /*!< True if the scan feature is enabled (default); false otherwise. Configurable in menuconfig.*/
bool ble_aa_check; /*!< True if adds a verification step for the Access Address within the CONNECT_IND PDU; false otherwise. Configurable in menuconfig */
uint32_t ble_log_mode_en; /*!< BLE log mode enable */
uint8_t ble_log_level; /*!< BLE log level */
bool adv_en; /*!< True if the ADV feature is enabled (default); false otherwise. Configurable in menuconfig.*/
} esp_bt_controller_config_t;
/**