添加 Blufi Function 后编译错误

YangGuoxin
Posts: 2
Joined: Tue Jul 25, 2023 7:29 am

添加 Blufi Function 后编译错误

Postby YangGuoxin » Tue Jul 25, 2023 7:48 am

我在我的项目中集成 Blufi 模块,参照实例项目编写代码,在 menuconfig 中开启 Include blufi funcion 后编译报错
  1. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:46:8: error: unknown type name 'esp_ble_adv_data_t'
  2.    46 | static esp_ble_adv_data_t blufi_adv_data = {
  3.       |        ^~~~~~~~~~~~~~~~~~
  4. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:47:5: error: field name not in record or union initializer
  5.    47 |     .set_scan_rsp = false,
  6.       |     ^
  7. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:47:5: note: (near initialization for 'blufi_adv_data')
  8. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:48:5: error: field name not in record or union initializer
  9.    48 |     .include_name = true,
  10.       |     ^
  11. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:48:5: note: (near initialization for 'blufi_adv_data')
  12. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:48:21: warning: excess elements in scalar initializer
  13.    48 |     .include_name = true,
  14.       |                     ^~~~
  15. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:48:21: note: (near initialization for 'blufi_adv_data')
  16. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:49:5: error: field name not in record or union initializer
  17.    49 |     .include_txpower = true,
  18.       |     ^
  19. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:49:5: note: (near initialization for 'blufi_adv_data')
  20. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:49:24: warning: excess elements in scalar initializer
  21.    49 |     .include_txpower = true,
  22.       |                        ^~~~
  23. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:49:24: note: (near initialization for 'blufi_adv_data')
  24. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:50:5: error: field name not in record or union initializer
  25.    50 |     .min_interval = 0x0006, //slave connection min interval, Time = min_interval * 1.25 msec
  26.       |     ^
  27. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:50:5: note: (near initialization for 'blufi_adv_data')
  28. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:50:21: warning: excess elements in scalar initializer
  29.    50 |     .min_interval = 0x0006, //slave connection min interval, Time = min_interval * 1.25 msec
  30.       |                     ^~~~~~
  31. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:50:21: note: (near initialization for 'blufi_adv_data')
  32. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:51:5: error: field name not in record or union initializer
  33.    51 |     .max_interval = 0x0010, //slave connection max interval, Time = max_interval * 1.25 msec
  34.       |     ^
  35. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:51:5: note: (near initialization for 'blufi_adv_data')
  36. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:51:21: warning: excess elements in scalar initializer
  37.    51 |     .max_interval = 0x0010, //slave connection max interval, Time = max_interval * 1.25 msec
  38.       |                     ^~~~~~
  39. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:51:21: note: (near initialization for 'blufi_adv_data')
  40. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:52:5: error: field name not in record or union initializer
  41.    52 |     .appearance = 0x00,
  42.       |     ^
  43. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:52:5: note: (near initialization for 'blufi_adv_data')
  44. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:52:19: warning: excess elements in scalar initializer
  45.    52 |     .appearance = 0x00,
  46.       |                   ^~~~
  47. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:52:19: note: (near initialization for 'blufi_adv_data')
  48. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:53:5: error: field name not in record or union initializer
  49.    53 |     .manufacturer_len = 0,
  50.       |     ^
  51. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:53:5: note: (near initialization for 'blufi_adv_data')
  52. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:53:25: warning: excess elements in scalar initializer
  53.    53 |     .manufacturer_len = 0,
  54.       |                         ^
  55. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:53:25: note: (near initialization for 'blufi_adv_data')
  56. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:54:5: error: field name not in record or union initializer
  57.    54 |     .p_manufacturer_data =  NULL,
  58.       |     ^
  59. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:54:5: note: (near initialization for 'blufi_adv_data')
  60. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:54:29: warning: excess elements in scalar initializer
  61.    54 |     .p_manufacturer_data =  NULL,
  62.       |                             ^~~~
  63. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:54:29: note: (near initialization for 'blufi_adv_data')
  64. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:55:5: error: field name not in record or union initializer
  65.    55 |     .service_data_len = 0,
  66.       |     ^
  67. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:55:5: note: (near initialization for 'blufi_adv_data')
  68. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:55:25: warning: excess elements in scalar initializer
  69.    55 |     .service_data_len = 0,
  70.       |                         ^
  71. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:55:25: note: (near initialization for 'blufi_adv_data')
  72. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:56:5: error: field name not in record or union initializer
  73.    56 |     .p_service_data = NULL,
  74.       |     ^
  75. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:56:5: note: (near initialization for 'blufi_adv_data')
  76. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:56:23: warning: excess elements in scalar initializer
  77.    56 |     .p_service_data = NULL,
  78.       |                       ^~~~
  79. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:56:23: note: (near initialization for 'blufi_adv_data')
  80. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:57:5: error: field name not in record or union initializer
  81.    57 |     .service_uuid_len = 16,
  82.       |     ^
  83. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:57:5: note: (near initialization for 'blufi_adv_data')
  84. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:57:25: warning: excess elements in scalar initializer
  85.    57 |     .service_uuid_len = 16,
  86.       |                         ^~
  87. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:57:25: note: (near initialization for 'blufi_adv_data')
  88. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:58:5: error: field name not in record or union initializer
  89.    58 |     .p_service_uuid = blufi_service_uuid128,
  90.       |     ^
  91. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:58:5: note: (near initialization for 'blufi_adv_data')
  92. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:58:23: warning: excess elements in scalar initializer
  93.    58 |     .p_service_uuid = blufi_service_uuid128,
  94.       |                       ^~~~~~~~~~~~~~~~~~~~~
  95. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:58:23: note: (near initialization for 'blufi_adv_data')
  96. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:59:5: error: field name not in record or union initializer
  97.    59 |     .flag = 0x6,
  98.       |     ^
  99. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:59:5: note: (near initialization for 'blufi_adv_data')
  100. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:59:13: warning: excess elements in scalar initializer
  101.    59 |     .flag = 0x6,
  102.       |             ^~~
  103. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:59:13: note: (near initialization for 'blufi_adv_data')
  104. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:62:8: error: unknown type name 'esp_ble_adv_params_t'
  105.    62 | static esp_ble_adv_params_t blufi_adv_params = {
  106.       |        ^~~~~~~~~~~~~~~~~~~~
  107. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:63:5: error: field name not in record or union initializer
  108.    63 |     .adv_int_min        = 0x100,
  109.       |     ^
  110. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:63:5: note: (near initialization for 'blufi_adv_params')
  111. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:64:5: error: field name not in record or union initializer
  112.    64 |     .adv_int_max        = 0x100,
  113.       |     ^
  114. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:64:5: note: (near initialization for 'blufi_adv_params')
  115. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:64:27: warning: excess elements in scalar initializer
  116.    64 |     .adv_int_max        = 0x100,
  117.       |                           ^~~~~
  118. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:64:27: note: (near initialization for 'blufi_adv_params')
  119. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:65:5: error: field name not in record or union initializer
  120.    65 |     .adv_type           = ADV_TYPE_IND,
  121.       |     ^
  122. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:65:5: note: (near initialization for 'blufi_adv_params')
  123. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:65:27: warning: excess elements in scalar initializer
  124.    65 |     .adv_type           = ADV_TYPE_IND,
  125.       |                           ^~~~~~~~~~~~
  126. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:65:27: note: (near initialization for 'blufi_adv_params')
  127. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:66:5: error: field name not in record or union initializer
  128.    66 |     .own_addr_type      = BLE_ADDR_TYPE_PUBLIC,
  129.       |     ^
  130. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:66:5: note: (near initialization for 'blufi_adv_params')
  131. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:66:27: warning: excess elements in scalar initializer
  132.    66 |     .own_addr_type      = BLE_ADDR_TYPE_PUBLIC,
  133.       |                           ^~~~~~~~~~~~~~~~~~~~
  134. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:66:27: note: (near initialization for 'blufi_adv_params')
  135. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:69:5: error: field name not in record or union initializer
  136.    69 |     .channel_map        = ADV_CHNL_ALL,
  137.       |     ^
  138. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:69:5: note: (near initialization for 'blufi_adv_params')
  139. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:69:27: warning: excess elements in scalar initializer
  140.    69 |     .channel_map        = ADV_CHNL_ALL,
  141.       |                           ^~~~~~~~~~~~
  142. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:69:27: note: (near initialization for 'blufi_adv_params')
  143. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:70:5: error: field name not in record or union initializer
  144.    70 |     .adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
  145.       |     ^
  146. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:70:5: note: (near initialization for 'blufi_adv_params')
  147. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:70:26: warning: excess elements in scalar initializer
  148.    70 |     .adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY,
  149.       |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  150. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:70:26: note: (near initialization for 'blufi_adv_params')
  151. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c: In function 'esp_blufi_gap_event_handler':
  152. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:77:9: error: implicit declaration of function 'esp_ble_gap_start_advertising'; did you mean  
  153. esp_ble_gap_start_ext_scan'? [-Werror=implicit-function-declaration]
  154.   77 |         esp_ble_gap_start_advertising(&blufi_adv_params);
  155.      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  156.      |         esp_ble_gap_start_ext_scan
  157. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c: In function 'esp_blufi_adv_start':
  158. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:374:5: error: implicit declaration of function 'esp_ble_gap_config_adv_data'; did you mean 'esp_ble_gap_config_ext_adv_data_raw'? [-Werror=implicit-function-declaration]
  159.  374 |     esp_ble_gap_config_adv_data(&blufi_adv_data);
  160.      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  161.      |     esp_ble_gap_config_ext_adv_data_raw
  162. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c: In function 'esp_blufi_adv_stop':
  163. D:/Programs/espressif/esp-idf/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c:379:5: error: implicit declaration of function 'esp_ble_gap_stop_advertising'; did you mean  
  164. esp_ble_gap_stop_ext_scan'? [-Werror=implicit-function-declaration]
  165.   379 |     esp_ble_gap_stop_advertising();
  166.       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  167.       |     esp_ble_gap_stop_ext_scan
  168. cc1.exe: some warnings being treated as errors
  169. [43/144] Building C object esp-idf/protocomm/CMakeFiles/__idf_protocomm.dir/src/transports/protocomm_ble.c.obj
  170. ninja: build stopped: subcommand failed.

ESP_zhanghaipeng
Posts: 42
Joined: Thu May 04, 2023 3:49 am

Re: 添加 Blufi Function 后编译错误

Postby ESP_zhanghaipeng » Tue Aug 01, 2023 9:51 am

根据报错的log:你用了 esp_ble_gap_start_advertising 等函数,该函数位于 esp-idf/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h
但是没有引入该函数。

你需要将 “esp_gap_ble_api.h” 引入一下。

Who is online

Users browsing this forum: Baidu [Spider] and 85 guests