Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_ble_build_fail_v5.3' into 'release/v5.3'
Browse files Browse the repository at this point in the history
fix(ble/bluedroid): Fixed BLE build fail when enable dynamic memory and BLE5.0 (v5.3)

See merge request espressif/esp-idf!34664
  • Loading branch information
Isl2017 committed Nov 13, 2024
2 parents dc1265c + 7a4d10b commit 845a925
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/bt/common/btc/core/btc_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ static void btc_deinit_mem(void) {
btc_profile_cb_tab = NULL;
}

#if (BLE_INCLUDED == TRUE)
#if (BLE_42_FEATURE_SUPPORT == TRUE)
if (gl_bta_adv_data_ptr) {
osi_free(gl_bta_adv_data_ptr);
gl_bta_adv_data_ptr = NULL;
Expand All @@ -392,7 +392,7 @@ static void btc_deinit_mem(void) {
osi_free(gl_bta_scan_rsp_data_ptr);
gl_bta_scan_rsp_data_ptr = NULL;
}
#endif ///BLE_INCLUDED == TRUE
#endif // BLE_42_FEATURE_SUPPORT

#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
if (btc_creat_tab_env_ptr) {
Expand Down Expand Up @@ -444,7 +444,8 @@ static bt_status_t btc_init_mem(void) {
}
memset((void *)btc_profile_cb_tab, 0, sizeof(void *) * BTC_PID_NUM);

#if (BLE_INCLUDED == TRUE)
#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
if ((gl_bta_adv_data_ptr = (tBTA_BLE_ADV_DATA *)osi_malloc(sizeof(tBTA_BLE_ADV_DATA))) == NULL) {
goto error_exit;
}
Expand All @@ -454,7 +455,8 @@ static bt_status_t btc_init_mem(void) {
goto error_exit;
}
memset((void *)gl_bta_scan_rsp_data_ptr, 0, sizeof(tBTA_BLE_ADV_DATA));
#endif ///BLE_INCLUDED == TRUE
#endif // (BLE_42_FEATURE_SUPPORT == TRUE)
#endif // BTC_DYNAMIC_MEMORY == TRUE

#if GATTS_INCLUDED == TRUE && GATT_DYNAMIC_MEMORY == TRUE
if ((btc_creat_tab_env_ptr = (esp_btc_creat_tab_t *)osi_malloc(sizeof(esp_btc_creat_tab_t))) == NULL) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
#include "esp_gap_ble_api.h"

#if BTC_DYNAMIC_MEMORY == TRUE
#if (BLE_42_FEATURE_SUPPORT == TRUE)
#include "bta/bta_api.h"
extern tBTA_BLE_ADV_DATA *gl_bta_adv_data_ptr;
extern tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
#define gl_bta_adv_data (*gl_bta_adv_data_ptr)
#define gl_bta_scan_rsp_data (*gl_bta_scan_rsp_data_ptr)
#endif // BLE_42_FEATURE_SUPPORT
#endif

#define BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)))
Expand Down

0 comments on commit 845a925

Please sign in to comment.