]> begriffs open source - cmsis/blob - main/Core_A/group__system__init__gr.html
Update documentation for branch main
[cmsis] / main / Core_A / group__system__init__gr.html
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">
4 <head>
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-A): System and Clock Configuration</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="resize.js"></script>
17 <script type="text/javascript" src="navtreedata.js"></script>
18 <script type="text/javascript" src="navtree.js"></script>
19 <link href="search/search.css" rel="stylesheet" type="text/css"/>
20 <script type="text/javascript" src="search/searchdata.js"></script>
21 <script type="text/javascript" src="search/search.js"></script>
22 <script type="text/javascript">
23 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
24   $(document).ready(function() { init_search(); });
25 /* @license-end */
26 </script>
27 <script type="text/javascript" src="darkmode_toggle.js"></script>
28 <link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
29 <link href="extra_navtree.css" rel="stylesheet" type="text/css"/>
30 <link href="extra_search.css" rel="stylesheet" type="text/css"/>
31 <link href="extra_tabs.css" rel="stylesheet" type="text/css"/>
32 <link href="version.css" rel="stylesheet" type="text/css"/>
33 <script type="text/javascript" src="../../version.js"></script>
34 </head>
35 <body>
36 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
37 <div id="titlearea">
38 <table cellspacing="0" cellpadding="0">
39  <tbody>
40  <tr style="height: 55px;">
41   <td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
42   <td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
43    <div id="projectname">CMSIS-Core (Cortex-A)
44    &#160;<span id="projectnumber"><script type="text/javascript">
45      <!--
46      writeHeader.call(this);
47      writeVersionDropdown.call(this, "CMSIS-Core (Cortex-A)");
48      //-->
49     </script>
50    </span>
51    </div>
52    <div id="projectbrief">CMSIS-Core support for Cortex-A processor-based devices</div>
53   </td>
54    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
55         <span class="left">
56           <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
57           <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
58                onfocus="searchBox.OnSearchFieldFocus(true)" 
59                onblur="searchBox.OnSearchFieldFocus(false)" 
60                onkeyup="searchBox.OnSearchFieldChange(event)"/>
61           </span><span class="right">
62             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
63           </span>
64         </div>
65 </td>
66   <!--END !PROJECT_NAME-->
67  </tr>
68  </tbody>
69 </table>
70 </div>
71 <!-- end header part -->
72 <div id="CMSISnav" class="tabs1">
73   <ul class="tablist">
74     <script type="text/javascript">
75       writeComponentTabs.call(this);
76     </script>
77   </ul>
78 </div>
79 <script type="text/javascript">
80   writeSubComponentTabs.call(this);
81 </script>
82 <!-- Generated by Doxygen 1.9.6 -->
83 <script type="text/javascript">
84 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
85 var searchBox = new SearchBox("searchBox", "search/",'.html');
86 /* @license-end */
87 </script>
88 </div><!-- top -->
89 <div id="side-nav" class="ui-resizable side-nav-resizable">
90   <div id="nav-tree">
91     <div id="nav-tree-contents">
92       <div id="nav-sync" class="sync"></div>
93     </div>
94   </div>
95   <div id="splitbar" style="-moz-user-select:none;" 
96        class="ui-resizable-handle">
97   </div>
98 </div>
99 <script type="text/javascript">
100 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
101 $(document).ready(function(){initNavTree('group__system__init__gr.html',''); initResizable(); });
102 /* @license-end */
103 </script>
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)">
110 </div>
111
112 <!-- iframe showing the search results (closed by default) -->
113 <div id="MSearchResultsWindow">
114 <div id="MSearchResults">
115 <div class="SRPage">
116 <div id="SRIndex">
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>
121 </div>
122 </div>
123 </div>
124 </div>
125
126 <div class="header">
127   <div class="summary">
128 <a href="#func-members">Functions</a> &#124;
129 <a href="#var-members">Variables</a>  </div>
130   <div class="headertitle"><div class="title">System and Clock Configuration</div></div>
131 </div><!--header-->
132 <div class="contents">
133
134 <p>Functions for system and clock setup available in system_<em>device</em>.c.  
135 <a href="#details">More...</a></p>
136 <table class="memberdecls">
137 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
138 Functions</h2></td></tr>
139 <tr class="memitem:ga93f514700ccf00d08dbdcff7f1224eb2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2">SystemInit</a> (void)</td></tr>
140 <tr class="memdesc:ga93f514700ccf00d08dbdcff7f1224eb2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to Initialize the system.  <br /></td></tr>
141 <tr class="separator:ga93f514700ccf00d08dbdcff7f1224eb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
142 <tr class="memitem:gae0c36a9591fe6e9c45ecb21a794f0f0f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__system__init__gr.html#gae0c36a9591fe6e9c45ecb21a794f0f0f">SystemCoreClockUpdate</a> (void)</td></tr>
143 <tr class="memdesc:gae0c36a9591fe6e9c45ecb21a794f0f0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to update the variable <a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>.  <br /></td></tr>
144 <tr class="separator:gae0c36a9591fe6e9c45ecb21a794f0f0f"><td class="memSeparator" colspan="2">&#160;</td></tr>
145 </table><table class="memberdecls">
146 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
147 Variables</h2></td></tr>
148 <tr class="memitem:gaa3cd3e43291e81e795d642b79b6088e6"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a></td></tr>
149 <tr class="memdesc:gaa3cd3e43291e81e795d642b79b6088e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Variable to hold the system core clock value.  <br /></td></tr>
150 <tr class="separator:gaa3cd3e43291e81e795d642b79b6088e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
151 </table>
152 <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
153 <p>Functions for system and clock setup available in system_<em>device</em>.c. </p>
154 <p>Arm provides a template file <b>system_<em>device</em>.c</b> that must be adapted by the silicon vendor to match their actual device. As a <b>minimum requirement</b>, this file must provide:</p><ul>
155 <li>A device-specific system configuration function, <a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2">SystemInit()</a>.</li>
156 <li>A global variable that contains the system frequency, <a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>.</li>
157 </ul>
158 <p>The file configures the device and, typically, initializes the oscillator (PLL) that is part of the microcontroller device. This file might export other functions or variables that provide a more flexible configuration of the microcontroller system.</p>
159 <dl class="section note"><dt>Note</dt><dd>Please pay special attention to the static variable <code>SystemCoreClock</code>. This variable might be used throughout the whole system initialization and runtime to calculate frequency/time related values. Thus one must assure that the variable always reflects the actual system clock speed. Be aware that a value stored to <code>SystemCoreClock</code> during low level initialization (i.e. <code><a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2" title="Function to Initialize the system.">SystemInit()</a></code>) might get overwritten by C library startup code. Thus its highly recommended to call <a class="el" href="group__system__init__gr.html#gae0c36a9591fe6e9c45ecb21a794f0f0f">SystemCoreClockUpdate</a> at the beginning of the user <code>main()</code> routine.</dd></dl>
160 <h1><a class="anchor" id="system_init_code_ex_sec"></a>
161 Code Example</h1>
162 <p>The code below shows the usage of the variable <a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a> and the functions <a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2" title="Function to Initialize the system.">SystemInit()</a> and <a class="el" href="group__system__init__gr.html#gae0c36a9591fe6e9c45ecb21a794f0f0f" title="Function to update the variable SystemCoreClock.">SystemCoreClockUpdate()</a> with an arbitrary Arm Cortex-A9.</p>
163 <div class="fragment"><div class="line"><span class="preprocessor">#include &quot;ARMCA9.h&quot;</span></div>
164 <div class="line"> </div>
165 <div class="line">uint32_t coreClock_1 = 0;                       <span class="comment">/* Variables to store core clock values */</span></div>
166 <div class="line">uint32_t coreClock_2 = 0;</div>
167 <div class="line"> </div>
168 <div class="line"> </div>
169 <div class="line"><span class="keywordtype">int</span> main (<span class="keywordtype">void</span>)  {</div>
170 <div class="line"> </div>
171 <div class="line">  coreClock_1 = <a class="code hl_variable" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>;                <span class="comment">/* Store value of predefined SystemCoreClock */</span></div>
172 <div class="line"> </div>
173 <div class="line">  <a class="code hl_function" href="group__system__init__gr.html#gae0c36a9591fe6e9c45ecb21a794f0f0f">SystemCoreClockUpdate</a>();                      <span class="comment">/* Update SystemCoreClock according to register settings */</span></div>
174 <div class="line"> </div>
175 <div class="line">  coreClock_2 = <a class="code hl_variable" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>;                <span class="comment">/* Store value of calculated SystemCoreClock */</span></div>
176 <div class="line"> </div>
177 <div class="line">  <span class="keywordflow">if</span> (coreClock_2 != coreClock_1)  {            <span class="comment">/* Without changing the clock setting both core clock values should be the same */</span> </div>
178 <div class="line">    <span class="comment">// Error Handling</span></div>
179 <div class="line">  }</div>
180 <div class="line"> </div>
181 <div class="line">  <span class="keywordflow">while</span>(1);</div>
182 <div class="line">}</div>
183 <div class="ttc" id="agroup__system__init__gr_html_gaa3cd3e43291e81e795d642b79b6088e6"><div class="ttname"><a href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a></div><div class="ttdeci">uint32_t SystemCoreClock</div><div class="ttdoc">Variable to hold the system core clock value.</div><div class="ttdef"><b>Definition:</b> ref_system_init.txt:67</div></div>
184 <div class="ttc" id="agroup__system__init__gr_html_gae0c36a9591fe6e9c45ecb21a794f0f0f"><div class="ttname"><a href="group__system__init__gr.html#gae0c36a9591fe6e9c45ecb21a794f0f0f">SystemCoreClockUpdate</a></div><div class="ttdeci">void SystemCoreClockUpdate(void)</div><div class="ttdoc">Function to update the variable SystemCoreClock.</div></div>
185 </div><!-- fragment --> <h2 class="groupheader">Function Documentation</h2>
186 <a id="gae0c36a9591fe6e9c45ecb21a794f0f0f" name="gae0c36a9591fe6e9c45ecb21a794f0f0f"></a>
187 <h2 class="memtitle"><span class="permalink"><a href="#gae0c36a9591fe6e9c45ecb21a794f0f0f">&#9670;&#160;</a></span>SystemCoreClockUpdate()</h2>
188
189 <div class="memitem">
190 <div class="memproto">
191       <table class="memname">
192         <tr>
193           <td class="memname">void SystemCoreClockUpdate </td>
194           <td>(</td>
195           <td class="paramtype">void&#160;</td>
196           <td class="paramname"></td><td>)</td>
197           <td></td>
198         </tr>
199       </table>
200 </div><div class="memdoc">
201
202 <p>Function to update the variable <a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>. </p>
203 <p><br  />
204  Updates the variable <a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a> and must be called whenever the core clock is changed during program execution. The function evaluates the clock register settings and calculates the current core clock. </p>
205
206 </div>
207 </div>
208 <a id="ga93f514700ccf00d08dbdcff7f1224eb2" name="ga93f514700ccf00d08dbdcff7f1224eb2"></a>
209 <h2 class="memtitle"><span class="permalink"><a href="#ga93f514700ccf00d08dbdcff7f1224eb2">&#9670;&#160;</a></span>SystemInit()</h2>
210
211 <div class="memitem">
212 <div class="memproto">
213       <table class="memname">
214         <tr>
215           <td class="memname">void SystemInit </td>
216           <td>(</td>
217           <td class="paramtype">void&#160;</td>
218           <td class="paramname"></td><td>)</td>
219           <td></td>
220         </tr>
221       </table>
222 </div><div class="memdoc">
223
224 <p>Function to Initialize the system. </p>
225 <p><br  />
226  Initializes the microcontroller system. Typically, this function configures the oscillator (PLL) that is part of the microcontroller device. For systems with a variable clock speed, it updates the variable <a class="el" href="group__system__init__gr.html#gaa3cd3e43291e81e795d642b79b6088e6">SystemCoreClock</a>. SystemInit is called from the file <b>startup<em>_device</em></b>. </p>
227
228 </div>
229 </div>
230 <h2 class="groupheader">Variable Documentation</h2>
231 <a id="gaa3cd3e43291e81e795d642b79b6088e6" name="gaa3cd3e43291e81e795d642b79b6088e6"></a>
232 <h2 class="memtitle"><span class="permalink"><a href="#gaa3cd3e43291e81e795d642b79b6088e6">&#9670;&#160;</a></span>SystemCoreClock</h2>
233
234 <div class="memitem">
235 <div class="memproto">
236       <table class="memname">
237         <tr>
238           <td class="memname">uint32_t SystemCoreClock</td>
239         </tr>
240       </table>
241 </div><div class="memdoc">
242
243 <p>Variable to hold the system core clock value. </p>
244 <p>Holds the system core clock, which is the system clock frequency supplied to the SysTick timer and the processor core clock. This variable can be used by debuggers to query the frequency of the debug timer or to configure the trace clock speed.</p>
245 <dl class="section attention"><dt>Attention</dt><dd>Compilers must be configured to avoid removing this variable in case the application program is not using it. Debugging systems require the variable to be physically present in memory so that it can be examined to configure the debugger. </dd></dl>
246
247 </div>
248 </div>
249 </div><!-- contents -->
250 </div><!-- doc-content -->
251 <!-- start footer part -->
252 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
253   <ul>
254     <li class="footer">
255       <script type="text/javascript">
256         <!--
257         writeFooter.call(this);
258         //-->
259       </script> 
260     </li>
261   </ul>
262 </div>
263 </body>
264 </html>