SlideShare a Scribd company logo
RTOS - CM
Neo Jou
IOT 技術同好會
Search : Ameba / IoT
AMEBA
CMSIS-DAP
USB mbed disk / USB-Serial / Debug
TOPICS
Cortex-M
RTOS
OS / Realtime
HW design for RTOS
Micro Kernel
memory
schedule
IPC
Future
ARM ARCH
ARM
ARM CORTEX
TOPICS
Cortex-M
RTOS
OS / Realtime
HW design for RTOS
Micro Kernel
memory
schedule
IPC
Future
OS -> OR
運籌學
資源 => 有效運⽤
兵⼒/糧草/時間...
空間
Memory
DOS - 640K
arduino : Atmega328 :
2K SRAM / 32K flash
Ameba : 512K internal
時間
CPU 處理速度
cortem-M3/M4
1.25 DMIPS/MHz
Ameba - 166MHz
時空轉換
compiler toolchain 參數選擇 -Osize / -Otime
空間換取時間
e.g. loop unroll, 查表 : switch , …
時間換取空間
e.g. loop without unroll, compression
資源
除了空間時間外, 還有什麼資源需要管理?
Power consumption -> Zephyr
容易 porting
CMSIS
middleware (USB / TCPIP / .. )
….
TRADE OFF
複雜的動態系統
external flash -> external RAM -> internal RAM -> cache ...
task priority / critical path
power consumption
…
TOPICS
Cortex-M
RTOS
OS / Realtime
HW design for RTOS
Micro Kernel
memory
schedule
IPC
即時 - REAL TIME
deadline => priority -> renice -> preemptive
Linux : RTOS ?
kernel 非搶佔, user 權限⾼也無法搶佔
時間計算/限制機制
改良
重改 linux - PREEMPT_RT
dual kernel - 替換底層 - Xenomai ( 底層⽤ Nucleus )
TOPICS
Cortex-M
RTOS
OS / Realtime
HW design for RTOS performance
Micro Kernel
memory
schedule
IPC
Future
HW FOR RTOS
MSP / PSP
LR - branch (bx lr), EXC_RETURN
auto push/pop stack
privileged / handler - thread
REGISTERS
AAPCS
Procedure Call Standard for ARM Architecture
HANDLER
privileged
thread / handler
handler only have
privileged mode
EXC_RETURN
Exception : thread ->
handler
LR : EXC_RETURN
TOPICS
Cortex-M
RTOS
OS / Realtime
HW design for RTOS performance
Micro Kernel
memory
schedule
IPC
Future
微核⼼
Memory
Thread
IPC
TEXT / DATA
* Howard - HyperC OS
* Linker script -http://njiot.blogspot.tw/2016/03/arduino-ameba-100-textdatabssheapstack.html
動態管理
C: malloc / free
sbrk()
linker script
動態管理
Windows:
VirtualAlloc / HeapAlloc
非分⾴ / 分⾴
Linux:
vmalloc / kmalloc :
GFP_ATOMIC / GFP_KERNEL
動態管理
cortex-M : no MMU , no virtual address
經濟 <-> 技術, RAM 價格曲線
MMU overhead / die size cost
fragment / chunk / page / utilization
CACHE
Ameba : cortex-m3 , no cache
instruction / data
barrier : ISB , DSB, DMB
TOPICS
Cortex-M
RTOS
OS / Realtime
Micro Kernel
memory
schedule
IPC
多⼯-1
真的需要多⼯?
* https://github.com/liuxuming/trochili
ARDUINO
setup()
loop()
多⼯-2
ISR
* https://github.com/liuxuming/trochili
無線程排程-ISR
8-bit / 16-bit programming
x86
BIOS/DOS INT
VECTOR TABLE
線程排程 - TIMER - 1
One shot / period
latency : 8 cycles
auto push pop by HW
Pros : easy, quick, less
overhead
TICKER SCHEDULER
ESP 8266 - yield() do back ground functions ; https://github.com/Toshik/TickerScheduler
void setup(void)
{
…
if (ts.add(0, 5000, task0, true))
{
Serial.println("Tick task - task0 ok");
}
if (ts.add(1, 2000, task1, true))
{
Serial.println("Tick task - task1 ok");
}
….
}
void task0(void)
{
Serial.println("Task0");
}
…
void loop(void) {
ts.update();
}
TICKER SCHEDULER
TICKER SCHEDULER
ESP 8266 - yield() do back ground functions ; https://github.com/Toshik/TickerScheduler
ARM MBED TICKER
https://developer.mbed.org/handbook/Ticker
TIMER CONS
HW timer 有限
SW timer : 延遲
preemptive
no reentrant
context switch ?
function execution -> starvation
多⼯ - 2
multi-tasks
多⼯ - 3
⼯作 Task 程式執⾏最⼩單位?
Process =>Thread
Unix -> Mach
第⼀代 micro kernel
Mac OSX
THREAD
ARDUINO SCHEDULER
zero, MKR1000 - cortex-m0+ , Due - cortex-m3
https://www.arduino.cc/en/Reference/Scheduler
ARDUINO SCHEDULER
為何需要多⼯
ARDUINO SCHEDULR
NUM_REGS=10, https://github.com/arduino-libraries/Scheduler/blob/master/src/Scheduler.cpp
ARDUINO SCHEDULR
NUM_REGS=10, https://github.com/arduino-libraries/Scheduler/blob/master/src/Scheduler.cpp
ARDUINO SCHEDULR
NUM_REGS=10, https://github.com/arduino-libraries/Scheduler/blob/master/src/Scheduler.cpp
ARDUINO SCHEDULER
和 mini-arm-os / RTX 很像
 比 timer 優點 :
