|
1 | | -# example-application |
2 | | -Example out-of-tree application that is also a module |
| 1 | +# Zephyr Example Application |
| 2 | + |
| 3 | +This repository contains a Zephyr example application. The main purpose of this |
| 4 | +repository is to serve as a reference on how to structure Zephyr-based |
| 5 | +applications. Some of the features demonstrated in this example are: |
| 6 | + |
| 7 | +- Basic [Zephyr application][app_dev] skeleton |
| 8 | +- [Zephyr workspace applications][workspace_app] |
| 9 | +- [Zephyr modules][modules] |
| 10 | +- [West T2 topology][west_t2] |
| 11 | +- [Custom boards][board_porting] |
| 12 | +- Custom [devicetree bindings][bindings] |
| 13 | +- Out-of-tree [drivers][drivers] |
| 14 | +- Out-of-tree libraries |
| 15 | +- Example CI configuration (using Github Actions) |
| 16 | +- Custom [west extension][west_ext] |
| 17 | + |
| 18 | +This repository is versioned together with the [Zephyr main tree][zephyr]. This |
| 19 | +means that every time that Zephyr is tagged, this repository is tagged as well |
| 20 | +with the same version number, and the [manifest](west.yml) entry for `zephyr` |
| 21 | +will point to the corresponding Zephyr tag. For example, the `example-application` |
| 22 | +v2.6.0 will point to Zephyr v2.6.0. Note that the `main` branch always |
| 23 | +points to the development branch of Zephyr, also `main`. |
| 24 | + |
| 25 | +[app_dev]: https://docs.zephyrproject.org/latest/develop/application/index.html |
| 26 | +[workspace_app]: https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-app |
| 27 | +[modules]: https://docs.zephyrproject.org/latest/develop/modules.html |
| 28 | +[west_t2]: https://docs.zephyrproject.org/latest/develop/west/workspaces.html#west-t2 |
| 29 | +[board_porting]: https://docs.zephyrproject.org/latest/guides/porting/board_porting.html |
| 30 | +[bindings]: https://docs.zephyrproject.org/latest/guides/dts/bindings.html |
| 31 | +[drivers]: https://docs.zephyrproject.org/latest/reference/drivers/index.html |
| 32 | +[zephyr]: https://github.com/zephyrproject-rtos/zephyr |
| 33 | +[west_ext]: https://docs.zephyrproject.org/latest/develop/west/extensions.html |
| 34 | + |
| 35 | +## Getting Started |
| 36 | + |
| 37 | +Before getting started, make sure you have a proper Zephyr development |
| 38 | +environment. Follow the official |
| 39 | +[Zephyr Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html). |
| 40 | + |
| 41 | +### Initialization |
| 42 | + |
| 43 | +The first step is to initialize the workspace folder (``my-workspace``) where |
| 44 | +the ``example-application`` and all Zephyr modules will be cloned. Run the following |
| 45 | +command: |
| 46 | + |
| 47 | +```shell |
| 48 | +# initialize my-workspace for the example-application (main branch) |
| 49 | +west init -m https://github.com/zephyrproject-rtos/example-application --mr main my-workspace |
| 50 | +# update Zephyr modules |
| 51 | +cd my-workspace |
| 52 | +west update |
| 53 | +``` |
| 54 | + |
| 55 | +### Building and running |
| 56 | + |
| 57 | +To build the application, run the following command: |
| 58 | + |
| 59 | +```shell |
| 60 | +west build -b $BOARD app |
| 61 | +``` |
| 62 | + |
| 63 | +where `$BOARD` is the target board. |
| 64 | + |
| 65 | +You can use the `custom_plank` board found in this |
| 66 | +repository. Note that Zephyr sample boards may be used if an |
| 67 | +appropriate overlay is provided (see `app/boards`). |
| 68 | + |
| 69 | +A sample debug configuration is also provided. To apply it, run the following |
| 70 | +command: |
| 71 | + |
| 72 | +```shell |
| 73 | +west build -b $BOARD app -- -DOVERLAY_CONFIG=debug.conf |
| 74 | +``` |
| 75 | + |
| 76 | +Once you have built the application, run the following command to flash it: |
| 77 | + |
| 78 | +```shell |
| 79 | +west flash |
| 80 | +``` |
0 commit comments