OS Demos

# Operating System Sample Demos

## Location

`$NitroSDK/build/demos/os`

## Compilation

Move to the `$NitroSDK/build/demos/os` directory and enter:

> `% make`

The executable files (`.nef`, `.srl` files) will be generated in `$NitroSDK/build/demos/os/sample_name/bin/platform/target/`

For example:

    $NitroSDK/build/demos/os/thread-1/bin/ARM9-TEG/Release/

## Execution

Navigate to the `$NitroSDK/build/demos/os/sample_name/bin/platform/target/` directory and perform one of the following:

- Execute `*.nef`, `*.srl` using ensata.
- Execute `*.srl` using the TEG version of the IS-NITRO-EMULATOR.
- Load and execute `*.nlf` using the IS-NITRO-DEBUGGER.
- Execute `*.srl` using IS-NITRO-DEBUGGER.

## Description

`alarm-1` | Uses one one-shot alarm.
`alarm-2` | Uses the cyclic alarm and one-shot alarm.
`arena-1` | Set up the arena and acquire memory.
`callTrace-1` | Carries out the function call trace display without using the thread system.
`callTrace-2` | Carries out the function call trace display using the thread system.
`cplusplus-1` | Carries out initialization of the memory control before calling the static initializer for C++ implementation.
`exceptionDisplay-1` | Displays the exception and uses the exception callback.
`exceptionDisplay-2` | Pseudo-generates an exception when dividing by `0`.
`exceptionDisplay-3` | Shows the function call trace information when an exception occurs.
`functionCost-1` | Measures and displays the function cost.
`functionCost-2` | Measures and displays the function cost with multiple threads.
`functionCost-3` | Calculates and displays the total function cost measured with multiple threads.
`heap-1` | Sets one heap, and use it.
`heap-2` | Sets multiple heaps, and use them.
`heap-3` | Sets multiple heaps, and makes a region secured from one heap into a discontinuous region of another heap.
`interrupt-key-1` | Uses key-press interrupt.
`mutex-1` | When accessing one function from multiple threads, uses mutex to do exclusive control.
`mutex-2` | Unlock mutex when thread is completed.
`reset-1` | Execute software reset.
`sleep-1` | Sleep thread for a given length of time.
`spinwait-1` | Demo of `OS_SpinWait()`.
`thread-1` | Creates 2 threads, where one directly wakes up the other.
`thread-2` | Creates 2 threads, where idle threads wake up each of them.
`thread-3` | Switches threads using a message queue.
`thread-4` | Wakes up a thread from within the IRQ handler.
`thread-5` | Waits for a thread to complete.
`tick-1` | Uses the tick system to read and display a tick value.
`timer-1` | Uses an interrupt that employs a timer.
`valarm-1` | Uses an alarm that uses V-count.
`waitIrq-1` | Waits for a V-blank while operating a separate thread.
`waitIrq-2` | Shows the difference in operation of `OS_WaitIrq()` and `OS_WaitAnyIrq()`.

## Operation

`exceptionDisplay-1`, `exceptionDisplay-2`, `exceptionDisplay-3`, `interrupt-key-1`, `reset-1`, and `waitIrq-2` do not function properly on ensata. `exceptionDisplay-1`, `exceptionDisplay-2`, and `exceptionDisplay-3` stop with code having an exception that occurs on IS-NITRO-DEBUGGER.

## See Also

OS Function List

## Revision history

09/01/2004 Added `reset-1`.
08/17/2004 Standardized the notation of the IS-NITRO-EMULATOR.
07/10/2004 Changed from `.bin` to `.srl.`
06/25-2004 Added `thread-5.`
06/08/2004 Made it possible to insert the demo of the `profile` function into `Makefile` by default.
05/24/2004 Added `functionCost-1`, `functionCost-2`, `functionCost-3`, and `waitlrq-1`, `waitlrq-2`. Added description about necessary `profile` functions.
04/15/2004 Added description of `callTrace-1`, `callTrace-2`, `cplusplus-1`, and `exceptionDisplay-3`.
04/05/2004 Added description for `mutex-2`, `sleep-1`, and `timer-1`. Changed `systemClock-1` to `tick-1`.
03/17/2004 Added description for `exceptionDisplay-2`, `valarm-1`, `spinWait-1.`
02/05/2004 Added description for `alarm-1`, `alarm-2`, `exceptionDisplay-1`, and `systemClock-1.`
01/18/2004 Moved `interrupt-dma-1` sample to `MI` as `dmaCallback-1`.
01/09/2004 Initial version.