RTX調査part1
とりあえず気になっているRTXについて調査。
展開したソースには詳細なドキュメントは一切なく、サンプルがあるだけ。
MDK-ARMのuvisionについているRL-RTXのドキュメントが対応する模様。
これは無料32KB制限版にも入っている。
Source code
Directory structure
$ tree -d ./ ./
-- Boards | |||
`-- Keil | |||
`-- MCB1700 | |||
-- RTX_Blinky | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
`-- RTX_Traffic | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
-- Examples | |||
-- C++ | |||
-- Example1 | |||
-- ARM | |||
-- GCC | |||
`-- IAR | |||
`-- Example2 | |||
-- ARM | |||
-- GCC | |||
`-- IAR | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
-- Message | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
-- RTX_ex1 | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
-- RTX_ex2 | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
`-- Semaphore | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
-- INC | |||
-- LIB | |||
-- ARM | |||
-- GCC | |||
`-- IAR | |||
-- SRC | |||
-- ARM | |||
-- GCC | |||
`-- IAR | |||
-- Templates | |||
-- CM0 | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
-- CM3 | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR | |||
`-- CM4 | |||
-- ARM | |||
-- G++ | |||
-- GCC | |||
`-- IAR |
- Boards
- 実際にKeilで発売しているMCB1700で動作可能なサンプル。
- Examples
- Simulatorで動作可能なサンプル。(に、見える)
- INC
- RTXを使用する際のincludeファイル群。
- LIB
- Pre-compile し、ライブラリ化された RTX kernel 本体。デバッグ情報はついている。
- LIB/ARM
- ARM RVCT4 環境(MDK)用のkernel
- LIB/GCC
- GCC環境(含Sourcery G++)のkernel
- LIB/IAR
- IAR EWARM用のkernel
- SRC
- RTX kernel source。
- Templates
- RTXを使用する際のテンプレート集
- Tests
- 空。よくわからない。
Kernel overview
uITRON4 より kernel object は種類が少ない感じ。
「scheduler + inter task(process) communication」数点に絞り込んである。
- Selectable task scheduler
- Preemptive scheduling
- Round-Robin scheduling
- Co-operative multi-tasking
- Event flags
- task毎に最大16個のevent flagを設定でき、待ち合わせに使える
- AND-connection : 指定フラグが全て揃うまでTaskを待ち状態にすることができる
- OR-connection : 指定フラグがどれか上がるまでTaskを待ち状態にすることができる
- task毎に最大16個のevent flagを設定でき、待ち合わせに使える
- Semaphores
- Binary semaphore
- Semaphoreを獲得できなかったtaskはsleepに入る
- Mutexes
- Semaphoreに変わるもう一つのリソース競合調停の仕組み
- Mailboxes
- uITRONのMailboxesとほぼ同じ?
Scheduler detail
Scheduling rule
- Preemptive scheduling
- 各Taskは個別の実行優先度をもつ
- Preemptの発生か、blocking OS callをするまでタスクは実行される
- Round-Robin scheduling
- 各Taskは個別の実行優先度をもたない
- Time-sliceの期限時間がくるかblocking OS callまでタスクは実行される
- Co-operative multi-tasking
- 各Taskは個別の実行優先度をもたない
- Time-sliceもない
- os_tsk_pass()呼び出しか、blocking OS callまでタスクは実行される
Task states
Technical description
Technical data
Description | ARM7™/ARM9™ | Cortex™-M |
---|---|---|
Defined Tasks | Unlimited | Unlimited |
Active Tasks | 250 max | 250 max |
Mailboxes | Unlimited | Unlimited |
Semaphores | Unlimited | Unlimited |
Mutexes | Unlimited | Unlimited |
Signals / Events | 16 per task | 16 per task |
User Timers | Unlimited | Unlimited |
Code Space | <4.2 Kbytes | <4.0 Kbytes |
RAM Space for Kernel | 300 bytes + 80 bytes User Stack | 300 bytes + 128 bytes Main Stack |
RAM Space for a Task | TaskStackSize + 52 bytes | TaskStackSize + 52 bytes |
RAM Space for a Mailbox | MaxMessages * 4 + 16 bytes | MaxMessages * 4 + 16 bytes |
RAM Space for a Semaphore | 8 bytes | 8 bytes |
RAM Space for a Mutex | 12 bytes | 12 bytes |
RAM Space for a User Timer | 8 bytes | 8 bytes |
Hardware Requirements | One on-chip timer | SysTick timer |
User task priorities | 1 - 254 | 1 - 254 |
Task switch time | <5.3 µsec @ 60 MHz | <2.6 µsec @ 72 MHz |
Interrupt lockout time | <2.7 µsec @ 60 MHz | Not disabled by RTX |
Timing spec
Function | ARM7™/ARM9™(cycles) | Cortex™-M(cycles) |
---|---|---|
Initialize system (os_sys_init), start task | 1721 | 1147 |
Create task (no task switch) | 679 | 403 |
Create task (switch task) | 787 | 461 |
Delete task (os_tsk_delete) | 402 | 218 |
Task switch (by os_tsk_delete_self) | 458 | 230 |
Task switch (by os_tsk_pass) | 321 | 192 |
Set event (no task switch) | 128 | 89 |
Set event (switch task) | 363 | 215 |
Send semaphore (no task switch) | 106 | 72 |
Send semaphore (switch task) | 364 | 217 |
Send message (no task switch) | 218 | 117 |
Send message (switch task) | 404 | 241 |
Get own task identifier (os_tsk_self) | 23 | 65 |
Interrupt lockout | <160 | 0 |