Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select project configuration does not work as expected (VSC-1573) #1408

Open
1 task done
VasylMA opened this issue Jan 21, 2025 · 16 comments · May be fixed by #1417
Open
1 task done

Select project configuration does not work as expected (VSC-1573) #1408

VasylMA opened this issue Jan 21, 2025 · 16 comments · May be fixed by #1417
Assignees
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)

Comments

@VasylMA
Copy link

VasylMA commented Jan 21, 2025

OS

Windows

Operating System version

Windows 10

Visual Studio Code version

1.96.4 (last)

ESP-IDF version

5.3.1

Python version

3.13.0

Doctor command output

Not required to reproduce the error

Extension

No response

Description

Create simple project with two config.
Build. -> Build directory is wrong.
Try edit "esp_idf_project_configuration.json" -> Changes does not applied
Switch config in bottom bar -> build error.

hello_world.zip

The idea is good. Implementation still wants better.

Debug Message

No Backtrace

Other Steps to Reproduce

No response

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

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@VasylMA VasylMA added the bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) label Jan 21, 2025
@github-actions github-actions bot changed the title Select project configuration does not work as expected Select project configuration does not work as expected (VSC-1573) Jan 21, 2025
@VasylMA
Copy link
Author

VasylMA commented Jan 21, 2025

Also "Flash device" button must flash file from current config build directory.

@radurentea
Copy link
Collaborator

radurentea commented Jan 27, 2025

Hi @VasylMA,

L.E.2: Found the tutorial for multiple config in the new documentation format https://docs.espressif.com/projects/vscode-esp-idf-extension/en/latest/additionalfeatures/multiple-projects.html#use-multiple-build-configurations-in-the-same-workspace-folder

If the multiple projects is setup properly, the flash button will use the correct build directory as well.

If you still have issues setting up multiple configs for your project after reviewing the above tutorial, please do the followings in order for me to be able to investigate your project example:

  1. Share your esp_idf_project_configuration.json file content directly in this issue by copying and pasting it between triple backticks
  2. Provide the specific error messages you're seeing when switching configurations
  3. If you want to share the full project, consider creating a minimal public GitHub repository that demonstrates the issue, instead of sharing the zip file. This makes it easier for us to investigate and not having to setup a virtual environment to take all security measures.

@radurentea radurentea self-assigned this Jan 27, 2025
@VasylMA
Copy link
Author

VasylMA commented Jan 29, 2025

esp_idf_project_configuration.json file:

{
  "level5": {
    "build": {
      "compileArgs": [],
      "ninjaArgs": [],
      "buildDirectoryPath": "build.level5",
      "sdkconfigDefaults": [
        "sdkconfig.defaults.level5"
      ],
      "sdkconfigFilePath": "sdkconfig.level5"
    },
    "env": {},
    "flashBaudRate": "",
    "idfTarget": "",
    "monitorBaudRate": "",
    "openOCD": {
      "debugLevel": 0,
      "configs": [],
      "args": []
    },
    "tasks": {
      "preBuild": "echo build level5",
      "preFlash": "echo flash level5",
      "postBuild": "echo build done level5",
      "postFlash": "echo flash done level5"
    }
  },
  "level3": {
    "build": {
      "compileArgs": [],
      "ninjaArgs": [],
      "buildDirectoryPath": "build.level3",
      "sdkconfigDefaults": [
        "sdkconfig.defaults.level3"
      ],
      "sdkconfigFilePath": "sdkconfig.level3"
    },
    "env": {},
    "flashBaudRate": "",
    "idfTarget": "",
    "monitorBaudRate": "",
    "openOCD": {
      "debugLevel": 0,
      "configs": [],
      "args": []
    },
    "tasks": {
      "preBuild": "echo build level3",
      "preFlash": "echo flash level3",
      "postBuild": "echo build done level3 ",
      "postFlash": "echo flash done level3"
    }
  }
}

@VasylMA
Copy link
Author

VasylMA commented Jan 29, 2025

@radurentea
Copy link
Collaborator

Hi @VasylMA,

The problem seems to be with the file names: sdkconfig.defaullts.level3 and sdkconfig.defaullts.level3 , the default word in your case have double "L" .

I also found a bug in regards to the build paths, they work only if they are absolute path, such as:

"buildDirectoryPath": "c:\Users\radur\OneDrive\Desktop\delete\multi_config\build.prod2"

I'm going to make a fix for the build paths, but as a workaround for now, you can use absolute paths.

@VasylMA
Copy link
Author

VasylMA commented Jan 30, 2025

Hi @VasylMA

Thanks! With relative path it works. Please add message "Default config file not found"

@radurentea
Copy link
Collaborator

radurentea commented Jan 30, 2025

Hi @VasylMA,

Thanks! With relative path it works. Please add message "Default config file not found"

That's interesting, cause for me, if I try to use your settings from esp_idf_project_configuration.json , I get the following error when I try to build:

 *  The terminal process failed to launch: Starting directory (cwd) "C:\Users\radur\OneDrive\Desktop\Expressif_VSC-1573-main\Expressif_VSC-1573-main\build.level5" does not exist. 

Can you confirm both build worked? And what action are you using to build? Is it the status bar icon

Image?

@VasylMA
Copy link
Author

VasylMA commented Jan 30, 2025

Hi @VasylMA,
I updated the test case on GitHub.
When I fix file names, the error still hasn't gone away.
Then I deleted all the old generated files and it worked.
I haven't checked yet flashing chip for right firmware.

@VasylMA
Copy link
Author

VasylMA commented Jan 30, 2025

I changed the defaults ​​to make example work correctly.

@radurentea
Copy link
Collaborator

From what I can see, you've change the paths to be absolute, right?
Because the issue I found was related to relative paths, so I'm wondering if it works for you to have:

buildDirectoryPath": "build.level5"

or you needed to make this path absolute, like I can see you've modified it in your repo:

buildDirectoryPath": "D:/Test/hello_world/build.level5"

@VasylMA
Copy link
Author

VasylMA commented Jan 30, 2025

With relative path there is error

@radurentea
Copy link
Collaborator

Hey,

I've made a PR for fixing the relative path issue:

If you want, you can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

esp-idf-extension.vsix.zip

@VasylMA
Copy link
Author

VasylMA commented Feb 3, 2025

And now the problem with absolute paths, like
"buildDirectoryPath": "D:/tmp/test/hello-word2/build.level5".
Another problem:

  1. Copy project to another directory or rename project directory.
  2. Delete builds directories
  3. Open in Visual Code.
  4. Try select project config by button (no button) or command palette (if absolute path - no options to select)

@radurentea
Copy link
Collaborator

Hi @VasylMA,

Thanks for pointing this out. The reason this happens is because the path does not exist anymore.

Do you have suggestions on the behaviour you would like to see?

Should you get an error notification informing you that the paths in the configuration don't exist and display a button that would run "ESP-IDF: Open Project Configuration" so that you edit the absolute path yourself?

@VasylMA
Copy link
Author

VasylMA commented Feb 3, 2025

In my opinion, if there is a configuration file, the button should be there anyway. If we click it, a message may appear if the path is outside the project.

@VasylMA
Copy link
Author

VasylMA commented Feb 3, 2025

There should also be the following warning:
Default configuration file not found.
This is useful when the user makes a typo in file name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)
Projects
None yet
2 participants