startup_s_pg.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <title>Startup File startup_&lt;device&gt;.s</title>
  7. <title>CMSIS-CORE: Startup File startup_&lt;device&gt;.s</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <link href="cmsis.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="printComponentTabs.js"></script>
  13. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  14. <script type="text/javascript" src="resize.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <script type="text/javascript">
  17. $(document).ready(initResizable);
  18. $(window).load(resizeHeight);
  19. </script>
  20. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  21. <script type="text/javascript" src="search/search.js"></script>
  22. <script type="text/javascript">
  23. $(document).ready(function() { searchBox.OnSelectItem(0); });
  24. </script>
  25. </head>
  26. <body>
  27. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  28. <div id="titlearea">
  29. <table cellspacing="0" cellpadding="0">
  30. <tbody>
  31. <tr style="height: 46px;">
  32. <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
  33. <td style="padding-left: 0.5em;">
  34. <div id="projectname">CMSIS-CORE
  35. &#160;<span id="projectnumber">Version 5.0.1</span>
  36. </div>
  37. <div id="projectbrief">CMSIS-CORE support for Cortex-M processor-based devices</div>
  38. </td>
  39. </tr>
  40. </tbody>
  41. </table>
  42. </div>
  43. <!-- end header part -->
  44. <div id="CMSISnav" class="tabs1">
  45. <ul class="tablist">
  46. <script type="text/javascript">
  47. <!--
  48. writeComponentTabs.call(this);
  49. //-->
  50. </script>
  51. </ul>
  52. </div>
  53. <!-- Generated by Doxygen 1.8.6 -->
  54. <script type="text/javascript">
  55. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  56. </script>
  57. <div id="navrow1" class="tabs">
  58. <ul class="tablist">
  59. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  60. <li class="current"><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
  61. <li><a href="modules.html"><span>Reference</span></a></li>
  62. <li>
  63. <div id="MSearchBox" class="MSearchBoxInactive">
  64. <span class="left">
  65. <img id="MSearchSelect" src="search/mag_sel.png"
  66. onmouseover="return searchBox.OnSearchSelectShow()"
  67. onmouseout="return searchBox.OnSearchSelectHide()"
  68. alt=""/>
  69. <input type="text" id="MSearchField" value="Search" accesskey="S"
  70. onfocus="searchBox.OnSearchFieldFocus(true)"
  71. onblur="searchBox.OnSearchFieldFocus(false)"
  72. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  73. </span><span class="right">
  74. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  75. </span>
  76. </div>
  77. </li>
  78. </ul>
  79. </div>
  80. </div><!-- top -->
  81. <div id="side-nav" class="ui-resizable side-nav-resizable">
  82. <div id="nav-tree">
  83. <div id="nav-tree-contents">
  84. <div id="nav-sync" class="sync"></div>
  85. </div>
  86. </div>
  87. <div id="splitbar" style="-moz-user-select:none;"
  88. class="ui-resizable-handle">
  89. </div>
  90. </div>
  91. <script type="text/javascript">
  92. $(document).ready(function(){initNavTree('startup_s_pg.html','');});
  93. </script>
  94. <div id="doc-content">
  95. <!-- window showing the filter options -->
  96. <div id="MSearchSelectWindow"
  97. onmouseover="return searchBox.OnSearchSelectShow()"
  98. onmouseout="return searchBox.OnSearchSelectHide()"
  99. onkeydown="return searchBox.OnSearchSelectKey(event)">
  100. <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>
  101. <!-- iframe showing the search results (closed by default) -->
  102. <div id="MSearchResultsWindow">
  103. <iframe src="javascript:void(0)" frameborder="0"
  104. name="MSearchResults" id="MSearchResults">
  105. </iframe>
  106. </div>
  107. <div class="header">
  108. <div class="headertitle">
  109. <div class="title">Startup File startup_&lt;device&gt;.s </div> </div>
  110. </div><!--header-->
  111. <div class="contents">
  112. <div class="textblock"><p>The <a class="el" href="startup_s_pg.html">Startup File startup_&lt;device&gt;.s</a> contains:</p>
  113. <ul>
  114. <li>The reset handler which is executed after CPU reset and typically calls the <a class="el" href="group__system__init__gr.html#ga93f514700ccf00d08dbdcff7f1224eb2">SystemInit</a> function.</li>
  115. <li>The setup values for the Main Stack Pointer (MSP).</li>
  116. <li>Exception vectors of the Cortex-M Processor with weak functions that implement default routines.</li>
  117. <li>Interrupt vectors that are device specific with weak functions that implement default routines.</li>
  118. </ul>
  119. <p>The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.</p>
  120. <p>To adapt the file to a new device only the interrupt vector table needs to be extended with the device-specific interrupt handlers. The naming convention for the interrupt handler names are &lt;interrupt_name&gt;_IRQHandler. This table needs to be consistent with <a class="el" href="group__NVIC__gr.html#ga7e1129cd8a196f4284d41db3e82ad5c8">IRQn_Type</a> that defines all the IRQ numbers for each interrupt.</p>
  121. <p><b>Example:</b> </p>
  122. <p>The following example shows the extension of the interrupt vector table for the LPC1100 device family.</p>
  123. <div class="fragment"><div class="line"> ; External Interrupts</div>
  124. <div class="line"> DCD WAKEUP0_IRQHandler ; 16+ 0: Wakeup PIO0.0</div>
  125. <div class="line"> DCD WAKEUP1_IRQHandler ; 16+ 1: Wakeup PIO0.1</div>
  126. <div class="line"> DCD WAKEUP2_IRQHandler ; 16+ 2: Wakeup PIO0.2</div>
  127. <div class="line"> : :</div>
  128. <div class="line"> : :</div>
  129. <div class="line"> DCD EINT1_IRQHandler ; 16+30: PIO INT1</div>
  130. <div class="line"> DCD EINT0_IRQHandler ; 16+31: PIO INT0</div>
  131. <div class="line"> :</div>
  132. <div class="line"> :</div>
  133. <div class="line"> EXPORT WAKEUP0_IRQHandler [WEAK]</div>
  134. <div class="line"> EXPORT WAKEUP1_IRQHandler [WEAK]</div>
  135. <div class="line"> EXPORT WAKEUP2_IRQHandler [WEAK]</div>
  136. <div class="line"> : :</div>
  137. <div class="line"> : :</div>
  138. <div class="line"> EXPORT EINT1_IRQHandler [WEAK]</div>
  139. <div class="line"> EXPORT EINT0_IRQHandler [WEAK]</div>
  140. <div class="line"></div>
  141. <div class="line">WAKEUP0_IRQHandler</div>
  142. <div class="line">WAKEUP1_IRQHandler</div>
  143. <div class="line">WAKEUP1_IRQHandler</div>
  144. <div class="line"> :</div>
  145. <div class="line"> :</div>
  146. <div class="line">EINT1_IRQHandler</div>
  147. <div class="line">EINT0_IRQHandler</div>
  148. <div class="line"> B .</div>
  149. </div><!-- fragment --><h1><a class="anchor" id="startup_s_sec"></a>
  150. startup_Device.s Template File</h1>
  151. <p>An ARM Compiler <a class="el" href="startup_s_pg.html#startup_s_sec">startup_Device.s Template File</a> for an ARMv7-M processor like Cortex-M3 is shown below. The files for other compiler vendors differ slightly in the syntax, but not in the overall structure.</p>
  152. <pre class="fragment">;/**************************************************************************//**
  153. ; * @file startup_&lt;Device&gt;.s
  154. ; * @brief CMSIS Cortex-M ARMv7-M based Core Device Startup File for
  155. ; * Device &lt;Device&gt;
  156. ; * @version V5.00
  157. ; * @date 02. March 2016
  158. ; ******************************************************************************/
  159. ;/*
  160. ; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
  161. ; *
  162. ; * SPDX-License-Identifier: Apache-2.0
  163. ; *
  164. ; * Licensed under the Apache License, Version 2.0 (the License); you may
  165. ; * not use this file except in compliance with the License.
  166. ; * You may obtain a copy of the License at
  167. ; *
  168. ; * www.apache.org/licenses/LICENSE-2.0
  169. ; *
  170. ; * Unless required by applicable law or agreed to in writing, software
  171. ; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  172. ; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  173. ; * See the License for the specific language governing permissions and
  174. ; * limitations under the License.
  175. ; */
  176. ;/*
  177. ;//-------- &lt;&lt;&lt; Use Configuration Wizard in Context Menu &gt;&gt;&gt; ------------------
  178. ;*/
  179. ; &lt;h&gt; Stack Configuration
  180. ; &lt;o&gt; Stack Size (in Bytes) &lt;0x0-0xFFFFFFFF:8&gt;
  181. ; &lt;/h&gt;
  182. Stack_Size EQU 0x00000400
  183. AREA STACK, NOINIT, READWRITE, ALIGN=3
  184. Stack_Mem SPACE Stack_Size
  185. __initial_sp
  186. ; &lt;h&gt; Heap Configuration
  187. ; &lt;o&gt; Heap Size (in Bytes) &lt;0x0-0xFFFFFFFF:8&gt;
  188. ; &lt;/h&gt;
  189. Heap_Size EQU 0x00000100
  190. AREA HEAP, NOINIT, READWRITE, ALIGN=3
  191. __heap_base
  192. Heap_Mem SPACE Heap_Size
  193. __heap_limit
  194. PRESERVE8
  195. THUMB
  196. ; Vector Table Mapped to Address 0 at Reset
  197. AREA RESET, DATA, READONLY
  198. EXPORT __Vectors
  199. EXPORT __Vectors_End
  200. EXPORT __Vectors_Size
  201. __Vectors DCD __initial_sp ; Top of Stack
  202. DCD Reset_Handler ; Reset Handler
  203. DCD NMI_Handler ; NMI Handler
  204. DCD HardFault_Handler ; Hard Fault Handler
  205. DCD MemManage_Handler ; MPU Fault Handler
  206. DCD BusFault_Handler ; Bus Fault Handler
  207. DCD UsageFault_Handler ; Usage Fault Handler
  208. DCD 0 ; Reserved
  209. DCD 0 ; Reserved
  210. DCD 0 ; Reserved
  211. DCD 0 ; Reserved
  212. DCD SVC_Handler ; SVCall Handler
  213. DCD DebugMon_Handler ; Debug Monitor Handler
  214. DCD 0 ; Reserved
  215. DCD PendSV_Handler ; PendSV Handler
  216. DCD SysTick_Handler ; SysTick Handler
  217. ; External Interrupts
  218. ; ToDo: Add here the vectors for the device specific external interrupts handler
  219. DCD &lt;DeviceInterrupt&gt;_IRQHandler ; 0: Default
  220. __Vectors_End
  221. __Vectors_Size EQU __Vectors_End - __Vectors
  222. AREA |.text|, CODE, READONLY
  223. ; Reset Handler
  224. Reset_Handler PROC
  225. EXPORT Reset_Handler [WEAK]
  226. IMPORT SystemInit
  227. IMPORT __main
  228. LDR R0, =SystemInit
  229. BLX R0
  230. LDR R0, =__main
  231. BX R0
  232. ENDP
  233. ; Dummy Exception Handlers (infinite loops which can be modified)
  234. NMI_Handler\
  235. PROC
  236. EXPORT NMI_Handler [WEAK]
  237. B .
  238. ENDP
  239. HardFault_Handler\
  240. PROC
  241. EXPORT HardFault_Handler [WEAK]
  242. B .
  243. ENDP
  244. MemManage_Handler\
  245. PROC
  246. EXPORT MemManage_Handler [WEAK]
  247. B .
  248. ENDP
  249. BusFault_Handler\
  250. PROC
  251. EXPORT BusFault_Handler [WEAK]
  252. B .
  253. ENDP
  254. UsageFault_Handler\
  255. PROC
  256. EXPORT UsageFault_Handler [WEAK]
  257. B .
  258. ENDP
  259. SVC_Handler\
  260. PROC
  261. EXPORT SVC_Handler [WEAK]
  262. B .
  263. ENDP
  264. DebugMon_Handler\
  265. PROC
  266. EXPORT DebugMon_Handler [WEAK]
  267. B .
  268. ENDP
  269. PendSV_Handler\
  270. PROC
  271. EXPORT PendSV_Handler [WEAK]
  272. B .
  273. ENDP
  274. SysTick_Handler\
  275. PROC
  276. EXPORT SysTick_Handler [WEAK]
  277. B .
  278. ENDP
  279. Default_Handler PROC
  280. ; ToDo: Add here the export definition for the device specific external interrupts handler
  281. EXPORT &lt;DeviceInterrupt&gt;_IRQHandler [WEAK]
  282. ; ToDo: Add here the names for the device specific external interrupts handler
  283. &lt;DeviceInterrupt&gt;_IRQHandler
  284. B .
  285. ENDP
  286. ALIGN
  287. ; User Initial Stack &amp; Heap
  288. IF :DEF:__MICROLIB
  289. EXPORT __initial_sp
  290. EXPORT __heap_base
  291. EXPORT __heap_limit
  292. ELSE
  293. IMPORT __use_two_region_memory
  294. EXPORT __user_initial_stackheap
  295. __user_initial_stackheap PROC
  296. LDR R0, = Heap_Mem
  297. LDR R1, =(Stack_Mem + Stack_Size)
  298. LDR R2, = (Heap_Mem + Heap_Size)
  299. LDR R3, = Stack_Mem
  300. BX LR
  301. ENDP
  302. ALIGN
  303. ENDIF
  304. END
  305. </pre> </div></div><!-- contents -->
  306. </div><!-- doc-content -->
  307. <!-- start footer part -->
  308. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  309. <ul>
  310. <li class="navelem"><a class="el" href="templates_pg.html">CMSIS-Core Device Templates</a></li>
  311. <li class="footer">Generated on Wed Feb 8 2017 10:20:41 for CMSIS-CORE by ARM Ltd. All rights reserved.
  312. <!--
  313. <a href="http://www.doxygen.org/index.html">
  314. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6
  315. -->
  316. </li>
  317. </ul>
  318. </div>
  319. </body>
  320. </html>