Skip to content

Latest commit

 

History

History
73 lines (46 loc) · 4.19 KB

multiple_config.md

File metadata and controls

73 lines (46 loc) · 4.19 KB

Use multiple build configuration

Use the ESP-IDF CMake Multiple Configuration Example to follow this tutorial.

Use the ESP-IDF: Open Project Configuration and create two configurations profiles: prod1 and prod2 and sdkconfig.prod_common;sdkconfig.prod1 and sdkconfig.prod_common;sdkconfig.prod2 on the sdkconfig defaults field as shown below:

Enter new profile configuration name

Production 1

Production 1

After creating each profile and the configuration settings for each profile, click the Save button and use the ESP-IDF: Select Project Configuration command to choose the configuration to override extension configuration settings.

Select configuration

After a configuration profile is selected, the selected profile will be shown in the status bar as shown before.

Configuration in status bar

Now use the ESP-IDF: Build your Project to build the project for prod1 and prod2. You can observe binaries generated for each profiles in the path defined in each profile as before. You can use ESP-IDF: Select Project Configuration command to switch between configurations.

Use the ESP-IDF: Open Project Configuration command to modify, add or delete the configuration profiles. If you want to stop using these profile, just delete all configuration profiles.

Multiple ESP-IDF Versions

You can use multiple ESP-IDF versions, one for each ESP-IDF project by explicitly defining your configuration settings in your current project directory .vscode/settings.json.

  1. Set the idf.saveScope to WorkspaceFolder with the ESP-IDF: Select where to Save Configuration Settings command or directly in the .vscode/settings.json of desired project opened in Visual Studio Code.

  2. Configure the extension as described in here or use the JSON Manual Configuration to set these values in your project's .vscode/settings.json.

  3. Make sure to delete any previous build directory since a different ESP-IDF version would not work if there is any cache of previous build.

  4. Repeat from 1) on any project you would like to use a different version from the global user settings.

Look at the Working with Multiple Projects documentation to understand where and how Visual Studio Code handle configuration settings and the scope of each location.

Using Multiple Build Configuration Manually

As shown in the ESP-IDF CMake Multiple Configuration example you can use multiple build directories and multiple sdkconfig defaults files to produce different production output.

In this extension you can define the build directory with the idf.buildPath (idf.buildPathWin fo Windows) configuration setting and the list of sdkconfig default files with idf.sdkconfigDefaults configuration. The value of these settings will be using by the extension build command.

Say you want to make product 1:

  1. you have sdkconfig files sdkconfig.prod_common and sdkconfig.prod1 and you want the resulting firmware to be generated in <your-project>/build_prod1 where build_prod1 is the name of the custom build folder.
  2. Add these settings in <your-project>/.vscode/settings.json:
{
  // ...
  "idf.buildPath": "${workspaceFolder}/build_prod1",
  "idf.sdkconfigDefaults": ["sdkconfig.prod_common", "sdkconfig.prod1"]
  // ...
}
  1. Build your project using the ESP-IDF: Build your Project command.

  2. Your resulting files will be generated in <your-project>/build_prod1 and the sdkconfig being used by the SDK Configuration Editor will be <your-project>/build_prod1/sdkconfig.

  3. Change values in 2) for different products and configurations.