espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
12.89k stars 7.08k forks source link

Bluedroid BT_BLE_42_FEATURES_SUPPORTED config can't be selected for target ESP32, build fails as it cannot find common BT elements. (IDFGH-5805) #7512

Open AliAkdurak opened 2 years ago

AliAkdurak commented 2 years ago

Environment

Problem Description

Can't enable BLE_42_FEATURE_SUPPORT that's used in esp_gap_ble_api.h from menuconfig as bluedroid will not let me enable it under its menu.

components/bt/host/bluedroid/Kconfig.in for the feature is quoted below which doesn't allow for activation if target is not ESP32C3 or ESP32S3. Also esp_bt.h lacks the necesary define for importing the define from sdkconfig.h to actual c files.

config BT_BLE_42_FEATURES_SUPPORTED
    bool "Enable BLE 4.2 features"
    depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
    default n
    help
        This enables BLE 4.2 features.

I have been using all bluetooth functionality with ESP32-WROOM-32E until upgrade to a recent master branch requiring support for W5500

Expected Behavior

Being able to enable BLE4.2 features. Our project has stopped being able to be built after upgrade to latest master branch.

Actual Behavior

No menu element will show for ESP32 target and I can't enable define BLE_42_FEATURE_SUPPORT.

Steps to reproduce

I am not sure why my specific project of ESP32-WROOM-32E does not BLE_42_FEATURE_SUPPORT. I am unable to offer suggestions for reproduce. I can build examples under the latest master branch.

Code to reproduce this issue

Use anything from esp_gap_ble_api.h such as

esp_ble_adv_data_t esp_ble_adv_params_t

while not having enabled BLE_42_FEATURE_SUPPORT

Debug Logs

Other items if possible

I can add CONFIG_BLE_42_FEATURE_SUPPORT=y by hand does not solve the problem as the files is generated automatically and esp_bt.h does not have necessary definition to convert this into BLE_42_FEATURE_SUPPORT define.

AliAkdurak commented 2 years ago

Problem can be solved with changing this under /components/bt/host/bluedroid/Kconfig.in

config BT_BLE_42_FEATURES_SUPPORTED
bool "Enable BLE 4.2 features"
    depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
        default n
    help
        This enables BLE 4.2 features.

to

config BT_BLE_42_FEATURES_SUPPORTED
    bool "Enable BLE 4.2 features"
    depends on (BT_BLUEDROID_ENABLED && (IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3))
    default n
    help
        This enables BLE 4.2 features.

Also need to add this to esp_bt.h

#ifdef CONFIG_BT_BLE_42_FEATURES_SUPPORTED
#define BLE_42_FEATURE_SUPPORT TRUE
#endif

This change is probably wrong but at least it might solve the problem for some. There is probably going to be a default way to mark this when target is selected.

I wish I didn't need to read github markdown page for 10 minutes before I can show indentation and save peoples eyes

xiewenxiang commented 2 years ago

If the chip is ESP32, There would be no configuration items CONFIG_BT_BLE_50_FEATURES_SUPPORTED and CONFIG_BT_BLE_42_FEATURES_SUPPORTED.

#if (UC_BT_BLE_42_FEATURES_SUPPORTED == TRUE || BLE_50_FEATURE_SUPPORT == FALSE)
#define BLE_42_FEATURE_SUPPORT   TRUE
#else
#define BLE_42_FEATURE_SUPPORT   FALSE
#endif

Then, the BLE 4.2 macro will open, So, compilation errors will not occur.

AliAkdurak commented 2 years ago

If the chip is ESP32, There would be no configuration items CONFIG_BT_BLE_50_FEATURES_SUPPORTED and CONFIG_BT_BLE_42_FEATURES_SUPPORTED.

#if (UC_BT_BLE_42_FEATURES_SUPPORTED == TRUE || BLE_50_FEATURE_SUPPORT == FALSE)
#define BLE_42_FEATURE_SUPPORT   TRUE
#else
#define BLE_42_FEATURE_SUPPORT   FALSE
#endif

Then, the BLE 4.2 macro will open, So, compilation errors will not occur.

Is this already in the code or another nice solution to the problem my friend.

xiewenxiang commented 2 years ago

@AliAkdurak

Yes, It's already done in IDF. No matter which chip you use(ESP32 or ESP32C3), you won't meet the compile issues.

If you do have this problem, please provide your sdkconfig file.

Alvin1Zhang commented 2 years ago

@AliAkdurak Thanks for reporting, sorry for the slow turnaround, any updates for the issue? Thanks.

nicklasb commented 2 years ago

Hi @xiewenxiang! Sorry, but I am not sure I understand this one. Is this a problem, fixed, or not? I cannot get the ble50_security_server example to compile due to this.

nicklasb commented 2 years ago

Hi again, solved, for me at least.

Basically, I hadn't been able to properly select the ESP32 S3 target in Platform IO....because it doesn't seem to support it. Made it work using idf.py set-target esp32s3 and not using Platform IO, only command line.

Only to realize I have one S3 too few to make my idea work anyway. :-)

(The gist of this thread to me is that only S3 and C3 supports BLE 5)

mrx23dot commented 1 month ago

weird, enabling Bluetooth in menuconf 2024-05-28_230101_NL

even this is not enogough! [*] Enable BLE 4.2 features

doesn't enable CONFIG_BT_BLE_42_FEATURES_SUPPORTED CONFIG_BT_BLE_50_FEATURES_SUPPORTED