This board [esp32dev] doesn't support espdif framework!

I am having general struggles with PlatformIO. I’ll have something working for awhile, then, inexplicably, something trivial that should work (e.g., a build of a simple program) fails.

Here’s my latest struggle.

I have a simple light flash with BLE program that runs on an ESP32-DevKitC-32E board. My platformio.ini has this:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espdif
monitor_speed = 115200
lib_extra_dirs = ~/Documents/Arduino/libraries

The source just includes these headers at the top:

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

When I attempt to build, I get the following error almost immediately:

rocessing esp32dev (platform: espressif32; board: esp32dev; framework: espdif)
-----------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
Error: This board doesn't support espdif framework!
========================================================= [FAILED] Took 0.74 seconds =========================================================
The terminal process "C:\Users\mdbra\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'esp32dev'" terminated with exit code: 1.

I tried completely removing and re-installing PlatformIO but that did not get rid of the problem.

What I really want to use for framweork is ‘arduino’, but this is what I was getting when I set framwork to ‘arduino’. What I need to use is the ESP32 library for BLE but Arduino framework. This was previously working for me.

Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 3.10006.210326 (1.0.6)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 50 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <ArduinoBLE> 1.2.0
|-- <ESP32 BLE Arduino> 1.0.1
|-- <TaskJockey> 0.1.0
Building in release mode
Compiling .pio\build\esp32dev\src\main.cpp.o
Generating partitions .pio\build\esp32dev\partitions.bin
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLEAdvertisingData.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLECharacteristic.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLEDescriptor.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLEDevice.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLEService.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLEStringCharacteristic.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\BLETypedCharacteristics.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\local\BLELocalAttribute.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\local\BLELocalCharacteristic.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\local\BLELocalDescriptor.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\local\BLELocalDevice.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\local\BLELocalService.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\remote\BLERemoteAttribute.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\remote\BLERemoteCharacteristic.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\remote\BLERemoteDescriptor.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\remote\BLERemoteDevice.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\remote\BLERemoteService.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\ATT.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\BLEUuid.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\GAP.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\GATT.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\HCI.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\HCICordioTransport.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\HCIUartTransport.cpp.o
Compiling .pio\build\esp32dev\lib7e4\ArduinoBLE\utility\L2CAPSignaling.cpp.o
Compiling .pio\build\esp32dev\lib070\BLE\BLE2902.cpp.o
Compiling .pio\build\esp32dev\lib070\BLE\BLE2904.cpp.o
C:\Users\mdbra\Documents\Arduino\libraries\ArduinoBLE\src\utility\HCIUartTransport.cpp:33:2: error: #error "Unsupported board selected!"
 #error "Unsupported board selected!"
  ^
C:\Users\mdbra\Documents\Arduino\libraries\ArduinoBLE\src\utility\HCIUartTransport.cpp:99:40: error: 'SerialHCI' was not declared in this scope HCIUartTransportClass HCIUartTransport(SerialHCI, 912600);
                                        ^
*** [.pio\build\esp32dev\lib7e4\ArduinoBLE\utility\HCIUartTransport.cpp.o] Error 1
========================================================= [FAILED] Took 24.03 seconds =========================================================The terminal process "C:\Users\mdbra\.platformio\penv\Scripts\platformio.exe 'run', '--environment', 'esp32dev'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

This program was building for me using the arduiino framework previously. I’m not sure what changed which would cause this error.

There is no espdif framework, only espidf. Espressif IoT Development Framework.

Remove this line and use explicit dependency declaration and use explicit dependency declarations with lib_deps and libraries listed in PlatformIO Registry. The libraries in this folder overshadow the actually needed libraries, and so this

from

gets included (GitHub - arduino-libraries/ArduinoBLE: ArduinoBLE library for Arduino), which is meant for

Arduino MKR WiFi 1010, Arduino UNO WiFi Rev.2, Arduino Nano 33 IoT, and Arduino Nano 33 BLE.

Not the ESP32.

In this case the ESP32 BLE library is built in so you do not need to delcare that one. The other TaskJockey library seems to be external though, so if it isn’t already in the lib/ folder of the project, you’ll need to use lib_deps to include it.

@maxgerhardt thanks for the quick reply.

