espressif / vscode-esp-idf-extension

Visual Studio Code extension for ESP-IDF projects
Apache License 2.0
1.03k stars 300 forks source link

sdkconfigDefaults configured in esp_idf_project_configuration.json has no effect on build (VSC-1224) #1074

Closed BenMens closed 10 months ago

BenMens commented 11 months ago

OS

MacOS

Operating System version

macOS 12.7

Visual Studio Code version

No response

ESP-IDF version

5.1.1

Python version

1.84.2

Doctor command output

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report --------------------------------------------- OS darwin x64 21.6.0 System environment variable IDF_PYTHON_ENV_PATH undefined System environment variable PATH /usr/local/lib/ruby/gems/3.2.0/bin:/usr/local/opt/ruby/bin:/.nvm/versions/node/v18.10.0/bin:/.jenv/shims:/.jenv/bin:/Applications/apache-maven-3.8.7/bin:/Applications/Docker.app/Contents/Resources/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin System environment variable PYTHON undefined Visual Studio Code version 1.84.2 Visual Studio Code language en Visual Studio Code shell /bin/zsh ESP-IDF Extension version 1.6.5 Workspace folder /development/esp/esp-lvgl ---------------------------------------------------- Extension configuration settings ------------------------------------------------------ ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH} ESP-IDF Path (idf.espIdfPath) /esp/v5.1.1/esp-idf ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH} ESP-Matter Path (idf.espMatterPath) ${env:ESP_MATTER_PATH} Custom extra paths (idf.customExtraPaths) /.espressif/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin:/.espressif/tools/riscv32-esp-elf-gdb/12.1_20221002/riscv32-esp-elf-gdb/bin:/.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin:/.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin:/.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin:/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin:/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin:/.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin:/.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin:/.espressif/tools/ninja/1.10.2:/.espressif/tools/esp-rom-elfs/20230320 Custom extra vars (idf.customExtraVars) OPENOCD_SCRIPTS: /.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/share/openocd/scripts ESP_ROM_ELF_DIR: /.espressif/tools/esp-rom-elfs/20230320/ Virtual env Python Path (idf.pythonBinPath) /.espressif/python_env/idf5.1_py3.11_env/bin/python Serial port (idf.port) /dev/cu.usbserial-0001 OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,target/esp32.cfg ESP-IDF Tools Path (idf.toolsPath) /.espressif Git Path (idf.gitPath) git -------------------------------------------------------- Configurations access ------------------------------------------------------------- Access to ESP-ADF Path (idf.espAdfPath) false Access to ESP-IDF Path (idf.espIdfPath) true Access to ESP-MDF Path (idf.espMdfPath) false Access to ESP-Matter Path (idf.espMatterPath) false Access to ESP-IDF Custom extra paths Access to /.espressif/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin: true Access to /.espressif/tools/riscv32-esp-elf-gdb/12.1_20221002/riscv32-esp-elf-gdb/bin: true Access to /.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin: true Access to /.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin: true Access to /.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin: true Access to /.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin: true Access to /.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin: true Access to /.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin: false Access to /.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin: true Access to /.espressif/tools/ninja/1.10.2: false Access to /.espressif/tools/esp-rom-elfs/20230320: true Access to Virtual env Python Path (idf.pythonBinPath) true Access to CMake in environment PATH true Access to Ninja in environment PATH true Access to ESP-IDF Tools Path (idf.toolsPath) true -------------------------------------------------------- Configurations has spaces ------------------------------------------------------------- Spaces in system environment Path false Spaces in ESP-ADF Path (idf.espAdfPath) false Spaces in ESP-IDF Path (idf.espIdfPath) false Spaces in ESP-MDF Path (idf.espMdfPath) false Spaces in ESP-Matter Path (idf.espMatterPath) false Spaces in ESP-IDF Custom extra paths Spaces in /.espressif/tools/xtensa-esp-elf-gdb/12.1_20221002/xtensa-esp-elf-gdb/bin: false Spaces in /.espressif/tools/riscv32-esp-elf-gdb/12.1_20221002/riscv32-esp-elf-gdb/bin: false Spaces in /.espressif/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin: false Spaces in /.espressif/tools/xtensa-esp32s2-elf/esp-12.2.0_20230208/xtensa-esp32s2-elf/bin: false Spaces in /.espressif/tools/xtensa-esp32s3-elf/esp-12.2.0_20230208/xtensa-esp32s3-elf/bin: false Spaces in /.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin: false Spaces in /.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin: false Spaces in /.espressif/tools/cmake/3.24.0/CMake.app/Contents/bin: false Spaces in /.espressif/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/bin: false Spaces in /.espressif/tools/ninja/1.10.2: false Spaces in /.espressif/tools/esp-rom-elfs/20230320: false Spaces in Virtual env Python Path (idf.pythonBinPath) false Spaces in ESP-IDF Tools Path (idf.toolsPath) false ----------------------------------------------------------- Executables Versions ----------------------------------------------------------- Git version 2.42.0 ESP-IDF version 5.1.1 Python version 3.11.6 Python's pip version 23.3.1 -------------------------------------------------- Project configuration settings ---------------------------------------------------------- Selected configuration: debug

