Unsupported platform, currently running on that platform

I got a BLE peripheral to work yesterday on a WeMos Mini/32. It is currently running on a WeMos. I see it in my BLE scanner.
Actually, I see two of my devices, so this program is running on both. The script stopped being acceptable.

Got this error:

Processing wemos_d1_mini32 (platform: espressif32; board: wemos_d1_mini32; framework: arduino)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/wemos_d1_mini32.html
PLATFORM: Espressif 32 1.12.4 > WeMos D1 MINI ESP32
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.10004.200129 (1.0.4)
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-mkspiffs 2.230.0 (2.30) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 53 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <BLEPeripheral> 0.3.1
|-- <ESP32 BLE Arduino> 1.0.1
Building in release mode
Compiling .pio\build\wemos_d1_mini32\src\main.cpp.o
Generating partitions .pio\build\wemos_d1_mini32\partitions.bin
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLEAttribute.cpp.o
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLEBondStore.cpp.o
C:\Users\joema\.platformio\lib\BLEPeripheral\src\BLEBondStore.cpp:9:4: warning: #warning "BLEBondStore persistent storage not supported on this platform" [-Wcpp]
   #warning "BLEBondStore persistent storage not supported on this platform"
    ^
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLECentral.cpp.o
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLECharacteristic.cpp.o
In file included from C:\Users\joema\.platformio\lib\BLEPeripheral\src/utility/lib_aci.h:34:0,
                 from C:\Users\joema\.platformio\lib\BLEPeripheral\src\nRF8001.h:9,
                 from C:\Users\joema\.platformio\lib\BLEPeripheral\src\BLEPeripheral.h:26,
                 from C:\Users\joema\.platformio\lib\BLEPeripheral\src\BLECentral.cpp:6:
C:\Users\joema\.platformio\lib\BLEPeripheral\src/utility/hal_platform.h:75:6: error: #error "Unsupported platform"
     #error "Unsupported platform"
      ^
