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-Core (Cortex-M): TrustZone setup: partition_<device>.h</title>
9 <link href="doxygen.css" rel="stylesheet" type="text/css"/>
10 <link href="tabs.css" rel="stylesheet" type="text/css"/>
11 <link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
12 <link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
13 <link href="extra_search.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="jquery.js"></script>
15 <script type="text/javascript" src="dynsections.js"></script>
16 <script type="text/javascript" src="printComponentTabs.js"></script>
17 <script type="text/javascript" src="footer.js"></script>
18 <script type="text/javascript" src="navtree.js"></script>
19 <link href="navtree.css" rel="stylesheet" type="text/css"/>
20 <script type="text/javascript" src="resize.js"></script>
21 <script type="text/javascript" src="navtreedata.js"></script>
22 <script type="text/javascript" src="navtree.js"></script>
23 <link href="search/search.css" rel="stylesheet" type="text/css"/>
24 <script type="text/javascript" src="search/searchdata.js"></script>
25 <script type="text/javascript" src="search/search.js"></script>
26 <script type="text/javascript">
27 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
28 $(document).ready(function() { init_search(); });
31 <script type="text/javascript" src="darkmode_toggle.js"></script>
32 <link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
33 <link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
34 <link href="extra_search.css" rel="stylesheet" type="text/css"/>
35 <link href="version.css" rel="stylesheet" type="text/css" />
36 <script type="text/javascript" src="../../../version.js"></script>
39 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
41 <table cellspacing="0" cellpadding="0">
43 <tr style="height: 55px;">
44 <td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
45 <td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
46 <div id="projectname">CMSIS-Core (Cortex-M)
47  <span id="projectnumber"><script type="text/javascript">
49 writeHeader.call(this);
50 writeVersionDropdown.call(this);
55 <div id="projectbrief">CMSIS-Core support for Cortex-M processor-based devices</div>
57 <td> <div id="MSearchBox" class="MSearchBoxInactive">
59 <span id="MSearchSelect" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()"> </span>
60 <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
61 onfocus="searchBox.OnSearchFieldFocus(true)"
62 onblur="searchBox.OnSearchFieldFocus(false)"
63 onkeyup="searchBox.OnSearchFieldChange(event)"/>
64 </span><span class="right">
65 <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
69 <!--END !PROJECT_NAME-->
74 <!-- end header part -->
75 <div id="CMSISnav" class="tabs1">
77 <script type="text/javascript">
78 writeComponentTabs.call(this);
82 <script type="text/javascript">
83 writeSubComponentTabs.call(this);
85 <!-- Generated by Doxygen 1.9.6 -->
86 <script type="text/javascript">
87 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
88 var searchBox = new SearchBox("searchBox", "search/",'.html');
92 <div id="side-nav" class="ui-resizable side-nav-resizable">
94 <div id="nav-tree-contents">
95 <div id="nav-sync" class="sync"></div>
98 <div id="splitbar" style="-moz-user-select:none;"
99 class="ui-resizable-handle">
102 <script type="text/javascript">
103 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
104 $(document).ready(function(){initNavTree('partition_h_pg.html',''); initResizable(); });
107 <div id="doc-content">
108 <!-- window showing the filter options -->
109 <div id="MSearchSelectWindow"
110 onmouseover="return searchBox.OnSearchSelectShow()"
111 onmouseout="return searchBox.OnSearchSelectHide()"
112 onkeydown="return searchBox.OnSearchSelectKey(event)">
115 <!-- iframe showing the search results (closed by default) -->
116 <div id="MSearchResultsWindow">
117 <div id="MSearchResults">
120 <div id="SRResults"></div>
121 <div class="SRStatus" id="Loading">Loading...</div>
122 <div class="SRStatus" id="Searching">Searching...</div>
123 <div class="SRStatus" id="NoMatches">No Matches</div>
129 <div><div class="header">
130 <div class="headertitle"><div class="title">TrustZone setup: partition_<device>.h </div></div>
132 <div class="contents">
133 <div class="textblock"><p>The <a class="el" href="partition_h_pg.html">TrustZone setup: partition_<device>.h</a> header file contains the initial setup of the TrustZone hardware in an Armv8-M system.</p>
134 <p>This file implements the function <a class="el" href="group__sau__trustzone__functions.html#ga6093bc5939ea8924fbcfdffb8f0553f1">TZ_SAU_Setup</a> that is call from <a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2">SystemInit</a>. It uses settings in these files:</p>
136 <li><a class="el" href="partition_h_pg.html">partition_<device>.h</a> that defines the initial system configuration and during SystemInit in Secure state.</li>
137 <li><a class="el" href="partition_h_pg.html#partition_gen_h_pg">partition_gen.h</a> that contains SAU region and interrupt target assignments. This file may be generated using <a href="../../Zone/html/index.html"><b>CMSIS-Zone</b></a>.</li>
139 <dl class="section note"><dt>Note</dt><dd><a class="el" href="partition_h_pg.html#partition_gen_h_pg">partition_gen.h</a> is optional and can be generated using <a href="../../Zone/html/index.html"><b>CMSIS-Zone</b></a>. In previous versions of CMSIS-Core(M) this settings were part of <a class="el" href="partition_h_pg.html">partition_<device>.h</a>.</dd></dl>
141 <p>The <a class="el" href="partition_h_pg.html">partition_<device>.h</a> file contains the following configuration settings for:</p><ul>
142 <li><a class="el" href="partition_h_pg.html#sau_ctrlregister_sec">SAU CTRL register settings</a> provides settings for the SAU CTRL register.</li>
143 <li><a class="el" href="partition_h_pg.html#sau_sleepexception_sec">Configuration of Sleep and Exception behaviour</a> provides device-specific deep-sleep and exception settings.</li>
144 <li><a class="el" href="partition_h_pg.html#sau_fpu_sec">Configuration of Floating Point Unit</a> defines the usage of the Floating Point Unit in secure and non-secure state.</li>
146 <p>The <a class="el" href="partition_h_pg.html">partition_<device>.h</a> file includes the <a class="el" href="partition_h_pg.html#partition_gen_h_pg">partition_gen.h</a> file with configuration settings for:</p><ul>
147 <li><a class="el" href="partition_h_pg.html#sau_regions_sect">Configuration of the SAU Address Regions</a> provides configuration of the SAU Address Regions.</li>
148 <li><a class="el" href="partition_h_pg.html#sau_interrupttarget_sec">Configuration of Interrupt Target settings</a> provides device-specific interrupt target settings.</li>
150 <h1><a class="anchor" id="sau_ctrlregister_sec"></a>
151 SAU CTRL register settings</h1>
152 <table class="cmtable">
154 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
156 <td>SAU_INIT_CTRL </td><td>0 .. 1 </td><td>0 </td><td>Initialize SAU CTRL register or not<ul>
157 <li>0: do not initialize SAU CTRL register</li>
158 <li>1: initialize SAU CTRL register </li>
162 <td>SAU_INIT_CTRL_ENABLE </td><td>0 .. 1 </td><td>0 </td><td>enable/disable the SAU<ul>
163 <li>0: disable SAU</li>
164 <li>1: enable SAU </li>
168 <td>SAU_INIT_CTRL_ALLNS </td><td>0 .. 1 </td><td>0 </td><td>value for SAU_CTRL register bit ALLNS<ul>
169 <li>0: all Memory is Secure</li>
170 <li>1: all Memory is Non-Secure </li>
174 <h1><a class="anchor" id="sau_sleepexception_sec"></a>
175 Configuration of Sleep and Exception behaviour</h1>
176 <table class="cmtable">
178 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
180 <td>SCB_CSR_AIRCR_INIT </td><td>0 .. 1 </td><td>1 </td><td>Setup behaviour of Sleep and Exception Handling<ul>
181 <li>0: not setup of CSR and AIRCR registers; the values below are not relevant</li>
182 <li>1: setup of CSR and AIRCR registers with values below </li>
186 <td>CSR_INIT_DEEPSLEEPS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_CSR register bit DEEPSLEEPS<ul>
187 <li>0: Deep Sleep can be enabled by Secure and Non-Secure state</li>
188 <li>1: Deep Sleep can be enabled by Secure state only </li>
192 <td>AIRCR_INIT_SYSRESETREQS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_AIRCR register bit SYSRESETREQS<ul>
193 <li>0: System reset request accessible from Secure and Non-Secure state</li>
194 <li>1: System reset request accessible from Secure state only </li>
198 <td>AIRCR_INIT_PRIS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_AIRCR register bit PRIS<ul>
199 <li>0: Priority of Non-Secure exceptions is Not altered</li>
200 <li>1: Priority of Non-Secure exceptions is Lowered to 0x80-0xFF </li>
204 <td>AIRCR_INIT_BFHFNMINS_VAL </td><td>0 .. 1 </td><td>0 </td><td>value for SCB_AIRCR register bit BFHFNMINS<ul>
205 <li>0: BusFault, HardFault, and NMI target are Secure state</li>
206 <li>1: BusFault, HardFault, and NMI target are Non-Secure state </li>
210 <h1><a class="anchor" id="sau_fpu_sec"></a>
211 Configuration of Floating Point Unit</h1>
212 <table class="cmtable">
214 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
216 <td>TZ_FPU_NS_USAGE </td><td>0 .. 1 </td><td>1 </td><td>Setup behaviour of Floating Point Unit<ul>
217 <li>0: not setup of NSACR and FPCCR registers; the values below are not relevant</li>
218 <li>1: setup of NSACR and FPCCR registers with values below </li>
222 <td>SCB_NSACR_CP10_11_VAL </td><td>0 or 3 </td><td>3 </td><td>Floating Point Unit usage (Value for SCB->NSACR register bits CP10, CP11)<ul>
223 <li>0: Secure state only</li>
224 <li>3: Secure and Non-Secure state </li>
228 <td>FPU_FPCCR_TS_VAL </td><td>0 .. 1 </td><td>0 </td><td>Treat floating-point registers as Secure (value for FPU->FPCCR register bit TS)<ul>
234 <td>FPU_FPCCR_CLRONRETS_VAL </td><td>0 .. 1 </td><td>0 </td><td>Clear on return (CLRONRET) accessibility (Value for FPU->FPCCR register bit CLRONRETS)<ul>
235 <li>0: Secure and Non-Secure state</li>
236 <li>1: Secure state only </li>
240 <td>FPU_FPCCR_CLRONRET_VAL </td><td>0 .. 1 </td><td>1 </td><td>Clear floating-point caller saved registers on exception return (Value for FPU->FPCCR register bit CLRONRET)<ul>
248 <h1><a class="anchor" id="partition_gen_h_pg"></a>
249 Region/ISR setup: partition_gen.h</h1>
250 <p>The <a class="el" href="partition_h_pg.html#partition_gen_h_pg">partition_gen.h</a> header file can be generated using <a href="../../Zone/html/index.html"><b>CMSIS-Zone</b></a>.</p>
251 <p>The <a class="el" href="partition_h_pg.html">partition_<device>.h</a> file includes the <a class="el" href="partition_h_pg.html">partition_gen.h</a> file with configuration settings for:</p><ul>
252 <li><a class="el" href="partition_h_pg.html#sau_regions_sect">Configuration of the SAU Address Regions</a> provides configuration of the SAU Address Regions.</li>
253 <li><a class="el" href="partition_h_pg.html#sau_interrupttarget_sec">Configuration of Interrupt Target settings</a> provides device-specific interrupt target settings.</li>
255 <dl class="section note"><dt>Note</dt><dd>In previous versions of CMSIS-Core(M) the above settings were part of <a class="el" href="partition_h_pg.html">partition_<device>.h</a></dd></dl>
256 <h2><a class="anchor" id="sau_regions_sect"></a>
257 Configuration of the SAU Address Regions</h2>
258 <table class="cmtable">
260 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
262 <td>SAU_REGIONS_MAX </td><td>0 .. tbd </td><td>8 </td><td>maximum number of SAU regions </td></tr>
264 <td>SAU_INIT_REGION<number> </td><td>0 .. 1 </td><td>0 </td><td>initialize SAU region or not<ul>
265 <li>0: do not initialize SAU region</li>
266 <li>1: initialize SAU region </li>
270 <td>SAU_INIT_START<number> </td><td>0x00000000 .. 0xFFFFFFE0<br />
271 [in steps of 32] </td><td>0x00000000 </td><td>region start address </td></tr>
273 <td>SAU_INIT_END<number> </td><td>0x00000000 .. 0xFFFFFFE0<br />
274 [in steps of 32] </td><td>0x00000000 </td><td>region start address </td></tr>
276 <td>SAU_INIT_NSC<number> </td><td>0 .. 1 </td><td>0 </td><td>SAU region attribute<ul>
277 <li>0: Non-Secure</li>
278 <li>1: Secure, Non-Secure callable </li>
282 <p>The range of <number> is from 0 .. SAU_REGIONS_MAX. A set of these macros must exist for each <number>.</p>
283 <p>The following example shows a set of SAU region macros.</p>
284 <div class="fragment"><div class="line"><span class="preprocessor">#define SAU_REGIONS_MAX 8 </span><span class="comment">/* Max. number of SAU regions */</span><span class="preprocessor"></span></div>
285 <div class="line"> </div>
286 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION0 1</span></div>
287 <div class="line"><span class="preprocessor">#define SAU_INIT_START0 0x00000000 </span><span class="comment">/* start address of SAU region 0 */</span><span class="preprocessor"></span></div>
288 <div class="line"><span class="preprocessor">#define SAU_INIT_END0 0x001FFFE0 </span><span class="comment">/* end address of SAU region 0 */</span><span class="preprocessor"></span></div>
289 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC0 1</span></div>
290 <div class="line"> </div>
291 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION1 1</span></div>
292 <div class="line"><span class="preprocessor">#define SAU_INIT_START1 0x00200000 </span><span class="comment">/* start address of SAU region 1 */</span><span class="preprocessor"></span></div>
293 <div class="line"><span class="preprocessor">#define SAU_INIT_END1 0x003FFFE0 </span><span class="comment">/* end address of SAU region 1 */</span><span class="preprocessor"></span></div>
294 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC1 0</span></div>
295 <div class="line"> </div>
296 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION2 1</span></div>
297 <div class="line"><span class="preprocessor">#define SAU_INIT_START2 0x20200000 </span><span class="comment">/* start address of SAU region 2 */</span><span class="preprocessor"></span></div>
298 <div class="line"><span class="preprocessor">#define SAU_INIT_END2 0x203FFFE0 </span><span class="comment">/* end address of SAU region 2 */</span><span class="preprocessor"></span></div>
299 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC2 0</span></div>
300 <div class="line"> </div>
301 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION3 1</span></div>
302 <div class="line"><span class="preprocessor">#define SAU_INIT_START3 0x40000000 </span><span class="comment">/* start address of SAU region 3 */</span><span class="preprocessor"></span></div>
303 <div class="line"><span class="preprocessor">#define SAU_INIT_END3 0x40040000 </span><span class="comment">/* end address of SAU region 3 */</span><span class="preprocessor"></span></div>
304 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC3 0</span></div>
305 <div class="line"> </div>
306 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION4 0</span></div>
307 <div class="line"><span class="preprocessor">#define SAU_INIT_START4 0x00000000 </span><span class="comment">/* start address of SAU region 4 */</span><span class="preprocessor"></span></div>
308 <div class="line"><span class="preprocessor">#define SAU_INIT_END4 0x00000000 </span><span class="comment">/* end address of SAU region 4 */</span><span class="preprocessor"></span></div>
309 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC4 0</span></div>
310 <div class="line"> </div>
311 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION5 0</span></div>
312 <div class="line"><span class="preprocessor">#define SAU_INIT_START5 0x00000000 </span><span class="comment">/* start address of SAU region 5 */</span><span class="preprocessor"></span></div>
313 <div class="line"><span class="preprocessor">#define SAU_INIT_END5 0x00000000 </span><span class="comment">/* end address of SAU region 5 */</span><span class="preprocessor"></span></div>
314 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC5 0</span></div>
315 <div class="line"> </div>
316 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION6 0</span></div>
317 <div class="line"><span class="preprocessor">#define SAU_INIT_START6 0x00000000 </span><span class="comment">/* start address of SAU region 6 */</span><span class="preprocessor"></span></div>
318 <div class="line"><span class="preprocessor">#define SAU_INIT_END6 0x00000000 </span><span class="comment">/* end address of SAU region 6 */</span><span class="preprocessor"></span></div>
319 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC6 0</span></div>
320 <div class="line"> </div>
321 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION7 0</span></div>
322 <div class="line"><span class="preprocessor">#define SAU_INIT_START7 0x00000000 </span><span class="comment">/* start address of SAU region 7 */</span><span class="preprocessor"></span></div>
323 <div class="line"><span class="preprocessor">#define SAU_INIT_END7 0x00000000 </span><span class="comment">/* end address of SAU region 7 */</span><span class="preprocessor"></span></div>
324 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC7 0</span></div>
325 </div><!-- fragment --><h2><a class="anchor" id="sau_interrupttarget_sec"></a>
326 Configuration of Interrupt Target settings</h2>
327 <p>Each interrupt has a configuration bit that defines the execution in Secure or Non-secure state. The Non-Secure interrupts have a separate vector table. Refer to <a class="el" href="using_TrustZone_pg.html#Model_TrustZone">Programmers Model with TrustZone</a> for more information.</p>
328 <table class="cmtable">
330 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
332 <td>NVIC_INIT_ITNS<number> </td><td>0x00000000 .. 0xFFFFFFFF<br />
333 [each bit represents an interrupt] </td><td>0x00000000 </td><td>Interrupt vector target<ul>
334 <li>0: Secure state</li>
335 <li>1: Non-Secure state </li>
339 <p>The range of <number> is 0 .. (<number of external interrupts> + 31) / 32.</p>
340 <p>The following example shows the configuration for a maximum of 64 external interrupts.</p>
341 <div class="fragment"><div class="line"><span class="preprocessor">#define NVIC_INIT_ITNS0 0x0000122B</span></div>
342 <div class="line"><span class="preprocessor">#define NVIC_INIT_ITNS1 0x0000003A</span></div>
343 </div><!-- fragment --></div></div><!-- contents -->
344 </div><!-- PageDoc -->
345 </div><!-- doc-content -->
346 <!-- start footer part -->
347 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
350 <script type="text/javascript">
352 writeFooter.call(this);