Best approach today to running Arduino libraries with ESP-IDF?

It’s now September 2023 and I’ve spent the last month trying to find a simple and reliable way to move my platformio/arduino esp projects to the esp-idf so I can have both the benefits of getting deep into things like ULP and wake stubs using espressif idf while bringing along my many years investment in the arduino framework under platformio.

Everything I read is several years old and many things have broken since then. For example, the “Arduino as a component” option has been broken since the esp-idf move to release 5+ (over nine months now). Finding the right combination of revisions of libraries to make this work has eluded me.

So… the question… What is the right/best way to approach this today. Again, I want to use Platformio, Espressif-idf (with all its example code), and bring along all my investment in arduino code.

Thanks.

I don’t know if this is ‘the right way’ but I would just forget about Arduino and rewrite the IO dependencies based on ESP IDF. What kind of I/O do you use in your code? Do you have Arduino dependencies other than I/O related?

Zapta,
I use lots of libraries that use lots of arduino-based libraries. For example:

    adafruit/Adafruit NeoPixel@^1.10.6
rlogiacco/CircularBuffer@^1.3.3
wollewald/ADS1220_WE@^1.0.13
otadrive/OTAdrive@^1.1.10
bblanchon/ArduinoJson@^6.21.1
   northernwidget/DS3231@^1.1.2
   arduino-libraries/NTPClient@^3.2.1
   tobiasschuerg/ESP8266 Influxdb@^3.13.0
   vshymanskyy/TinyGSM@^0.11.5
   vshymanskyy/StreamDebugger@^1.0.1
   otadrive/OTAdrive@^1.1.10
   bodmer/TFT_eSPI@^2.3.67
   Button2@1.0.0
   enjoyneering/AHT10@^1.1.0
   thijse/ArduinoLog@^1.1.1
   knolleary/PubSubClient@^2.8
   stevemarple/SoftWire@^2.0.4
   stevemarple/AsyncDelay@^1.1.2
   greiman/SSD1306Ascii@^1.3.2
   adafruit/Adafruit GFX Library@^1.10.2
   adafruit/Adafruit-TFT-LCD@0.0.0-alpha+sha.9b701b6d5a
    sensirion/Sensirion I2C SEN5X@^0.2.0
moononournation/GFX Library for Arduino@^1.2.3
heltecautomation/Heltec ESP32 Dev-Boards@^1.1.1
    bitbucket-fmalpartida/LiquidCrystal@^1.5.0

What this comes down to for me is…

  1. Arduino as a component does not work with current releases
  2. Should I use
platform = espressif32
framework = arduino, espidf

OR

platform = espressif32
framework = arduinoespressif32

OR something else?

I made the same move as you, for similar reasons, earlier this year. I also use some of those arduino-based libraries. framework =espidf, arduino.

You’ll also need a CMakeLists.txt file and probably an sdkconfig.defaults in your project root.

I don’t remember it being too hard to make the switch but if you hit issues do post them and I’ll see if it jogs my memory!