Page 1 of 1

Can't compile BLE

Posted: Tue May 28, 2024 10:32 pm
by Sports5115
ESP32 WROOM32D
latest IDF docker image
in menuconfig I enabled

Bluetooth/host bluedroid/
Bluetooth/controller
Bluetooth/bluedroidoptions/ Enable BLE 4.2 features

CMake txt:
idf_component_register(SRCS “ble_wrp.c”
REQUIRES driver
PRIV_REQUIRES nvs_flash bt
INCLUDE_DIRS “include”)

Code: Select all

rm -R build 
idf.py build
still getting

Code: Select all

/project/main/ble_wrp.c:20:8: error: unknown type name 'esp_ble_scan_params_t'
   20 | static esp_ble_scan_params_t ble_scan_params = {
      |        ^~~~~~~~~~~~~~~~~~~~~
I think this is not activated
#if CONFIG_BT_BLE_42_FEATURES_SUPPORTED==0
#error "BLE 42 features are not enabled in menuconfig"
#endif

Re: Can't compile BLE

Posted: Wed May 29, 2024 10:40 am
by divy98
In the code have you included the required bt/ble header files?

Re: Can't compile BLE

Posted: Thu Jun 06, 2024 8:44 pm
by Sports5115
in sdkconfig I have

Code: Select all

CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y

Code: Select all

   esp_ble_scan_params_t;
is implemented in

Code: Select all

  components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h

and i have this in my C file:

Code: Select all

  #include "esp_gap_ble_api.h"
same way as instructed in doc
https://docs.espressif.com/projects/esp ... ?highlight

so I dont understand why it doesnt work.

Re: Can't compile BLE

Posted: Fri Jun 07, 2024 9:34 pm
by rrwatt
Can you post your whole CMakeLists.txt file? That might help me understand whats going on.

Re: Can't compile BLE

Posted: Fri Jun 07, 2024 10:12 pm
by Sports5115
it finds the header, includes it, but the header doesn't contain the expected type?

Code: Select all

idf_component_register(
  INCLUDE_DIRS
    "."

  SRCS
    "user_main.c"
    "dio.c"
    "ble_wrp.c"

  REQUIRES
    driver
    esp_common
    esp_driver_i2s
    freertos
    hal
    log
    bt
    nvs_flash
)
also attaching the generated sdkconfig

Re: Can't compile BLE

Posted: Fri Jun 07, 2024 10:30 pm
by rrwatt
I think the problem is with the state of BLE_42_FEATURE_SUPPORT in the header file. You can try to override it by removing the if/endif in the header file and forcing it to define esp_ble_scan_params_t no matter what. Remember to change it back later though.

Re: Can't compile BLE

Posted: Fri Jun 07, 2024 11:50 pm
by Sports5115
I had to manually add

Code: Select all

add_compile_definitions(BLE_42_FEATURE_SUPPORT)
into cmake file.
What a shitty system :(