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 .slconf files 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. slc supports 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: Use the sdk-package-path argument to specify the path to the SDK and any SDK extensions. This argument accepts a list that includes the SDK and extensions in a single statement. Any packages specified in this statement are implicitly trusted by slc.

  • Target board (or part): Silicon Labs recommends using a Silicon Labs development board when creating the initial project so that peripheral components have valid pin definitions. After the initial project is created, you can replace the board with the desired target part and then modify the existing pin definitions for the target hardware. Specify the board in a with statement (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 Boolean argument determines whether the SDK source files are copied into the generated project or referenced 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, and llvm. (toolchain = "gcc")

  • New project indicator: This Boolean argument determines whether a new instance of the project is created. Set this argument to TRUE when creating a project from an SDK example project or workspace file. Set it to FALSE for previously created projects (new-project = "TRUE")

  • Workspace file or slcp project file path: Specify the relative path from the .slconf file location to the workspace or slcp project file. The path must use 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 with statement. For example, an IO Stream component specified with the bt_soc_empty project. (with = [ "brd4403b","iostream_eusart:vcom"])

  • Toolchain: A [toolchain] section can be included to specify a path to the toolchain used by the project. However, because slt is typically used during the CMake build to locate installed toolchains (and this overrides the toolchain in the .slconf file), the [toolchain] section is of limited use. If the toolchain needs to be overridden with one not installed using slt, define the environment variable ARM_GCC_DIR with 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.slconf

Example 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_vs

Build Command Line#

Run the following from the g/bt_soc_empty_4403b_vs/cmake_gcc folder:

cmake --workflow --preset project

Example 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_vs

Build Command Line#

Run the following command from the g/bt_soc_blinky_4402a_vs/cmake_gcc folder:

cmake --workflow --preset project

Example 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_vs

Build Command Line#

Run the following command from the g/bootloader-apploader_2902a_vs/cmake_gcc folder:

cmake --workflow --preset project

Example 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_vs

Build Command Line#

Run the following command from the g\bootloader-apploader-workspace_2901a_vs\bootloader-apploader-workspace_cmake folder:

cmake --workflow --preset project

Example 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=800

Build Command Line#

Run the following command from the g\MatterLightSwitchOverThreadSolution_1019a_vs\light-switch-app-thread-bootloader_cmake folder:

cmake --workflow --preset project