Project Generation Examples#
Silicon Labs Configurator (SLC) supports specifying all of its arguments in .slconf files and this improves portability for project generation. Any slc argument can be specified in the .slconf file. The long form of the argument name is used without the leading --. The format of the .slconf file is detailed in SLT Configuration File Specification.
Key benefits of using a .slconf file include:
Shorter command lines
Project generation portability
Reproducibility
Removal of requirements to trust SDKs
Notes on portability Key points for ensuring a project and its supporting files are portable are that they contain no absolute paths and that the specified paths work across the supported operating systems (Windows, macOS, and Linux (Ubuntu)). For maximum portability, the
.slconffiles should be located such that relative paths can be used to specify the SDK and the project or workspace file (only one is specified). A directory structure that meets those requirements is shown in the examples that follow. For portability across operating systems the relative paths should contain forward slashes (/) only - even on Windows.slcsupports using forward slashes on Windows from a command prompt or PowerShell terminal.
Steps for Creating a .slconf File#
Project File Creation Step#
Create a project-level .slconf file with the following elements:
SDK and SDK extension paths: The path to the SDK and any SDK extension is specified using the
sdk-package-pathargument which takes a list of the SDK and extensions in a single statement. Any packages specified in this statement are implicitly trusted byslc.Target board (or part): It is recommended to use a Silicon Labs development board when creating the initial project so that peripheral components will have valid pin definitions. After initial project creation, the board can be replaced with the desired target part and then the existing pin definitions can be modified for the customer hardware. Specify the board in a
withstatement. (with = [ brd4403b,])Output type: Specify the project generator to use for the integrated development environment (IDE) or build system. More than one generator can be specified as a comma-separated list. (
output-type = "vscode")Project Import mode: This is a boolean argument for if the SDK source files should be copied into the generated project or specified as links in the build system files. (
copy-sources = "TRUE")Toolchain type: Specify one toolchain that will be used to build the project. Options are
gcc,iar, andllvm. (toolchain = "gcc")New project indicator: This is a boolean argument for if a new instance of the project should be created or not. This should be
"TRUE"when creating a project from an SDK example project or workspace file and"FALSE"for previously created projects. (new-project = "TRUE")Workspace file or slcp project file path: This should be the relative path from the
.slconffile location to the workspace or slcp project file and it should be specified using forward slashes (/). Examples:project-file = "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p/app/bluetooth/example/bt_soc_empty/bt_soc_empty.slcp"workspace = "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p/platform/bootloader/sample-apps/workspaces/bootloader-apploader/bootloader-apploader.slcw"Other software components: Software components not pulled in by the project or workspace file can be specified using a
withstatement. For example, an IO Stream component specified with thebt_soc_emptyproject. (with = [ "brd4403b","iostream_eusart:vcom"])Toolchain: A
[toolchain]section can be included to specify a path to the toolchain used by the project. However, becausesltis typically used during the CMake build to locate installed toolchains (and this overrides the toolchain in the.slconffile), the[toolchain]section is of limited use. If the toolchain needs to be overridden with one not installed usingslt, define the environment variableARM_GCC_DIRwith the desired toolchain path.
Generation Step#
The generation command line when using a .slconf file is simple because the slconf file (--slt-config) and the output location (-d) are specified. Optionally a generator timeout can be specified for projects that use an adapter pack that takes a long time to generate, such as a Zigbee or Matter project.
Examples:
slc generate --slt-config=slconf/MatterLightSwitchOverThreadSolution_1019a_vs.slconf -d=g/MatterLightSwitchOverThreadSolution_1019a_vs -lfewp --generator-timeout=800
slc generate --slt-config=slconf/bt_soc_empty_4403b_vs.slconf -d=g/bt_soc_empty_4403b_vs
Build Step#
The build step consists of invoking CMake from the project cmake_gcc folder or the workspace _cmake folder. Examples are given in the next section.
Examples#
For these examples, the contents of the user .silabs folder created from installing the recommended packages with slt was copied to a home folder outside of the Users folder. This was done for ease of demonstration, so that the USERNAME folder is not involved in the examples. If this is done any packages updated with slt would have to be copied again. The folder structure used for these examples is ("g" is the destination folder used by the generate command):
- C:\slc-test\
- g
- home
- .silabs
- sdm
- slt
- slconf
- bootloader-apploader_2902a_vs.slconf
- bootloader-apploader-workspace_2901a_vs.slconf
- bt_soc_blinky_4402a_vs.slconf
- bt_soc_empty_4403b_vs.slconf
- MatterLightSwitchOverThreadSolution_1019a_vs.slconfExample 1: Bluetooth Empty Project (bt_soc_empty_4403b_vs.slconf)#
.slconf Contents#
[toolchain]
[slc]
sdk-package-path = [ "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p",]
with = [ "brd4403b","iostream_eusart:vcom"]
output-type = "vscode"
project-file = "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p/app/bluetooth/example/bt_soc_empty/bt_soc_empty.slcp"
copy-sources = "TRUE"
new-project = "TRUE"
toolchain = "gcc"Generation Command Line#
slc generate --slt-config=slconf/bt_soc_empty_4403b_vs.slconf -d=g/bt_soc_empty_4403b_vsBuild Command Line#
Run the following from the g/bt_soc_empty_4403b_vs/cmake_gcc folder:
cmake --workflow --preset projectExample 2: Bluetooth Blinky Project (bt_soc_blinky_4402a_vs.slconf)#
.slconf Contents#
[toolchain]
[slc]
sdk-package-path = [ "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p",]
with = [ "brd4402a",]
output-type = "vscode"
project-file = "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p/app/bluetooth/example/bt_soc_blinky/bt_soc_blinky.slcp"
copy-sources = "TRUE"
new-project = "TRUE"
toolchain = "gcc"Generation Command Line#
slc generate --slt-config=slconf/bt_soc_blinky_4402a_vs.slconf -d=g/bt_soc_blinky_4402a_vsBuild Command Line#
Run the following command from the g/bt_soc_blinky_4402a_vs/cmake_gcc folder:
cmake --workflow --preset projectExample 3. Bootloader Apploader Project (bootloader-apploader_2902a_vs.slconf)#
.slconf Contents#
[toolchain]
[slc]
sdk-package-path = [ "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p",]
with = [ "brd2902a",]
output-type = "vscode"
project-file = "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p/platform/bootloader/sample-apps/bootloader-apploader/bootloader-apploader.slcp"
copy-sources = "TRUE"
new-project = "TRUE"
toolchain = "gcc"Generation Command Line#
slc generate --slt-config=slconf/bootloader-apploader_2902a_vs.slconf -d=g/bootloader-apploader_2902a_vsBuild Command Line#
Run the following command from the g/bootloader-apploader_2902a_vs/cmake_gcc folder:
cmake --workflow --preset projectExample 4. Bootloader Workspace (bootloader-apploader-workspace_2901a_vs.slconf)#
.slconf Contents#
[toolchain]
[slc]
sdk-package-path = [ "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p",]
with = [ "brd2901a",]
output-type = "vscode"
workspace = "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p/platform/bootloader/sample-apps/workspaces/bootloader-apploader/bootloader-apploader.slcw"
copy-sources = "TRUE"
new-project = "TRUE"
toolchain = "gcc"Generation Command Line#
slc generate --slt-config=slconf/bootloader-apploader-workspace_2901a_vs.slconf -d=g/bootloader-apploader-workspace_2901a_vsBuild Command Line#
Run the following command from the g\bootloader-apploader-workspace_2901a_vs\bootloader-apploader-workspace_cmake folder:
cmake --workflow --preset projectExample 5. Matter Workspace (MatterLightSwitchOverThreadSolution_1019a_vs.slconf)#
This example is using Matter SDK Extension 2.7.0 and to get the project to build the environment variable ARM_GCC_DIR was defined to point to an installation of the GCC ARM 14.2.1 toolchain.
.slconf Contents#
[toolchain]
[slc]
sdk-package-path = [ "../home/.silabs/slt/installs/conan/p/matte7710ee5c0d1f2/p", "../home/.silabs/slt/installs/conan/p/simpleb526998f4a4d/p", "../home/.silabs/slt/installs/conan/p/wisece6a05cd369ee2/p",]
with = [ "brd1019a",]
output-type = "vscode"
workspace = "../home/.silabs/slt/installs/conan/p/matte7710ee5c0d1f2/p/slc/solutions/light-switch-app/series-3/light-switch-app-thread-bootloader.slcw"
copy-sources = "TRUE"
new-project = "TRUE"
toolchain = "gcc"Generation Command Line#
slc generate --slt-config=slconf/MatterLightSwitchOverThreadSolution_1019a_vs.slconf -d=g/MatterLightSwitchOverThreadSolution_1019a_vs -lfewp --generator-timeout=800Build Command Line#
Run the following command from the g\MatterLightSwitchOverThreadSolution_1019a_vs\light-switch-app-thread-bootloader_cmake folder:
cmake --workflow --preset project