espressif / vscode-esp-idf-extension

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

Custom (cmake) build path not working when flashing target (VSC-1511) #1331

Open mickeprag opened 1 day ago

mickeprag commented 1 day ago

OS

Linux

Operating System version

Ubuntu 24.04

Visual Studio Code version

1.94.0

ESP-IDF version

5.4.0

Python version

3.10.12

Doctor command output

---------------------------------------------- ESP-IDF Extension for Visual Studio Code report ---------------------------------------------
OS linux x64 6.8.0-47-generic 
System environment variable IDF_PYTHON_ENV_PATH 
 /opt/esp/python_env/idf5.4_py3.10_env 
System environment variable PATH 
 /vscode/vscode-server/bin/linux-x64/d78a74bcdfad14d5d3b1b782f87255d802b57511/bin/remote-cli:/opt/esp/idf/components/espcoredump:/opt/esp/idf/components/partition_table:/opt/esp/idf/components/app_update:/opt/esp/tools/xtensa-esp-elf-gdb/14.2_20240403/xtensa-esp-elf-gdb/bin:/opt/esp/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin:/opt/esp/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin:/opt/esp/tools/esp32ulp-elf/2.38_20240113/esp32ulp-elf/bin:/opt/esp/tools/cmake/3.24.0/bin:/opt/esp/tools/openocd-esp32/v0.12.0-esp32-20240726/openocd-esp32/bin:/opt/esp/tools/xtensa-esp-elf-gdb/14.2_20240403/xtensa-esp-elf-gdb/bin:/opt/esp/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin:/opt/esp/tools/riscv32-esp-elf/esp-13.2.0_20240530/riscv32-esp-elf/bin:/opt/esp/tools/esp32ulp-elf/2.38_20240113/esp32ulp-elf/bin:/opt/esp/tools/cmake/3.24.0/bin:/opt/esp/tools/openocd-esp32/v0.12.0-esp32-20240726/openocd-esp32/bin:/opt/esp/python_env/idf5.4_py3.10_env/bin:/opt/esp/idf/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 
System environment variable PYTHON 
 undefined 
Visual Studio Code version 1.94.0 
Visual Studio Code language en 
Visual Studio Code shell /usr/bin/bash 
ESP-IDF Extension version 1.8.1 
Workspace folder /workspaces/otp-hlp 
---------------------------------------------------- Extension configuration settings ------------------------------------------------------
ESP-ADF Path (idf.espAdfPath) ${env:ADF_PATH}
ESP-IDF Path (idf.espIdfPath) /opt/esp/idf
ESP-MDF Path (idf.espMdfPath) ${env:MDF_PATH}
ESP-Matter Path (idf.espMatterPath) ${env:ESP_MATTER_PATH}
ESP-HomeKit-SDK Path (idf.espHomeKitSdkPath) ${env:HOMEKIT_PATH}
Custom extra paths (idf.customExtraPaths) 
Custom extra vars (idf.customExtraVars)
    OPENOCD_SCRIPTS: /opt/esp/tools/openocd-esp32/v0.12.0-esp32-20230419/openocd-esp32/share/openocd/scripts
    ESP_ROM_ELF_DIR: /opt/esp/tools/esp-rom-elfs/20230320/