Sorry about the typo on the framework. I meant espidf.

But to your point about ArduinoBLE… I do know it does not work on ESP32. I’m not trying to use it. The reference to “C:\Users\mdbra\Documents\Arduino\libraries\ArduinoBLE” is not something I put in. It showed up, surprisingly to me, in the build output. I’m trying to use the ESP32 BLE library (thus the includes that are used for that purpose as shown). These, however, seem to be trying to access ArduinoBLE (?). That’s not happened to me previously. I am trying to use some other more generic Arduino libraries, which should work fine on the platform. That’s why I had the lib_extra_dirs which, again, has worked fine for this purpose previously.

So I tried using lib_deps = BLE (BLE is a built-in library that uses the headers that I include) and I get an error that it cannot find those header files. Again, this was working for me before with my original platformio.ini file. Not sure what I now have to explicitly set to get it to find the headers.

PlatformIO has included them by scanning the used header files files in your project and comparing that against what can be found in its library search paths, to which you explicitly added

Thus the library was able to be found.

While it is possible to use full paths, and is documented as such, e.g.

lib_deps =
   file://C:\Users\<user>\Documents\Arduino\libraries\SomeLibrary

one should not use this style of declaration if possible, but use the library management via lib_deps instead. This has many advantages:

  • portability: If you distribute the project with hardcoded filepaths specific to your computer, noone else will be able to compile it, unless the configuration is edited manually. Through lib_deps and the available library repository online, it is reproducable.
  • version number explicitibility. When using a harcoded path, it does not reveal what exact version was used for the project. Again, using expressions like bblanchon/ArduinoJson @ ^6.17.3 in the lib_deps makes it 100% clear what version and what source is used, as there could also be many forks of a particular library from many authors

In general I’d recommend reading through Library Management — PlatformIO latest documentation and maybe some online tutorial.

@maxgerhardt thanks for the link. I will read through the library management document.

I had updated my prior post as I did try lib_deps = BLE (which is a built-in ESP32 library) but it didn’t find the headers, which are in the library source folder.

I’ll narrow this down to a single use case and believe I understand the issue. It’s now a matter of finding the correct way to configure it to do what I want.

Here’s a simple BLE program for ESP32 that I copied straight from a tutorial:

/*
    Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleServer.cpp
    Ported to Arduino ESP32 by Evandro Copercini
    updates by chegewara
*/
#include <Arduino.h>

#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!");

  // --- A bunch of ESP32 BLE library related code here ---

  Serial.println("Characteristic defined! Now you can read it in your phone!");
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(2000);
}

Not much going on there. When I use the Arduino IDE 1.8.13, and I set the board to “ESP32 Dev Module”, this code compiles and runs fine.

I prefer the GUI experience in VS Code, so I would like to use PlatformIO. Initially, this was working fine but I don’t know what I changed to cause it to now fail. This identical code is setup in a PlatformIO project folder as main.cpp but otherwise identical. My platformio.ini file is as follows:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps = BLE

This actually compiles fine on PlatformIO.

Here’s where the trouble comes in. There’s another Arduino library I want to use called TaskJockey and it’s in the Arduino libraries folder. This is a custom library I created and installed in my Arduino environment. In order for PlatformIO to recognize it in my code, I put the following in my ini:

lib_extra_dirs = ~/Documents/Arduino/libraries

However, then PlatformIO decides that I have a dependency on the ArduinoBLE library instead of the ESP32 BLE library. This occurs because both the ESP32 and Arduino BLE libraries share some of the same header file names, but they are quite different. So, using lib_deps, I can do the following and it works:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
    BLE
    file://C:\Users\<username>\Documents\Arduino\libraries\TaskJockey

However, I’d like to find a way to do this without the absolute path to every Arduino specific library I want to use.

You can keep the above lib_extra_dirs if you lib_ignore the wrongfully included ones.

You can also

  • place the TaskJockey library in the lib/ directory of the project
  • or, create a new folder with only the ‘good’ libraries you want and point lib_extra_dirs there.

I like that idea. :slight_smile: I tried it and it works great. Very tidy approach.

Interesting choices. I didn’t want to make a redundant copy of the library (I want it in a “central” place).