Advanced building procedures

You can customize the basic building procedures in a variety of ways, depending on the configuration of your project.

Advanced compiler settings

The application has full control over the build process.

Using Zephyr’s configuration options is the standard way of controlling how the system is built. These options can be found under Zephyr’s menuconfig Build and Link Features > Compiler Options. For example, to turn off optimizations, select CONFIG_NO_OPTIMIZATIONS.

Compiler options not controlled by the Zephyr build system can be controlled through the CONFIG_COMPILER_OPT Kconfig option.

Optional build parameters

Here are some of the possible options you can use:

  • You can provide custom CMake options to the build command.

  • You can include the directory_name parameter to build from a directory other than the current directory.

  • You can use the build_target@board_revision parameter to get extra devicetree overlays with new features available for a board version. The board_revision is printed on the label of your DK, just below the PCA number. For example, if you run the west build command with an additional parameter @1.0.0 for nRF9160 build target, it adds the external flash on the nRF9160 DK that was available since board version v0.14.0.

  • You can start menuconfig with the west command to configure your application.

  • You can reuse an existing build directory for building another application for another board or build target by passing -p=auto to west build.

  • You can run unit tests with the west command with the -t run parameter from the unit test directory.

For more information on other optional build parameters, run the west build -h help text command.