Virtual env Python Path (idf.pythonBinPath) /opt/esp/python_env/idf5.4_py3.10_env/bin/python
Serial port (idf.port) /dev/ttyUSB1
OpenOCD Configs (idf.openOcdConfigs) interface/ftdi/esp32_devkitj_v1.cfg,target/esp32.cfg
ESP-IDF Tools Path (idf.toolsPath) /opt/esp
Git Path (idf.gitPath) /usr/bin/git
Notification Mode (idf.notificationMode) All
-------------------------------------------------------- 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-HomeKit Path (idf.espHomeKitSdkPath) false
Access to ESP-IDF Custom extra paths
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-HomeKit-SDK Path (idf.espHomeKitSdkPath) false
Spaces in ESP-IDF Custom extra paths
Spaces in Virtual env Python Path (idf.pythonBinPath) false
Spaces in ESP-IDF Tools Path (idf.toolsPath) false
----------------------------------------------------------- Executables Versions -----------------------------------------------------------
Git version 2.34.1
ESP-IDF version 5.4.0
Python version 3.10.12
Python's pip version 24.2
-------------------------------------------------- Project configuration settings ----------------------------------------------------------
-------------------------------------------------- Python packages in idf.pythonBinPath ----------------------------------------------------
annotated-types version: 0.7.0
argcomplete version: 3.5.0
bitarray version: 2.9.2
bitstring version: 4.2.3
certifi version: 2024.8.30
cffi version: 1.17.1
charset-normalizer version: 3.3.2
click version: 8.1.7
colorama version: 0.4.6
construct version: 2.10.70
cryptography version: 43.0.1
ecdsa version: 0.19.0
esp-coredump version: 1.11.0
esp-debug-backend version: 1.0.3
esp-idf-kconfig version: 2.3.0
esp-idf-monitor version: 1.5.0
esp_idf_nvs_partition_gen version: 0.1.3
esp-idf-panic-decoder version: 1.2.1
esp-idf-size version: 1.6.0
esptool version: 4.8.0
freertos-gdb version: 1.0.3
idf-component-manager version: 2.0.3
idna version: 3.10
intelhex version: 2.3.0
jsonref version: 1.1.0
markdown-it-py version: 3.0.0
mdurl version: 0.1.2
packaging version: 24.1
pip version: 24.2
pyclang version: 0.5.0
pycparser version: 2.22
pydantic version: 2.9.2
pydantic_core version: 2.23.4
pydantic-settings version: 2.5.2
pyelftools version: 0.31
pygdbmi version: 0.11.0.0
Pygments version: 2.18.0
pyparsing version: 3.1.4
pyserial version: 3.5
python-dotenv version: 1.0.1
PyYAML version: 6.0.2
reedsolo version: 1.7.0
requests version: 2.32.3
requests-file version: 2.1.0
requests-toolbelt version: 1.0.0
rich version: 13.8.1
setuptools version: 75.1.0
six version: 1.16.0
tqdm version: 4.66.5
typing_extensions version: 4.12.2
urllib3 version: 2.2.3
---------------------------------------------------- Check ESP-IDF python requirements.txt -------------------------------------------------
Check ESP-IDF 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 --------------------------------------------------------
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "ESP-IDF Debug: Launch",
            "type": "espidf",
            "request": "launch"
        }
    ]
} 
----------------------------------------------------------- Latest error -----------------------------------------------------------------
{
    "errno": -2,
    "code": "ENOENT",
    "syscall": "open",
    "path": "/workspaces/otp-hlp/.vscode/c_cpp_properties.json"
}
--------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------- Logfile -----------------------------------------------------------------