Configuration name: currentProjectConfKey ---- Build section ---- Compile Arguments: Ninja Arguments: Build directory path: SDKConfig defaults : sdkconfig.debug ---- Environment variables section ---- Flash baud rate: IDF Target: Monitor baud rate: ---- OpenOCD section ---- Debug level: 0 Configuration files: Launch arguments: ---- Tasks section ---- Pre build task: Post build task: Pre flash task: Post flash task: -------------------------------------------------- Python packages in idf.pythonBinPath ---------------------------------------------------- bitarray version: 2.8.1 bitstring version: 4.1.2 blinker version: 1.6.2 CacheControl version: 0.13.1 certifi version: 2023.7.22 cffi version: 1.15.1 charset-normalizer version: 3.2.0 click version: 8.0.4 cmake-format version: 0.6.13 cmakelang version: 0.6.13 colorama version: 0.4.6 construct version: 2.10.68 contextlib2 version: 21.6.0 cryptography version: 39.0.2 ecdsa version: 0.18.0 esp-coredump version: 1.7.0 esp-debug-backend version: 1.0.3 esp-idf-kconfig version: 1.4.0 esp-idf-monitor version: 1.3.3 esp-idf-panic-decoder version: 0.1.0 esp-idf-size version: 0.4.3 esptool version: 4.7.dev2 filelock version: 3.12.3 Flask version: 2.1.3 freertos-gdb version: 1.0.2 gcovr version: 6.0 idf-component-manager version: 1.4.1 idna version: 3.4 itsdangerous version: 2.1.2 Jinja2 version: 3.0.3 kconfiglib version: 14.1.0 lxml version: 4.9.3 MarkupSafe version: 2.1.3 msgpack version: 1.0.5 packaging version: 23.2 pip version: 23.3.1 pycparser version: 2.21 pyelftools version: 0.29 pygdbmi version: 0.9.0.2 Pygments version: 2.16.1 pyparsing version: 3.0.9 pyserial version: 3.5 PyYAML version: 6.0.1 reedsolo version: 1.7.0 requests version: 2.31.0 requests-file version: 1.5.1 requests-toolbelt version: 1.0.0 schema version: 0.7.5 setuptools version: 68.2.2 six version: 1.16.0 tqdm version: 4.66.1 urllib3 version: 1.26.16 websocket-client version: 1.6.4 Werkzeug version: 2.3.7 ---------------------------------------------------- Check ESP-IDF python requirements.txt ------------------------------------------------- Check ESP-IDF Python packages Python requirements are satisfied. ---------------------------------------------------- Check extension requirements.txt ------------------------------------------------------ Check Extension Python packages Python requirements are satisfied. ---------------------------------------------------- Check ESP-IDF debug adapter requirements.txt ------------------------------------------ Check Debug AdapterPython packages Python requirements are satisfied. ---------------------------------------------------- Visual Studio Code launch.json -------------------------------------------------------- { "version": "0.2.0", "configurations": [ { "type": "espidf", "name": "Launch", "request": "launch", "logLevel": 4, "mode": "auto", } ] } ---------------------------------------------------- Visual Studio Code c_cpp_properties.json ---------------------------------------------- { "configurations": [ { "name": "ESP-IDF", "compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc", "includePath": [ "${config:idf.espIdfPath}/components/", "${config:idf.espIdfPathWin}/components/", "${config:idf.espAdfPath}/components/", "${config:idf.espAdfPathWin}/components/", "${workspaceFolder}/" ], "browse": { "path": [ "${config:idf.espIdfPath}/components", "${config:idf.espIdfPathWin}/components", "${config:idf.espAdfPath}/components/", "${config:idf.espAdfPathWin}/components/**", "${workspaceFolder}" ], "limitSymbolsToIncludedHeaders": false }, "compileCommands": "${workspaceFolder}/build/compile_commands.json" } ], "version": 4 }


Extension

No response

Description

I expect that the sdkconfigDefaults setting configured in esp_idf_project_configuration.json would be added as a parameter on the build command. The actual command performed is shown below.

Note that the _-D SDKCONFIGDEFAULTS="sdkconfig.debug" is missing:

cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -B /Users/benmens/development/esp/esp-lvgl/build -S /Users/benmens/development/esp/esp-lvgl

I think I found the cause by debugging the extension. In the file src/build/buildTask.ts the code below does seem the cause:

if (
        compilerArgs.indexOf("SDKCONFIG_DEFAULTS") !== -1 &&
        sdkconfigDefaults &&
        sdkconfigDefaults.length
      ) {
        compilerArgs.push(
          "-D",
          `SDKCONFIG_DEFAULTS="${sdkconfigDefaults.join(";")}"`
        );
      }

What this does is check if SDKCONFIG_DEFAULTS is already in the command line and then add an additional SDKCONFIG_DEFAULTS=...

What I think should actually happen is that when the SDKCONFIG_DEFAULTS is NOT in the command line, then it is added. Like:

      if (
        compilerArgs.join().indexOf("SDKCONFIG_DEFAULTS") === -1 &&
        sdkconfigDefaults &&
        sdkconfigDefaults.length
      ) {
        compilerArgs.push(
          "-D",
          `SDKCONFIG_DEFAULTS="${sdkconfigDefaults.join(";")}"`
        );
      }

Debug Message

N/A

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

brianignacio5 commented 11 months ago

Thanks for the bug report @BenMens Will fix asap!

github-actions[bot] commented 10 months ago

This issue has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities