Files
@ 9fdc9e276115
Branch filter:
Location: therm/libraries/CMSIS/Documentation/RTOS/html/_using_o_s.html - annotation
9fdc9e276115
13.6 KiB
text/html
Fixed linkerfile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 f23a287bb7c1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>CMSIS-RTOS: Using a CMSIS RTOS Implementation</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="stylsheetf" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 46px;">
<td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">CMSIS-RTOS
 <span id="projectnumber">Version 1.02</span>
</div>
<div id="projectbrief">CMSIS-RTOS API: Generic RTOS interface for Cortex-M processor-based devices.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
<ul class="tablist">
<li><a href="../../General/html/index.html"><span>CMSIS</span></a></li>
<li><a href="../../Core/html/index.html"><span>CORE</span></a></li>
<li><a href="../../DSP/html/index.html"><span>DSP</span></a></li>
<li class="current"><a href="../../RTOS/html/index.html"><span>RTOS API</span></a></li>
<li><a href="../../SVD/html/index.html"><span>SVD</span></a></li>
</ul>
</div>
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="pages.html"><span>Usage and Description</span></a></li>
<li><a href="modules.html"><span>Reference</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_using_o_s.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">Using a CMSIS RTOS Implementation </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>A CMSIS RTOS implementation is typically provided as a library. To add the RTOS functionality to an existing CMSIS-based application the RTOS library (and typically a configuration file) needs to be added. The available functionality of the RTOS library is defined in the file <b><a class="el" href="cmsis__os_8h.html">cmsis_os.h</a></b> that is specific for each RTOS implementation.</p>
<div class="image">
<img src="CMSIS_RTOS_Files.png" alt="CMSIS_RTOS_Files.png"/>
<div class="caption">
CMSIS-RTOS File Structure</div></div>
<p> Depending on the CMSIS-RTOS implementation, execution may start with the <b>main</b> function as the first thread. This has the benefit that an application programmer may use other middleware libraries that create threads internally, but the remaining part of the user application just uses the <b>main</b> thread. Therefore, the usage of the RTOS can be invisible to the application programmer, but libraries can use CMSIS-RTOS features.</p>
<p>Once the files are added to a project, the user can start using the CMSIS-RTOS functions. A code example is provided below:</p>
<p><b>Example</b> </p>
<div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="cmsis__os_8h.html">cmsis_os.h</a>"</span> <span class="comment">// CMSIS RTOS header file</span></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> job1 (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument) { <span class="comment">// thread function 'job1'</span></div>
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
<div class="line"> : <span class="comment">// execute some code</span></div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___wait.html#ga02e19d5e723bfb06ba9324d625162255" title="Wait for Timeout (Time Delay).">osDelay</a> (10); <span class="comment">// delay execution for 10 milliseconds</span></div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"><span class="comment">// define job1 as thread function</span></div>
<div class="line"><a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gaee93d929beb350f16e5cc7fa602e229f" title="Create a Thread Definition with function, priority, and stack requirements.">osThreadDef</a>(job1, <a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#ga7f2b42f1983b9107775ec2a1c69a849aa17b36cd9cd38652c2bc6d4803990674b" title="priority: above normal">osPriorityAboveNormal</a>, 1, 0); <span class="comment">// define job1 as thread function</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> job2 (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument) { <span class="comment">// thread function 'job2'</span></div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gac59b5713cb083702dce759c73fd90dff" title="Create a thread and add it to Active Threads and set it to state READY.">osThreadCreate</a>(<a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gaf0c7c6b5e09f8be198312144b5c9e453" title="Access a Thread definition.">osThread</a>(job1),NULL); <span class="comment">// create job1 thread</span></div>
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
<div class="line"> : <span class="comment">// execute some code</span></div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gaee93d929beb350f16e5cc7fa602e229f" title="Create a Thread Definition with function, priority, and stack requirements.">osThreadDef</a>(job2, <a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#ga7f2b42f1983b9107775ec2a1c69a849aa45a2895ad30c79fb97de18cac7cc19f1" title="priority: normal (default)">osPriorityNormal</a>, 1, 0); <span class="comment">// define job2 as thread function</span></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> job3 (<span class="keywordtype">void</span> <span class="keyword">const</span> *argument) { <span class="comment">// thread function 'job3'</span></div>
<div class="line"> <span class="keywordflow">while</span> (1) {</div>
<div class="line"> : <span class="comment">// execute some code</span></div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___wait.html#ga02e19d5e723bfb06ba9324d625162255" title="Wait for Timeout (Time Delay).">osDelay</a> (20); <span class="comment">// delay execution for 20 milliseconds</span></div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gaee93d929beb350f16e5cc7fa602e229f" title="Create a Thread Definition with function, priority, and stack requirements.">osThreadDef</a>(job3, <a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#ga7f2b42f1983b9107775ec2a1c69a849aa45a2895ad30c79fb97de18cac7cc19f1" title="priority: normal (default)">osPriorityNormal</a>, 1, 0); <span class="comment">// define job3 as thread function</span></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>) { <span class="comment">// program execution starts here</span></div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___kernel_ctrl.html#ga53d078a801022e202e8115c083ece68e" title="Initialize the RTOS Kernel for creating objects.">osKernelInitialize</a> (); <span class="comment">// initialize RTOS kernel</span></div>
<div class="line"> : <span class="comment">// setup and initialize peripherals</span></div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gac59b5713cb083702dce759c73fd90dff" title="Create a thread and add it to Active Threads and set it to state READY.">osThreadCreate</a> (<a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gaf0c7c6b5e09f8be198312144b5c9e453" title="Access a Thread definition.">osThread</a>(job2));</div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gac59b5713cb083702dce759c73fd90dff" title="Create a thread and add it to Active Threads and set it to state READY.">osThreadCreate</a> (<a class="code" href="group___c_m_s_i_s___r_t_o_s___thread_mgmt.html#gaf0c7c6b5e09f8be198312144b5c9e453" title="Access a Thread definition.">osThread</a>(job3));</div>
<div class="line"> <a class="code" href="group___c_m_s_i_s___r_t_o_s___kernel_ctrl.html#gaab668ffd2ea76bb0a77ab0ab385eaef2" title="Start the RTOS Kernel.">osKernelStart</a> (); <span class="comment">// start kernel with job2 execution</span></div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Mon Mar 18 2013 13:38:00 for CMSIS-RTOS by ARM Ltd. All rights reserved.
<!--
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.3.1
-->
</li>
</ul>
</div>
</body>
</html>
|