{"user":true,"message":"Something went wrong while trying to build the project","stack":"Error: /workspaces/otp-hlp/build/${command:cmake.activeConfigurePresetName}/project_description.json doesn't exist.\n    at /dist/extension.js:2:1418813\n    at new Promise (<anonymous>)\n    at fe (/dist/extension.js:2:1418769)\n    at fa.mapFilePath (/dist/extension.js:2:1664013)\n    at fa.getSizeInfo (/dist/extension.js:2:1664182)\n    at va (/dist/extension.js:2:1666826)\n    at /dist/extension.js:2:1891342","level":"error","timestamp":"2024-10-29T08:33:44.173Z"}
{"user":true,"level":"warn","message":"flasher_args.json file is missing from the build directory, can't proceed, please build properly!","timestamp":"2024-10-29T08:36:51.192Z"}
{"message":"Cannot access filePath: ${env:ADF_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:ADF_PATH}'\n    at Object.accessSync (node:fs:244:11)\n    at Se (/dist/extension.js:2:1421806)\n    at /dist/extension.js:2:1650824\n    at ua (/dist/extension.js:2:1651892)\n    at /dist/extension.js:2:1868405","level":"error","timestamp":"2024-10-29T08:37:32.791Z"}
{"message":"Cannot access filePath: ${env:MDF_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:MDF_PATH}'\n    at Object.accessSync (node:fs:244:11)\n    at Se (/dist/extension.js:2:1421806)\n    at /dist/extension.js:2:1651002\n    at ua (/dist/extension.js:2:1651892)\n    at /dist/extension.js:2:1868405","level":"error","timestamp":"2024-10-29T08:37:32.794Z"}
{"message":"Cannot access filePath: ${env:ESP_MATTER_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:ESP_MATTER_PATH}'\n    at Object.accessSync (node:fs:244:11)\n    at Se (/dist/extension.js:2:1421806)\n    at /dist/extension.js:2:1651094\n    at ua (/dist/extension.js:2:1651892)\n    at /dist/extension.js:2:1868405","level":"error","timestamp":"2024-10-29T08:37:32.796Z"}
{"message":"Cannot access filePath: ${env:HOMEKIT_PATH}","stack":"Error: ENOENT: no such file or directory, access '${env:HOMEKIT_PATH}'\n    at Object.accessSync (node:fs:244:11)\n    at Se (/dist/extension.js:2:1421806)\n    at /dist/extension.js:2:1651190\n    at ua (/dist/extension.js:2:1651892)\n    at /dist/extension.js:2:1868405","level":"error","timestamp":"2024-10-29T08:37:32.797Z"}
{"message":"ENOENT: no such file or directory, open '/workspaces/otp-hlp/.vscode/c_cpp_properties.json'","stack":"Error: ENOENT: no such file or directory, open '/workspaces/otp-hlp/.vscode/c_cpp_properties.json'","level":"error","timestamp":"2024-10-29T08:37:33.663Z"}
{"user":true,"level":"warn","message":"Extension configuration report has been copied to clipboard with errors","timestamp":"2024-10-29T08:37:33.664Z"}

--------------------------------------------------------------------------------------------------------------------------------------------

Extension

{"user":true,"message":"Something went wrong while trying to build the project","stack":"Error: /workspaces/otp-hlp/build/${command:cmake.activeConfigurePresetName}/project_description.json doesn't exist.\n    at /dist/extension.js:2:1418813\n    at new Promise (<anonymous>)\n    at fe (/dist/extension.js:2:1418769)\n    at fa.mapFilePath (/dist/extension.js:2:1664013)\n    at fa.getSizeInfo (/dist/extension.js:2:1664182)\n    at va (/dist/extension.js:2:1666826)\n    at /dist/extension.js:2:1891342","level":"error","timestamp":"2024-10-29T08:33:44.173Z"}

Description

I have following in my .vscode/settings.json, since I have different cmake presets:

{
    "idf.buildPath": "${workspaceFolder}/build/${command:cmake.activeConfigurePresetName}"
}

This works when I press the ESP_IDF: Build Project button in vscode byt when I try flashing it does not work. Also, en empty directory build/${command:cmake.activeConfigurePresetName} is created.

Debug Message

flasher_args.json file is missing from the build directory, can't proceed, please build properly!

Other Steps to Reproduce

No response

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

brianignacio5 commented 23 hours ago

This is due to the fact that ${command:cmake.activeConfigurePresetName} is not supported in idf.buildPath resolution.

Right now the readParameter function (the one that reads settings) is not asynchronous so implementing this will require a lot of changes in the extension because executing a command to get a string takes time and is not synchronous.

You can try using our Project Configuration editor which allows you to define multiple idf.buildPath (and many other settings) in a single esp-idf project by defining multiple profiles. More information in this documentation