SlideShare a Scribd company logo
Zephyr RTOS in
One Hour
Pavel Hübner <pavel.hubner@hardwario.com>
CTO & Co-founder at HARDWARIO
Zephyr RTOS I.
❏ Scalable, secure & safe
❏ Friendly for low-power applications
❏ Designed with IoT projects in mind
❏ Vast range of connectivity options
❏ Integrates with MCUboot bootloader
❏ Encourages portability & code re-usability
❏ Protects investments to your code by
imposing low-maintenance requirements
❏ But there is a learning curve…
Zephyr RTOS II.
❏ Operating system for microcontrollers (minimum = 32 bits)
❏ Inspired by Linux kernel, backed by Linux Foundation
❏ Big vendors: Intel, Facebook, Google, NXP, Nordic Semiconductor, …
❏ Homepage: https://www.zephyrproject.org/
❏ Documentation: https://docs.zephyrproject.org/latest/
❏ GitHub: https://github.com/zephyrproject-rtos/zephyr
❏ 74,000+ commits
nRF Connect SDK
❏ Additional layer on top of the Zephyr RTOS
❏ Provides extra support for nRF5x / nRF91 SOCs
❏ BLE (SoftDevice) stack support, Thread, Matter, …
❏ Maintained only by Nordic Semiconductor
❏ Homepage: https://bit.ly/33pdPT1
❏ Documentation: https://bit.ly/3ndUDyv
❏ GitHub: https://github.com/nrfconnect/sdk-nrf
❏ 13,000+ commits
CHESTER Platform
❏ Configurable IoT gateway for industrial IoT applications
❏ Connectivity (NB-IoT, LTE-M, LoRaWAN, Astrocast, BLE, GNSS)
❏ Extensibility (CHESTER-X, CHESTER-Z, CHESTER-A, …)
❏ Power supply flexibility (LiSoCl2
3.6 V, Li-Ion, 24 VDC
, 230 VAC
, PV panels)
❏ Introduction video: https://youtu.be/YvKjCou68jw
❏ Product homepage: https://www.hardwario.com/chester/
❏ Product manual: https://docs.hardwario.com/chester/
❏ Open platform for HARDWARIO partners with full OEM customization
❏ Applications: Industrial IoT projects
Firmware landscape
BLE
nRF52840
Application
LTE
nRF9160
Serial modem
LoRaWAN
Murata
Serial modem
CHESTER SDK
is for this part
SWD
connector
SWD
connector
SWD
connector
Software stack
Onion-like layering but in a flat folder structure…
Zephyr RTOS
nRF Connect SDK
CHESTER SDK
Your application
Requirements
❏ Basic software development skills
❏ Operating system: Linux, macOS , Windows 10/11
❏ Reasonably fast machine (SSD, CPU, RAM)
❏ CHESTER (developer's edition)
❏ SEGGER J-Link (flashing + debugging)
❏ Recommended: Power Profiler Kit II
❏ Recommended: Visual Studio Code
(though any editor will work)
Software tools
❏ Compiler toolchain - Zephyr SDK 0.15.1
❏ CMake build generator (default build system = Ninja)
❏ Zephyr meta-tool West:
❏ Git repository management (multirepository)
❏ Build invocation
❏ Target flashing
❏ Target debugging
❏ nRF Command Line Tools (nrfjprog + SEGGER tools)
❏ nRF Connect for Desktop - Programmer, Power Profiler,
Toochain Manager, Bluetooth Low Energy, …
❏ nRF Device Manager - Bluetooth scanner + DFU firmware updates over BLE
❏ Bluefruit Connect (iOS / Android) - Shell interaction (through emulated UART)
❏ HARDWARIO Manager (iOS / Android) - Mobile app for CHESTER management
❏ HARDWARIO Monitor (cross-platform desktop app; implementation Qt 6 / C++)
❏ HARDWARIO Command Line Tools
West workspace
❏ Top-most folder contains .west directory
❏ File .west/config points to top-most manifest file
❏ Manifest file defines Git remote, Git projects + their path
❏ Recursive manifest file importing
❏ Definition of project self-placement
in West workspace
Workspace setup
❏ Initialize West workspace: west init
❏ Exploring workspace folder structure…
❏ All top-level folder are Git repositories
❏ Folder chester (SDK repo content):
❏ Folder applications - reference fully-fledged projects
❏ Folder boards - board definitions + DTS
❏ Folder drivers - device drivers following Device Driver Model
❏ Folder dts - Device Tree bindings + overlays
❏ Folder include - include headers (public interfaces)
❏ Folder lib - generic libraries
❏ Folder samples - minimalistic applications for various functions
❏ Folder scripts - helper scripts (also extensions to West)
❏ Folder subsys - independent subsystems (i.e. LTE, LoRaWAN, etc.)
❏ Folder zephyr - contains module.yaml defining basic paths in project
Basic workflow
❏ Define application requirements
❏ Repeat until the state of pure happiness:
❏ Edit source code
❏ Build application: west build (all output is in the build folder)
❏ Flash application: west flash
❏ Interact with the application in HARDWARIO Console / Monitor
❏ Eventually, debug the application: west debug / west attach
❏ Usually access to logging and shell
is very sufficient and traditional debugging is not needed
❏ Deploy application (create Git tag)
❏ Use continuous integration (nRF Connect SDK Docker image)
Build system
❏ Build system generator = CMake
❏ Default build system = ninja
❏ Everything is defined in a
human-friendly CMakeLists.txt
❏ No direct invocation is needed
❏ Execution is handled by west
❏ New directories with CMakeLists.txt
can be conditionally added via:
add_subdirectory_ifdef(CONFIG_SERIAL serial)
Kconfig system
❏ Heritage from Linux kernel
❏ Domain-specific language
❏ Defines existence and relationships
between build-time options
❏ Preprocessing before build
❏ Option selection via <board>_defconfig + prj.conf + optional overlays
❏ Result: autoconf.h full of #define CONFIG_<option> <value>
❏ Force-included into each file in the build
❏ Options should be checked in code via:
❏ #if CONFIG_<option>
❏ if (IS_ENABLED(CONFIG_<option>))
Device Tree system
❏ Heritage from Linux kernel
❏ Domain-specific language
❏ Describes hardware model in a tree-like structure
❏ Zero overhead in target environment
❏ Result: devicetree_unfixed.h
❏ Included via #include <kernel/devicetree.h>
❏ Binding example 1:
const struct device *dev = DEVICE_DT_GET(
DT_PARENT(DT_NODELABEL(node_label)));
❏ Binding example 2:
const struct device *dev = device_get_binding("LABEL");
Zephyr fundamentals I.
❏ Thread manipulation:
❏ Thread object - k_thread
❏ k_thread_init() or K_THREAD_DEFINE()
❏ k_sleep() - mostly used with macros:
❏ K_MSEC(n), K_SECONDS(n), K_FOREVER, …
❏ k_yield()
❏ Workqueue threads
❏ System or dedicated workqueue
❏ k_work_submit()
❏ Atomic services:
❏ atomic_t
❏ atomic_set()
❏ atomic_get()
Zephyr fundamentals II.
❏ Synchronization objects:
❏ Mutex object - k_mutex
❏ Semaphore object - k_sem
❏ Signal object - k_signal
❏ Data passing objects:
❏ FIFO object - k_fifo
❏ Pipe object - k_pipe
❏ Message queue object - k_msgq
❏ Ring buffer object - ringbuf
❏ Object polling:
❏ Wait on event from 1 or more sources
❏ k_poll()
Zephyr fundamentals III.
❏ Mutex services:
❏ K_MUTEX_DEFINE() or k_mutex_init()
❏ k_mutex_lock()
❏ k_mutex_unlock() - never forget…
❏ Pitfall = deadlock
❏ Timer control:
❏ k_timer_init() or K_TIMER_DEFINE()
❏ k_timer_start()
❏ Interrupt context
❏ Critical error:
❏ k_oops()
❏ Watchdog timer is advised to be enabled
Useful tips & tricks
❏ Pristine build: west build -t pristine
❏ Start from clean table: rm -rf build
❏ Start Kconfig wizard (terminal): west build -t menuconfig
❏ Start Kconfig wizard (GUI): west build -t guiconfig
❏ Processed Device Tree: devicetree_unfixed.h
❏ Processed Kconfig output: autoconf.h
❏ Output artifacts: zephyr.hex / zephyr.bin / zephyr.elf
❏ With bootloader: merged.hex / app_update.bin
❏ Build errors from compiler → start from top
❏ Build errors from linker → start from bottom
Logging subsystem
❏ Zero to N backend architecture
❏ Backends: UART, RTT, BLE, …
❏ Logger definition per module
❏ Individual log level - should be passed via Kconfig
❏ Logger module registration:
LOG_MODULE_REGISTER(ctr_lte_if, CONFIG_CTR_LTE_IF_LOG_LEVEL);
❏ Four basic log levels:
❏ Error - LOG_ERR("...")
❏ Warning - LOG_WRN("...")
❏ Info - LOG_INF("...")
❏ Debug - LOG_DBG("...")
❏ Logging macros support full printf-style formatting
Shell subsystem
❏ Zero to N backend architecture
❏ Backends: UART, RTT, BLE, …
❏ Shell-alike interaction with a microcontroller
❏ Command definition in a tree structure
❏ Help navigation is provided
❏ Commands are defined per module
❏ Allows definitions without module cross-dependencies
❏ Several useful built-in commands:
❏ help
❏ kernel threads
❏ kernel stacks
❏ kernel uptime
❏ kernel reboot cold
Settings subsystem
❏ Multiple storage formats:
❏ NVS, LittleFS, FAT, …
❏ Multiple storage media:
❏ Internal flash, NOR flash, eMMC, …
❏ Today: NVS in internal flash
❏ Future: LittleFS + possibility to download file over BLE
❏ No need to change implementation,
just a matter of configuration
❏ Settings handler registered per module
❏ Settings = simple key/value storage
❏ A bit of boilerplate code to enable it on module
❏ Penalty for robustness
Demo
CHESTER DevKit
https://shop.hardwario.com/chester-devkit/
❏ 20% discount - use voucher iotnorth
❏ Voucher valid only until Feb 12, 2023
Meet us in person:
1. Zephyr booth at Embedded World
March 14-16, 2023 in Nuremberg
2. Zephyr Developer Summit
June 27-30, 2023 in Prague

More Related Content

What's hot

Linux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platformLinux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platform
Emertxe Information Technologies Pvt Ltd
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
shimosawa
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
C4Media
 
Probabilistic programming
Probabilistic programmingProbabilistic programming
Probabilistic programming
Eli Gottlieb
 
Embedded Rust on IoT devices
Embedded Rust on IoT devicesEmbedded Rust on IoT devices
Embedded Rust on IoT devices
Lars Gregori
 
C Programming - Refresher - Part II
C Programming - Refresher - Part II C Programming - Refresher - Part II
C Programming - Refresher - Part II
Emertxe Information Technologies Pvt Ltd
 
Pthread
PthreadPthread
Pthread
Gopi Saiteja
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
Marco Tusa
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
Uday Sharma
 
Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016
Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016
Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016
DataStax
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
Linaro
 
Introduction and Deep Dive Into Containerd
Introduction and Deep Dive Into ContainerdIntroduction and Deep Dive Into Containerd
Introduction and Deep Dive Into Containerd
Kohei Tokunaga
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
Emertxe Information Technologies Pvt Ltd
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
Mydbops
 
Introduction to Return-Oriented Exploitation on ARM64 - Billy Ellis
Introduction to Return-Oriented Exploitation on ARM64 - Billy EllisIntroduction to Return-Oriented Exploitation on ARM64 - Billy Ellis
Introduction to Return-Oriented Exploitation on ARM64 - Billy Ellis
BillyEllis3
 
Docker Architecture (v1.3)
Docker Architecture (v1.3)Docker Architecture (v1.3)
Docker Architecture (v1.3)
rajdeep
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centers
MariaDB plc
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
Chiawei Wang
 

What's hot (20)

Linux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platformLinux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platform
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
 
Probabilistic programming
Probabilistic programmingProbabilistic programming
Probabilistic programming
 
Embedded Rust on IoT devices
Embedded Rust on IoT devicesEmbedded Rust on IoT devices
Embedded Rust on IoT devices
 
C Programming - Refresher - Part II
C Programming - Refresher - Part II C Programming - Refresher - Part II
C Programming - Refresher - Part II
 
Pthread
PthreadPthread
Pthread
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
MySQL innoDB split and merge pages
MySQL innoDB split and merge pagesMySQL innoDB split and merge pages
MySQL innoDB split and merge pages
 
Parallel Programming
Parallel ProgrammingParallel Programming
Parallel Programming
 
Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016
Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016
Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
 
Introduction and Deep Dive Into Containerd
Introduction and Deep Dive Into ContainerdIntroduction and Deep Dive Into Containerd
Introduction and Deep Dive Into Containerd
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 
Introduction to Return-Oriented Exploitation on ARM64 - Billy Ellis
Introduction to Return-Oriented Exploitation on ARM64 - Billy EllisIntroduction to Return-Oriented Exploitation on ARM64 - Billy Ellis
Introduction to Return-Oriented Exploitation on ARM64 - Billy Ellis
 
Docker Architecture (v1.3)
Docker Architecture (v1.3)Docker Architecture (v1.3)
Docker Architecture (v1.3)
 
Embedded C - Day 2
Embedded C - Day 2Embedded C - Day 2
Embedded C - Day 2
 
Running MariaDB in multiple data centers
Running MariaDB in multiple data centersRunning MariaDB in multiple data centers
Running MariaDB in multiple data centers
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 

Similar to Zephyr RTOS in One Hour | HARDWARIO @ IoT North UK

Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
Dheryta Jaisinghani
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
RightScale
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
Eddy Reyes
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
Xavier Hallade
 
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
DefCamp
 
Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#
Mauricio Velazco
 
Tuning systemd for embedded
Tuning systemd for embeddedTuning systemd for embedded
Tuning systemd for embedded
Alison Chaiken
 
Nomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweightsNomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweights
Iago López Galeiras
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
Opersys inc.
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
Rashmi Warghade
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
Kan-Ru Chen
 
Cuda 2011
Cuda 2011Cuda 2011
Cuda 2011
coolmirza143
 
Driver_linux
Driver_linuxDriver_linux
Driver_linux
Sayanton Vhaduri
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstack
Deepak Garg
 
Programming languages
Programming languagesProgramming languages
Programming languages
Dmitry Zinoviev
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班
Paul Chao
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015
Giorgio Cefaro
 
Talk 160920 @ Cat System Workshop
Talk 160920 @ Cat System WorkshopTalk 160920 @ Cat System Workshop
Talk 160920 @ Cat System Workshop
Quey-Liang Kao
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
Mohammed Farrag
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimes
Akihiro Suda
 

Similar to Zephyr RTOS in One Hour | HARDWARIO @ IoT North UK (20)

Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
Linux kernel modules
Linux kernel modulesLinux kernel modules
Linux kernel modules
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
Hunting and Exploiting Bugs in Kernel Drivers - DefCamp 2012
 
Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#
 
Tuning systemd for embedded
Tuning systemd for embeddedTuning systemd for embedded
Tuning systemd for embedded
 
Nomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweightsNomad + Flatcar: a harmonious marriage of lightweights
Nomad + Flatcar: a harmonious marriage of lightweights
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Cuda 2011
Cuda 2011Cuda 2011
Cuda 2011
 
Driver_linux
Driver_linuxDriver_linux
Driver_linux
 
Developing with-devstack
Developing with-devstackDeveloping with-devstack
Developing with-devstack
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
開放運算&GPU技術研究班
開放運算&GPU技術研究班開放運算&GPU技術研究班
開放運算&GPU技術研究班
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015
 
Talk 160920 @ Cat System Workshop
Talk 160920 @ Cat System WorkshopTalk 160920 @ Cat System Workshop
Talk 160920 @ Cat System Workshop
 
Lecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports DevelopmentLecture 6 Kernel Debugging + Ports Development
Lecture 6 Kernel Debugging + Ports Development
 
The internals and the latest trends of container runtimes
The internals and the latest trends of container runtimesThe internals and the latest trends of container runtimes
The internals and the latest trends of container runtimes
 

Recently uploaded

加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样
u0g33km
 
按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理
按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理
按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理
yizxn4sx
 
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
xuqdabu
 
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
terpt4iu
 
一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理
一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理
一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理
kuehcub
 
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalRBuilding a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Peter Gallagher
 
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
nudduv
 
按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理
按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理
按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理
terpt4iu
 
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
1jtj7yul
 
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
snfdnzl7
 
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
nvoyobt
 
一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理
一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理
一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理
byfazef
 
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
terpt4iu
 
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
yizxn4sx
 
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
uyesp1a
 
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
8db3cz8x
 
一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理
一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理
一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理
xuqdabu
 
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
2g3om49r
 
按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理
按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理
按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理
zpc0z12
 
按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理
按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理
按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理
6oo02s6l
 

Recently uploaded (20)

加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样加急办理美国南加州大学毕业证文凭毕业证原版一模一样
加急办理美国南加州大学毕业证文凭毕业证原版一模一样
 
按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理
按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理
按照学校原版(Westminster文凭证书)威斯敏斯特大学毕业证快速办理
 
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide文凭证书)阿德莱德大学毕业证如何办理
 
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
按照学校原版(KCL文凭证书)伦敦国王学院毕业证快速办理
 
