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, "CMSIS-Core (Cortex-M)");
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 <!-- Generated by Doxygen 1.9.6 -->
83 <script type="text/javascript">
84 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
85 var searchBox = new SearchBox("searchBox", "search/",'.html');
89 <div id="side-nav" class="ui-resizable side-nav-resizable">
91 <div id="nav-tree-contents">
92 <div id="nav-sync" class="sync"></div>
95 <div id="splitbar" style="-moz-user-select:none;"
96 class="ui-resizable-handle">
99 <script type="text/javascript">
100 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
101 $(document).ready(function(){initNavTree('partition_h_pg.html',''); initResizable(); });
104 <div id="doc-content">
105 <!-- window showing the filter options -->
106 <div id="MSearchSelectWindow"
107 onmouseover="return searchBox.OnSearchSelectShow()"
108 onmouseout="return searchBox.OnSearchSelectHide()"
109 onkeydown="return searchBox.OnSearchSelectKey(event)">
112 <!-- iframe showing the search results (closed by default) -->
113 <div id="MSearchResultsWindow">
114 <div id="MSearchResults">
117 <div id="SRResults"></div>
118 <div class="SRStatus" id="Loading">Loading...</div>
119 <div class="SRStatus" id="Searching">Searching...</div>
120 <div class="SRStatus" id="NoMatches">No Matches</div>
126 <div><div class="header">
127 <div class="headertitle"><div class="title">TrustZone setup: partition_<device>.h </div></div>
129 <div class="contents">
130 <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>
131 <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>
133 <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>
134 <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>
136 <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>
138 <p>The <a class="el" href="partition_h_pg.html">partition_<device>.h</a> file contains the following configuration settings for:</p><ul>
139 <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>
140 <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>
141 <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>
143 <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>
144 <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>
145 <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>
147 <h1><a class="anchor" id="sau_ctrlregister_sec"></a>
148 SAU CTRL register settings</h1>
149 <table class="cmtable">
151 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
153 <td>SAU_INIT_CTRL </td><td>0 .. 1 </td><td>0 </td><td>Initialize SAU CTRL register or not<ul>
154 <li>0: do not initialize SAU CTRL register</li>
155 <li>1: initialize SAU CTRL register </li>
159 <td>SAU_INIT_CTRL_ENABLE </td><td>0 .. 1 </td><td>0 </td><td>enable/disable the SAU<ul>
160 <li>0: disable SAU</li>
161 <li>1: enable SAU </li>
165 <td>SAU_INIT_CTRL_ALLNS </td><td>0 .. 1 </td><td>0 </td><td>value for SAU_CTRL register bit ALLNS<ul>
166 <li>0: all Memory is Secure</li>
167 <li>1: all Memory is Non-Secure </li>
171 <h1><a class="anchor" id="sau_sleepexception_sec"></a>
172 Configuration of Sleep and Exception behaviour</h1>
173 <table class="cmtable">
175 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
177 <td>SCB_CSR_AIRCR_INIT </td><td>0 .. 1 </td><td>1 </td><td>Setup behaviour of Sleep and Exception Handling<ul>
178 <li>0: not setup of CSR and AIRCR registers; the values below are not relevant</li>
179 <li>1: setup of CSR and AIRCR registers with values below </li>
183 <td>CSR_INIT_DEEPSLEEPS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_CSR register bit DEEPSLEEPS<ul>
184 <li>0: Deep Sleep can be enabled by Secure and Non-Secure state</li>
185 <li>1: Deep Sleep can be enabled by Secure state only </li>
189 <td>AIRCR_INIT_SYSRESETREQS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_AIRCR register bit SYSRESETREQS<ul>
190 <li>0: System reset request accessible from Secure and Non-Secure state</li>
191 <li>1: System reset request accessible from Secure state only </li>
195 <td>AIRCR_INIT_PRIS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_AIRCR register bit PRIS<ul>
196 <li>0: Priority of Non-Secure exceptions is Not altered</li>
197 <li>1: Priority of Non-Secure exceptions is Lowered to 0x80-0xFF </li>
201 <td>AIRCR_INIT_BFHFNMINS_VAL </td><td>0 .. 1 </td><td>0 </td><td>value for SCB_AIRCR register bit BFHFNMINS<ul>
202 <li>0: BusFault, HardFault, and NMI target are Secure state</li>
203 <li>1: BusFault, HardFault, and NMI target are Non-Secure state </li>
207 <h1><a class="anchor" id="sau_fpu_sec"></a>
208 Configuration of Floating Point Unit</h1>
209 <table class="cmtable">
211 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
213 <td>TZ_FPU_NS_USAGE </td><td>0 .. 1 </td><td>1 </td><td>Setup behaviour of Floating Point Unit<ul>
214 <li>0: not setup of NSACR and FPCCR registers; the values below are not relevant</li>
215 <li>1: setup of NSACR and FPCCR registers with values below </li>
219 <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>
220 <li>0: Secure state only</li>
221 <li>3: Secure and Non-Secure state </li>
225 <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>
231 <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>
232 <li>0: Secure and Non-Secure state</li>
233 <li>1: Secure state only </li>
237 <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>
245 <h1><a class="anchor" id="partition_gen_h_pg"></a>
246 Region/ISR setup: partition_gen.h</h1>
247 <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>
248 <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>
249 <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>
250 <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>
252 <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>
253 <h2><a class="anchor" id="sau_regions_sect"></a>
254 Configuration of the SAU Address Regions</h2>
255 <table class="cmtable">
257 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
259 <td>SAU_REGIONS_MAX </td><td>0 .. tbd </td><td>8 </td><td>maximum number of SAU regions </td></tr>
261 <td>SAU_INIT_REGION<number> </td><td>0 .. 1 </td><td>0 </td><td>initialize SAU region or not<ul>
262 <li>0: do not initialize SAU region</li>
263 <li>1: initialize SAU region </li>
267 <td>SAU_INIT_START<number> </td><td>0x00000000 .. 0xFFFFFFE0<br />
268 [in steps of 32] </td><td>0x00000000 </td><td>region start address </td></tr>
270 <td>SAU_INIT_END<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_NSC<number> </td><td>0 .. 1 </td><td>0 </td><td>SAU region attribute<ul>
274 <li>0: Non-Secure</li>
275 <li>1: Secure, Non-Secure callable </li>
279 <p>The range of <number> is from 0 .. SAU_REGIONS_MAX. A set of these macros must exist for each <number>.</p>
280 <p>The following example shows a set of SAU region macros.</p>
281 <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>
282 <div class="line"> </div>
283 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION0 1</span></div>
284 <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>
285 <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>
286 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC0 1</span></div>
287 <div class="line"> </div>
288 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION1 1</span></div>
289 <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>
290 <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>
291 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC1 0</span></div>
292 <div class="line"> </div>
293 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION2 1</span></div>
294 <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>
295 <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>
296 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC2 0</span></div>
297 <div class="line"> </div>
298 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION3 1</span></div>
299 <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>
300 <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>
301 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC3 0</span></div>
302 <div class="line"> </div>
303 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION4 0</span></div>
304 <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>
305 <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>
306 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC4 0</span></div>
307 <div class="line"> </div>
308 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION5 0</span></div>
309 <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>
310 <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>
311 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC5 0</span></div>
312 <div class="line"> </div>
313 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION6 0</span></div>
314 <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>
315 <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>
316 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC6 0</span></div>
317 <div class="line"> </div>
318 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION7 0</span></div>
319 <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>
320 <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>
321 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC7 0</span></div>
322 </div><!-- fragment --><h2><a class="anchor" id="sau_interrupttarget_sec"></a>
323 Configuration of Interrupt Target settings</h2>
324 <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>
325 <table class="cmtable">
327 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
329 <td>NVIC_INIT_ITNS<number> </td><td>0x00000000 .. 0xFFFFFFFF<br />
330 [each bit represents an interrupt] </td><td>0x00000000 </td><td>Interrupt vector target<ul>
331 <li>0: Secure state</li>
332 <li>1: Non-Secure state </li>
336 <p>The range of <number> is 0 .. (<number of external interrupts> + 31) / 32.</p>
337 <p>The following example shows the configuration for a maximum of 64 external interrupts.</p>
338 <div class="fragment"><div class="line"><span class="preprocessor">#define NVIC_INIT_ITNS0 0x0000122B</span></div>
339 <div class="line"><span class="preprocessor">#define NVIC_INIT_ITNS1 0x0000003A</span></div>
340 </div><!-- fragment --></div></div><!-- contents -->
341 </div><!-- PageDoc -->
342 </div><!-- doc-content -->
343 <!-- start footer part -->
344 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
347 <script type="text/javascript">
349 writeFooter.call(this);