| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <!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>Nuvoton NuMicro M2351</title>
- <title>CMSIS-Zone: Nuvoton NuMicro M2351</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>
- <script type="text/javascript" src="printComponentTabs.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>
- </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-Zone
-  <span id="projectnumber">Version 1.0.0</span>
- </div>
- <div id="projectbrief">System Resource Management</div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <div id="CMSISnav" class="tabs1">
- <ul class="tablist">
- <script type="text/javascript">
- <!--
- writeComponentTabs.call(this);
- //-->
- </script>
- </ul>
- </div>
- <!-- Generated by Doxygen 1.8.6 -->
- <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>
- <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('zTEM2351.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>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><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">Nuvoton NuMicro M2351 </div> </div>
- </div><!--header-->
- <div class="contents">
- <div class="textblock"><p>This single processor demo application shows how to do the <a class="el" href="UseCases.html#UseCase_TrustZone">TrustZone Partitioning</a>. It is split into a secure and non-secure part. Some peripherals are assigned to either the secure or the non-secure zone to demonstrate the generation of PPC setup and interrupt configuration in the partition.h template. Using CMSIS-Zone, it generates:</p>
- <ul>
- <li>A header file that contains #defines to control the various linker scatter files (and might be used in other parts of the application).</li>
- <li>Secure attribution unit (SAU) setup.</li>
- </ul>
- <p>The application itself shows how to implement calls between the secure and the non-secure part and how to use this to blink an LED.</p>
- <h1><a class="anchor" id="zTEM2351_Eclipse"></a>
- Using the CMSIS-Zone project</h1>
- <ul>
- <li><a class="el" href="zTExamples.html#zTExImport">Import</a> the project "Examples\M2351\Zone" into the CMSIS-Zone utility</li>
- <li><a class="el" href="zTUI.html#zTProjEx">Open</a> the M2351.azone file</li>
- <li><a class="el" href="zTUIGenerate.html">Generate</a> the related output files</li>
- </ul>
- <p>The M2351.azone file of that project has the following configuration settings:</p>
- <ul>
- <li><a class="el" href="zTUIZonePart.html#zTUICreate">Added the zones</a> <code>Secure</code> and <code>NonSecure</code> </li>
- <li><a class="el" href="zTUIMemPerRes.html#zTUIMemAdd">Created the memory regions</a> <code>CODE_NS</code>, <code>CODE_S</code>, <code>Veneer</code>, <code>DATA_NS</code>, and <code>DATA_S</code> </li>
- <li>Selected various memory regions and peripherals for using in the different zones: <div class="image">
- <img src="m2351_zones.png" alt="m2351_zones.png"/>
- </div>
- </li>
- </ul>
- <p>The zones use different Flash and SRAM regions for code and data. To generate the output, click on the <a class="el" href="zTUIGenerate.html">Generate</a> button in the Zone Editor tool bar. This creates the following files in the <code>ftl_gen</code> directory:</p>
- <table class="doxtable">
- <tr>
- <th align="left">Template File </th><th align="left">Generated File </th><th align="left">Description </th></tr>
- <tr>
- <td align="left">helper.ftlinc </td><td align="left">N/A </td><td align="left">Helper template file with FTL functions. </td></tr>
- <tr>
- <td align="left">mem_layout.h.ftl </td><td align="left">mem_layout.h </td><td align="left">Header file that contains the memory region definitions, for example for the linker scatter file. </td></tr>
- <tr>
- <td align="left">partition_gen.h.ftl </td><td align="left">partition_gen.h </td><td align="left">Configuration of the secure attribution unit (SAU) and the NVIC interrupt assignment. </td></tr>
- <tr>
- <td align="left">scatter_ns.sct.ftl </td><td align="left">scatter_ns.sct </td><td align="left">Example scatter file for the non-secure zone. </td></tr>
- <tr>
- <td align="left">scatter_s.sct.ftl </td><td align="left">scatter_s.sct </td><td align="left">Example scatter file for the secure zone. </td></tr>
- </table>
- <p>These files can be used in any IDE to create the final application. In the following, the usage in Arm Keil MDK is described.</p>
- <h1><a class="anchor" id="zTEM2351_MDK"></a>
- Using the MDK project</h1>
- <p>The example project can be loaded, built and debugged in µVision by performing the following steps:</p>
- <ol type="1">
- <li>Navigate to Examples/M2351/MDK</li>
- <li>Open the multi-project workspace TrustZone.uvmpw</li>
- <li>Optional: Update the generated files by executing the copy_gen.bat scripts in Secure\mdk and NonSecure\mdk folders.</li>
- <li>Run the batch build in MDK. Both projects, Secure and NonSecure need to be compiled in order.</li>
- <li>Set <code>Secure</code> as active project.</li>
- <li>Connect the NuMaker-PFM-M2351 board using a Micro-USB cable at ICEJ.</li>
- <li>Open <b>Options for Target - Debug</b> and make sure that the NULink Debugger is selected.</li>
- <li>Launch a debug session and watch LEDG and LEDY blinking.</li>
- </ol>
- <h1><a class="anchor" id="zTEM2351_MDK_Setup"></a>
- MDK project setup</h1>
- <p>The multiproject workspace contains the <code>Secure</code> project and the <code>NonSecure</code> project:</p>
- <div class="image">
- <img src="m2351_proj_window.png" alt="m2351_proj_window.png"/>
- </div>
- <p>The projects use the files generated in CMSIS-Zone as follows:</p>
- <table class="doxtable">
- <tr>
- <th align="left">File </th><th align="left">Used in </th><th align="left">Description </th></tr>
- <tr>
- <td align="left">mem_layout.h </td><td align="left">Secure, NonSecure </td><td align="left">Input for the scatter files. </td></tr>
- <tr>
- <td align="left">partition_gen.h </td><td align="left">Secure </td><td align="left">Configuration of the secure attribution unit (SAU) and the NVIC interrupt assignment. </td></tr>
- <tr>
- <td align="left">scatter_ns.sct </td><td align="left">NonSecure </td><td align="left">Scatter file for non-secure zone (initally based on generated file). </td></tr>
- <tr>
- <td align="left">scatter_s.sct </td><td align="left">Secure </td><td align="left">Scatter file for secure zone (initally based on generated file). </td></tr>
- </table>
- <p>The scatter files <code>scatter_s.sct</code> and <code>scatter_ns.sct</code> are using a preinclude to mem_layout.h to get the information about the different memory regions.</p>
- <dl class="section note"><dt>Note</dt><dd>If you want to learn more about the general project layout for an Armv8-M project using TrustZone, refer to <a href="https://www.keil.com/appnotes/docs/apnt_291.asp" target="_blank">Application Note 291</a>.</dd></dl>
- <h2><a class="anchor" id="zTEM2351_hwsScatter"></a>
- scatter_s.sct</h2>
- <p>As explained previously, the #defines in <code>mem_layout.h</code> can be used to create generic scatter files that are easy to update once changes in the CMSIS-Zone project happen. Using the <b>mem_layout.h</b> file from CMSIS-Zone, the following scatter file is used in the <code>Sections</code> project:</p>
- <div class="fragment"><div class="line"><span class="preprocessor">#! armclang -E --target=arm-arm-none-eabi -mcpu=cortex-m23 -I../ -xc</span></div>
- <div class="line"><span class="preprocessor"></span></div>
- <div class="line"><span class="preprocessor">#include "mem_layout.h"</span></div>
- <div class="line"></div>
- <div class="line">; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------</div>
- <div class="line"></div>
- <div class="line">;<h> Stack Configuration</div>
- <div class="line">; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8></div>
- <div class="line">;</h></div>
- <div class="line"><span class="preprocessor">#define STACK_SIZE 0x400</span></div>
- <div class="line"><span class="preprocessor"></span></div>
- <div class="line">;<h> Heap Configuration</div>
- <div class="line">; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8></div>
- <div class="line">;</h></div>
- <div class="line"><span class="preprocessor">#define HEAP_SIZE 0xC00</span></div>
- <div class="line"><span class="preprocessor"></span></div>
- <div class="line">; *-------------- <<< end of configuration section >>> -----------------------</div>
- <div class="line">LR_CODE_S REGION_CODE_S_START REGION_CODE_S_SIZE {</div>
- <div class="line"> ER_CODE_S REGION_CODE_S_START REGION_CODE_S_SIZE {</div>
- <div class="line"> (RESET,+FIRST)</div>
- <div class="line"> (InRoot$$Sections)</div>
- <div class="line"> .ANY (+RO +XO)</div>
- <div class="line"> }</div>
- <div class="line"> RW_DATA_S REGION_DATA_S_START REGION_DATA_S_SIZE-HEAP_SIZE-STACK_SIZE {</div>
- <div class="line"> .ANY (+RW +ZI)</div>
- <div class="line"> }</div>
- <div class="line"><span class="preprocessor">#if HEAP_SIZE>0</span></div>
- <div class="line"><span class="preprocessor"></span> ARM_LIB_HEAP REGION_DATA_S_START+REGION_DATA_S_SIZE-HEAP_SIZE-STACK_SIZE EMPTY HEAP_SIZE {</div>
- <div class="line"> }</div>
- <div class="line"><span class="preprocessor">#endif</span></div>
- <div class="line"><span class="preprocessor"></span><span class="preprocessor">#if STACK_SIZE>0</span></div>
- <div class="line"><span class="preprocessor"></span> ARM_LIB_STACK REGION_DATA_S_START+REGION_DATA_S_SIZE-STACK_SIZE EMPTY STACK_SIZE {</div>
- <div class="line"> }</div>
- <div class="line"><span class="preprocessor">#endif </span></div>
- <div class="line"><span class="preprocessor"></span>}</div>
- <div class="line">LR_VENEER REGION_VENEER_START REGION_VENEER_SIZE {</div>
- <div class="line"> ER_VENEER REGION_VENEER_START REGION_VENEER_SIZE {</div>
- <div class="line"> (Veneer$$CMSE)</div>
- <div class="line"> }</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="navelem"><a class="el" href="zoneToolUsage.html">CMSIS-Zone Utility</a></li><li class="navelem"><a class="el" href="zTExamples.html">Examples</a></li>
- <li class="footer">Generated on Thu Apr 9 2020 15:50:03 for CMSIS-Zone Version 1.0.0 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.6
- -->
- </li>
- </ul>
- </div>
- </body>
- </html>
|