From 7856fefea130fbf78cc5695741199d7cc309559a Mon Sep 17 00:00:00 2001 From: Shen Weilong Date: Fri, 28 Mar 2025 08:57:19 +0800 Subject: [PATCH] feat(ble/controller): Added memory boundary check for ESP32-C2 --- components/bt/controller/esp32c2/ble.c | 15 ++++++++++++++- .../bt/controller/lib_esp32c2/esp32c2-bt-lib | 2 +- .../esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld | 4 ++-- components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/components/bt/controller/esp32c2/ble.c b/components/bt/controller/esp32c2/ble.c index 9ea49196e5..dd6db35eed 100644 --- a/components/bt/controller/esp32c2/ble.c +++ b/components/bt/controller/esp32c2/ble.c @@ -12,9 +12,14 @@ ************************************************************************ */ #if (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED) -void adv_stack_enableClearLegacyAdvVsCmd(bool en); void scan_stack_enableAdvFlowCtrlVsCmd(bool en); +void adv_stack_enableClearLegacyAdvVsCmd(bool en); void chanSel_stack_enableSetCsaVsCmd(bool en); +void hci_stack_enableSetVsEvtMaskVsCmd(bool en); + +void adv_stack_enableScanReqRxdVsEvent(bool en); +void conn_stack_enableChanMapUpdCompVsEvent(bool en); +void sleep_stack_enableWakeupVsEvent(bool en); #endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED) /* Local functions definition @@ -32,10 +37,18 @@ void ble_stack_enableVsCmds(bool en) #endif // DEFAULT_BT_LE_ROLE_OBSERVER chanSel_stack_enableSetCsaVsCmd(en); + hci_stack_enableSetVsEvtMaskVsCmd(en); } void ble_stack_enableVsEvents(bool en) { +#if DEFAULT_BT_LE_ROLE_BROADCASTER + adv_stack_enableScanReqRxdVsEvent(en); +#endif // DEFAULT_BT_LE_ROLE_BROADCASTER + conn_stack_enableChanMapUpdCompVsEvent(en); +#if CONFIG_BT_LE_SLEEP_ENABLE + sleep_stack_enableWakeupVsEvent(en); +#endif // CONFIG_BT_LE_SLEEP_ENABLE } #endif // (CONFIG_BT_NIMBLE_ENABLED || CONFIG_BT_BLUEDROID_ENABLED) diff --git a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib index 1e88fa4606..c0d98a9a03 160000 --- a/components/bt/controller/lib_esp32c2/esp32c2-bt-lib +++ b/components/bt/controller/lib_esp32c2/esp32c2-bt-lib @@ -1 +1 @@ -Subproject commit 1e88fa4606b62faf7350ac12d4317ab4d1cd286d +Subproject commit c0d98a9a03c266828a25bed38c0174ecfc882aea diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld index a0892161e2..20df57a336 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble-eco4.ld @@ -144,7 +144,7 @@ r_ble_ll_adv_reset = 0x40000c88; r_ble_ll_adv_rpa_timeout = 0x40000c8c; r_ble_ll_adv_rpa_update = 0x40000c90; r_ble_ll_adv_rx_pkt_in = 0x40000c94; -r_ble_ll_adv_scan_req_rxd = 0x40000c98; +//r_ble_ll_adv_scan_req_rxd = 0x40000c98; r_ble_ll_adv_scan_rsp_legacy_pdu_make = 0x40000c9c; r_ble_ll_adv_scan_rsp_pdu_make = 0x40000ca0; r_ble_ll_adv_scheduled = 0x40000ca4; @@ -755,7 +755,7 @@ r_ble_lll_hci_dtm_tx_test_v2 = 0x40001614; r_ble_lll_hci_dtm_tx_test_v2_ext = 0x40001618; r_ble_lll_init = 0x4000161c; r_ble_lll_init_pre_process = 0x40001620; -r_ble_lll_init_rx_pkt_isr = 0x40001624; +//r_ble_lll_init_rx_pkt_isr = 0x40001624; r_ble_lll_per_adv_coex_dpc_calc_pti_update_itvl = 0x40001628; r_ble_lll_per_adv_coex_dpc_process = 0x4000162c; r_ble_lll_per_adv_coex_dpc_pti_get = 0x40001630; diff --git a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld index 2f30dd745a..1ff67da39f 100644 --- a/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld +++ b/components/esp_rom/esp32c2/ld/esp32c2.rom.ble.ld @@ -118,7 +118,7 @@ r_ble_ll_adv_rd_sup_adv_sets = 0x40000c7c; r_ble_ll_adv_read_txpwr = 0x40000c80; r_ble_ll_adv_rpa_timeout = 0x40000c8c; r_ble_ll_adv_rpa_update = 0x40000c90; -r_ble_ll_adv_scan_req_rxd = 0x40000c98; +//r_ble_ll_adv_scan_req_rxd = 0x40000c98; r_ble_ll_adv_scan_rsp_legacy_pdu_make = 0x40000c9c; r_ble_ll_adv_scan_rsp_pdu_make = 0x40000ca0; r_ble_ll_adv_scheduled = 0x40000ca4;