Configuring and building an application
For simplicity, this guide will refer to both samples and applications as “applications”.
After you have created an application, you need to build it in order to be able to program it. Just as for creating the application, you can build the application using either the nRF Connect for VS Code extension or the command line.
For instructions about building with the nRF Connect for VS Code extension, see How to build an application in the extension documentation.
By default, the extension runs both stages of the CMake build (configuration phase and building phase). If you want to only set up the build configuration without building it, make sure the Build after generating configuration is not selected.
To build with Sysbuild, select the Use sysbuild checkbox.
If you want to build with custom options or scripts, read about Binding custom tasks to actions in the extension documentation.
Note
Some samples in the nRF Connect SDK are currently not designed to work out-of-tree. You may need to manually configure your sample to work correctly in the nRF Connect for VS Code extension.
For more information about files generated as output of the build process, see Output build files (image files).
Complete the following steps to build on the command line:
Open a terminal window.
Go to the specific application directory.
For example, if you want to build the Cellular: AT Client sample, run the following command to navigate to its directory:
cd nrf/samples/cellular/at_client
Build the application by using the following west command with the board_target specified:
west build -b board_target
See Board names for more information on the supported boards and board targets. The board targets supported for a given application are always listed in its requirements section.
When building repository applications in the SDK repositories, building with sysbuild is enabled by default. If you work with out-of-tree freestanding applications, you need to manually pass the
--sysbuild
parameter to every build command or configure west to always use it.The command can be expanded with Optional build parameters, such as custom CMake options or the
--no-sysbuild
parameter that disables building with sysbuild. The parameters and options passed in the command line always take precedence overwest config
settings.
After running the
west build
command, the build files can be found in the main build directory or in the application-named sub-directories in the main build directory (or both, depending on your project structure). For more information about files generated as output of the build process, see Output build files (image files). For more information on the contents of the build directory, see Build Directory Contents in the Zephyr documentation.For more information on building using the command line, see Building in the Zephyr documentation.
Note
On Windows, because of the Windows path length limitations, the build can fail with errors related to permissions or missing files if some paths in the build are too long.
To avoid this issue, shorten the build folder name, for example to build
, or shorten the path to the build folder in some other way.