-
Notifications
You must be signed in to change notification settings - Fork 312
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
add build sdkconfig support #870
Conversation
Thanks for adding this feature Brian!
I am trying to understand, how does this support "multiple" build configuration? It seems like this PR is more about supporting a custom SDKCONFIG path? Is the idea that I am supposed to change the CMakeLists.txt SDKCONFIG variable myself? i.e. without a UI |
I just found and read your documentation (thanks)! To answer my own question, there is no UI for switching multiple build configs at this time. This PR is for supporting multiple heirarchical sdkconfigs, such as: Edit: actually I think I can use this UI to switch between Thanks for this great feature. |
Thanks for your feedback @chipweinberger Still need to have more links to docs in the main readme to make it more visible. There is also a tutorial for the Project Configuration Editor in here about using this UI you mentioned. If you have any feedback let us know ! |
Hi @chipweinberger so the idea of sdkconfig.defaults is to build an sdkconfig file. Let's say you have 2 products, prod1 and prod2. Each product has a single resulting sdkconfig file in
The currently selected profile is shown in the status bar at the bottom of the Visual Studio Code. Does this help @chipweinberger ? We should clarify a bit more of this in the documentation and tutorials. |
By the way, We are also adding the sdkconfig file location and IDF_TARGET to such profile configuration. So will try to explain better the difference between |
question 1
Yes, it mostly makes sense to me the build process you are describing. But I want to know about the editing workflow. How do I edit a specific sdkconfig file using the "SDK Config Editor"? question 2You say "sdkconfig.common". How do I set the name of "sdkconfig.common"? Does it have to be called "sdkconfig.common" or can I call it something else? question 3The json format I describe makes more intuitive sense to me. What settings should I set in the settings you describe to achieve the equivalent setup?
question 4Does the json description format I am describing above ^^ make sense to you? question 5Maybe you can consider if the UI could be improved, to be simpler to understand? Thank you for working on this. I hope my feedback & questions are useful. |
For the current behavior, 1) Select a profile
The example is just to illustrate why to use sdkconfigDefaults. You would define these values when you want to distribute the source code in a cleaner way without ESP-IDF generated values in resulting sdkconfig. If you look at the Multiple configuration example the sdkconfig.prod1 and sdkconfig.prod2 specify unique values but resulting sdkconfig files include ESP-IDF values.
JSON would be "product1": {
"idf.sdkconfigDefaults" : {
"${workspaceFolder}/sdkconfig.common"
"${workspaceFolder}/sdkconfig.prod1"
},
"idf.sdkconfig": "${workspaceFolder}/sdkconfig.product1",
"idf.buildDirectoryPath": "${workspaceFolder}/product1_build"
},
"product2": {
"idf.sdkconfigDefaults" : {
"${workspaceFolder}/sdkconfig.common"
"${workspaceFolder}/sdkconfig.prod2"
},
"idf.sdkconfig": "${workspaceFolder}/sdkconfig.product2",
"idf.buildDirectoryPath": "${workspaceFolder}/product2_build"
}
|
I still do not really understand very well. Question 1
That does not make sense to me. The build folder is ephemeral, and gets deleted on full clean. If you "save" to the build folder, then it is not really saved at all. It will be deleted! Am I supposed to add the build folder to my git repo? Or am I suppose to manually copy the settings from the build folder to my repo? Very frustrating user experience! It should save to our workspace folder! "git status" should show the changes I make, so that I can commit it! Without fixing this issue, "SDK Configuration editor" is useless. Now I have to manually edit the files every time! So frustrating! What is the point of "SDK Configuration editor" now? question 3
This seems to be the biggest misunderstanding. I really don't understand what summaryOverall, I just don't really get it. I don't understand how it is "supposed" to work. The PR made things more complicated, and AFAICT, made things worse for me. Before After I switched my product to multi config, the VSC extension did not support it at first, so I continued to also use a AFAICT, the PR makes things worse. The my opinionMy opinion: this pr should be reverted. I've read the documentation, and I still don't get it. I am an an "advanced" user. If an "advanced" user does not understand it, then very few developers are going to understand it. This is a big issue. I just want the old behavior back... IMO this feature needs to be re-designed. |
This multi config is not the default use case of ESP-IDF. Not at all. In fact is a very specific use case. You don't need to use the project configuration editor at all. Previous behavior still works well. I just trying to explain to you that This example (and the idea of project configuration in general) is to create multiple projects with a single source code. Let me give you an example use case. Say you have project using multiple tft screens. You want product 1 to use a screen A while product 2 to use a screen B. In your code you write a Kconfig file to choose between screen based on a sdkconfig value say CONFIG_SCREEN_TO_USE. In the ESP-IDF documentation about sdkconfig defaults Basically use sdkconfig.defaults as generators to have multiple sdkconfig files.
This feature is not intended at all to be used for most ESP-IDF projects. That why I mentioned that think of sdkconfig.defaults use more for a production use case to build multiple binaries from a single source at once than from a development point of view. In development point of view you get the sdkconfig working to your needs and when you want to release you would like to have a minimal set of sdkconfig values that you could, for example, share as open source and is not limited to specific ESP-IDF version since other ESP-IDF sdkconfig values. |
Thanks for your comments Brian.
Having a "dev" and "release" mode is common use case. Most products need these. This is all I want.
Yes I do understand that. ${workspacefolder}/build/sdkconfig. But, AFAIK, ${workspacefolder}/sdkconfig was always created the first time you opened the "gear" icon. And updated when you clicked "save" in the
Before the |
Idea: Perhaps you should create an example that has "dev" and "release" modes. Show:
Note: I know how to do all of this manually using idf.py. But I do not know how to do this in VSC Extension! |
The sdkconfig file is created and edited in the workspace by default in CMake projects and most ESP-IDF projects. Here is extending the use of a single sdkconfig to use many sdkconfig files for a single code. You can switch between one and another switch configuration profile. For this specific esp-idf example, build system multiple configuration example, the sdkconfig default path is modified in here |
Thanks @chipweinberger for this conversation. It really helps us to improve the intent of the feature and write better documentation. By the way there is a |
I just want to add that the original idea of the feature is for make easier scripting of these idf.py build and other commands. While sdkconfig and sdkconfig defaults is one of many things we can do with |
Any progress on #870 (comment)? |
Sorry for late reply, I haven't had bandwidth to continue writing these docs but for sure I'll make time before next release and I'll tag you in the MR . |
I appreciate your communications! Thanks Brian. |
Just want to bump this thread again =) Looking forward to the docs for #870 (comment)
This is the part I most want to know how to do. As well as how to switch between dev and release quickly. Ideally VSC would support
The only simple way that I can think of to support this, is to have a switcher in the UI. Clicking If that is too difficult to support, even knowing how to do a fully separate |
Could you check this PR with the docs ? #983 The idf.py save-defconfig works on ESP-IDF v5.0 |
overall looks good! i left some comments and suggestions! |
Description
Add support for multiple build configuration as done in esp-idf cmake multi_config example.
Load sdkconfig path as follows:
CMakeLists.txt
SDKCONFIG variable elseSDKCONFIG
environment variable (either system or extension defined inidf.customExtraVars
setting) elsesdkconfig
file.Also add
idf.sdkconfigDefaults
to define the set of SDKCONFIG_DEFAULTS to use to initially create the sdkconfig.Fix #855
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist