esp-nimble-cpp
esp-nimble-cpp copied to clipboard
References to arduino-esp32
Hi
I am running a essp-idf project with some arduino legacy code. At the moment I would prefer not rewrite those parts so I have installed arduino-esp32 as a component in my project.
To be able to use BLE nimble stack I installer esp-nimble-cpp. When building I have some error I don't understand like :
../idf_wrappers/esp-nimble/src/NimBLEDevice.cpp:46:10: fatal error: esp32-hal-bt.h: No such file or directory
esp32-hal-bt.h is part of the arduino-esp32 library,,, should there be references to that in esp-nimble-cpp???
If you are using arduino as an idf component as well as this library it needs to include that file so that the arduino code won't release the BLE memory. That's the only reason for including that.
Okay. Thanks for the explanation.
../components/arduino/libraries/BluetoothSerial/src/BTAddress.h:14:10: fatal error: esp_gap_bt_api.h: No such file or directory
#include <esp_gap_bt_api.h> // ESP32 BT
I have a similar problem.
After changing to nimble. Arduino as component won't compile. I disabled BluetoothSerial in sdkconfig but still the same.
Looks like Bluetooth is not enabled in your config? Can you share the IDF and arduino core commit ID?
Bluetooth is on. Host is nimBLE
If I comment these lines in the arduino component, everything works:
components/arduino/CMakeList.txt
#libraries/BluetoothSerial/src/BluetoothSerial.cpp
#libraries/BluetoothSerial/src/BTAddress.cpp
#libraries/BluetoothSerial/src/BTAdvertisedDeviceSet.cpp
#libraries/BluetoothSerial/src/BTScanResultsSet.cpp
But it is not an elegant solution.
Arduino: 399f4ecbb3a4cef21e2bffa37adb6190356dfb76 (https://github.com/espressif/arduino-esp32/commit/399f4ecbb3a4cef21e2bffa37adb6190356dfb76) idf v4.4 35b20cadce65ce79c14cf2018efc87c44d71ab21 (https://github.com/espressif/esp-idf/commit/35b20cadce65ce79c14cf2018efc87c44d71ab21)
sdkconfig:
#
# Bluetooth
#
CONFIG_BT_ENABLED=y
#
# Bluetooth controller
#
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set
# CONFIG_BTDM_CTRL_MODE_BTDM is not set
CONFIG_BTDM_CTRL_BLE_MAX_CONN=3
CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0
CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0
CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0
CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3
CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0
CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y
# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set
CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y
# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set
#
# MODEM SLEEP Options
#
CONFIG_BTDM_CTRL_MODEM_SLEEP=y
CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_ORIG=y
# CONFIG_BTDM_CTRL_MODEM_SLEEP_MODE_EVED is not set
CONFIG_BTDM_CTRL_LPCLK_SEL_MAIN_XTAL=y
# end of MODEM SLEEP Options
CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y
CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
CONFIG_BTDM_BLE_SCAN_DUPL=y
CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y
# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set
# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set
CONFIG_BTDM_SCAN_DUPL_TYPE=0
CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=200
# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set
CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y
CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y
CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100
CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
CONFIG_BTDM_RESERVE_DRAM=0xdb5c
CONFIG_BTDM_CTRL_HLI=y
# end of Bluetooth controller
# CONFIG_BT_BLUEDROID_ENABLED is not set
CONFIG_BT_NIMBLE_ENABLED=y
# CONFIG_BT_CONTROLLER_ONLY is not set
#
# NimBLE Options
#
# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL is not set
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL=y
# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set
# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set
# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set
# CONFIG_BT_NIMBLE_LOG_LEVEL_WARNING is not set
CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y
# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set
CONFIG_BT_NIMBLE_LOG_LEVEL=1
CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3
CONFIG_BT_NIMBLE_MAX_BONDS=3
CONFIG_BT_NIMBLE_MAX_CCCDS=8
CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0
CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y
# CONFIG_BT_NIMBLE_PINNED_TO_CORE_1 is not set
CONFIG_BT_NIMBLE_PINNED_TO_CORE=0
CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096
CONFIG_BT_NIMBLE_ROLE_CENTRAL=y
CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y
CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y
CONFIG_BT_NIMBLE_ROLE_OBSERVER=y
CONFIG_BT_NIMBLE_NVS_PERSIST=y
CONFIG_BT_NIMBLE_SM_LEGACY=y
CONFIG_BT_NIMBLE_SM_SC=y
# CONFIG_BT_NIMBLE_DEBUG is not set
# CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS is not set
CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="nimble"
CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31
CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=256
CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE=0
CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20
CONFIG_BT_NIMBLE_ACL_BUF_SIZE=255
CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70
CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT=30
CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT=8
CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT=12
CONFIG_BT_NIMBLE_HS_FLOW_CTRL=y
CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL=1000
CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH=2
CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT=y
CONFIG_BT_NIMBLE_RPA_TIMEOUT=900
# CONFIG_BT_NIMBLE_MESH is not set
CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y
CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS=2000
# CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT is not set
# CONFIG_BT_NIMBLE_BLUFI_ENABLE is not set
CONFIG_BT_NIMBLE_USE_ESP_TIMER=y
# end of NimBLE Options
# end of Bluetooth
Thanks!
Looking through the arduino core I can see the header only checks CONFIG_BT_ENABLED
and should be CONFIG_BT_BLUEDROID_ENABLED
Obviously, that would require a PR to fix.
Potentially you could define the include guard macro in your project Cmake to avoid altering the component files.
The macro is this: COMPONENTS_CPP_UTILS_BTADDRESS_H_
Thank you, this looks like a better solution.
Thanks for your work and this repository.
You're very welcome, let me know if that works. In the meantime I will propose the necessary PR to arduino-esp32.
Yes it works. Here PR: https://github.com/espressif/arduino-esp32/pull/5920
Awesome, thanks!
Is there a way to fix the original issue?
I am having that compiling issue as well and don't know how to make the component be able to find the include file
I had this issue using Platform io with
framework = arduino, espidf
in platformio.ini
To solve it, I removed 'arduino' from the framework field, and installed arduino as a separate component.