I have a ESP32 (TinyPico – not S2) project that uses Arduino but needs some sdkconfig changes that don’t seem to be available in IDF 3.3. Thanks for the link. I tried briefly and it’s not picking up my local xtensa toolchain for some reason. But sounds like here be dragons right?
In general if people need to make sdkconfig changes for their project I imagine they switch to using esp-idf directly right? Doesn’t seem like that’s very supported by esp32-arduino & platformio.
Though if you are able to stand-alone recompile the libraries for a standard core version (e.g. 2.0.0) and you can get a standard 2.0.0 core version to work using the link above, your method of overwriting the precompiled libraries should work.
You nailed it – that was my problem. Thank you. I get the same result as you now.
Very interesting, so with this example, since the platformio.ini specifies framework = arduino, espidf It will rebuild framework-arduinoespressif32 using the included sdkconfig.defaults file as overrides? And it all just magically works?
But nobody has this working yet right? Your post is the closest anyone’s gotten?
If it works, yes. It is basically an ESP-IDF project that has the Arduino-ESP32 added to it via a component. Doing so is not a magic trick only PlatformIO can do, it’s intended usage per regular ESP-IDF docs. In fact you should be able to use regular native ESP-IDF tooling to also achieve your “Use custom ESP-IDF config with Arduino-ESP32 2.0.0” goal.
If have not yet attempted to recompile libraries used in, e.g., the current master branch of Arduino-ESP32 or the 2.0.0 branch. My last experiences with GitHub - espressif/esp32-arduino-lib-builder were traumatizing enough – unclear configuration (regarding the exact ESP-IDF version that is expected by a certain Arduino-ESP32 branch), bugs during execution, etc. Maybe things are better now though.
Ok here’s what worked for me (with irrelevant bits removed). The build_flags thing tripped me up a bit. I guess the espidf-arduino-blink example can get away without them because it’s stupid simple?
[env]
platform = espressif32@3.3.2 # ESP-IDF 4.3.1
framework =
arduino
espidf
platform_packages =
framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
board = esp32dev
# These need to mirror the ones used by PlatformIO when building for Arduino
# https://github.com/marcovannoord/arduino-esp32/blob/idf-release/v4.0/tools/platformio-build.py#L101
build_flags =
-D ESP32
-D ESP_PLATFORM
-D MBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"
-D ARDUINO=10805
-D ARDUINO_ARCH_ESP32
I also tried some other SHAs of arduino-esp32 from the last few months since that release/v4.0 branch is from Sep 30, 2020 but I wasn’t able to find one that would work with the latest PlatformIO ESP-IDF (4.3.1). I guess we just wait until ESP-IDF 4.4 is marked stable and the PlatformIO espressif32 library gets updated and then we can use arduino-esp32 v2.0.0? @maxgerhardt does that all line up with your understanding of things?
Thank you. You are my hero. I got my Wemos S2 Mini to compile and load. Were you able to use the S2 built it USB? /dev/ttyAMC0 disappears after flashing my app. I know the app is running because the wifi AP shows up. The problem is I print the AP’s ip address out on Serial1. Also, Serial2 isn’t defined.
I found a few references that say the USB Serial doesn’t work in the Arduino framework so I gave up. I found an Adafruit FTDI Friendly USB to serial converter in my junk drawer and configured the UART pins with Serial1.begin method. I’m all good to go and am a happy man. Serial2 isn’t defined because my board only has two UARTs 0 and 1. Thanks again!