-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Status: SolvedThe issue has been resolved and requires no further action.The issue has been resolved and requires no further action.Type: For referenceCommon questions & problemsCommon questions & problemsType: QuestionOnly questionOnly question
Description
Board
ESP32C3
Device Description
ESP32C3kit
Hardware Configuration
An I2C Device
Version
v2.0.2
IDE Name
Arduino
Operating System
Windows10
Flash frequency
80
PSRAM enabled
yes
Upload speed
115200
Description
I found that when compiling the code including the BluetoothSerial.h file, the console reported a lot of undefined references
Sketch
#include <BluetoothSerial.h>
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
#define BT_DISCOVER_TIME 10000
static bool btScanAsync = true;
static bool btScanSync = true;
void btAdvertisedDeviceFound(BTAdvertisedDevice* pDevice) {
Serial.printf("Found a device asynchronously: %s\n", pDevice->toString().c_str());
}
void setup() {
Serial.begin(115200);
SerialBT.begin("ESP32test"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
if (btScanAsync) {
Serial.print("Starting discoverAsync...");
if (SerialBT.discoverAsync(btAdvertisedDeviceFound)) {
Serial.println("Findings will be reported in \"btAdvertisedDeviceFound\"");
delay(10000);
Serial.print("Stopping discoverAsync... ");
SerialBT.discoverAsyncStop();
Serial.println("stopped");
} else {
Serial.println("Error on discoverAsync f.e. not workin after a \"connect\"");
}
}
if (btScanSync) {
Serial.println("Starting discover...");
BTScanResults *pResults = SerialBT.discover(BT_DISCOVER_TIME);
if (pResults)
pResults->dump(&Serial);
else
Serial.println("Error on BT Scan, no result!");
}
}
void loop() {
delay(100);
}
Debug Message
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `.L0 ':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:651: undefined reference to `esp_spp_disconnect'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `_stop_bt':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:652: undefined reference to `esp_spp_deinit'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `.LVL35':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:253: undefined reference to `esp_bt_gap_set_scan_mode'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `esp_spp_cb':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:259: undefined reference to `esp_spp_start_srv'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:271: undefined reference to `esp_spp_disconnect'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:339: undefined reference to `esp_spp_connect'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:350: undefined reference to `esp_spp_disconnect'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `.L0 ':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:177: undefined reference to `esp_spp_write'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:141: undefined reference to `esp_bt_gap_set_pin'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:586: undefined reference to `esp_bt_gap_register_callback'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `_init_bt':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:595: undefined reference to `esp_spp_register_callback'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:603: undefined reference to `esp_spp_init'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:623: undefined reference to `esp_bt_gap_set_security_param'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:626: undefined reference to `esp_bt_gap_set_cod'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `BluetoothSerial::disconnect()':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:594: undefined reference to `esp_spp_disconnect'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `BluetoothSerial::discover(int)':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:953: undefined reference to `esp_bt_gap_set_scan_mode'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:956: undefined reference to `esp_bt_gap_start_discovery'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:961: undefined reference to `esp_bt_gap_cancel_discovery'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `BluetoothSerial::discoverAsyncStop()':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:962: undefined reference to `esp_bt_gap_cancel_discovery'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<void (*)(std::_Any_data const&, BTAdvertisedDevice*&&)> >, std::is_move_constructible<void (*)(std::_Any_data const&, BTAdvertisedDevice*&&)>, std::is_move_assignable<void (*)(std::_Any_data const&, BTAdvertisedDevice*&&)> >::value, void>::type std::swap<void (*)(std::_Any_data const&, BTAdvertisedDevice*&&)>(void (*&)(std::_Any_data const&, BTAdvertisedDevice*&&), void (*&)(std::_Any_data const&, BTAdvertisedDevice*&&))':
d:\tools\arduino\hardware\espressif\arduino-esp32\tools\riscv32-esp-elf\riscv32-esp-elf\include\c++\8.4.0\bits/move.h:193: undefined reference to `esp_bt_gap_set_scan_mode'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `BluetoothSerial::discoverAsync(std::function<void (BTAdvertisedDevice*)>, int)':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:981: undefined reference to `esp_bt_gap_start_discovery'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `.L0 ':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:114: undefined reference to `esp_bt_gap_resolve_eir_data'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `get_name_from_eir':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:118: undefined reference to `esp_bt_gap_resolve_eir_data'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `.L0 ':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:413: undefined reference to `esp_bt_gap_cancel_discovery'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `esp_bt_gap_cb':
D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:415: undefined reference to `esp_spp_start_discovery'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:477: undefined reference to `esp_bt_gap_pin_reply'
d:/tools/arduino/hardware/espressif/arduino-esp32/tools/riscv32-esp-elf/bin/../lib/gcc/riscv32-esp-elf/8.4.0/../../../../riscv32-esp-elf/bin/ld.exe: D:\Tools\Arduino\hardware\espressif\arduino-esp32\libraries\BluetoothSerial\src/BluetoothSerial.cpp:485: undefined reference to `esp_bt_gap_ssp_confirm_reply'
collect2.exe: error: ld returned 1 exit status
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Metadata
Metadata
Assignees
Labels
Status: SolvedThe issue has been resolved and requires no further action.The issue has been resolved and requires no further action.Type: For referenceCommon questions & problemsCommon questions & problemsType: QuestionOnly questionOnly question