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><a class="anchor" id="md_src_core_partition_device_h"></a> The TrustZone 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 called from <a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2">SystemInit</a>. It uses settings in these files:</p><ul>
135 <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>
136 <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">CMSIS-Zone</a>.</li>
138 <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">CMSIS-Zone</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>
139 <p>The <a class="el" href="partition_h_pg.html">partition_<Device>.h</a> file contains the following configuration settings for:</p><ul>
140 <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>
141 <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>
142 <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>
144 <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>
145 <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>
146 <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>
148 <h1><a class="anchor" id="sau_ctrlregister_sec"></a>
149 SAU CTRL register settings</h1>
150 <table class="cmtable">
152 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
154 <td>SAU_INIT_CTRL </td><td>0 .. 1 </td><td>0 </td><td>Initialize SAU CTRL register or not<ul>
155 <li>0: do not initialize SAU CTRL register</li>
156 <li>1: initialize SAU CTRL register </li>
160 <td>SAU_INIT_CTRL_ENABLE </td><td>0 .. 1 </td><td>0 </td><td>enable/disable the SAU<ul>
161 <li>0: disable SAU</li>
162 <li>1: enable SAU </li>
166 <td>SAU_INIT_CTRL_ALLNS </td><td>0 .. 1 </td><td>0 </td><td>value for SAU_CTRL register bit ALLNS<ul>
167 <li>0: all Memory is Secure</li>
168 <li>1: all Memory is Non-Secure </li>
172 <h1><a class="anchor" id="sau_sleepexception_sec"></a>
173 Configuration of Sleep and Exception behaviour</h1>
174 <table class="cmtable">
176 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
178 <td>SCB_CSR_AIRCR_INIT </td><td>0 .. 1 </td><td>1 </td><td>Setup behaviour of Sleep and Exception Handling<ul>
179 <li>0: not setup of CSR and AIRCR registers; the values below are not relevant</li>
180 <li>1: setup of CSR and AIRCR registers with values below </li>
184 <td>CSR_INIT_DEEPSLEEPS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_CSR register bit DEEPSLEEPS<ul>
185 <li>0: Deep Sleep can be enabled by Secure and Non-Secure state</li>
186 <li>1: Deep Sleep can be enabled by Secure state only </li>
190 <td>AIRCR_INIT_SYSRESETREQS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_AIRCR register bit SYSRESETREQS<ul>
191 <li>0: System reset request accessible from Secure and Non-Secure state</li>
192 <li>1: System reset request accessible from Secure state only </li>
196 <td>AIRCR_INIT_PRIS_VAL </td><td>0 .. 1 </td><td>1 </td><td>value for SCB_AIRCR register bit PRIS<ul>
197 <li>0: Priority of Non-Secure exceptions is Not altered</li>
198 <li>1: Priority of Non-Secure exceptions is Lowered to 0x80-0xFF </li>
202 <td>AIRCR_INIT_BFHFNMINS_VAL </td><td>0 .. 1 </td><td>0 </td><td>value for SCB_AIRCR register bit BFHFNMINS<ul>
203 <li>0: BusFault, HardFault, and NMI target are Secure state</li>
204 <li>1: BusFault, HardFault, and NMI target are Non-Secure state </li>
208 <h1><a class="anchor" id="sau_fpu_sec"></a>
209 Configuration of Floating Point Unit</h1>
210 <table class="cmtable">
212 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
214 <td>TZ_FPU_NS_USAGE </td><td>0 .. 1 </td><td>1 </td><td>Setup behaviour of Floating Point Unit<ul>
215 <li>0: not setup of NSACR and FPCCR registers; the values below are not relevant</li>
216 <li>1: setup of NSACR and FPCCR registers with values below </li>
220 <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>
221 <li>0: Secure state only</li>
222 <li>3: Secure and Non-Secure state </li>
226 <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>
232 <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>
233 <li>0: Secure and Non-Secure state</li>
234 <li>1: Secure state only </li>
238 <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>
244 <h1><a class="anchor" id="partition_gen_h_pg"></a>
245 Region/ISR setup: partition_gen.h</h1>
246 <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">CMSIS-Zone</a>.</p>
247 <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>
248 <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>
249 <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>
251 <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>
252 <h2><a class="anchor" id="sau_regions_sect"></a>
253 Configuration of the SAU Address Regions</h2>
254 <table class="cmtable">
256 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
258 <td>SAU_REGIONS_MAX </td><td>0 .. tbd </td><td>8 </td><td>maximum number of SAU regions </td></tr>
260 <td>SAU_INIT_REGION<number> </td><td>0 .. 1 </td><td>0 </td><td>initialize SAU region or not<ul>
261 <li>0: do not initialize SAU region</li>
262 <li>1: initialize SAU region </li>
266 <td>SAU_INIT_START<number> </td><td>0x00000000 .. 0xFFFFFFE0<br />
267 [in steps of 32] </td><td>0x00000000 </td><td>region start address </td></tr>
269 <td>SAU_INIT_END<number> </td><td>0x00000000 .. 0xFFFFFFE0<br />
270 [in steps of 32] </td><td>0x00000000 </td><td>region start address </td></tr>
272 <td>SAU_INIT_NSC<number> </td><td>0 .. 1 </td><td>0 </td><td>SAU region attribute<ul>
273 <li>0: Non-Secure</li>
274 <li>1: Secure, Non-Secure callable </li>
278 <p>The range of <number> is from 0 .. SAU_REGIONS_MAX. A set of these macros must exist for each <number>.</p>
279 <p>The following example shows a set of SAU region macros.</p>
280 <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>
281 <div class="line"> </div>
282 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION0 1</span></div>
283 <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>
284 <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>
285 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC0 1</span></div>
286 <div class="line"> </div>
287 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION1 1</span></div>
288 <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>
289 <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>
290 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC1 0</span></div>
291 <div class="line"> </div>
292 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION2 1</span></div>
293 <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>
294 <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>
295 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC2 0</span></div>
296 <div class="line"> </div>
297 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION3 1</span></div>
298 <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>
299 <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>
300 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC3 0</span></div>
301 <div class="line"> </div>
302 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION4 0</span></div>
303 <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>
304 <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>
305 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC4 0</span></div>
306 <div class="line"> </div>
307 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION5 0</span></div>
308 <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>
309 <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>
310 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC5 0</span></div>
311 <div class="line"> </div>
312 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION6 0</span></div>
313 <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>
314 <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>
315 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC6 0</span></div>
316 <div class="line"> </div>
317 <div class="line"><span class="preprocessor">#define SAU_INIT_REGION7 0</span></div>
318 <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>
319 <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>
320 <div class="line"><span class="preprocessor">#define SAU_INIT_NSC7 0</span></div>
321 </div><!-- fragment --><h2><a class="anchor" id="sau_interrupttarget_sec"></a>
322 Configuration of Interrupt Target settings</h2>
323 <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>
324 <table class="cmtable">
326 <th>#define </th><th>Value Range </th><th>Default </th><th>Description </th></tr>
328 <td>NVIC_INIT_ITNS<number> </td><td>0x00000000 .. 0xFFFFFFFF<br />
329 [each bit represents an interrupt] </td><td>0x00000000 </td><td>Interrupt vector target<ul>
330 <li>0: Secure state</li>
331 <li>1: Non-Secure state </li>
335 <p>The range of <number> is 0 .. (<number of external interrupts> + 31) / 32.</p>
336 <p>The following example shows the configuration for a maximum of 64 external interrupts.</p>
337 <div class="fragment"><div class="line"><span class="preprocessor">#define NVIC_INIT_ITNS0 0x0000122B</span></div>
338 <div class="line"><span class="preprocessor">#define NVIC_INIT_ITNS1 0x0000003A</span></div>
339 </div><!-- fragment --> </div></div><!-- contents -->
340 </div><!-- PageDoc -->
341 </div><!-- doc-content -->
342 <!-- start footer part -->
343 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
346 <script type="text/javascript">
348 writeFooter.call(this);