
BÙI QUC BO
1
ARM PROGRAMMING
Bùi Quc Bo
Why use RTOS
•Three sources of LCD messages
•Mix of fast and slow hardware
•Mix of continuous, periodic, event driven, high
priority and low priority requirements

BÙI QUC BO
2
Why use RTOS
Concurrent processing

BÙI QUC BO
3
Scheduler
Scheduler là 1 ph5n c6a kernel dùng ñ9 quy:t
ñ;nh tác v= nào ñư?c ch@y t@i mAi thBi ñi9m.
Kernel có th9 dFng và ph=c hGi ho@t ñHng c6a
1 tác v= trong khi tác v= ñang ch@y.
MHt tác v= có th9 dFng chính nó bKng cách
delay (sleep) mHt khong thBi gian, hoNc ch
(block) ñ9 ñ?i mHt sO kiPn (vd: keypressed)
hay 1 tài nguyên (vd: serialport)
Scheduler

BÙI QUC BO
4
Scheduler
At (1) task 1 is executing.
At (2) the kernel suspends task 1 ...
and at (3) resumes task 2.
While task 2 is executing (4), it locks a
processor peripheral for it's own
exclusive access.
At (5) the kernel suspends task 2 ...
... and at (6) resumes task 3.
Scheduler
Task 3 tries to access the same processor
peripheral, finding it locked, task 3 cannot
continue so suspends itself at (7).
At (8) the kernel resumes task 1.
Etc.
The next time task 2 is executing (9) it finishes
with the processor peripheral and unlocks it.
The next time task 3 is executing (10) it finds it
can now access the
processor peripheral and this time executes
until suspended by the kernel.

BÙI QUC BO
5
Realtime scheduler
MAi tác v= phi ñáp \ng (response)
trong thBi gian qui ñ;nh (deadline).
MAi tác v= có 1 m\c ưu tiên riêng
Scheduler s] ñm bo tác v= có quy^n
ưu tiên cao luôn ñư?c thOc thi bKng
cách t@m dFng tác v= có quy^n ưu tiên
th`p.
Realtime OS
Display
Keypad LCD
ADC
Analog Input filter
Sample rate: 5Khz
Response time: 0b100ms
control
output