Operating system¶
Guide 3 · E-M5 III firmware 1.7 · draft 1. New to these guides? Read Before you start first. Open questions: research gaps.
Key points¶
- The main program runs on a μITRON real-time kernel, wrapped in a thin Olympus layer of task, flag, queue and semaphore calls.
- The 144 tasks of the main core come from a table compiled into the program, and nearly all of them spend their time waiting.
- Interrupt handlers must never wait, so they hand work to tasks, and hooks must know which context they run in.
- Each control core runs its own copy of the kernel, and every object id says which core it belongs to.
This guide explains what the main program runs on. That is the μITRON real-time operating system, the thin Olympus layer over it, the tasks it schedules, and how those tasks pass work to each other. It ends with the generated-code framework on top (Rhapsody OXF), the fact that each control core runs its own copy of the kernel, and the debug commands that let you look at all of this on a running camera.
Most of the structure is clear from the code. The scheduler's own details (time slicing, the idle task, how interrupts are entered) are not traced yet.
1. Overview¶
μITRON is a Japanese specification for small real-time kernels, written by the TRON project and used in a great many cameras, printers and appliances. It is a specification, not one product. Each vendor writes or licenses its own kernel to it. Which kernel Olympus used isn't known. Its error codes match version 4.0 of the specification.
A μITRON kernel offers a fixed menu of objects, and the camera has all the usual ones:
- Tasks: threads with a fixed priority and their own stack.
- Semaphores and mutexes: counting locks and ownership locks.
- Event flags: a word of bits a task can wait on ("wake me when bit 0 or bit 3 is set").
- Data queues, mailboxes and message buffers: three ways to hand data from one task to another.
- Memory pools: fixed-size and variable-size blocks a task can borrow and return.
- Cyclic handlers and alarm handlers: short functions the kernel calls on a period or once after a delay.
Every object has a small number, its id, and system calls name objects by id (wai_sem(5): wait on semaphore 5).
Calls that can be made from an interrupt handler have their own i-prefixed versions (iloc_cpu instead of
loc_cpu). The usual style is to create the objects once at start-up from a configuration table, which is what this
firmware does for its tasks (section 3).
Scheduling is pre-emptive by priority. The highest-priority task that is ready runs, and it keeps the processor until it waits for something or a more urgent task becomes ready. In μITRON a lower number means more urgent.
Where in the firmware
| what | where | known from |
|---|---|---|
object types (od command list: tsk stk sem flg dtq mbx mtx cnd mbf mpf mpl cyc alm, plus 1/2 per CPU) |
strings 0x600771c4 | [code] |
μITRON 4.0 error legend (E_RLWAI, E_DLT, E_CLS, E_WBLK, ...), printed by oserr |
0x61443c20 | [code] |
kernel call names in error messages (wai_sem, sig_sem, tslp_tsk, act_tsk, get_tim, loc_cpu/iloc_cpu) |
strings | [code] |
| lower number = more urgent | μITRON rule, not traced in this kernel | [inferred] |
Kernel object types, error codes and call names found in the firmware.
Sources: OS and framework.
2. Olympus's layer¶
Application code rarely calls the kernel directly. Olympus wrapped it in a small API whose names are two-letter
abbreviations: OlyTaSt (task start), OlySmWt and OlySmSi (semaphore wait and signal), OlyEvSt, OlyEvWt and
OlyEvCl (event flag set, wait and clear), OlyQeRd and OlyQeWr (queue read and write), and a Dl (delete) for
each. Each has a ...Cpu version that takes an id which also says which core the object belongs to (section 7).
The ids themselves are kept as 16-bit constants in one block of the program, so a call usually looks like "load
the id from a fixed address, then call OlyEvWtCpu". That makes the ids easy to follow in the disassembly. Two pieces
of code that load the same constant are talking to the same object.
Where in the firmware
| what | where | known from |
|---|---|---|
OlyEvStCpu / OlyEvWtCpu / OlyEvClCpu |
0x60051078 / 0x60051143 / 0x6005123a | [code] |
OlyQeRdCpu / OlyQeWrCpu |
0x600513d2 / 0x600514a2 | [code] |
OlySmWtCpu / OlySmSiCpu |
0x60051679 / 0x6005174e | [code] |
OlyTaStCpu |
0x6005185f | [code] |
| meanings of the two-letter verbs | from the names | [inferred] |
| object ids (u16 constants) | around 0x60040b00-0x60041300, e.g. 0x60040dc0, 0x60040f9e | [code] |
The Olympus layer's entry points and the block of object ids.
Sources: OS and framework, useful routines.
3. Task table¶
The tasks for the main core are not created one by one in code. They are listed in a table compiled into the program, with one 28-byte record per task. A record holds the function the task runs, its priority and its stack size. There are 144 of them. Task id N is record N, so starting a task is "start id 25" and the kernel finds the rest in the table. Start-up (see boot) walks through its stages starting tasks by id.
Some things the table shows:
- Priorities cluster. Most tasks (82) run at priority 55, a large group (28) at 25, and a few elsewhere between 1 and 66. The shooting sequencer runs at 25, so it can interrupt the many ordinary tasks at 55. Two tasks run far above everything else (priorities 1 and 15). What they do isn't identified yet.
- Stacks are small. 1 to 4 KB each, about 416 KB for all 144. Code that runs on a task's stack (a patch's hook, for instance) has little room to spare.
- Names live elsewhere. The table has no names. Names such as PER_WDT, STB_SEQ or FCS come from log strings printed next to the code that starts the task, which is how most of the task names on the reference pages were found.
Where in the firmware
| what | where | known from |
|---|---|---|
| static task table (main core) | 0x60038b68, 28-byte records {entry, priority, stack, word, u16, 0, 0}, 144 records then zero | [code] |
| id N = record N | checked: 25 → 0x600741c0 (PER_WDT), 142 → 0x6019c924 (Tsk_USHL), 143 → 0x6005f871 | [code] |
| record +16 | mostly N+1, not the id; meaning unknown | [code] |
| sequencer task | 0x602a0f90, record 117, priority 25, 4 KB | [code] |
| system shell task S_SHELL | 0x600570bd, record 141, priority 65, 4 KB | [code] |
| priority 1 and 15 tasks | 0x60052147 (record 1), 0x6005365e (record 139) | [code] |
| total stack | 0x67e88 bytes | [code] |
The main core's task table and some of its records.
Sources: OS and framework.
4. Task states¶
Almost every task has the same shape. It is a loop that waits for something, handles it, and waits again. While it waits, it uses no processor time. This is what makes a camera with 144 tasks practical. At any moment nearly all of them are blocked on a queue, a flag or a semaphore.
Two examples from the main core:
The watchdog task (PER_WDT) blocks reading a queue, and kicks the watchdog every 3 seconds.
The shooting sequencer waits on an event flag. Other parts of the camera set a bit in that flag when they have an event for it (a button half-pressed, a frame finished). The sequencer then takes the event and hands it to the handler for its current state:
pseudocode in our own words, summarised from the disassembly (0x602a0f90), simplified
sequencer_task:
loop forever:
wait on the sequencer's event flag, no timeout
if the "event pending" bit is set:
take the pending event
find the record for the current state in the state table
run that state's handler for this event
This one pattern, "wait on a flag or queue, then dispatch by state", covers a large part of the firmware. The sequencer's state tables are one instance. The generated components in section 6 are another.
If a handler gets an event its state has no entry for, the sequencer logs it and prints a history of recent events (this is how our Live ND work found its missing handlers, see the end section).
Where in the firmware
| what | where | known from |
|---|---|---|
| sequencer wait | OlyEvWtCpu at 0x602a0fc4, flag id u16 at 0x60040dc0, wait pattern 0x62107750, timeout −1 |
[code] |
| take pending event | 0x60227f32 | [code] |
| state table / current state | 0x6044f9e4 (20-byte records) / 0x62107744 | [code] |
| watchdog task wait | OlyQeRdCpu, queue id u16 at 0x60040f9e |
[code] |
| watchdog kick period | 3 s | [code] |
Where the sequencer and the watchdog task wait.
Sources: OS and framework, shooting sequencer, recovery.
5. Interrupts¶
Code runs in one of two contexts. Task context is ordinary code on a task's stack. It may wait, take locks and call anything. Interrupt context is code run by a hardware interrupt, borrowing whatever was running at the time. It must finish quickly and must never wait, because nothing else on that core can run until it returns. That rules out semaphores, file access and anything that might block.
The usual way out is to do the minimum in the interrupt (note what happened, set an event flag bit or post to a
queue with the i-prefixed calls) and let a task do the real work. The camera follows this widely. A few completion
routines do more than that inside the interrupt, which matters when you hook them. The burst-capture frame completion,
for example, runs in interrupt context.
The firmware has a function that tells the two apart (it returns 0 in task context). Native code calls it in 163 places, including inside the Olympus layer, which appears to use it to pick the interrupt-safe kernel call.
Where in the firmware
| what | where | known from |
|---|---|---|
| "am I in an interrupt?" check | 0x600386ae, returns 0 in task context; 163 call sites | [code] |
| Olympus layer branching on it | e.g. 0x6005370e (reached from OlyTaStCpu) |
[code]; purpose [inferred] |
| current task id | 0x600317b4 | [code] |
| interrupt vectors | written to 0x8000-0x801c at boot, handlers 0x60030020-0x60030080 | [code] (see boot) |
| burst frame completion runs in an interrupt | StlUhs completion | [camera] |
The interrupt check, the current task id and the interrupt vectors.
Sources: useful routines, patching techniques.
6. Rhapsody OXF¶
Much of the application layer is C++ generated by IBM Rhapsody from state diagrams
(background). That code runs on Rhapsody's small runtime, OXF, and OXF reaches the kernel
through one adapter file, itronos.h, which maps its threads, queues and timers onto μITRON objects.
In OXF terms, an active object is a task with an event queue, and it owns a number of reactive objects, each a
state machine that handles one event at a time. So the generated components follow the same "wait, then dispatch by
state" pattern as the hand-written sequencer, only produced by a tool. CapThr_ThroughImage (live view) is a readable
example. It has a state word, and tables of {state, handler} pairs for each trigger such as Start or Pause.
How exactly a generated active object is laid out once compiled (where its queue is, which task runs it) has not been traced yet.
Where in the firmware
| what | where | known from |
|---|---|---|
| OXF OS adapter | string base_framework/include/rhapsody/oxf/itronos.h |
[code] |
| reactive-object pool limit | "overflow in OMREactive too many active" | [code] |
| live-view state machine | CapThr_ThroughImage, state word 0x61e9cd1c, handler tables 0x60b30808-0x60b30f38 |
[code] |
The OXF adapter and the live-view state machine.
Sources: OS and framework.
7. Kernels per core¶
The system-on-chip has several MN103 cores, and each runs its own copy of the kernel with its own tasks and objects.
The debug commands show this directly. Every object type exists three times, plain for the main core (CPU0) and with a
1 or 2 suffix for CPU1 and CPU2.
An id says which core it belongs to. The core number sits in the top bits (id = core × 4096 + index). That is why the
API has ...Cpu versions. During start-up the main core starts tasks 4120 and 8213, which are task 24 on CPU1 and task
21 on CPU2. Each core finds its own kernel data through a small table in memory shared by all cores, indexed by a
word at a fixed low address that holds the core's number.
How the cores pass messages to each other, and to the ARM, is the subject of Core communication. What CPU1 and CPU2 run, and where their task tables are, is still open (research gaps).
Where in the firmware
| what | where | known from |
|---|---|---|
| core number | (0x8050) | [code] |
| per-core kernel object | 0x8ff00004 + 4 × core | [code] |
| shared block (lock word, UART state) | 0x8ff00000-0x8ff000bc | [code] |
| cross-core task starts in stage 1 | ids 4120, 8213 (0x60045894, 0x600458af) | [code] |
The core number, the per-core kernel data and the cross-core task starts.
Sources: OS and framework (task table route).
8. Live inspection¶
The firmware keeps μITRON's debugging aids. The system shell, which reads the serial port, has ps (list the tasks
and their states), od (dump any kernel object, or all of one type), oserr (print the error-code legend) and
chgpri (change a task's priority). A second, user-level shell carries most of the camera's own commands. On a retail
camera the user shell is reachable through a stock card-file switch that brings up a Wi-Fi network with the shell on
port 23. We use it on our camera: take dbgmode 1 streams the sequencer's states and events live to a laptop, which
is how the Live ND runs are traced. A : prefix should reach the system shell from there. That part hasn't been
tried.
ps writes its rows straight to the serial port, so its output can't be read back from the console log.
Where in the firmware
| what | where | known from |
|---|---|---|
| system shell S_SHELL, command dispatcher | 0x600570bd, 0x60055d99 | [code] |
ps and the task-id list it walks |
0x6005991e, 0x60038b5c | [code] |
| task query | 0x60034bab | [code] |
| user shell Tsk_USHL, 58-command table | 0x6019c924, 0x601fbe38 | [code] |
| Wi-Fi shell switch | a PARAMDT/CP??????.CSV line that sets property 63857 (0xf971) to 1, exact line on Wi-Fi debug shell; camera at 192.168.0.10, port 23 |
[code] + [camera] (2026-11-12) |
The two shells and their commands.
Sources: debug consoles, Wi-Fi debug shell.
Patching notes¶
The rules our builds follow (see patching techniques) come straight from this picture:
- Know which context a hook runs in. A hook in an interrupt-context completion may not take locks or touch files. Our hooks check the "am I in an interrupt?" function and the core number before touching native objects.
- Use the native objects, don't invent new ones. Patches post to the sequencer the same way native code does, so its event tables decide what happens. When Live ND sent the sequencer an event its current state had no entry for, the result was the history dump from section 4, which is how the missing handlers were found.
- Mind the stack. Tasks have 1 to 4 KB stacks. Hook code copies the native call frame exactly and keeps its own frame small.
- Don't hold up a fast task. The sequencer runs at priority 25 above most of the camera. Work done in its handlers delays everything at 55.
Other cameras¶
Each step checked against the firmware of other bodies. Nothing is assumed. "Not checked" means we don't know.
| step | E-M5 III 1.7 | OM-5 1.2 | E-M1 III 1.6 | OM-5 II 1.1 | OM-1 1.9 | PEN-F 3.1 | other projects |
|---|---|---|---|---|---|---|---|
μITRON 4.0 error legend and od object list (3 CPUs) |
yes | confirmed | confirmed | confirmed | confirmed | confirmed | — |
Oly*Cpu API names |
yes | confirmed | confirmed | confirmed | confirmed | confirmed | — |
| static task table, 28-byte records | 0x60038b68 | confirmed 0x60038b68 | confirmed 0x60038b68 | confirmed 0x60038b68 | confirmed (block0 offset 0x180b0) | confirmed 0x600396d0 | — |
| S_SHELL and Tsk_USHL shells | yes (Wi-Fi shell used on camera) | confirmed (strings) | confirmed (strings) | confirmed (strings) | confirmed (strings) | confirmed (strings) | E-M5 III: Wi-Fi shell reported (oly_fw_analysis) |
OXF runtime names (omreactive.cpp) |
yes | not found | not found | not found | confirmed | confirmed | — |
| sequencer task waits on an event flag | yes | not checked | not checked | not checked | not checked | not checked | — |
| task id N = record N | yes | not checked | not checked | not checked | not checked | not checked | — |
The operating-system facts of this guide checked against other bodies' firmware.
"Not found" means the string search found nothing. The framework may still be there under other strings. OS and framework, oly_fw_analysis notes.
Further reading¶
- OS and framework, the reference notes on the kernel, the task table and the shells.
- Core communication, the guide to how the cores and the ARM talk.
- Rhapsody and OXF, the background on the generated code.
- Patching techniques, the rules our builds follow.
Research by the Oly Firmware Notes and Mods contributors, shared under CC BY 4.0. If you use or summarise it, please credit and link "Operating system".
Spotted a mistake, or know something we don't? Additions and corrections are welcome. Open an issue on the notes repository.