OS Demos

# Operating System Sample Demos

## Location

`$NitroSDK/build/demos/os`

## Compilation

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

> `% make`

Executable (`.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-TS/Release/`

## Execution

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

- Execute `*.nef`, `*.srl` with ensata.
- Load and execute a `*.nlf` file with IS-NITRO-DEBUGGER.
- Execute a `*.srl` file with 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.
`argument-1` | Embeds argument data in the ROM image and display.
`argument-2` | Creates argument data from a character string in real-time and sets it.
`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.
`entropy-1` | The demo uses the function `OS_GetLowEntropyData`.
`exceptionDisplay-1` | Displays exceptions 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.
`favorite-color` | Demo that test-displays on the screen the "favorite color" included in the console information.
`forChina-1` | This is a simplified sample for creating applications designed for China.
`forChina-fs` | This is the same as forChina-1, but it uniquely defines the OS_ShowAttentionChina function and obtains the image data from the file system.
`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 uses it.
`heap-2` | Sets multiple heaps and uses them.
`heap-3` | Sets multiple heaps and makes a region secured from one heap into a discontinuous region of another heap.
`mutex-1` | When accessing one function from multiple threads, uses mutex to do exclusive control.
`mutex-2` | Unlocks mutex when thread is completed.
`reset-1` | Executes software reset.
`sleep-1` | Puts thread to sleep 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.
`thread-6` | Demo of `OS_YieldThread()`.
`thread-7` | Demo of thread destructor.
`thread-8` | Version 1 of demo for creating a large number of threads.
`thread-9` | Demo that compares `OS_KillThread()` and `OS_KillThreadWithPriority()`.
`thread-10` | Version 2 of demo for creating a large number of threads.
`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 between `OS_WaitIrq()` and `OS_WaitAnyIrq()`.

## Operation

`exceptionDisplay-1`, `exceptionDisplay-2`, `exceptionDisplay-3`, and `reset-1` do not function properly on ensata. `exceptionDisplay-1`, `exceptionDisplay-2`, and `exceptionDisplay-3` halt in IS-NITRO-DEBUGGER with code in which an exception occurs.

## See Also

`OS Function List`

## Revision History

09/09/2005 Added argument-2.
07/22/2005 Corrected the erroneous omission of functionCost-1.
07/21/2005 Added argument-1.
07/14/2005 Added thread-10.
07/13/2005 Added thread-6, thread-7, thread-8, and thread-9.
07/11/2005 Added description for `forChina-1` and `forChina-fs` samples.
05/10/2005 Added description of `favorite-color` demo.
03/02/2005 Revised descriptions to reflect current support environment conditions.
12/08/2004 Removed `interrupt-key-1`, Revised Operation
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.

CONFIDENTIAL