一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理
一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理
一比一原版(KCL文凭证书)伦敦国王学院毕业证如何办理
 
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalRBuilding a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR
 
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
一比一原版(ANU文凭证书)澳大利亚国立大学毕业证如何办理
 
按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理
按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理
按照学校原版(Adelaide文凭证书)阿德莱德大学毕业证快速办理
 
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
按照学校原版(UVic文凭证书)维多利亚大学毕业证快速办理
 
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
按照学校原版(USD文凭证书)圣地亚哥大学毕业证快速办理
 
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
买(usyd毕业证书)澳洲悉尼大学毕业证研究生文凭证书原版一模一样
 
一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理
一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理
一比一原版(Greenwich文凭证书)格林威治大学毕业证如何办理
 
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
按照学校原版(UOL文凭证书)利物浦大学毕业证快速办理
 
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
按照学校原版(UAL文凭证书)伦敦艺术大学毕业证快速办理
 
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
按照学校原版(Columbia文凭证书)哥伦比亚大学毕业证快速办理
 
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理按照学校原版(QU文凭证书)皇后大学毕业证快速办理
按照学校原版(QU文凭证书)皇后大学毕业证快速办理
 
一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理
一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理
一比一原版(UQ文凭证书)昆士兰大学毕业证如何办理
 
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
1比1复刻澳洲皇家墨尔本理工大学毕业证本科学位原版一模一样
 
