How to use framwork=arduino, espidf?

Hi,

what is wrong here?

Resolving esp32s3_120_16_8-qio_opi dependencies...
Already up-to-date.
Updating metadata for the vscode IDE...
UserSideException: Processing esp32s3_120_16_8-qio_opi (board: esp32s3_120_16_8-qio_opi; platform: https://github.com/pioarduino/platform-espressif32/archive/refs/tags/53.03.13.zip; framework: arduino, espidf)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32s3_120_16_8-qio_opi.html
PLATFORM: Espressif 32 (53.3.13) > ESP32-S3 16MB QIO, 8MB OPI PSRAM
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, 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.1.3 
 - framework-arduinoespressif32-libs @ 5.3.0+sha.489d7a2b3a 
 - framework-espidf @ 3.50302.0 (5.3.2) 
 - tool-cmake @ 3.30.2 
 - tool-esptoolpy @ 4.8.6 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 14.2.0+20240403 
 - tool-xtensa-esp-elf-gdb @ 14.2.0+20240403 
 - toolchain-esp32ulp @ 1.23800.240113 (2.38.0) 
 - toolchain-riscv32-esp @ 13.2.0+20240530 
 - toolchain-xtensa-esp-elf @ 13.2.0+20240530
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32s3
Processing 11 dependencies:

[1/11] chmorgan/esp-libhelix-mp3 (1.0.3)

[2/11] espressif/cbor (0.6.0~1)

[3/11] espressif/esp-dsp (1.4.12)

[4/11] espressif/esp-sr (1.9.5)

[5/11] espressif/esp-zboss-lib (1.6.0)

[6/11] espressif/esp-zigbee-lib (1.6.0)

[7/11] espressif/esp_modem (1.3.0)

[8/11] espressif/mdns (1.7.0)

[9/11] espressif/network_provisioning (1.0.2)

[10/11] joltwallet/littlefs (1.17.0)

[11/11] idf (5.3.2)

-- Project sdkconfig file C:/Users/Czarek/Documents/PlatformIO/Projects/Test_ESP32_S3/sdkconfig.esp32s3_120_16_8-qio_opi
-- Compiler supported targets: xtensa-esp-elf
-- App "Test_ESP32_S3" version: 1
-- Adding linker script C:/Users/Czarek/Documents/PlatformIO/Projects/Test_ESP32_S3/.pio/build/esp32s3_120_16_8-qio_opi/esp-idf/esp_system/ld/memory.ld
-- Adding linker script C:/Users/Czarek/Documents/PlatformIO/Projects/Test_ESP32_S3/.pio/build/esp32s3_120_16_8-qio_opi/esp-idf/esp_system/ld/sections.ld.in
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.api.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.bt_funcs.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.libgcc.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.wdt.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.version.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/esp_rom/esp32s3/ld/esp32s3.rom.newlib.ld
-- Adding linker script C:/Users/Czarek/.platformio/packages/framework-espidf/components/soc/esp32s3/ld/esp32s3.peripherals.ld
-- Configuring incomplete, errors occurred!

fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/Czarek/.platformio/packages/framework-arduinoespressif32/CMakeLists.txt:371 (message):
  esp32-arduino requires CONFIG_FREERTOS_HZ=1000 (currently 100)



========================== [FAILED] Took 7.27 seconds ==========================
[env:esp32s3_120_16_8-qio_opi]
;platform = espressif32
board = esp32s3_120_16_8-qio_opi
monitor_speed = 115200
platform=https://github.com/pioarduino/platform-espressif32/archive/refs/tags/53.03.13.zip ; Arduino 3.1.3 IDF 5.3.2
framework = arduino, espidf
lib_deps = 
	adafruit/Adafruit GFX Library@^1.12.0
	adafruit/Adafruit ILI9341@^1.6.1
	https://github.com/tzapu/WiFiManager
  	https://github.com/schreibfaul1/ESP32-audioI2S
	https://github.com/ESP32Async/AsyncTCP
	https://github.com/ESP32Async/ESPAsyncWebServer

this is wrong:

Either change the framework back to “arduino” or setup the “Arduino as ESP-IDF component” project correctly.

The question is, why did you make this change and what do you want to acheive?

Hi @sivar2311. I’m trying to follow this advise: [I2S not initialized after updating the Arduino ESP core to version 3.1.2 · Issue #975 · schreibfaul1/ESP32-audioI2S · GitHub](https://ESP32-audioI2S DMA Issue)

Create a brand new “Arduino as ESP-IDF component” project. Let Platformio finish all tasks to setup the project properly. Then start implementing your project files.

Unfortunately, I see no option to create a new Arduino as ESP-IDF component project in my PlatformIO.

Is there any detailed manual how to do that? I was looking for it, but didn’t get anything helpful…

Unfortunately there is no option in the wizard.
Create a new, blank Arduino project.
Then edit the platformio.ini and change the framework to arduino, espidf.
Save the platformio.ini and wait until platformio setup everything.

Some steps forward, but still some issues preventing from success :slight_smile:

Platformio.ini:

[env:esp32s3_120_16_8-qio_opi]
monitor_speed = 115200
platform = espressif32
board = esp32s3_120_16_8-qio_opi
framework = arduino, espidf
lib_deps = 
	adafruit/Adafruit GFX Library@^1.12.0
	adafruit/Adafruit ILI9341@^1.6.1
	https://github.com/tzapu/WiFiManager
  	https://github.com/schreibfaul1/ESP32-audioI2S
	https://github.com/ESP32Async/AsyncTCP
	https://github.com/ESP32Async/ESPAsyncWebServer

CMakeLists.txt:

cmake_minimum_required(VERSION 3.16.0)
project(Internet_Radio)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)

Build errors:

Replace: CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
 with: CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Configuring incomplete, errors occurred!

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  cmake_minimum_required() should be called prior to this top-level project()
  call.  Please see the cmake-commands(7) manual for usage documentation of
  both commands.
This warning is for project developers.  Use -Wno-dev to suppress it.

**CMake Error in CMakeLists.txt:**
**  No CMAKE_C_COMPILER could be found.**

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


**CMake Error in CMakeLists.txt:**
**  No CMAKE_CXX_COMPILER could be found.**

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


You should have 2 auto generated CMakeList.txt files:

./CMakeLists.txt:

cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(test)

./src/CMakeLists.txt:

# This file was automatically generated for projects
# without default 'CMakeLists.txt' file.

FILE(GLOB_RECURSE app_sources ${CMAKE_SOURCE_DIR}/src/*.*)

idf_component_register(SRCS ${app_sources})

You should do this step by step! Remove these lib_deps and start with a simple “Hello World” program using Arduino as ESP-IDF component to get familiar with this.

If your Hello World program runs, start implementing your real project.
There might be some other cumbersomes waiting for you :wink:

The next error you should see is
esp32-arduino requires CONFIG_FREERTOS_HZ=1000 (currently 100)

You have to run menuconfig or edit the sdkconfig an change

CONFIG_FREERTOS_HZ=100

to

CONFIG_FREERTOS_HZ=1000

Thanks! I’ve already found it and modified :slight_smile:

OK, my program:

#include <Arduino.h>

void setup() {
   
}


void loop()
{
  delay(100);
}

gives me:

Processing esp32s3_120_16_8-qio_opi (platform: espressif32; board: esp32s3_120_16_8-qio_opi; framework: arduino, espidf)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32s3_120_16_8-qio_opi.html
PLATFORM: Espressif 32 (53.3.13+sha.15e5639) > ESP32-S3 16MB QIO, 8MB OPI PSRAM
HARDWARE: ESP32S3 240MHz, 320KB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-builtin, 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.1.3 
 - framework-arduinoespressif32-libs @ 5.3.0+sha.489d7a2b3a 
 - framework-espidf @ 3.50302.0 (5.3.2) 
 - tool-cmake @ 3.30.2 
 - tool-esptoolpy @ 4.8.6 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.9.0 
 - tool-riscv32-esp-elf-gdb @ 14.2.0+20240403 
 - tool-xtensa-esp-elf-gdb @ 14.2.0+20240403 
 - toolchain-esp32ulp @ 1.23800.240113 (2.38.0) 
 - toolchain-riscv32-esp @ 13.2.0+20240530 
 - toolchain-xtensa-esp-elf @ 13.2.0+20240530
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
Warning! Flash memory size mismatch detected. Expected 16MB, found 2MB!
Please select a proper value in your `sdkconfig.defaults` or via the `menuconfig` target!
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 55 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Adafruit GFX Library @ 1.12.0
|-- Adafruit ILI9341 @ 1.6.1
|-- WiFiManager @ 2.0.17+sha.b67b782
|-- ESP32-audioI2S @ 3.0.13+sha.b664b97
|-- AsyncTCP @ 3.3.6+sha.ad8b0ba
|-- ESPAsyncWebServer @ 3.7.1+sha.d5aa208
Building in release mode
Compiling .pio\build\esp32s3_120_16_8-qio_opi\src\main.cpp.o
*** [.pio\build\esp32s3_120_16_8-qio_opi\.pio\build\esp32s3_120_16_8-qio_opi\https_server.crt.S.o] Source `.pio\build\esp32s3_120_16_8-qio_opi\https_server.crt.S' not found, needed by target `.pio\build\esp32s3_120_16_8-qio_opi\.pio\build\esp32s3_120_16_8-qio_opi\https_server.crt.S.o'.
======================================================================================= [FAILED] Took 5.02 seconds =======================================================================================
[env:esp32s3_120_16_8-qio_opi]
monitor_speed = 115200
platform = espressif32
board = esp32s3_120_16_8-qio_opi
framework = arduino, espidf
lib_deps = 
	adafruit/Adafruit GFX Library@^1.12.0
	adafruit/Adafruit ILI9341@^1.6.1
	https://github.com/tzapu/WiFiManager
  	https://github.com/schreibfaul1/ESP32-audioI2S
	https://github.com/ESP32Async/AsyncTCP
	https://github.com/ESP32Async/ESPAsyncWebServer

There seems to be an incompatibility with the component manager and pioarduino’s hybrid compile feature.

Please ask at pioarduino for further help.
Either open an issue or ask via their discord server.

ok. Thanks for your help and guidance.

No pioarduino issue. Since Arduino core forces (via the placed yml file) Rainmaker components install the Rainmaker setup needs to be statisfied.

add to your platformio.ini

board_build.embed_txtfiles =
    managed_components/espressif__esp_insights/server_certs/https_server.crt
    managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt
    managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
    managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt

See example platform-espressif32/examples/espidf-arduino-littlefs at main · pioarduino/platform-espressif32 · GitHub

1 Like

Sorry for the misinformation and thanks for the correction :slight_smile:

With Jason2866’s help, this configuration should work for you:

platformio.ini

[env:esp32s3_120_16_8-qio_opi]
platform = espressif32
board = esp32s3_120_16_8-qio_opi
framework = arduino, espidf
board_build.embed_txtfiles =
  managed_components/espressif__esp_insights/server_certs/https_server.crt
  managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt
  managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
  managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt

Edits in sdkconfig:

CONFIG_FREERTOS_HZ=1000
CONFIG_AUTOSTART_ARDUINO=y

Thanks! I’ve overcame this issue this way:

[env]
;platform=https://github.com/pioarduino/platform-espressif32/archive/refs/tags/53.03.13.zip
;platform = https://github.com/pioarduino/platform-espressif32.git#main
platform=espressif32
framework = arduino, espidf
build_flags = -DCORE_DEBUG_LEVEL=3 ; 0 None, 1 Error, 2 Warn, 3 Info, 4 Debug, 5 Verbose
              -DBOARD_HAS_PSRAM
              -mfix-esp32-psram-cache-issue
monitor_speed = 115200
board_build.filesystem = littlefs
board_build.partitions = boards/default_16MB.csv   ; 16MB Flash

custom_component_remove = espressif/esp_hosted
                          espressif/esp_wifi_remote
                          espressif/esp-dsp
                          espressif/esp32-camera
                          espressif/libsodium
                          espressif/esp-modbus
                          espressif/qrcode
                          espressif/esp_insights
                          espressif/esp_diag_data_store
                          espressif/esp_diagnostics
                          espressif/esp_rainmaker
                          espressif/rmaker_common

lib_deps = 
	adafruit/Adafruit GFX Library@^1.12.0
	adafruit/Adafruit ILI9341@^1.6.1
	https://github.com/tzapu/WiFiManager
  	https://github.com/schreibfaul1/ESP32-audioI2S
	https://github.com/ESP32Async/AsyncTCP
	https://github.com/ESP32Async/ESPAsyncWebServer


[env:ESP32-S3-DevKitC-1-N16R8]
board = ESP32-S3-DevKitC-1-N16R8

Currently, the only issue is I can’t get PSRAM to get worked :frowning:


----------------------------------
ESP32 Chip: ESP32-S3
Arduino Version: 3.2.0
ESP-IDF Version: 5.4.0
ARDUINO_LOOP_STACK_SIZE 8192 words (32 bit)
PSRAM SIZE 0
----------------------------------

Regarding your board ESP32-S3-DevKitC-1-N16R8 you need to change these settings:

CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y

Result:

SPIRAM Memory Info:
------------------------------------------
  Total Size        :  8388608 B (8192.0 KB)
  Free Bytes        :  8385720 B (8189.2 KB)
  Allocated Bytes   :      576 B (   0.6 KB)
  Minimum Free Bytes:  8385720 B (8189.2 KB)
  Largest Free Block:  8257536 B (8064.0 KB)
  Bus Mode          : OPI
------------------------------------------

Please note that this is a pre release, not a stable version. See Release Arduino Pre-Release v3.2.0-RC1 based on ESP-IDF v5.4 · espressif/arduino-esp32 · GitHub

Job done :slight_smile: Thanks!

----------------------------------
ESP32 Chip: ESP32-S3
Arduino Version: 3.2.0
ESP-IDF Version: 5.4.0
ARDUINO_LOOP_STACK_SIZE 8192 words (32 bit)
PSRAM SIZE 8388608
----------------------------------

audio_info: PSRAM found, inputBufferSize: 638965 bytes
audio_info: buffers freed, free Heap: 198375 bytes
audio_info: connect to: "s0.radiohost.pl" on port 8018 path "/stream"
audio_info: Connection has been established in 71 ms, free Heap: 197463 bytes
audio_info: MP3Decoder has been initialized, free Heap: 189007 bytes , free stack 4408 DWORDs
audio_info: stream ready
audio_info: syncword found at pos 0
audio_info: MPEG-2.5, Layer I
audio_info: Channels: 2
audio_info: SampleRate: 44100
audio_info: BitsPerSample: 16
audio_info: BitRate: 256000
audio_info: StreamTitle='Fancy - Flames Of Love (Extended Version)
1 Like