Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controller_vhci_ble_adv example on ESP32-C6 linking errors (IDFGH-11010) #12194

Closed
jakkra opened this issue Sep 5, 2023 · 4 comments
Closed
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally

Comments

@jakkra
Copy link

jakkra commented Sep 5, 2023

General issue report

Hi, I'm trying to compile and run the controller_vhci_ble_adv example on ESP32-C6 but I get linking errors.

.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(app_bt.c.obj): in function `hci_cmd_send_reset':
esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/main/app_bt.c:49: undefined reference to `esp_vhci_host_send_packet'
.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(app_bt.c.obj): in function `hci_cmd_send_ble_set_adv_param':
esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/main/app_bt.c:70: undefined reference to `esp_vhci_host_send_packet'
.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(app_bt.c.obj): in function `hci_cmd_send_ble_set_adv_data':
esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/main/app_bt.c:95: undefined reference to `esp_vhci_host_send_packet'
.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(app_bt.c.obj): in function `hci_cmd_send_ble_adv_start':
esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/main/app_bt.c:55: undefined reference to `esp_vhci_host_send_packet'
.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/main/libmain.a(app_bt.c.obj): in function `bleAdvtTask':
esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/main/app_bt.c:106: undefined reference to `esp_vhci_host_register_callback'
.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/main/app_bt.c:119: undefined reference to `esp_vhci_host_check_send_available'

I checked in the bt.c and I'm trying to understand why those functions are wrapped in #ifdef CONFIG_BT_BLUEDROID_ENABLED?

I tested removing those #ifdef CONFIG_BT_BLUEDROID_ENABLED (as in the bt.c for other ESP32 chip) but then I get linking errors for below.

esp-idf/components/bt/controller/esp32c6/bt.c:343: undefined reference to `ble_hs_rx_data'
esp-idf/components/bt/controller/esp32c6/bt.c:343: undefined reference to `ble_hs_hci_rx_evt'
esp-idf/components/bt/controller/esp32c6/bt.c:343: undefined reference to `ble_hs_hci_rx_evt'

Is there a reason that this does not wortk? If not any pointers to why this is not working?

Tested with both esp-idf 5.1 and current head of master (62ee413)

@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 5, 2023
@github-actions github-actions bot changed the title controller_vhci_ble_adv example on ESP32-C6 linking errors controller_vhci_ble_adv example on ESP32-C6 linking errors (IDFGH-11010) Sep 5, 2023
@zhaoweiliang2021
Copy link
Contributor

Thanks for your question.This example doesn't currently support ESP32C6. Please check the README.md(esp-idf/examples/bluetooth/hci/controller_vhci_ble_adv/README.md) file under this example.
If you want to use the hci function of ESP32C6, please use the following example: esp-idf/examples/bluetooth/nimble/hci

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Sep 6, 2023
@jakkra
Copy link
Author

jakkra commented Sep 6, 2023

@zhaoweiliang2021 thank you, what I need is the vhci functions to bind that with the Bluetkitchen btstack as we are not using Espressif Bluetooth stacks. Previously we use the vhci functions for this, but they are not availible in the C6. How would you suggest doing this?

Should I modify the esp-idf and hook in on those functions and instead of doing it on UART, I'd map those to external stack?

#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
    ._hal_uart_start_tx     =  hci_uart_start_tx_wrapper,
    ._hal_uart_init_cbs     =  hci_uart_init_cbs_wrapper,
    ._hal_uart_config       =  hci_uart_config_wrapper,
    ._hal_uart_close        =  hci_uart_close_wrapper,
    ._hal_uart_blocking_tx  =  hci_uart_blocking_tx_wrapper,
    ._hal_uart_init         =  hci_uart_init_wrapper,
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART

@zhaoweiliang2021
Copy link
Contributor

You can refer to the adaptation work of BLUEDROID HOST in bt.c(components/bt/controller/esp32c6/bt.c).
The adaptation code is enabled by CONFIG_BT_BLUEDROID_ENABLED.
HCI TX direction: refer to the required esp_vhci_host_send_packet api;
HCI RX direction:
refer to ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
Need to implement ble_hs_hci_rx_evt/ble_hs_rx_data API.

@jakkra
Copy link
Author

jakkra commented Sep 7, 2023

@zhaoweiliang2021 thanks, I'll use that as reference. You may close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

3 participants