Skip to content

πŸš€ Template for a standalone πŸ”₯ Zephyr application ⚑ for STM32

License

Notifications You must be signed in to change notification settings

kaizoku-oh/zephyr-app-workspace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Standalone Zephyr application template

GitHub Build workflow status GitHub release GitHub issues GitHub top language License

This repo can be used as a template and a playground for experimenting with a standalone Zephyr application.

πŸš€ Getting started

# Create a directory for zephyr projects and switch to it
$ mkdir zephyr-projects
$ cd zephyr-projects

# Create python virtual environment there
$ python3 -m venv zephyr-venv

# Activate it
$ source zephyr-venv/bin/activate

# Install west
(zephyr-venv) $ pip install west

# Initialize workspace for the app (main branch)
(zephyr-venv) $ west init -m https://github.com/kaizoku-oh/zephyr-app-workspace --mr main app-workspace
(zephyr-venv) $ cd app-workspace

# Update Zephyr modules
(zephyr-venv) $ west update

# Install python dependencies for zephyr and mcuboot
(zephyr-venv) $ python -m pip install -r deps/zephyr/scripts/requirements.txt
(zephyr-venv) $ python -m pip install -r deps/bootloader/mcuboot/scripts/requirements.txt

# Build the bootloader (mcuboot)
(zephyr-venv) $ west build deps/bootloader/mcuboot/boot/zephyr -d deps/bootloader/mcuboot/boot/zephyr/build -b nucleo_f767zi

# Flash the bootloader (mcuboot)
(zephyr-venv) $ west flash -d deps/bootloader/mcuboot/boot/zephyr/build

# Build the app
(zephyr-venv) $ west build app -d app/build -b nucleo_f767zi

# Flash the app
(zephyr-venv) $ west flash -d app/build

# Copy vscode workspace file from the app to the outer workspace directory
(zephyr-venv) $ cp app/linux.code-workspace .

# Open vscode workspace
(zephyr-venv) $ code linux.code-workspace

Once vscode is open you can run your workspace tasks.

πŸ”¨ Application footprint for NUCLEO-F767ZI

Memory region Used Size Region Size %age Used
FLASH 186206 B 768 KB 23.68%
RAM 57120 B 384 KB 14.53%
QSPI 0 GB 256 MB 0.00%
DTCM 12544 B 128 KB 9.57%
IDT_LIST 0 GB 2 KB 0.00%

πŸ”¨ Bootloader footprint for NUCLEO-F767ZI

Memory region Used Size Region Size %age Used
FLASH 32706 B 64 KB 49.91%
RAM 24320 B 384 KB 6.18%
QSPI 0 GB 256 MB 0.00%
DTCM 0 B 128 KB 0.00%
IDT_LIST 0 GB 2 KB 0.00%

βœ… ToDo

  • Blink board LED

  • Shell over UART

  • Fix vscode launch with cortex-debug

  • Add multithreading code

  • Add die temp sensor class

  • Add Github CI workflow

  • Add GitHub badges to readme

  • Enable C++20

  • Add lambda callback to Serial class

  • Add a simple Network manager class

  • Add NVS Storage class

  • Add HTTP client class

  • Add an IoT app that reads die temperature, store it in NVS, retrieve it, format it then send it

  • Add vscode dev container environment

  • Build project with MCUBoot

  • Run app in Renode

  • Add configurable vscode tasks

  • Integrate Renode + robot in the CI workflow

  • Solve the Shared Callback Registration problem in the Network class

  • Add native simulator to vscode build task

  • Add a script to download and setup the project (intellisense, structure, venv...)

  • Add static code analysis with CodeChecker

  • Add coverage testing with gcov

  • Add unit tests using Ztest and run them using Twister

  • Add integration tests

  • Add HIL tests using GitHub local runner

  • Add application events manager using zbus

  • Automate updating the README.md Build footprint table automatically by running a post build

  • Add debouncing mechanism to Button class

  • Add OTA update example

  • Add lambda callback to Button class

  • Use the active object design pattern

  • Use an event driven state machine using the SMF OS service and the message queue kernel object

  • Add Local class for managing local time and geo-location

  • Add MQTT client class

  • Add TCP class

  • Add an out-of-tree driver

πŸ’³ Credits

This project is generated from the zephyr-vscode-example template by Jonathan Beri.

It is following the Golioth recommended way to structure a zephyr app using manifest files, more on this in this blog post.