1 <!-- HTML header for doxygen 1.9.6-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
5 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=11"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>CMSIS-FreeRTOS: Example Projects</title>
9 <link href="doxygen.css" rel="stylesheet" type="text/css" />
10 <script type="text/javascript" src="jquery.js"></script>
11 <script type="text/javascript" src="dynsections.js"></script>
12 <script type="text/javascript" src="tabs.js"></script>
13 <script type="text/javascript" src="footer.js"></script>
14 <script type="text/javascript" src="navtree.js"></script>
15 <link href="navtree.css" rel="stylesheet" type="text/css"/>
16 <script type="text/javascript" src="navtreedata.js"></script>
17 <script type="text/javascript" src="navtree.js"></script>
18 <script type="text/javascript" src="resize.js"></script>
19 <script type="text/javascript" src="cookie.js"></script>
20 <link href="search/search.css" rel="stylesheet" type="text/css"/>
21 <script type="text/javascript" src="search/searchdata.js"></script>
22 <script type="text/javascript" src="search/search.js"></script>
23 <script type="text/javascript">
24 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
25 $(function() { init_search(); });
28 <script type="text/javascript" src="darkmode_toggle.js"></script>
29 <link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
30 <link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
31 <link href="extra_search.css" rel="stylesheet" type="text/css"/>
32 <link href="extra_tabs.css" rel="stylesheet" type="text/css"/>
33 <link href="version.css" rel="stylesheet" type="text/css"/>
34 <script type="text/javascript" src="../version.js"></script>
37 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
39 <table cellspacing="0" cellpadding="0">
41 <tr style="height: 55px;">
42 <td id="projectlogo" style="padding: 1.5em;"><a href="https://www.keil.arm.com/cmsis" target="_blank"><img alt="Logo" src="cmsis_logo_white_small.png"/</a></td>
43 <td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
44 <div id="projectname">CMSIS-FreeRTOS
45  <span id="projectnumber"><script type="text/javascript">
47 writeHeader.call(this);
48 writeVersionDropdown.call(this, "CMSIS-FreeRTOS");
53 <div id="projectbrief">CMSIS-RTOS2 compliant FreeRTOS Implementation</div>
55 <td> <div id="MSearchBox" class="MSearchBoxInactive">
57 <span id="MSearchSelect" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"> </span>
58 <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
59 onfocus="searchBox.OnSearchFieldFocus(true)"
60 onblur="searchBox.OnSearchFieldFocus(false)"
61 onkeyup="searchBox.OnSearchFieldChange(event)"/>
62 </span><span class="right">
63 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
71 <!-- end header part -->
72 <div id="CMSISnav" class="tabs1">
74 <script type="text/javascript">
75 writeComponentTabs.call(this);
79 <!-- Generated by Doxygen 1.13.2 -->
80 <script type="text/javascript">
81 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
82 var searchBox = new SearchBox("searchBox", "search/",'.html');
85 <script type="text/javascript">
86 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
87 $(function() { codefold.init(0); });
91 <div id="side-nav" class="ui-resizable side-nav-resizable">
93 <div id="nav-tree-contents">
94 <div id="nav-sync" class="sync"></div>
97 <div id="splitbar" style="-moz-user-select:none;"
98 class="ui-resizable-handle">
101 <script type="text/javascript">
102 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
103 $(function(){initNavTree('page_example_projects.html',''); initResizable(true); });
106 <div id="doc-content">
107 <!-- window showing the filter options -->
108 <div id="MSearchSelectWindow"
109 onmouseover="return searchBox.OnSearchSelectShow()"
110 onmouseout="return searchBox.OnSearchSelectHide()"
111 onkeydown="return searchBox.OnSearchSelectKey(event)">
114 <!-- iframe showing the search results (closed by default) -->
115 <div id="MSearchResultsWindow">
116 <div id="MSearchResults">
119 <div id="SRResults"></div>
120 <div class="SRStatus" id="Loading">Loading...</div>
121 <div class="SRStatus" id="Searching">Searching...</div>
122 <div class="SRStatus" id="NoMatches">No Matches</div>
128 <div><div class="header">
129 <div class="headertitle"><div class="title">Example Projects</div></div>
131 <div class="contents">
132 <div class="textblock"><p><a class="anchor" id="md_src_2example__projects"></a></p>
133 <p>This pack contains two example projects:</p>
135 <li><a class="el" href="#example_hello_world">Hello World</a></li>
136 <li><a class="el" href="#example_trustzone">TrustZone</a></li>
138 <p>The first example shows how to configure a simple application using FreeRTOS with CMSIS-RTOS2, whereas the second example shows how to use the FreeRTOS with CMSIS-RTOS2 in an application that utilizes TrustZone secure/non-secure execution.</p>
139 <p>Provided examples use the <a href="https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/">CMSIS Solution Project File Format</a> and can be built for multiple Cortex-M targets using <a href="https://open-cmsis-pack.github.io/cmsis-toolbox/">CMSIS Toolbox</a> either from the command line or from Visual Studio Code by using <a href="https://developer.arm.com/documentation/108029/0000/?lang=en">Arm Keil Studio Cloud extensions</a>.</p>
140 <p>The <b>Examples</b> solution defines projects and build information for each project.</p>
141 <h1><a class="anchor" id="autotoc_md5"></a>
143 <p>The <b>Examples</b> solution supports only "Debug" Build-Type which is optimized for debugging. It disables compiler optimization and retains all debug-related information. By default, Arm Compiler 6 is used to build the projects.</p>
144 <h2><a class="anchor" id="autotoc_md6"></a>
146 <p>Each example can be built for multiple target processors. The below table lists supported target processors together with the corresponding context target-types and model executable that shall be used for running the application image.</p>
147 <table class="markdownTable">
148 <tr class="markdownTableHead">
149 <th class="markdownTableHeadLeft">Target processor </th><th class="markdownTableHeadLeft">Target-Type </th><th class="markdownTableHeadLeft">Model Executable </th></tr>
150 <tr class="markdownTableRowOdd">
151 <td class="markdownTableBodyLeft">Cortex-M0 </td><td class="markdownTableBodyLeft">CM0 </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M0 </td></tr>
152 <tr class="markdownTableRowEven">
153 <td class="markdownTableBodyLeft">Cortex-M0+ </td><td class="markdownTableBodyLeft">CM0plus </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M0plus </td></tr>
154 <tr class="markdownTableRowOdd">
155 <td class="markdownTableBodyLeft">Cortex-M3 </td><td class="markdownTableBodyLeft">CM3 </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M3 </td></tr>
156 <tr class="markdownTableRowEven">
157 <td class="markdownTableBodyLeft">Cortex-M4 </td><td class="markdownTableBodyLeft">CM4 </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M4 </td></tr>
158 <tr class="markdownTableRowOdd">
159 <td class="markdownTableBodyLeft">Cortex-M7 </td><td class="markdownTableBodyLeft">CM7 </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M7 </td></tr>
160 <tr class="markdownTableRowEven">
161 <td class="markdownTableBodyLeft">Cortex-M23 </td><td class="markdownTableBodyLeft">CM23 </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M23 </td></tr>
162 <tr class="markdownTableRowOdd">
163 <td class="markdownTableBodyLeft">Cortex-M23 </td><td class="markdownTableBodyLeft">CM23_noTZ </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M23 </td></tr>
164 <tr class="markdownTableRowEven">
165 <td class="markdownTableBodyLeft">Cortex-M33 </td><td class="markdownTableBodyLeft">CM33 </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M33 </td></tr>
166 <tr class="markdownTableRowOdd">
167 <td class="markdownTableBodyLeft">Cortex-M33 </td><td class="markdownTableBodyLeft">CM33_noTZ </td><td class="markdownTableBodyLeft">FVP_MPS2_Cortex-M33 </td></tr>
168 <tr class="markdownTableRowEven">
169 <td class="markdownTableBodyLeft">Cortex-M55 </td><td class="markdownTableBodyLeft">CM55 </td><td class="markdownTableBodyLeft">FVP_Corstone_SSE-300 </td></tr>
170 <tr class="markdownTableRowOdd">
171 <td class="markdownTableBodyLeft">Cortex-M55 </td><td class="markdownTableBodyLeft">CM55_noTZ </td><td class="markdownTableBodyLeft">FVP_Corstone_SSE-300 </td></tr>
172 <tr class="markdownTableRowEven">
173 <td class="markdownTableBodyLeft">Cortex-M85 </td><td class="markdownTableBodyLeft">CM85 </td><td class="markdownTableBodyLeft">FVP_Corstone_SSE-310 </td></tr>
174 <tr class="markdownTableRowOdd">
175 <td class="markdownTableBodyLeft">Cortex-M85 </td><td class="markdownTableBodyLeft">CM85_noTZ </td><td class="markdownTableBodyLeft">FVP_Corstone_SSE-310 </td></tr>
177 <h2><a class="anchor" id="autotoc_md7"></a>
178 Build in VS Code using Arm Keil Studio Pack extensions</h2>
180 <li>See <a href="https://developer.arm.com/documentation/108029/0000/?lang=en">Arm Keil Studio Visual Studio Code Extensions User Guide</a> for more information about using the Keil Studio extensions.</li>
181 <li>Search for <a href="https://marketplace.visualstudio.com/items?itemName=Arm.keil-studio-pack">Arm Keil Studio Pack</a> in the Visual Studio Marketplace to download the extensions.</li>
183 <p>To build a project using Keil Studio extensions open CMSIS view, open "Manage CMSIS Solution" view and select "Active Context" and "Active Projects". Build Type is automatically selected since there is only one option.</p>
184 <p>Once the context and projects are selected one can build them by selecting "Build" in CMSIS view.</p>
185 <h2><a class="anchor" id="autotoc_md8"></a>
186 Build via command line</h2>
188 <li>See <a href="https://open-cmsis-pack.github.io/cmsis-toolbox/">CMSIS-Toolbox documentation</a> to learn more about CMSIS Solution project build and management tools.</li>
190 <p>To build the project via command line one can use the following command syntax:</p>
191 <div class="fragment"><div class="line">cbuild Examples.csolution.yml --context <project-name>.<build-type>+<target-type></div>
192 </div><!-- fragment --><p>To list the available contexts execute the following command:</p>
193 <div class="fragment"><div class="line">cbuild list contexts Examples.csolution.yml</div>
194 </div><!-- fragment --><h2><a class="anchor" id="autotoc_md9"></a>
195 Execute on Virtual Hardware Target</h2>
196 <p><a href="https://www.arm.com/products/development-tools/simulation/virtual-hardware">Arm Virtual Hardware Target</a> simulation models are used to execute the example application images.</p>
197 <p>To execute application image (axf or elf) on a simulation model use the following command syntax:</p>
198 <div class="fragment"><div class="line"><model-executable> -f ./Target/<target_type>/fvp_config.txt -a ./out/<project>/<project>.axf</div>
199 </div><!-- fragment --><h1><a class="anchor" id="example_hello_world"></a>
201 <p>The <b>Hello World</b> application can be used as a starting point when developing a new application. Using it, one can verify initial system setup and configuration.</p>
202 <p>The application is simple and shows how to use CMSIS-RTOS2:</p>
204 <li>how to initialize and start the RTOS kernel</li>
205 <li>how to create a new thread</li>
206 <li>how to retarget stdout</li>
208 <h3>Build via command line</h3>
209 <p>The following cbuild command may be used to build Hello World example project for Cortex-M3:</p>
210 <div class="fragment"><div class="line">cbuild Examples.csolution.yml --context Hello.Debug+CM3 --update-rte</div>
211 </div><!-- fragment --><h3>Execute via command line</h3>
212 <p>To execute simulation model and run Hello World project executable for Cortex-M3 use the following command:</p>
213 <div class="fragment"><div class="line">FVP_MPS2_Cortex-M3 -f ./Target/CM3/fvp_config.txt -a ./out/Hello/Hello.axf</div>
214 </div><!-- fragment --><p>When executed, application outputs the following to the serial terminal:</p>
215 <p><img src="hello_out.png" alt="" class="inline" title="Hello Output"/> </p>
216 <p>(Press Ctrl + C to stop the simulation model.)</p>
217 <h1><a class="anchor" id="example_trustzone"></a>
219 <p>The <b>TrustZone</b> application explains how to setup projects for booting and execution from TrustZone secure to non-secure domain and vice versa.</p>
220 <p>The application shows:</p>
222 <li>how to boot from the secure domain and switch the execution to the non-secure domain</li>
223 <li>how to create the interface functions between secure and non-secure domain</li>
224 <li>how to use the secure/non-secure interface functions</li>
226 <h3>Build via command line</h3>
227 <p>TrustZone example must always be built in two steps:</p>
229 <li>Build secure side project for Cortex-M55 <div class="fragment"><div class="line">cbuild Examples.csolution.yml --context TZ_Secure.Debug+CM55 --update-rte</div>
230 </div><!-- fragment --></li>
231 <li>Build non-secure side project for Cortex-M55 <div class="fragment"><div class="line">cbuild Examples.csolution.yml --context TZ_NonSecure.Debug+CM55 --update-rte</div>
232 </div><!-- fragment --></li>
234 <h3>Execute via command line</h3>
235 <p>To execute simulation model and run TrustZone project executable for Cortex-M55 use the following command:</p>
236 <div class="fragment"><div class="line">FVP_Corstone_SSE-300 -f ./Target/CM55/fvp_config.txt -a ./out/TZ_NonSecure/TZ_NonSecure.axf -a ./out/TZ_Secure/TZ_Secure.axf</div>
237 </div><!-- fragment --><p>When executed, application outputs the following to the serial terminal:</p>
238 <p><img src="trustzone_out.png" alt="" class="inline" title="TrustZone Output"/> </p>
239 <p>(Press Ctrl + C to stop the simulation model.) </p>
240 </div></div><!-- contents -->
241 </div><!-- PageDoc -->
242 </div><!-- doc-content -->
243 <!-- start footer part -->
244 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
247 <script type="text/javascript">
249 writeFooter.call(this);