按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理
按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理
按照学校原版(UST文凭证书)圣托马斯大学毕业证快速办理
 
按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理
按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理
按照学校原版(Birmingham文凭证书)伯明翰大学|学院毕业证快速办理
 

Zephyr RTOS in One Hour | HARDWARIO @ IoT North UK

  • 1. Zephyr RTOS in One Hour Pavel Hübner <pavel.hubner@hardwario.com> CTO & Co-founder at HARDWARIO
  • 2. Zephyr RTOS I. ❏ Scalable, secure & safe ❏ Friendly for low-power applications ❏ Designed with IoT projects in mind ❏ Vast range of connectivity options ❏ Integrates with MCUboot bootloader ❏ Encourages portability & code re-usability ❏ Protects investments to your code by imposing low-maintenance requirements ❏ But there is a learning curve…
  • 3. Zephyr RTOS II. ❏ Operating system for microcontrollers (minimum = 32 bits) ❏ Inspired by Linux kernel, backed by Linux Foundation ❏ Big vendors: Intel, Facebook, Google, NXP, Nordic Semiconductor, … ❏ Homepage: https://www.zephyrproject.org/ ❏ Documentation: https://docs.zephyrproject.org/latest/ ❏ GitHub: https://github.com/zephyrproject-rtos/zephyr ❏ 74,000+ commits
  • 4. nRF Connect SDK ❏ Additional layer on top of the Zephyr RTOS ❏ Provides extra support for nRF5x / nRF91 SOCs ❏ BLE (SoftDevice) stack support, Thread, Matter, … ❏ Maintained only by Nordic Semiconductor ❏ Homepage: https://bit.ly/33pdPT1 ❏ Documentation: https://bit.ly/3ndUDyv ❏ GitHub: https://github.com/nrfconnect/sdk-nrf ❏ 13,000+ commits
  • 5. CHESTER Platform ❏ Configurable IoT gateway for industrial IoT applications ❏ Connectivity (NB-IoT, LTE-M, LoRaWAN, Astrocast, BLE, GNSS) ❏ Extensibility (CHESTER-X, CHESTER-Z, CHESTER-A, …) ❏ Power supply flexibility (LiSoCl2 3.6 V, Li-Ion, 24 VDC , 230 VAC , PV panels) ❏ Introduction video: https://youtu.be/YvKjCou68jw ❏ Product homepage: https://www.hardwario.com/chester/ ❏ Product manual: https://docs.hardwario.com/chester/ ❏ Open platform for HARDWARIO partners with full OEM customization ❏ Applications: Industrial IoT projects
  • 6. Firmware landscape BLE nRF52840 Application LTE nRF9160 Serial modem LoRaWAN Murata Serial modem CHESTER SDK is for this part SWD connector SWD connector SWD connector
  • 7. Software stack Onion-like layering but in a flat folder structure… Zephyr RTOS nRF Connect SDK CHESTER SDK Your application
  • 8. Requirements ❏ Basic software development skills ❏ Operating system: Linux, macOS , Windows 10/11 ❏ Reasonably fast machine (SSD, CPU, RAM) ❏ CHESTER (developer's edition) ❏ SEGGER J-Link (flashing + debugging) ❏ Recommended: Power Profiler Kit II ❏ Recommended: Visual Studio Code (though any editor will work)
  • 9. Software tools ❏ Compiler toolchain - Zephyr SDK 0.15.1 ❏ CMake build generator (default build system = Ninja) ❏ Zephyr meta-tool West: ❏ Git repository management (multirepository) ❏ Build invocation ❏ Target flashing ❏ Target debugging ❏ nRF Command Line Tools (nrfjprog + SEGGER tools) ❏ nRF Connect for Desktop - Programmer, Power Profiler, Toochain Manager, Bluetooth Low Energy, … ❏ nRF Device Manager - Bluetooth scanner + DFU firmware updates over BLE ❏ Bluefruit Connect (iOS / Android) - Shell interaction (through emulated UART) ❏ HARDWARIO Manager (iOS / Android) - Mobile app for CHESTER management ❏ HARDWARIO Monitor (cross-platform desktop app; implementation Qt 6 / C++) ❏ HARDWARIO Command Line Tools
  • 10. West workspace ❏ Top-most folder contains .west directory ❏ File .west/config points to top-most manifest file ❏ Manifest file defines Git remote, Git projects + their path ❏ Recursive manifest file importing ❏ Definition of project self-placement in West workspace
  • 11. Workspace setup ❏ Initialize West workspace: west init ❏ Exploring workspace folder structure… ❏ All top-level folder are Git repositories ❏ Folder chester (SDK repo content): ❏ Folder applications - reference fully-fledged projects ❏ Folder boards - board definitions + DTS ❏ Folder drivers - device drivers following Device Driver Model ❏ Folder dts - Device Tree bindings + overlays ❏ Folder include - include headers (public interfaces) ❏ Folder lib - generic libraries ❏ Folder samples - minimalistic applications for various functions ❏ Folder scripts - helper scripts (also extensions to West) ❏ Folder subsys - independent subsystems (i.e. LTE, LoRaWAN, etc.) ❏ Folder zephyr - contains module.yaml defining basic paths in project
  • 12. Basic workflow ❏ Define application requirements ❏ Repeat until the state of pure happiness: ❏ Edit source code ❏ Build application: west build (all output is in the build folder) ❏ Flash application: west flash ❏ Interact with the application in HARDWARIO Console / Monitor ❏ Eventually, debug the application: west debug / west attach ❏ Usually access to logging and shell is very sufficient and traditional debugging is not needed ❏ Deploy application (create Git tag) ❏ Use continuous integration (nRF Connect SDK Docker image)
  • 13. Build system ❏ Build system generator = CMake ❏ Default build system = ninja ❏ Everything is defined in a human-friendly CMakeLists.txt ❏ No direct invocation is needed ❏ Execution is handled by west ❏ New directories with CMakeLists.txt can be conditionally added via: add_subdirectory_ifdef(CONFIG_SERIAL serial)
  • 14. Kconfig system ❏ Heritage from Linux kernel ❏ Domain-specific language ❏ Defines existence and relationships between build-time options ❏ Preprocessing before build ❏ Option selection via <board>_defconfig + prj.conf + optional overlays ❏ Result: autoconf.h full of #define CONFIG_<option> <value> ❏ Force-included into each file in the build ❏ Options should be checked in code via: ❏ #if CONFIG_<option> ❏ if (IS_ENABLED(CONFIG_<option>))
  • 15. Device Tree system ❏ Heritage from Linux kernel ❏ Domain-specific language ❏ Describes hardware model in a tree-like structure ❏ Zero overhead in target environment ❏ Result: devicetree_unfixed.h ❏ Included via #include <kernel/devicetree.h> ❏ Binding example 1: const struct device *dev = DEVICE_DT_GET( DT_PARENT(DT_NODELABEL(node_label))); ❏ Binding example 2: const struct device *dev = device_get_binding("LABEL");
  • 16. Zephyr fundamentals I. ❏ Thread manipulation: ❏ Thread object - k_thread ❏ k_thread_init() or K_THREAD_DEFINE() ❏ k_sleep() - mostly used with macros: ❏ K_MSEC(n), K_SECONDS(n), K_FOREVER, … ❏ k_yield() ❏ Workqueue threads ❏ System or dedicated workqueue ❏ k_work_submit() ❏ Atomic services: ❏ atomic_t ❏ atomic_set() ❏ atomic_get()
  • 17. Zephyr fundamentals II. ❏ Synchronization objects: ❏ Mutex object - k_mutex ❏ Semaphore object - k_sem ❏ Signal object - k_signal ❏ Data passing objects: ❏ FIFO object - k_fifo ❏ Pipe object - k_pipe ❏ Message queue object - k_msgq ❏ Ring buffer object - ringbuf ❏ Object polling: ❏ Wait on event from 1 or more sources ❏ k_poll()
  • 18. Zephyr fundamentals III. ❏ Mutex services: ❏ K_MUTEX_DEFINE() or k_mutex_init() ❏ k_mutex_lock() ❏ k_mutex_unlock() - never forget… ❏ Pitfall = deadlock ❏ Timer control: ❏ k_timer_init() or K_TIMER_DEFINE() ❏ k_timer_start() ❏ Interrupt context ❏ Critical error: ❏ k_oops() ❏ Watchdog timer is advised to be enabled
  • 19. Useful tips & tricks ❏ Pristine build: west build -t pristine ❏ Start from clean table: rm -rf build ❏ Start Kconfig wizard (terminal): west build -t menuconfig ❏ Start Kconfig wizard (GUI): west build -t guiconfig ❏ Processed Device Tree: devicetree_unfixed.h ❏ Processed Kconfig output: autoconf.h ❏ Output artifacts: zephyr.hex / zephyr.bin / zephyr.elf ❏ With bootloader: merged.hex / app_update.bin ❏ Build errors from compiler → start from top ❏ Build errors from linker → start from bottom
  • 20. Logging subsystem ❏ Zero to N backend architecture ❏ Backends: UART, RTT, BLE, … ❏ Logger definition per module ❏ Individual log level - should be passed via Kconfig ❏ Logger module registration: LOG_MODULE_REGISTER(ctr_lte_if, CONFIG_CTR_LTE_IF_LOG_LEVEL); ❏ Four basic log levels: ❏ Error - LOG_ERR("...") ❏ Warning - LOG_WRN("...") ❏ Info - LOG_INF("...") ❏ Debug - LOG_DBG("...") ❏ Logging macros support full printf-style formatting
  • 21. Shell subsystem ❏ Zero to N backend architecture ❏ Backends: UART, RTT, BLE, … ❏ Shell-alike interaction with a microcontroller ❏ Command definition in a tree structure ❏ Help navigation is provided ❏ Commands are defined per module ❏ Allows definitions without module cross-dependencies ❏ Several useful built-in commands: ❏ help ❏ kernel threads ❏ kernel stacks ❏ kernel uptime ❏ kernel reboot cold
  • 22. Settings subsystem ❏ Multiple storage formats: ❏ NVS, LittleFS, FAT, … ❏ Multiple storage media: ❏ Internal flash, NOR flash, eMMC, … ❏ Today: NVS in internal flash ❏ Future: LittleFS + possibility to download file over BLE ❏ No need to change implementation, just a matter of configuration ❏ Settings handler registered per module ❏ Settings = simple key/value storage ❏ A bit of boilerplate code to enable it on module ❏ Penalty for robustness
  • 23. Demo
  • 24. CHESTER DevKit https://shop.hardwario.com/chester-devkit/ ❏ 20% discount - use voucher iotnorth ❏ Voucher valid only until Feb 12, 2023 Meet us in person: 1. Zephyr booth at Embedded World March 14-16, 2023 in Nuremberg 2. Zephyr Developer Summit June 27-30, 2023 in Prague