https://github.com/maksimdrachov/opencyphal-zephyr
An example Zephyr firmware project that implements a network-controlled LED (through OpenCyphal)
https://github.com/maksimdrachov/opencyphal-zephyr
Last synced: 7 months ago
JSON representation
An example Zephyr firmware project that implements a network-controlled LED (through OpenCyphal)
- Host: GitHub
- URL: https://github.com/maksimdrachov/opencyphal-zephyr
- Owner: maksimdrachov
- Created: 2024-02-02T09:21:04.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-02T12:48:47.000Z (over 1 year ago)
- Last Synced: 2025-01-28T19:24:53.962Z (8 months ago)
- Language: CMake
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenCyphal + Zephyr: example project
In this project I will show how one can setup an Zephyr project for a simple OpenCyphal device: a remotely controlled LED.
I'll be using the following:
- OS: Ubuntu 22.04
- Board: [Nucleo F756-ZG](https://www.st.com/en/evaluation-tools/nucleo-f756zg.html)
- Zephyr: [maksimdrachov/zephyr](https://github.com/maksimdrachov/zephyr/tree/opencyphal-zephyr) (`opencyphal-zephyr` branch)
- I recommend doing the same (make fork, create branch) for the following reasons:
- Sometimes it might be necessary to make small changes in the Zephyr codebase (one should strive to keep those as minimal as possible though).
- By using a seperate branch you can update main and rebase (if some update is necessary).## 1. Setup
To get started we'll need to a bunch of setup steps, this part heavily borrows from [maksimdrachov/zephyr-rtos-template](https://github.com/maksimdrachov/zephyr-rtos-template), so I won't be explaining every step here (check there if you're not sure).
For now I'll just assume you have done the following steps:
```bash
# Setup repository
cd ~
mkdir opencyphal-zephyr
cd opencyphal-zephyr
git init
git remote add origin git@github.com:maksimdrachov/zephyr-rtos-template.git# Create .west
mkdir .west
cd .west
touch config
````.west/config`:
```yml
[manifest]
path = zephyr
file = west.yml
``````bash
cd ~/opencyphal-zephyr
git submodule add https://github.com/maksimdrachov/zephyr zephyr # We will keep track of branch/commit through .git
west update # This will take a while, get some coffee
```Copy this to `.gitignore`
```
# Prerequisites
*.d# Compiled Object files
*.slo
*.lo
*.o
*.obj# Precompiled Headers
*.gch
*.pch# Compiled Dynamic libraries
*.so
*.dylib
*.dll# Fortran module files
*.mod
*.smod# Compiled Static libraries
*.lai
*.la
*.a
*.lib# Executables
*.exe
*.out
*.app# macOS
.DS_Store# Zephyr
bootloader/
/modules/
tools/
build/
zephyr-project-template/build/
twister-out*/# .vscode
.vscode/.cortex-debug*# Python
venv/
__pycache__/# scripts
scripts/platform-tests-results/
*.bin# nox
.nox/
.pytest_cache/
.coverage*# SonarCloud
.scannerwork/
```Now let's run a simple blinky to check if our toolchain is setup correctly:
```bash
cd ~/opencyphal-zephyr
west build -b nucleo_f756zg ./zephyr/samples/basic/blinky
west flash # Should start blinking
```## 2. Minimal template for application
Now let's create a minimal application (we will come back to this later).
```bash
cd ~/opencyphal-zephyr
mkdir app
```