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.
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, from build_nrf5340dk_nrf5340_cpuapp_ns
to build
, or shorten the path to the build folder in some other way.
For instructions about building with the nRF Connect for VS Code extension, see How to build an application in the extension documentation.
Note
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.
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 build_target specified:
west build -b build_target
See Board names for more information on the supported boards and build targets. The board targets supported for a given application are always listed in its requirements section.
After running the
west build
command, the build files can be found inbuild/zephyr
. 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.