TCB : Task control block
各⾃有 stack
RTX
何時切換:
systick interrupt
CMSIS API
IPC
SWITCH- SYSTICK
SWITCH - PENDSVC
CMSIS-RTOS
Cortex Microcontroller Software Interface Standard
IDLE TASK
busy waiting 耗電
WFI / WFE
中斷完成時直接休眠, 不回 Thread, 省下 stack push/
pop
TOPICS
Cortex-M
RTOS
OS / Realtime
Micro Kernel
memory
schedule
IPC
IPC - 1
Inter Process Communication
L4 kernel - 第⼆代微核⼼重點
f9-kernel: http://wiki.csie.ncku.edu.tw/
embedded/f9-kernel
SHARE MEMORY
No thread safe
flag
interrupt write status
thread polling
CRITICAL SECTION
atomic
spinlock / mutex / semaphore 差異?
IPC -⼩訊息傳遞
signal events
mutex
semaphore
IPC - ⼤訊息傳遞
message queue
mail queue
L4
http://www.slideshare.net/microkerneldude/from-l3-to-sel4-what-have-we-learnt-in-20-years-l4
https://www.youtube.com/watch?v=RdoaFc5-1Rk
優先權錯逆
priority inversion
realtime - deadline
優先權錯逆
⽕星探測計畫
http://wiki.csie.ncku.edu.tw/embedded/priority-inversion-on-Mars.pdf
複雜
drivers
wifi, usb, …
network protocol
TCP/IP
SSL / TLS
MQTT / HTTP
….
MBED OS
LoRa : https://docs.mbed.com/docs/lora-with-mbed/en/latest/intro-to-lora/
WIFI 驅動程式-1
http://www.slideshare.net/simenli/adv-embedded
WIN WDI DRIVER
安全
資料安全
資訊隱藏與封裝 (C++)
資訊最⼩化公開原則
各⾃ stack
系統安全 : security boot
網路安全 : SSL/TLS
安全- 硬體設計
Ameba Cortex-M3 :
MPU -> mbed uvisor
hardware crypto engine
加解密, 簽章 : AES / SHA-2
TrustZone : v8m : SAU
stack limit
FUTURE
Benchmark
ARM mbed / Arduino
CMSIS++ / mbed minar
NUTTX : ardupilot / cortex-m4
Zephyr : Linux ⼩弟
dynamic linking / module loading
hypervisor

More Related Content

PPT
PDF
Real Time Operating System Concepts
PPT
PPT
PPTX
Real time Operating System
PDF
Rtos part2
PDF
RTOS implementation
PPTX
RTOS MICRO CONTROLLER OPERATING SYSTEM-2
Real Time Operating System Concepts
Real time Operating System
Rtos part2
RTOS implementation
RTOS MICRO CONTROLLER OPERATING SYSTEM-2

What's hot (20)

PPTX
Real Time Operating System
PPT
Chapter 19 - Real Time Systems
PDF
Real time operating system
PPTX
Real Time Kernels
PDF
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
PPT
Os rtos.ppt
PPTX
Real Time Operating Systems
PDF
Real Time Operating Systems
PDF
Testing real-time Linux. What to test and how
PPT
Real Time Operating Systems
PDF
Rtos princples adn case study
PPTX
Preempt_rt realtime patch
PPTX
Basic functions & types of RTOS ES
PDF
Mastering Real-time Linux
PDF
Linux Preempt-RT Internals
PPTX
How to Measure RTOS Performance
PPT
Introduction to Real-Time Operating Systems
Real Time Operating System
Chapter 19 - Real Time Systems
Real time operating system
Real Time Kernels
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
Os rtos.ppt
Real Time Operating Systems
Real Time Operating Systems
Testing real-time Linux. What to test and how
Real Time Operating Systems
Rtos princples adn case study
Preempt_rt realtime patch
Basic functions & types of RTOS ES
Mastering Real-time Linux
Linux Preempt-RT Internals
How to Measure RTOS Performance
Introduction to Real-Time Operating Systems
Ad

Viewers also liked (20)

