Debug error on espidf-arduino-wifiscan example

[env]
platform = espressif32
framework = arduino, espidf
monitor_speed = 115200

; [env:esp32dev]
; board = esp32dev

[env:esp-wrover-kit]
board = esp-wrover-kit
build_src_filter = 
    +<*>
    -<C:/Users/JJS/.platformio/packages/framework-espidf/components/mbedtls/*>
    -<C:/Users/JJS/.platformio/packages/framework-espidf/components/nghttp/*>
    -<C:/Users/JJS/.platformio/packages/framework-espidf/components/lwip/*>
    -<C:/Users/JJS/.platformio/packages/framework-espidf/components/freemodbus/*>
  1. I am trying to debug the espidf-arduino-wifiscan example, but I am getting the following error:
undefinedError: Unknown environment names 'esp32dev'. Valid names are 'esp-wrover-kit'
  1. I wrote build_src_filter as above, but it doesn’t seem to be applied. What did I do wrong?
Warning: the 'src_filter' option cannot be used with ESP-IDF. Select source files to build in the project CMakeLists.txt file.
  1. Can I ignore this message? Or do I need to fix something?
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.

Debugging the example program (arduino-espidf-wifiscan) works by modifying the configuration file and launch.json as shown below.

[env]
platform = espressif32
framework = arduino, espidf
monitor_speed = 115200

[env:esp32dev]
board = esp32dev

[env:esp-wrover-kit]
board = esp-wrover-kit
lib_ldf_mode = chain+
debug_tool = ftdi

“projectEnvName”: “esp32dev” → “esp-wrover-kit”

        {
            "type": "platformio-debug",
            "request": "launch",
            "name": "PIO Debug (skip Pre-Debug)",
            "executable": "c:/Users/JJS/Documents/PlatformIO/Projects/221007-090609-espidf-arduino-wifiscan/.pio/build/esp32dev/firmware.elf",
            "projectEnvName": "esp-wrover-kit",
            "toolchainBinDir": "C:/Users/JJS/.platformio/packages/toolchain-xtensa-esp32/bin",
            "internalConsoleOptions": "openOnSessionStart"
        },

But the compilation time is still too long. So, I tried various settings(chain, deep) of lib_ldf_mode, but nothing worked.

LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
  • Arduino.h, WiFi.h, and FreeRTOS.h are included in main.cpp, but I wonder why “No dependency” is displayed.
  • What if I want to exclude libraries in a specific folder from compilation? (e.g. files in the ‘mbedtls’ folder)
Compiling .pio\build\esp-wrover-kit\mbedtls\mbedtls\library\pk.o

You have two build environments in your platformio.ini, does it not work if you select your esp-prover-kit environment in the project environment switcher and then use PIO debug?

1 Like

I forgot to use project environment switcher. Thanks for the useful tip.
I would appreciate it if you could tell me how to selectively compile the library to reduce the compile time.

To exclude components, try using the EXCLUDE_COMPONENTS CMake variable as documented, for example.

1 Like

As I entered the link you told me and studied, it was explained that all variables in the project.cmake file have default values. So where can I check these defaults? For example, where can I find the default values for COMPONENT_DIRS or COMPONENTS_DIRS?