*** [.pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLECentral.cpp.o] Error 1
==================================================================================================== [FAILED] To
/*
    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(9600);
  Serial.println("Starting BLE work!");

  BLEDevice::init("Monster Laboratories");
  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);
}
; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino

This is the problem:

Check the file mentioned, at the line and column listed:

C:\Users\joema.platformio\lib\BLEPeripheral\src\BLEBondStore.cpp:9:4

and you most likely will see a #warning line.

I suspect that above that warning will be a few tests to make sure that you are running on a supported device. You apparently are not.

This is not a message from PlatformIO, but from a library/source file.

Cheers,
Norm.

1 Like

That library doesn’t support the espressif32 platform, hence the warnings and errors from the library.

image

This sucks. Now the hobby is all about clicking folders open? This library is apparently in every published example, even the ones that claim to be ESP32 friendly.

I’ve gotten a few scripts to work, basically, but now I’ve got so many folders it makes me carsick.

What do you do to keep your thousands of folders organized?

I’m not following you here I’m afraid. Your device isn’t supported by the library you are using. I don’t use your device, so I might be offbase here, but is this library any use? PlatformIO Registry.

It is specifically for Espressif32.

Puzzled again. Why do you have do many folders? Are you downloading libraries manually instead of using the PlatformIO tools?

Cheers,
Norm.

PlatformIO Registry.
This is one of the versions this Kolban guy wrrote. I’ve used this one and the one that says “Neil Say Hello World”. The latter worked, before the platform became incompatible.

Libraries were really black boxes at Arduino. All you had to know is that you downloaded it. Now I’m going back over all the BLE failures I’ve had (all the folders) and it’s all platform problems. That’s not how I remember it. I know I’ve uploaded that example (Neil Says Hello World), and I know it worked, and I don’t have any other way to make bluetooth happen. I haven’t really worked with the HC-06 yet. So I got bluetooth to happen with these files. And now the platform doesn’t work?

I don’t have notes. It’s entirely possible it was a file I can’t find for some reason.1 I don’t have a record of the filenames I’m using in a particular session. But I’ve only seen a few ways of starting a bluetooth script.
I really have to scorch the earth and start a new folder. But that messes everything up.

I have another question about the workspace in PIO, but that’s a new post.

“Why do you have do many folders?”
I’ve had to manually download a handful of libraries that aren’t in the PIO list, but I’m talking about projects.

There’s a new folder every time you create a new main, one for every single file. Each of these programs is six folders (three empty) and one .cpp file? Just feels off.

If you look at what PlatformIO and the compiler are telling you (e.g.)

Dependency Graph
|-- <BLEPeripheral> 0.3.1
|-- <ESP32 BLE Arduino> 1.0.1
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLEBondStore.cpp.o
C:\Users\joema\.platformio\lib\BLEPeripheral\src\BLEBondStore.cpp:9:4: warning: #warning "BLEBondStore persistent storage not supported on this platform" [-Wcpp]
   #warning "BLEBondStore persistent storage not supported on this platform"
    ^
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLECentral.cpp.o
Compiling .pio\build\wemos_d1_mini32\libdec\BLEPeripheral\BLECharacteristic.cpp.o
In file included from C:\Users\joema\.platformio\lib\BLEPeripheral\src/utility/lib_aci.h:34:0,
                 from C:\Users\joema\.platformio\lib\BLEPeripheral\src\nRF8001.h:9,
                 from C:\Users\joema\.platformio\lib\BLEPeripheral\src\BLEPeripheral.h:26,
                 from C:\Users\joema\.platformio\lib\BLEPeripheral\src\BLECentral.cpp:6:
C:\Users\joema\.platformio\lib\BLEPeripheral\src/utility/hal_platform.h:75:6: error: #error "Unsupported platform"
     #error "Unsupported platform"

you will see the source of the problem.

You are using global library storage - C:\Users\joema\.platformio\lib\ - and you have a library in that folder that is not compatible with the ESP32 / espressif32 platform. That library is BLEPeripheral, which is the first one listed in the dependency graph. All the warnings and errors are comming from that library. This is why you should NOT be using global library storage - as if you install incompatiable libraries to there, it will break your compiles.

If you must, use the lib_extra_dirs configuration option and point to a folder containing libraries, but it will probably cause you grief like this in the future. Learn how to use the lib_deps parameter in your platformio.ini. This will then ensure ONLY the libraries that your project need will be used, and even only specific versions if that is needed. If you need a library that isn’t in the PIO Library Registry, but is available as a zip file, or on GitHub, etc, you can reference that as well, so for 99% of your library needs, you shouldn’t need to download anything.

re: folder organisation, I have a main Projects folder. Since I work with different architecture boards, it’s then broken up - atmelAvr, espressif8266, espressif32, stm32, etc. Then the various projects I’m working on live under there. To group projects (i.e. I have several DIY ‘smart home’ esp8266 projects I’m working on at the moment), I use workspaces - see that other topic you opened to follow that particular squirrel.

When you create a new project in PlatformIO, it does create several folders that you may not use, and can safely delete. i.e. if you aren’t using / don’t know what unit testing is, you can delete the test folder. If you’re not using GIT to manage your source code, you can delete the .gitignore file in the root of the project. If you don’t have a custom private library you need to add to a project, you can delete the lib folder. I think the include folder needs to stay (IIRC PlatformIO will either give an error, or just create it if it’s missing).

Once you know what you’re doing, you can create a project simply by creating an empty folder, putting a platformio.ini with the platform, framework and board specifies, and then create a src subfolder and put your main.cpp in it. You can even do away with the src subfolder, but I wouldn’t advise going that that particular rabbit hole just yet - baby steps :wink:

I’ve been putting the out-of-system libraries in the project’s /lib folder. There is no way to add them to PIO, is there?

I just re-emptied the users/ lib folder and the file compiled.

Thanks again.

1 Like

Hence the link to the documentation for lib_deps above! :wink:

I have a growing libraries folder. It’s been useful for examples, and I don’t usually have to download them again. If PIO doesn’t have it, I check my folder.