PDF
How to Hunt for Lateral Movement on Your Network
PDF
Advanced Threats and Lateral Movement Detection
PDF
Hunting Lateral Movement in Windows Infrastructure
PDF
Two-fet based PUF
PDF
Dakotacon 2017
PDF
Kaspersky managed protection
PDF
A Threat Hunter Himself
PPTX
Io t security-ameba-ppt
PDF
Threat hunting as SOC process
PDF
Physically Unclonable Random Permutations
PPTX
Whitewood entropy and random numbers - owasp - austin - jan 2017
PDF
A Very Stable Diode-Based Physically Unclonable Constant
PPTX
Active Directory - Real Defense For Domain Admins
PDF
Threat Intelligence Field of Dreams
PDF
Deploying Privileged Access Workstations (PAWs)
PDF
Terra Bruciata: an open source initiative for software correctness
PDF
Rtos ameba
PDF
PHDays '14 Cracking java pseudo random sequences by egorov & soldatov
PDF
Generalized Elias Schemes for Truly Random Bits
PDF
Трудовые будни охотника на угрозы
How to Hunt for Lateral Movement on Your Network
Advanced Threats and Lateral Movement Detection
Hunting Lateral Movement in Windows Infrastructure
Two-fet based PUF
Dakotacon 2017
Kaspersky managed protection
A Threat Hunter Himself
Io t security-ameba-ppt
Threat hunting as SOC process
Physically Unclonable Random Permutations
Whitewood entropy and random numbers - owasp - austin - jan 2017
A Very Stable Diode-Based Physically Unclonable Constant
Active Directory - Real Defense For Domain Admins
Threat Intelligence Field of Dreams
Deploying Privileged Access Workstations (PAWs)
Terra Bruciata: an open source initiative for software correctness
Rtos ameba
PHDays '14 Cracking java pseudo random sequences by egorov & soldatov
Generalized Elias Schemes for Truly Random Bits
Трудовые будни охотника на угрозы
Ad

Similar to RTOS on ARM cortex-M platform -draft (20)

ODP
[Defcon] Hardware backdooring is practical
ODP
Hardware backdooring is practical : slides
PDF
ARM® Cortex™ M Bootup_CMSIS_Part_2_3
PPTX
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
PPT
[CCC-28c3] Post Memory Corruption Memory Analysis
PDF
Programar para GPUs
PDF
ACPI and FreeBSD (Part 1)
PDF
Running Java on Arm - Is it worth it in 2025?
PPTX
U-Boot Porting on New Hardware
PPTX
“Linux Kernel CPU Hotplug in the Multicore System”
PDF
Introduction to FreeRTOS
 
PDF
Network Programming: Data Plane Development Kit (DPDK)
PPTX
Operating Systems - A Primer
PPTX
Linux Network Stack
PPT
Micro processor
PDF
Accelerating SDN/NFV with transparent offloading architecture
PDF
Jagan Teki - U-boot from scratch
PPTX
QEMU and Raspberry Pi. Instant Embedded Development
PPT
The x86 Family
PPTX
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
[Defcon] Hardware backdooring is practical
Hardware backdooring is practical : slides
ARM® Cortex™ M Bootup_CMSIS_Part_2_3
Advanced Apache Spark Meetup: How Spark Beat Hadoop @ 100 TB Daytona GraySor...
[CCC-28c3] Post Memory Corruption Memory Analysis
Programar para GPUs
ACPI and FreeBSD (Part 1)
Running Java on Arm - Is it worth it in 2025?
U-Boot Porting on New Hardware
“Linux Kernel CPU Hotplug in the Multicore System”
Introduction to FreeRTOS
 
Network Programming: Data Plane Development Kit (DPDK)
Operating Systems - A Primer
Linux Network Stack
Micro processor
Accelerating SDN/NFV with transparent offloading architecture
Jagan Teki - U-boot from scratch
QEMU and Raspberry Pi. Instant Embedded Development
The x86 Family
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...

Recently uploaded (20)

PPTX
Welding lecture in detail for understanding
PPTX
Sustainable Sites - Green Building Construction
DOCX
573137875-Attendance-Management-System-original
PDF
Well-logging-methods_new................
PPT
Mechanical Engineering MATERIALS Selection
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPT
Project quality management in manufacturing
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Geodesy 1.pptx...............................................
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Welding lecture in detail for understanding
Sustainable Sites - Green Building Construction
573137875-Attendance-Management-System-original
Well-logging-methods_new................
Mechanical Engineering MATERIALS Selection
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Operating System & Kernel Study Guide-1 - converted.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Project quality management in manufacturing
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
UNIT-1 - COAL BASED THERMAL POWER PLANTS
UNIT 4 Total Quality Management .pptx
Internet of Things (IOT) - A guide to understanding
Geodesy 1.pptx...............................................
Foundation to blockchain - A guide to Blockchain Tech
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026

RTOS on ARM cortex-M platform -draft