How can I create a new component using the ESP-IDF framework in PlatformIO?

Yes, so after some further investigation the issue seems to be related to the ESP32-S2 board currently not supporting the Arduino framework. I understand that you probably are not having the same issue and are just trying to help troubleshoot so I will be leaving some information below for anyone else who visits this thread.

Also, forgive me if I am not uploading my project files here. I have a bunch of dummy project files in my project’s directory now from just trying to troubleshoot this thing and I do not want to go back and find the specific one with which we were discussing :smile:

Using the Esp32Dev board definition will not work with the ESP32-S2-Saola (and as far as I know, any other ESP-S2 board). It will fail to build/flash. Instead, you must use the ESP32-Saola-1 board definition and either use the espidf framework or a workaround that I found to get the arduino framework working.

The following platformio configuration snippit will get the Arduino framework working for this board. However, I encourage you to briefly read this thread where it originated from.

platformIO.ini

[env:esp32-s2-saola-1]
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-idf-v4.2
board = esp32-s2-saola-1
framework = arduino

It is not bug-free from what I understand. I haven’t played around with it enough to find anything wrong yet though. Just make sure that your source file is in .ino format. Once you have the Arduino.h header, main.ino and your normal setup() and loop() functions implemented, it will build just fine. I can even include libraries now and their own dependencies on the Arduino core framework seem to be linking and building just fine now.

This is a relief since I needed this framework for most of the features in my project. However considering the esp32-s2 board is almost 1.5 years old now, I’d expect something like this to be integrated into the PlatformIO pluggin or at least offer a ‘beta’ of the framework when initializing the project. It creates a lot of difficulties for the end user which takes more time researching, slows down development, and creates a lot of confusion. The point of platformIO is to make things easier for these microcontrollers, not more difficult. Although I suppose I can’t criticize too much-- since at least there is a workaround and overall the pluggin is pretty great. :wink: