From 13a26e56e15e1c0134d75abf706a5068bd55e197 Mon Sep 17 00:00:00 2001 From: Marek Fiala Date: Tue, 8 Aug 2023 13:54:44 +0200 Subject: [PATCH] feat(tools): idf.py adding arguments from file via @filename.txt - readme update --- .../build_system/cmake/multi_config/README.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/examples/build_system/cmake/multi_config/README.md b/examples/build_system/cmake/multi_config/README.md index 0eaae79cb2..72da1f2d67 100644 --- a/examples/build_system/cmake/multi_config/README.md +++ b/examples/build_system/cmake/multi_config/README.md @@ -80,6 +80,40 @@ It is possible to specify multiple files in this variable, separating them with This way the common options do not need to be repeated in each of `sdkconfig.prodN` files. +### Create configuration profile files via @filename + +You can further enhance your build process by using configuration profile files. These profile files contain arguments that streamline the build process for specific scenarios. For example, let's have the following profile files: + +`profiles/prod`: + +```bash +-B build-production -DSDKCONFIG=build-production/sdkconfig -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.prod" +``` + +`profiles/debug`: + +```bash +-B build-debug -DSDKCONFIG=build-debug/sdkconfig -DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.debug" +``` + +You can use these profile files to quickly set up the build environment with specific configurations. + +- To build with the production profile: `idf.py @profiles/prod build` +- To build with the debug profile: `idf.py @profiles/debug build` + +This approach simplifies the process of specifying complex command-line arguments and allows for greater flexibility in managing different build scenarios. + +Moreover, you can combine arguments from a profile file with additional command line arguments. Anywhere on the idf.py command line, you can specify a file as @filename.txt to read one or more arguments from the text file. Arguments in the file can be separated by newlines or spaces and are expanded exactly as if they had appeared in that order on the idf.py command line. + +For example, you can create a file named custom_flash.txt: + +`custom_flash.txt`: + +```bash +-p PORT flash +``` + +Then, you can expand the command: `idf.py -B build_production @filename.txt monitor` ### Generated `sdkconfig` file In this example, `sdkconfig` file is placed into the build directory, instead of the project root directory as it is done by default. This allows development and production builds to exist side by side. The location of `sdkconfig` file is set using `SDKCONFIG` variable in [project CMakeLists.txt](CMakeLists.txt) file.