feat(ble): support for putting ble code into flash on ESP32-C6

This commit is contained in:
zwl
2025-01-03 16:46:58 +08:00
committed by zhouxiao
parent 1a0f98b1ec
commit 7ac466957c
4 changed files with 37 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -131,6 +131,10 @@ extern void r_ble_lll_rfmgmt_set_sleep_cb(void *s_cb, void *w_cb, void *s_arg,
extern void r_ble_rtc_wake_up_state_clr(void);
extern int os_msys_init(void);
extern void os_msys_deinit(void);
#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
extern void r_ble_ll_scan_start_time_init_compensation(uint32_t init_compensation);
extern void r_priv_sdk_config_insert_proc_time_set(uint16_t insert_proc_time);
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
extern sleep_retention_entries_config_t *r_esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra);
extern void r_esp_ble_set_wakeup_overhead(uint32_t overhead);
@@ -495,11 +499,13 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
return rc;
}
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
void *arg, void **ret_handle_in)
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, void *arg, void **ret_handle_in)
{
int rc = esp_intr_alloc(source, flags | ESP_INTR_FLAG_IRAM, handler,
arg, (intr_handle_t *)ret_handle_in);
#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
int rc = esp_intr_alloc(source, flags, handler, arg, (intr_handle_t *)ret_handle_in);
#else
int rc = esp_intr_alloc(source, flags | ESP_INTR_FLAG_IRAM, handler, arg, (intr_handle_t *)ret_handle_in);
#endif
return rc;
}
@@ -1043,6 +1049,10 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
coex_enable();
#endif // CONFIG_SW_COEXIST_ENABLE
#if CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
r_ble_ll_scan_start_time_init_compensation(500);
r_priv_sdk_config_insert_proc_time_set(500);
#endif // CONFIG_BT_CTRL_RUN_IN_FLASH_ONLY
if (r_ble_controller_enable(mode) != 0) {
ret = ESP_FAIL;
goto error;