Merge branch 'bugfix/fix_ble_controller_emi_assert_v6.0' into 'release/v6.0'

fix(ble): Fixed BLE assert in "emi.c" when low memory (6.0)

See merge request espressif/esp-idf!46915
This commit is contained in:
Jiang Jiang Jian
2026-03-24 11:01:13 +08:00
2 changed files with 27 additions and 17 deletions
+15 -11
View File
@@ -1692,32 +1692,31 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
ESP_LOGI(BTDM_LOG_TAG, "BT controller compile version [%s]", btdm_controller_get_compile_version());
s_wakeup_req_sem = semphr_create_wrapper(1, 0);
if (s_wakeup_req_sem == NULL) {
err = ESP_ERR_NO_MEM;
goto error;
}
esp_phy_modem_init();
esp_bt_power_domain_on();
btdm_controller_mem_init();
/* Must call periph_module_enable(BT) before any step that may goto error,
* otherwise bt_controller_deinit_internal() will call periph_module_disable(BT)
* when ref is still 0, causing ref underflow (0-1=255) and subsequent
* init/enable failures (EM BASE MISMATCH, BLE assert, etc.) */
periph_module_enable(PERIPH_BT_MODULE);
periph_module_reset(PERIPH_BT_MODULE);
s_wakeup_req_sem = semphr_create_wrapper(1, 0);
if (s_wakeup_req_sem == NULL) {
err = ESP_ERR_NO_MEM;
goto error;
}
#if CONFIG_BTDM_CTRL_HCI_UART_FLOW_CTRL_EN
sdk_config_set_uart_flow_ctrl_enable(true);
#else
sdk_config_set_uart_flow_ctrl_enable(false);
#endif
if ((err = btdm_low_power_mode_init()) != ESP_OK) {
ESP_LOGE(BTDM_LOG_TAG, "Low power module initialization failed");
goto error;
}
#if CONFIG_SW_COEXIST_ENABLE
coex_init();
#endif
@@ -1738,6 +1737,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#endif /* CONFIG_BLE_LOG_ENABLED */
if ((err = btdm_low_power_mode_init()) != ESP_OK) {
ESP_LOGE(BTDM_LOG_TAG, "Low power module initialization failed");
goto error;
}
btdm_cfg_mask = btdm_config_mask_load();
err = btdm_controller_init(btdm_cfg_mask, cfg);
+12 -6
View File
@@ -1867,15 +1867,18 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
ESP_LOGI(BT_LOG_TAG,"Put all controller code in flash");
#endif
if ((err = btdm_low_power_mode_init(cfg)) != ESP_OK) {
ESP_LOGE(BT_LOG_TAG, "Low power module initialization failed");
goto error;
}
#if CONFIG_SW_COEXIST_ENABLE
coex_init();
#endif
/* Must call periph_module_enable(BT) before any step that may goto error,
* otherwise bt_controller_deinit_internal() will call periph_module_disable(BT)
* when ref is still 0, causing ref underflow (0-1=255) and subsequent
* init/enable failures (EM BASE MISMATCH, BLE assert, etc.) */
periph_module_enable(PERIPH_BT_MODULE);
periph_module_reset(PERIPH_BT_MODULE);
#if CONFIG_BLE_LOG_ENABLED
if (!ble_log_init()) {
ESP_LOGE(BT_LOG_TAG, "BLE Log v2 init failed");
@@ -1892,8 +1895,11 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
#endif // CONFIG_BT_BLE_LOG_SPI_OUT_ENABLED
#endif /* CONFIG_BLE_LOG_ENABLED */
periph_module_enable(PERIPH_BT_MODULE);
periph_module_reset(PERIPH_BT_MODULE);
if ((err = btdm_low_power_mode_init(cfg)) != ESP_OK) {
ESP_LOGE(BT_LOG_TAG, "Low power module initialization failed");
goto error;
}
#if CONFIG_BT_CTRL_LE_LOG_EN
err = esp_bt_controller_log_init(log_output_mode);