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">
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_<device>.s</title>
7 <title>CMSIS-CORE: Startup File startup_<device>.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);
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); });
27 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
29 <table cellspacing="0" cellpadding="0">
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  <span id="projectnumber">Version 5.0.0 - Beta</span>
37 <div id="projectbrief">CMSIS-CORE support for Cortex-M processor-based devices</div>
43 <!-- end header part -->
44 <div id="CMSISnav" class="tabs1">
46 <script type="text/javascript">
48 writeComponentTabs.call(this);
53 <!-- Generated by Doxygen 1.8.6 -->
54 <script type="text/javascript">
55 var searchBox = new SearchBox("searchBox", "search",false,'Search');
57 <div id="navrow1" class="tabs">
59 <li><a href="index.html"><span>Main Page</span></a></li>
60 <li class="current"><a href="pages.html"><span>Usage and Description</span></a></li>
61 <li><a href="modules.html"><span>Reference</span></a></li>
63 <div id="MSearchBox" class="MSearchBoxInactive">
65 <img id="MSearchSelect" src="search/mag_sel.png"
66 onmouseover="return searchBox.OnSearchSelectShow()"
67 onmouseout="return searchBox.OnSearchSelectHide()"
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>
81 <div id="side-nav" class="ui-resizable side-nav-resizable">
83 <div id="nav-tree-contents">
84 <div id="nav-sync" class="sync"></div>
87 <div id="splitbar" style="-moz-user-select:none;"
88 class="ui-resizable-handle">
91 <script type="text/javascript">
92 $(document).ready(function(){initNavTree('startup_s_pg.html','');});
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"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Pages</a></div>
102 <!-- iframe showing the search results (closed by default) -->
103 <div id="MSearchResultsWindow">
104 <iframe src="javascript:void(0)" frameborder="0"
105 name="MSearchResults" id="MSearchResults">
110 <div class="headertitle">
111 <div class="title">Startup File startup_<device>.s </div> </div>
113 <div class="contents">
114 <div class="textblock"><p>The <a class="el" href="startup_s_pg.html">Startup File startup_<device>.s</a> contains:</p>
116 <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>
117 <li>The setup values for the Main Stack Pointer (MSP).</li>
118 <li>Exception vectors of the Cortex-M Processor with weak functions that implement default routines.</li>
119 <li>Interrupt vectors that are device specific with weak functions that implement default routines.</li>
121 <p>The file exists for each supported toolchain and is the only tool-chain specific CMSIS file.</p>
122 <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 <interrupt_name>_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>
123 <p><b>Example:</b> </p>
124 <p>The following example shows the extension of the interrupt vector table for the LPC1100 device family.</p>
125 <div class="fragment"><div class="line"> ; External Interrupts</div>
126 <div class="line"> DCD WAKEUP0_IRQHandler ; 16+ 0: Wakeup PIO0.0</div>
127 <div class="line"> DCD WAKEUP1_IRQHandler ; 16+ 1: Wakeup PIO0.1</div>
128 <div class="line"> DCD WAKEUP2_IRQHandler ; 16+ 2: Wakeup PIO0.2</div>
129 <div class="line"> : :</div>
130 <div class="line"> : :</div>
131 <div class="line"> DCD EINT1_IRQHandler ; 16+30: PIO INT1</div>
132 <div class="line"> DCD EINT0_IRQHandler ; 16+31: PIO INT0</div>
133 <div class="line"> :</div>
134 <div class="line"> :</div>
135 <div class="line"> EXPORT WAKEUP0_IRQHandler [WEAK]</div>
136 <div class="line"> EXPORT WAKEUP1_IRQHandler [WEAK]</div>
137 <div class="line"> EXPORT WAKEUP2_IRQHandler [WEAK]</div>
138 <div class="line"> : :</div>
139 <div class="line"> : :</div>
140 <div class="line"> EXPORT EINT1_IRQHandler [WEAK]</div>
141 <div class="line"> EXPORT EINT0_IRQHandler [WEAK]</div>
142 <div class="line"></div>
143 <div class="line">WAKEUP0_IRQHandler</div>
144 <div class="line">WAKEUP1_IRQHandler</div>
145 <div class="line">WAKEUP1_IRQHandler</div>
146 <div class="line"> :</div>
147 <div class="line"> :</div>
148 <div class="line">EINT1_IRQHandler</div>
149 <div class="line">EINT0_IRQHandler</div>
150 <div class="line"> B .</div>
151 </div><!-- fragment --><h1><a class="anchor" id="startup_s_sec"></a>
152 startup_Device.s Template File</h1>
153 <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>
154 <pre class="fragment">;/**************************************************************************//**
155 ; * @file startup_<Device>.s
156 ; * @brief CMSIS Cortex-M ARMv7-M based Core Device Startup File for
157 ; * Device <Device>
159 ; * @date 02. March 2016
160 ; ******************************************************************************/
162 ; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
164 ; * SPDX-License-Identifier: Apache-2.0
166 ; * Licensed under the Apache License, Version 2.0 (the License); you may
167 ; * not use this file except in compliance with the License.
168 ; * You may obtain a copy of the License at
170 ; * http://www.apache.org/licenses/LICENSE-2.0
172 ; * Unless required by applicable law or agreed to in writing, software
173 ; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
174 ; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
175 ; * See the License for the specific language governing permissions and
176 ; * limitations under the License.
180 ;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
184 ; <h> Stack Configuration
185 ; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
188 Stack_Size EQU 0x00000400
190 AREA STACK, NOINIT, READWRITE, ALIGN=3
191 Stack_Mem SPACE Stack_Size
195 ; <h> Heap Configuration
196 ; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
199 Heap_Size EQU 0x00000100
201 AREA HEAP, NOINIT, READWRITE, ALIGN=3
203 Heap_Mem SPACE Heap_Size
211 ; Vector Table Mapped to Address 0 at Reset
213 AREA RESET, DATA, READONLY
216 EXPORT __Vectors_Size
218 __Vectors DCD __initial_sp ; Top of Stack
219 DCD Reset_Handler ; Reset Handler
220 DCD NMI_Handler ; NMI Handler
221 DCD HardFault_Handler ; Hard Fault Handler
222 DCD MemManage_Handler ; MPU Fault Handler
223 DCD BusFault_Handler ; Bus Fault Handler
224 DCD UsageFault_Handler ; Usage Fault Handler
229 DCD SVC_Handler ; SVCall Handler
230 DCD DebugMon_Handler ; Debug Monitor Handler
232 DCD PendSV_Handler ; PendSV Handler
233 DCD SysTick_Handler ; SysTick Handler
235 ; External Interrupts
236 ; ToDo: Add here the vectors for the device specific external interrupts handler
237 DCD <DeviceInterrupt>_IRQHandler ; 0: Default
240 __Vectors_Size EQU __Vectors_End - __Vectors
242 AREA |.text|, CODE, READONLY
248 EXPORT Reset_Handler [WEAK]
258 ; Dummy Exception Handlers (infinite loops which can be modified)
262 EXPORT NMI_Handler [WEAK]
267 EXPORT HardFault_Handler [WEAK]
272 EXPORT MemManage_Handler [WEAK]
277 EXPORT BusFault_Handler [WEAK]
282 EXPORT UsageFault_Handler [WEAK]
287 EXPORT SVC_Handler [WEAK]
292 EXPORT DebugMon_Handler [WEAK]
297 EXPORT PendSV_Handler [WEAK]
302 EXPORT SysTick_Handler [WEAK]
307 ; ToDo: Add here the export definition for the device specific external interrupts handler
308 EXPORT <DeviceInterrupt>_IRQHandler [WEAK]
310 ; ToDo: Add here the names for the device specific external interrupts handler
311 <DeviceInterrupt>_IRQHandler
319 ; User Initial Stack & Heap
329 IMPORT __use_two_region_memory
330 EXPORT __user_initial_stackheap
332 __user_initial_stackheap PROC
334 LDR R1, =(Stack_Mem + Stack_Size)
335 LDR R2, = (Heap_Mem + Heap_Size)
346 </pre> </div></div><!-- contents -->
347 </div><!-- doc-content -->
348 <!-- start footer part -->
349 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
351 <li class="navelem"><a class="el" href="templates_pg.html">Template Files</a></li>
352 <li class="footer">Generated on Tue Sep 13 2016 16:45:26 for CMSIS-CORE by ARM Ltd. All rights reserved.
354 <a href="http://www.doxygen.org/index.html">
355 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6