Getting Started With Zephyr RTOS
Getting Started With Zephyr RTOS
Zephyr RTOS
- Unknown
AGENDA
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Introducing the Zephyr Project
Zephyr RTOS Architecture
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Introducing the Zephyr Project
Zephyr APIs
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Introducing the Zephyr Project
POSIX API’s
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Introducing the Zephyr Project
Zephyr Kernel APIs
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
2 Zephyr RTOS Fundamentals
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Zephyr RTOS Fundamentals
Thread States
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Zephyr RTOS Fundamentals
Thread Creation
K_THREAD_STACK_DEFINE(my_stack_area, MY_STACK_SIZE);
Stack Definitions
struct k_thread my_thread_data;
K_THREAD_STACK_SIZEOF(my_stack_area),
MY_PRIORITY, 0, K_NO_WAIT);
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Zephyr RTOS Fundamentals
Thread Creation
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Zephyr RTOS Fundamentals
Semaphores
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
Zephyr RTOS Fundamentals
Mutexes
// Mutex Operations
printk(”Cannot lock Shared Data!");
k_mutex_lock(&my_mutex, K_FOREVER);
}
k_mutex_unlock(&my_mutex); ...
}
©©
2022
E mBeningo
b e d d e dEmbedded
O n l i n e C oGroup,
n f e r e nLLC.
c e . All
com Rights
A l l Reserved
rights reserved EmbeddedOnlineConference.com
3 Introducing The Zephyr Project
RTOS
• Design Work
• Medical Devices
• Scientific Instruments
• LIDAR
• Custom ASIC
• FPGA
• Expertise
• Zephyr
• Yocto/Embedded Linux
/mab-embedded • Qt
@mabembedded
Self-contained
• Support for:
• CPUs
• Boards
• Bootloader
• Subsystems
• Peripherals
• VS Code Plugins!
• Create new project
§ Based on example
• Open existing project
• Configure Zephyr
• Build and debug project
External libraries
RTOS
CPUs
Boards
Device drivers
CPUs
Samples!!
© 2023 MAB Labs. All rights reserved EmbeddedOnlineConference.com
4 Zephyr Application Model
C/C++
source files
Relies on
CMake
Configuration can be
exhaustive!
• Specify
• Target board
• Zephyr configuration
• “Devicetree Overlay”
§ Custom hardware connected to board
SUCCESS!!
• Configuration
• Can be file based
§ Usually “prj.conf”
• Or use GUI
https://github.com/mabembedded/zephyr-sd-spi
• Device Debugging
• Over-the-Air Updates
• Built-in to Zephyr!
https://beningo.mykajabi.com/offers/xeJBY7k5/checkout
w w w . e m b e d d e d o n l i n e c o n f e r e n c e . c o m