Im trying to compile this code:
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
// See the following for generating UUIDs:
// https://www.uuidgenerator.net/
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
BLEDevice::init("MyESP32");
BLEServer *pServer = BLEDevice::createServer();
BLEService *pService = pServer->createService(SERVICE_UUID);
BLECharacteristic *pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic::PROPERTY_READ |
BLECharacteristic::PROPERTY_WRITE
);
pCharacteristic->setValue("Hello World says Neil");
pService->start();
// BLEAdvertising *pAdvertising = pServer->getAdvertising(); // this still is working for backward compatibility
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();
pAdvertising->addServiceUUID(SERVICE_UUID);
pAdvertising->setScanResponse(true);
pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue
pAdvertising->setMinPreferred(0x12);
BLEDevice::startAdvertising();
Serial.println("Characteristic defined! Now you can read it in your phone!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(2000);
}
Im getting this error:
during GIMPLE pass: profile_estimate
/home/panchines/.arduino15/packages/esp32/hardware/esp32/3.0.5/libraries/BLE/src/BLEClient.cpp: In member function 'void std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_construct_node(_Link_type, _Args&& ...) [with _Args = {std::pair<BLERemoteService*, short unsigned int>}; _Key = BLERemoteService*; _Val = std::pair<BLERemoteService* const, short unsigned int>; _KeyOfValue = std::_Select1st<std::pair<BLERemoteService* const, short unsigned int> >; _Compare = std::less<BLERemoteService*>; _Alloc = std::allocator<std::pair<BLERemoteService* const, short unsigned int> >]':
/home/panchines/.arduino15/packages/esp32/hardware/esp32/3.0.5/libraries/BLE/src/BLEClient.cpp:583:1: internal compiler error: Segmentation fault
583 | } // toString
| ^
0x75c17104251f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x75c171029d8f __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x75c171029e3f __libc_start_main_impl
../csu/libc-start.c:392
exit status 1
Compilation error: exit status 1
Thanks!