Skip to content

Commit bab5da6

Browse files
casarolikr-t
authored andcommitted
docs: custom zephyr application
Add the documentation about how to use Ocre Runtime in an existing custom Zephyr application. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
1 parent e8083e1 commit bab5da6

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

docs/CustomZephyrApplication.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Adding Ocre Zephyr module to a custom Zephyr application
2+
3+
Ocre comes with a few samples to get you going fast:
4+
5+
- [`src/samples/mini/zephyr`](samples/mini.md)
6+
- [`src/samples/demo/zephyr`](samples/demo.md)
7+
- [`src/samples/supervisor/zephyr`](samples/supervisor.md)
8+
9+
However in most real-world scenarios, you will want to create your own application that controls Ocre.
10+
11+
This will guide you through the process of adding Ocre to an already existing Zephyr application.
12+
13+
Assuming you have a working zephyr build workspace, for example:
14+
15+
```sh
16+
cd ~/zephyrproject
17+
ls -1a
18+
```
19+
20+
Output includes:
21+
22+
```
23+
.west
24+
zephyr
25+
modules
26+
```
27+
28+
You can add Ocre as a Zephyr module alongside the other directories (or anywhere else):
29+
30+
```sh
31+
cd ~/zephyrproject
32+
git clone --recursive https://github.com/project-ocre/ocre-runtime.git
33+
```
34+
35+
And we can add include the Ocre Zephyr module in the build:
36+
37+
```sh
38+
export EXTRA_ZEPHYR_MODULES=~/zephyrproject/ocre-runtime
39+
```
40+
41+
Note that the ocre command line shell interface is not part of ocre-runtime, but part of the supervisor sample.
42+
43+
You probably want your application to control Ocre, being able to `#include <ocre/ocre.h>` and make calls to its API, so you need to tell Zephyr build system to make Ocre Runtime available to your application:
44+
45+
Edit `CMakeLists.txt` on your application and add:
46+
47+
```
48+
target_link_libraries(app
49+
PUBLIC
50+
OcreCore
51+
)
52+
```
53+
54+
And you can continue building your application normally, which should be able to use Ocre.
55+
56+
See [Get Started with Zephyr](GetStartedZephyr.md) for more information.
57+
58+
Also, check the API documentation for more information on how to use Ocre in your application.

0 commit comments

Comments
 (0)