Generate a New Project#
Objective#
Generate a project from an existing .slcp file.
Use the slc generate command to generate a project from an existing Software Development Kit (SDK) example. You can generate the project in place, create a copy in a new directory, target a specific device or board, or generate a project for a specific build system. Use the -np (new project) option to copy the project into a new location and update the project references.
Generate a Project#
Generate the project in the same directory as the .slcp file.
slc generate <path-to-project.slcp>
Generate into a New Project Directory#
Create a project by copying the .slcp file and its referenced files.
slc generate app.slcp -np -d ./MyProject -name MyProject
Options:
-np– Creates a project by copying the.slcpfile and its referenced files.-d– Specifies the destination directory.-name– Specifies the generated project name.
Generate a Project for a Specific Device or Board#
To target a device, run the following command:
slc generate app.slcp --with EFR32BG22C224F512IM40
To target a board, run the following command:
slc generate app.slcp -np -d ./MyProject -name MyProject --with brd2704a
The --with option customizes the generated project for the specified board or device.
Generate a Makefile Project or Visual Studio Code Project#
Generate a Makefile project:
slc generate ~/sdk/gecko_sdk/app/bluetooth/example/bt_soc_blinky/bt_soc_blinky.slcp -np -d ~/projects/bt_soc_blinky -name bt_soc_blinky --with brd4187c -o makefile
Generate a Visual Studio Code project:
slc generate ~/sdk/gecko_sdk/app/bluetooth/example/bt_soc_blinky/bt_soc_blinky.slcp -np -d ~/projects/bt_soc_blinky -name bt_soc_blinky --with brd4187c -o vscode
Generate a Project Using .slconf#
If you use Silicon Labs Tool (SLT), define the project settings in a .slconf file and generate the project with:
slc generate --slt-config=bt_soc_blinky.slconf -d ~/projects/bt_soc_blinky
For more information, see Project Generation Examples.
Typical Workflow#
Install SDK (SLT) │ ▼ slc generate -np │ ▼ Configure project (components/config files) │ ▼ slc generate │ ▼ Build (make/cmake)
Build the Generated Project#
Run CMake from the project's cmake_gcc directory or the workspace's _cmake directory.
For example, if the project is generated in g/bt_soc_empty_4403b_vs, run the following commands from g/bt_soc_empty_4403b_vs/cmake_gcc:
cd <project>/cmake_gcc cmake --workflow --preset project