This repository contains the source code for a Zephyr RTOS template application.
TODO: Add description for development environment setup
You can clone the project by running the following command from WSL2:
# cd to your projects root folder e.g. ~/projects
$ cd ~/projects
# clone the repository and it's submodules
$ git clone --recursive git@github.com:pflonz/zephyr-application-template.gitIf your're using the VSCode devcontainer, there is nothing to do.
If you want to setup the project within WSL2 please run these commands:
# cd into the application project folder
$ cd ~/projects/zephyr-application-template
# run west update to initialize the project and it's dependencies
$ west update
# export the project's CMake configuration
$ west zephyr-export# cd into the project folder
$ cd ~/projects/zephyr-application-template
# Release build
$ west build -b <your-board> -s apps/template
# or
$ west build -b <your-board> -s apps/template -- -DBUILD_TYPE=release
# Debug build
$ west build -b <your-board> -s apps/template -- -DBUILD_TYPE=debugThe configuration of the project can be done in two different ways:
-
Customize the project configuration file.
The project configuration file
prj.confcan be edited directly in the editor and can be found under the pathapp/prj.conf -
Customize the project configuration via the GUI.
The build target
menuconfigcan be used to start the GUI for the project configuration. The command for this is:$ west build -b <your-board> -s apps/template -t menuconfigNote: The GUI can only be used if the project has been built at least once.
From project root folder call:
west flashFrom project root folder call:
west espressif monitorThe following approaches currently works only for specific modules.
This approach is useful when you want to run unit tests manually, for example, when you want to build software according to the concept of test-driven development (TDD).
# Basic approach
$ west build -b unit_testing -d build/unit_testing/<your_module> deps/modules/<your_module>/tests && build/unit_testing/<<our_module>/testbinary
# Example for "sample_module"
$ west build -b unit_testing -d build/unit_testing deps/modules/sample_module/tests && build/unit_testing/testbinaryThis approach is useful when you want to run all unit tests automatically, for example when you want to run unit tests in a CI/CD pipeline.
If you want to run one specific test you can use the
-Toption to specify the folder where the test is located.
# Build and run ALL unit tests and create coverage reports (around 200)
$ west twister --coverage -p unit_testing -O build/twister-out
# Build and run unit tests for a specific module (e.g. smaple_modules) and create coverage reports
$ west twister --coverage -p unit_testing -O build/twister-out -T ./deps/modules/sample_module/The documentation is based on Doxygen and can be build with the following command:
# Build documentation
$ west build -b <your-board> -s apps/template -t doxygen- Add unit test suite for the application
- Automate c_cpp_properties.json update by script