Build an Application
The build process unifies all components of the application into a coherent application image that can be run on both simulated and real hardware targets.
Building a Base Application
Build a base application image to test functionality in a simulated environment and to ultimately run on your hardware target. Before building, keep in mind the following:
- Each source code directory and sub-directory needs a directory-specific
Makefile
. - The
$(ZEPHYR_BASE)
environment variable must be set for each console terminal as outlined in Common Procedures.
To build the image, navigate to the ~/appDir
. From here you can
build an image for a single target with make.
Developing the Application
The app development process works best when changes are continually tested. Frequently rebuilding with make makes debugging less painful as your application becomes more complex. It’s usually a good idea to rebulild and test after any major changes to source files, Makefiles, .conf, or .mdef.
Important
The Zephyr build system rebuilds only the parts of the application image potentially affected by the changes; as such, the application may rebuild significantly faster than it did when it was first built.
Recovering from Build Failure
Sometimes the build system doesn’t rebuild the application correctly because it fails to recompile one or more necessary files. You can force the build system to rebuild the entire application from scratch with the following procedure:
- Navigate to the application directory
~/appDir
. - Run $ make clean, or manually delete the generated files,
including the
.config
file. - Run $ make pristine.
- Optionally, override the values specified in the application’s
.conf
file by specifying the kernel configuration option settings needed. - Run $ make menuconfig.
- Rebuild the application normally. Run $ make