1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=utf-8">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.1.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../../css/nitro.css">
8<TITLE>OS Demos</TITLE>
9</HEAD>
10<BODY>
11<H1>Operating System (OS) Sample Demos</H1>
12<H2>Location</H2>
13<P><CODE>$TwlSDK/build/demos/os</CODE><BR> <CODE>$TwlSDK/build/demos.TWL/os</CODE></P>
14<H2>Compilation</H2>
15<P>Move to the <CODE>$TwlSDK/build/demos/os</CODE> (or <CODE>$TwlSDK/build/demos.TWL/os</CODE>) directory and enter the following.</P>
16<BLOCKQUOTE><CODE>% make</CODE></BLOCKQUOTE>
17<P>  Compiling begins, and the SRL executable file and the NEF or TEF files with the binary information are generated in:</P>
18<BLOCKQUOTE><CODE>$TwlSDK/build/demos/os/(sample name)/bin/(platform)/(target)/</CODE><BR> <CODE>$TwlSDK/build/demos.TWL/os/(sample name)/bin/(platform)/(target)/</CODE></BLOCKQUOTE>
19<P>  For example: </P>
20<BLOCKQUOTE><CODE>$TwlSDK/build/demos/os/thread-1/bin/ARM9-TS/Release/main.srl</CODE></BLOCKQUOTE>
21<P>is the executable file for the <CODE>thread-1</CODE> demo.</P>
22
23<H2>Running the Tool</H2>
24<H3>For NITRO ROMs</H3>
25
26<P>When using the ensata emulator:</P>
27<UL>
28<LI>Execute the NEF and SRL files with ensata.
29</UL>
30<P>When using IS-NITRO-DEBUGGER:</P>
31<UL>
32<LI>Load and execute an NLF file with IS-NITRO-DEBUGGER.
33<LI>Execute an SRL file with IS-NITRO-DEBUGGER.
34<LI>Execute an SRL file with IS-NITRO-DEBUGGER using the <CODE>loadrun.exe</CODE> tool from the command line.
35</UL>
36<P>When using IS-TWL-DEBUGGER:</P>
37<UL>
38<LI>Load and execute an NLF file with IS-TWL-DEBUGGER.
39<LI>Execute an SRL file with IS-TWL-DEBUGGER.
40<LI>Execute an SRL file with IS-TWL-DEBUGGER using the <CODE>loadrun.TWL.exe</CODE> tool from the command line.
41</UL>
42<H3>For TWL/NITRO HYBRID ROMs</H3>
43<P>When using IS-NITRO-DEBUGGER:</P>
44<UL>
45<LI>Execute an SRL file with IS-NITRO-DEBUGGER.
46<LI>Execute an SRL file with IS-NITRO-DEBUGGER using the <CODE>loadrun.exe</CODE> tool from the command line.
47</UL>
48<P>If using IS-TWL-DEBUGGER:</P>
49<UL>
50<LI>Load and execute a TLF file with IS-TWL-DEBUGGER.
51<LI>Execute an SRL file with IS-TWL-DEBUGGER.
52<LI>Execute an SRL file with IS-TWL-DEBUGGER using the <CODE>loadrun.TWL.exe</CODE> tool from the command line.
53</UL>
54<H3>For TWL LIMITED ROMs</H3>
55<P>If using IS-TWL-DEBUGGER:</P>
56<UL>
57<LI>Load and execute a TLF file with IS-TWL-DEBUGGER.
58<LI>Execute an SRL file with IS-TWL-DEBUGGER.
59<LI>Execute an SRL file with IS-TWL-DEBUGGER using the <CODE>loadrun.TWL.exe</CODE> tool from the command line.
60</UL>
61<H2>Description</H2>
62<BR>
63<TABLE width="720">
64  <TBODY>
65    <TR>
66<TH>Name</TH>
67<TH>Directory</TH>
68<TH>Operation</TH>
69    </TR>
70    <TR>
71<TD width="187"><CODE>alarm-1</CODE></TD>
72<TD><CODE>demos</CODE></TD>
73<TD width="525">Uses one one-time alarm.</TD>
74    </TR>
75    <TR>
76<TD width="187"><CODE>alarm-2</CODE></TD>
77<TD><CODE>demos</CODE></TD>
78<TD width="525">Uses the periodic alarm and a one-time alarm.</TD>
79    </TR>
80    <TR>
81<TD width="187"><CODE>arena-1</CODE></TD>
82<TD><CODE>demos</CODE></TD>
83<TD width="525">Sets up the arena and acquires memory.</TD>
84    </TR>
85    <TR>
86<TD><CODE>argument-1</CODE></TD>
87<TD><CODE>demos</CODE></TD>
88<TD>Embeds argument data in the ROM image and display.</TD>
89    </TR>
90    <TR>
91<TD><CODE>argument-2</CODE></TD>
92<TD><CODE>demos</CODE></TD>
93<TD>Creates argument data from a string in real-time and sets it.</TD>
94    </TR>
95    <TR>
96<TD><CODE>callTrace-1</CODE></TD>
97<TD><CODE>demos</CODE></TD>
98<TD>Carries out the function call trace display without using the thread system.</TD>
99    </TR>
100    <TR>
101<TD><CODE>callTrace-2</CODE></TD>
102<TD><CODE>demos</CODE></TD>
103<TD>Carries out the function call trace display using the thread system.</TD>
104    </TR>
105    <TR>
106<TD><CODE>consoleType-1</CODE></TD>
107<TD><CODE>demos</CODE></TD>
108<TD>Displays information about the operating environment on the screen.</TD>
109    </TR>
110    <TR>
111<TD><CODE>cplusplus-1</CODE></TD>
112<TD><CODE>demos</CODE></TD>
113<TD>Initializes the memory control before calling the static initializer for C++ implementation.</TD>
114    </TR>
115    <TR>
116<TD><CODE>cpuSpeed-1</CODE></TD>
117<TD><CODE>demos.TWL</CODE></TD>
118<TD>Changes the CPU speed between normal speed and double speed.</TD>
119    </TR>
120    <TR>
121<TD width="187"><CODE>entropy-1</CODE></TD>
122<TD><CODE>demos</CODE></TD>
123<TD width="525">Uses the <A href="../../os/entropy/OS_GetLowEntropyData.html"><CODE>OS_GetLowEntropyData</CODE></A> function.</TD>
124    </TR>
125    <TR>
126<TD width="187"><CODE>event-1</CODE></TD>
127<TD><CODE>demos</CODE></TD>
128<TD width="525">Starts a thread in response to an event.</TD>
129    </TR>
130    <TR>
131<TD width="187"><CODE>exceptionDisplay-1</CODE></TD>
132<TD><CODE>demos</CODE></TD>
133<TD width="525">Displays exceptions and uses the exception callback.<BR>(IS-TWL-DEBUGGER does not use exception callbacks.)</TD>
134    </TR>
135    <TR>
136<TD><CODE>exceptionDisplay-2</CODE></TD>
137<TD><CODE>demos</CODE></TD>
138<TD>Pseudo-generates an exception when dividing by zero.</TD>
139    </TR>
140    <TR>
141<TD><CODE>exceptionDisplay-3</CODE></TD>
142<TD><CODE>demos</CODE></TD>
143<TD>Shows the function call trace information when an exception occurs.<BR>(IS-TWL-DEBUGGER does not display function call trace information.)</TD>
144    </TR>
145    <TR>
146<TD><CODE>exceptionDisplay-4</CODE></TD>
147<TD><CODE>demos</CODE></TD>
148<TD>Displays the exception context on the screen when an exception occurs.<BR>(IS-TWL-DEBUGGER does not display context on the screen.)</TD>
149    </TR>
150    <TR>
151<TD><CODE>forChina-1</CODE></TD>
152<TD><CODE>demos</CODE></TD>
153<TD>A simplified sample for creating applications designed for China.</TD>
154    </TR>
155    <TR>
156<TD><CODE>forKorea-1</CODE></TD>
157<TD><CODE>demos</CODE></TD>
158<TD>A simplified sample for creating applications designed for Korea.</TD>
159    </TR>
160    <TR>
161<TD><CODE>functionCost-1</CODE></TD>
162<TD><CODE>demos</CODE></TD>
163<TD>Measures and displays the function cost.</TD>
164    </TR>
165    <TR>
166<TD><CODE>functionCost-2</CODE></TD>
167<TD><CODE>demos</CODE></TD>
168<TD>Measures and displays the function cost with multiple threads.</TD>
169    </TR>
170    <TR>
171<TD><CODE>functionCost-3</CODE></TD>
172<TD><CODE>demos</CODE></TD>
173<TD>Calculates and displays the total function cost measured with multiple threads.</TD>
174    </TR>
175    <TR>
176<TD width="187"><CODE>heap-1</CODE></TD>
177<TD><CODE>demos</CODE></TD>
178<TD width="525">Creates a heap and then allocates and frees memory areas.</TD>
179    </TR>
180    <TR>
181<TD width="187"><CODE>message-1</CODE></TD>
182<TD><CODE>demos</CODE></TD>
183<TD width="525">Starts a thread in response to an event.</TD>
184    </TR>
185    <TR>
186<TD width="187"><CODE>mutex-1</CODE></TD>
187<TD><CODE>demos</CODE></TD>
188<TD width="525">When accessing one function from multiple threads, uses a mutex to gain exclusive control.</TD>
189    </TR>
190    <TR>
191<TD width="187"><CODE>mutex-2</CODE></TD>
192<TD><CODE>demos</CODE></TD>
193<TD width="525">Unlocks a mutex when a thread is completed.</TD>
194    </TR>
195    <TR>
196<TD width="187"><CODE>os_jump</CODE></TD>
197<TD><CODE>demos.TWL</CODE></TD>
198<TD width="525">Demonstrates the operation of functions that go through hardware reset such as <A href="../../os/appJump/OS_JumpToSystemMenu.html"><CODE>OS_JumpToSystemMenu</CODE></A> and <A href="../../os/appJump/OS_RebootSystem.html"><CODE>OS_RebootSystem</CODE></A>.</TD>
199    </TR>
200    <TR>
201<TD><CODE>reset-1</CODE></TD>
202<TD><CODE>demos</CODE></TD>
203<TD>Resets software.</TD>
204    </TR>
205    <TR>
206<TD width="187"><CODE>simple-1</CODE></TD>
207<TD><CODE>demos</CODE></TD>
208<TD width="525">The simplest of the demos.</TD>
209    </TR>
210    <TR>
211<TD width="187"><CODE>sleep-1</CODE></TD>
212<TD><CODE>demos</CODE></TD>
213<TD width="525">Puts a thread to sleep for a specified length of time.</TD>
214    </TR>
215    <TR>
216<TD><CODE>spinwait-1</CODE></TD>
217<TD><CODE>demos</CODE></TD>
218<TD>Uses the <A href="../../os/system/OS_SpinWait.html"><CODE>OS_SpinWait</CODE></A> function to wait for a fixed period of time.</TD>
219    </TR>
220    <TR>
221<TD width="187"><CODE>thread-1</CODE></TD>
222<TD><CODE>demos</CODE></TD>
223<TD width="525">Creates two threads so that one directly wakes up the other.</TD>
224    </TR>
225    <TR>
226<TD width="187"><CODE>thread-2</CODE></TD>
227<TD><CODE>demos</CODE></TD>
228<TD width="525">Creates two threads and starts each one from an interrupt handler.</TD>
229    </TR>
230    <TR>
231<TD width="187"><CODE>thread-3</CODE></TD>
232<TD><CODE>demos</CODE></TD>
233<TD width="525">An example of how to use the <A href="../../os/thread/OS_JoinThread.html"><CODE>OS_JoinThread</CODE></A> function.</TD>
234    </TR>
235    <TR>
236<TD><CODE>threadQueue-1</CODE></TD>
237<TD><CODE>demos</CODE></TD>
238<TD>Starts a thread using a thread queue.</TD>
239    </TR>
240    <TR>
241<TD><CODE>threadYield-1</CODE></TD>
242<TD><CODE>demos</CODE></TD>
243<TD>An example of how to use the <A href="../../os/thread/OS_YieldThread.html"><CODE>OS_YieldThread</CODE></A> function.</TD>
244    </TR>
245    <TR>
246<TD width="187"><CODE>tick-1</CODE></TD>
247<TD><CODE>demos</CODE></TD>
248<TD width="525">Gets the system's tick value.</TD>
249    </TR>
250    <TR>
251<TD width="187"><CODE>timer-1</CODE></TD>
252<TD><CODE>demos</CODE></TD>
253<TD width="525">Uses a 16-bit timer and a 32-bit timer.</TD>
254    </TR>
255    <TR>
256<TD><CODE>valarm-1</CODE></TD>
257<TD><CODE>demos</CODE></TD>
258<TD>Uses an alarm that uses V-Count.</TD>
259    </TR>
260    <TR>
261<TD><CODE>waitIrq-1</CODE></TD>
262<TD><CODE>demos</CODE></TD>
263<TD>Waits for a V-Blank while operating a separate thread.</TD>
264    </TR>
265    <TR>
266<TD><CODE>waitIrq-2</CODE></TD>
267<TD><CODE>demos</CODE></TD>
268<TD>Shows the difference in operation between the <A href="../../os/irq/OS_WaitIrq.html"><CODE>OS_WaitIrq</CODE></A> and <A href="../../os/irq/OS_WaitAnyIrq.html"><CODE>OS_WaitAnyIrq</CODE></A> functions.</TD>
269    </TR>
270  </TBODY>
271</TABLE>
272<H2>Operation</H2>
273<P><CODE></CODE>The <CODE>exceptionDisplay-*</CODE> and <CODE>reset-1</CODE> demos do not work properly with ensata.</CODE></P>
274<P><CODE></CODE>With IS-TWL-DEBUGGER, the <CODE>exceptionDisplay-*</CODE> demos halt on the code where the interrupt occurs.</CODE></P>
275<P>Use <CODE><A href="../../romfiles/TwlNmenu.html">TwlNmenu.srl</A></CODE> to import the TAD file into system memory before you execute <CODE>arbitrary_jump</CODE>.</P>
276<P>Several of the demos use the <A href="../../os/debug/OS_Printf.html"><CODE>OS_Printf</CODE></A> function to display information in the debug console. However, the FINALROM build of a ROM disables the <A href="../../os/debug/OS_Printf.html"><CODE>OS_Printf</CODE></A> function, so this information cannot be verified with the FINALROM build.</P>
277<H2>See Also</H2>
278<P><A href="../../os/list_os.html">OS Function List</A></P>
279<H2>Revision History</H2>
280<P>
2812009/09/10 Removed the <CODE>forChina-fs</CODE> sample. <BR>2009/07/01 Revised the descriptions of the <CODE>exceptionDisplay-*</CODE> demos. <BR>2009/06/17 Added a description of the <CODE>exceptionDisplay-4</CODE> demo. <BR>2008/07/09 Added <CODE>argument-1</CODE> and <CODE>argument-2</CODE>, which had been deleted temporarily. <BR>2008/04/25 Reworked the table. Changed the lists for TWL.<BR> 2006/10/19 Added description for <code>forKorea-1</code> sample.<br /> 2005/09/09 Added <CODE>argument-2</CODE>.<BR> 2005/07/22 Corrected the erroneous omission of <CODE>functionCost-1</CODE>.<BR> 2005/07/21 Added <CODE>argument-1</CODE>.<BR> 2005/07/14 Added <CODE>thread-10</CODE>.<BR> 2005/07/13 Added <CODE>thread-6</CODE>, <CODE>thread-7</CODE>, <CODE>thread-8</CODE>, and <CODE>thread-9</CODE>.<BR> 2005/07/11 Added description for <code>forChina-1</code> and <CODE>forChina-fs</code> samples.<br /> 2005/05/10 Added description of <code>favorite-color</code> demo.<br /> 2005/03/02 Revised descriptions to reflect current support environment conditions.<br /> 2004/12/08 Removed <code>interrupt-key-1</code>, Revised <B>Operation</B>.<br /> 09/01/2004 Added <code>reset-1</code>.<br /> 2004/08/17 Standardized the notation of IS-NITRO-EMULATOR.<br /> 2004/07/10 Changed from <code>.bin</code> to <code>.srl.</code>.<br /> 2004/06/25 Added <code>thread-5.</code><br /> 2004/06/08 Made it possible to insert the demo of the <code>profile</code> function into <code>Makefile</code> by default.<br /> 2004/05/24 Added <code>functionCost-1</code>, <code>functionCost-2</code>, <code>functionCost-3</code>, <code>waitlrq-1</code>, and <code>waitlrq-2</code>. Added description about necessary <code>profile</code> functions.<br /> 2004/04/15 Added description of <code>callTrace-1</code>, <code>callTrace-2</code>, <code>cplusplus-1</code>, and <code>exceptionDisplay-3</code>.<br /> 2004/04/05 Added description of <code>mutex-2</code>, <code>sleep-1</code>, and <code>timer-1</code>. Changed <code>systemClock-1</code> to <code>tick-1</code>.<br /> 2004/03/17 Added description of <code>exceptionDisplay-2</code>, <code>valarm-1</code>, and <code>spinWait-1.</code><br /> 2004/02/05 Added description of <code>alarm-1</code>, <code>alarm-2</code>, <code>exceptionDisplay-1</code>, and <code>systemClock-1</code>.<br /> 2004/01/18 Moved <code>interrupt-dma-1</code> sample to <code>MI</code> as <code>dmaCallback-1</code>.<br /> 2004/01/09 Initial version. </P>
282<hr><p>CONFIDENTIAL</p></body>
283</HTML>