1 /**************************************************
3 * Part one of the system initialization code, contains low-level
4 * initialization, plain thumb variant.
6 * Copyright 2012 IAR Systems. All rights reserved.
10 **************************************************/
13 ; The modules in this file are included in the libraries, and may be replaced
14 ; by any user-defined modules that define the PUBLIC symbol _program_start or
15 ; a user defined start symbol.
16 ; To override the cstartup defined in the library, simply add your modified
17 ; version to the workbench project.
19 ; The vector table is normally located at address 0.
20 ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
21 ; The name "__vector_table" has special meaning for C-SPY:
22 ; it is where the SP start value is found, and the NVIC vector
23 ; table register (VTOR) is initialized to this address if != 0.
30 ;; Forward declaration of sections.
31 SECTION CSTACK:DATA:NOROOT(3)
33 SECTION .intvec:CODE:NOROOT(2)
35 EXTERN __iar_program_start
39 PUBLIC __vector_table_0x1c
44 DCD sfe(CSTACK) ; Top of Stack
45 DCD Reset_Handler ; Reset Handler
46 DCD NMI_Handler ; NMI Handler
47 DCD HardFault_Handler ; Hard Fault Handler
48 DCD MemManage_Handler ; MPU Fault Handler
49 DCD BusFault_Handler ; Bus Fault Handler
50 DCD UsageFault_Handler ; Usage Fault Handler
56 DCD SVC_Handler ; SVCall Handler
57 DCD DebugMon_Handler ; Debug Monitor Handler
59 DCD PendSV_Handler ; PendSV Handler
60 DCD SysTick_Handler ; SysTick Handler
63 DCD FLEX_INT0_IRQHandler ; All GPIO pin can be routed to FLEX_INTx
64 DCD FLEX_INT1_IRQHandler
65 DCD FLEX_INT2_IRQHandler
66 DCD FLEX_INT3_IRQHandler
67 DCD FLEX_INT4_IRQHandler
68 DCD FLEX_INT5_IRQHandler
69 DCD FLEX_INT6_IRQHandler
70 DCD FLEX_INT7_IRQHandler
72 DCD GINT1_IRQHandler ; PIO0 (0:7)
73 DCD Reserved_IRQHandler ; Reserved
74 DCD Reserved_IRQHandler
75 DCD Reserved_IRQHandler
76 DCD Reserved_IRQHandler
77 DCD SSP1_IRQHandler ; SSP1
78 DCD I2C_IRQHandler ; I2C
79 DCD TIMER16_0_IRQHandler ; 16-bit Timer0
80 DCD TIMER16_1_IRQHandler ; 16-bit Timer1
81 DCD TIMER32_0_IRQHandler ; 32-bit Timer0
82 DCD TIMER32_1_IRQHandler ; 32-bit Timer1
83 DCD SSP0_IRQHandler ; SSP0
84 DCD UART_IRQHandler ; UART
85 DCD USB_IRQHandler ; USB IRQ
86 DCD USB_FIQHandler ; USB FIQ
87 DCD ADC_IRQHandler ; A/D Converter
88 DCD WDT_IRQHandler ; Watchdog timer
89 DCD BOD_IRQHandler ; Brown Out Detect
90 DCD FMC_IRQHandler ; IP2111 Flash Memory Controller
91 DCD Reserved_IRQHandler ; Reserved
92 DCD Reserved_IRQHandler ; Reserved
93 DCD USBWakeup_IRQHandler ; USB wake up
94 DCD Reserved_IRQHandler ; Reserved
96 ;; 48 vector entries. We pad to 128 to fill the 0x0 - 0x1FF REMAP address space
99 DCD 0xFFFFFFFF ; Datafill
100 DCD 0xFFFFFFFF ; Datafill
101 DCD 0xFFFFFFFF ; Datafill
102 DCD 0xFFFFFFFF ; Datafill
103 DCD 0xFFFFFFFF ; Datafill
104 DCD 0xFFFFFFFF ; Datafill
105 DCD 0xFFFFFFFF ; Datafill
106 DCD 0xFFFFFFFF ; Datafill
107 DCD 0xFFFFFFFF ; Datafill
108 DCD 0xFFFFFFFF ; Datafill
110 DCD 0xFFFFFFFF ; Datafill
111 DCD 0xFFFFFFFF ; Datafill
112 DCD 0xFFFFFFFF ; Datafill
113 DCD 0xFFFFFFFF ; Datafill
114 DCD 0xFFFFFFFF ; Datafill
115 DCD 0xFFFFFFFF ; Datafill
116 DCD 0xFFFFFFFF ; Datafill
117 DCD 0xFFFFFFFF ; Datafill
118 DCD 0xFFFFFFFF ; Datafill
119 DCD 0xFFFFFFFF ; Datafill
121 DCD 0xFFFFFFFF ; Datafill
122 DCD 0xFFFFFFFF ; Datafill
123 DCD 0xFFFFFFFF ; Datafill
124 DCD 0xFFFFFFFF ; Datafill
125 DCD 0xFFFFFFFF ; Datafill
126 DCD 0xFFFFFFFF ; Datafill
127 DCD 0xFFFFFFFF ; Datafill
128 DCD 0xFFFFFFFF ; Datafill
129 DCD 0xFFFFFFFF ; Datafill
130 DCD 0xFFFFFFFF ; Datafill
132 DCD 0xFFFFFFFF ; Datafill
133 DCD 0xFFFFFFFF ; Datafill
134 DCD 0xFFFFFFFF ; Datafill
135 DCD 0xFFFFFFFF ; Datafill
136 DCD 0xFFFFFFFF ; Datafill
137 DCD 0xFFFFFFFF ; Datafill
138 DCD 0xFFFFFFFF ; Datafill
139 DCD 0xFFFFFFFF ; Datafill
140 DCD 0xFFFFFFFF ; Datafill
141 DCD 0xFFFFFFFF ; Datafill
143 DCD 0xFFFFFFFF ; Datafill
144 DCD 0xFFFFFFFF ; Datafill
145 DCD 0xFFFFFFFF ; Datafill
146 DCD 0xFFFFFFFF ; Datafill
147 DCD 0xFFFFFFFF ; Datafill
148 DCD 0xFFFFFFFF ; Datafill
149 DCD 0xFFFFFFFF ; Datafill
150 DCD 0xFFFFFFFF ; Datafill
151 DCD 0xFFFFFFFF ; Datafill
152 DCD 0xFFFFFFFF ; Datafill
154 DCD 0xFFFFFFFF ; Datafill
155 DCD 0xFFFFFFFF ; Datafill
156 DCD 0xFFFFFFFF ; Datafill
157 DCD 0xFFFFFFFF ; Datafill
158 DCD 0xFFFFFFFF ; Datafill
159 DCD 0xFFFFFFFF ; Datafill
160 DCD 0xFFFFFFFF ; Datafill
161 DCD 0xFFFFFFFF ; Datafill
162 DCD 0xFFFFFFFF ; Datafill
163 DCD 0xFFFFFFFF ; Datafill
165 DCD 0xFFFFFFFF ; Datafill
166 DCD 0xFFFFFFFF ; Datafill
167 DCD 0xFFFFFFFF ; Datafill
168 DCD 0xFFFFFFFF ; Datafill
169 DCD 0xFFFFFFFF ; Datafill
170 DCD 0xFFFFFFFF ; Datafill
171 DCD 0xFFFFFFFF ; Datafill
172 DCD 0xFFFFFFFF ; Datafill
173 DCD 0xFFFFFFFF ; Datafill
174 DCD 0xFFFFFFFF ; Datafill
176 DCD 0xFFFFFFFF ; Datafill
177 DCD 0xFFFFFFFF ; Datafill
178 DCD 0xFFFFFFFF ; Datafill
179 DCD 0xFFFFFFFF ; Datafill
180 DCD 0xFFFFFFFF ; Datafill
181 DCD 0xFFFFFFFF ; Datafill
182 DCD 0xFFFFFFFF ; Datafill
183 DCD 0xFFFFFFFF ; Datafill
184 DCD 0xFFFFFFFF ; Datafill
185 DCD 0xFFFFFFFF ; Datafill
186 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
188 ;; Default interrupt handlers.
191 PUBWEAK Reset_Handler
192 SECTION .text:CODE:NOROOT:REORDER(2)
196 LDR R0, =__iar_program_start
200 PUBWEAK HardFault_Handler
201 PUBWEAK MemManage_Handler
202 PUBWEAK BusFault_Handler
203 PUBWEAK UsageFault_Handler
205 PUBWEAK DebugMon_Handler
206 PUBWEAK PendSV_Handler
207 PUBWEAK SysTick_Handler
208 PUBWEAK FLEX_INT0_IRQHandler
209 PUBWEAK FLEX_INT1_IRQHandler
210 PUBWEAK FLEX_INT2_IRQHandler
211 PUBWEAK FLEX_INT3_IRQHandler
212 PUBWEAK FLEX_INT4_IRQHandler
213 PUBWEAK FLEX_INT5_IRQHandler
214 PUBWEAK FLEX_INT6_IRQHandler
215 PUBWEAK FLEX_INT7_IRQHandler
216 PUBWEAK GINT0_IRQHandler
217 PUBWEAK GINT1_IRQHandler
218 PUBWEAK SSP1_IRQHandler
219 PUBWEAK I2C_IRQHandler
220 PUBWEAK TIMER16_0_IRQHandler
221 PUBWEAK TIMER16_1_IRQHandler
222 PUBWEAK TIMER32_0_IRQHandler
223 PUBWEAK TIMER32_1_IRQHandler
224 PUBWEAK SSP0_IRQHandler
225 PUBWEAK UART_IRQHandler
226 PUBWEAK USB_IRQHandler
227 PUBWEAK USB_FIQHandler
228 PUBWEAK ADC_IRQHandler
229 PUBWEAK WDT_IRQHandler
230 PUBWEAK BOD_IRQHandler
231 PUBWEAK FMC_IRQHandler
232 PUBWEAK USBWakeup_IRQHandler
233 PUBWEAK Reserved_IRQHandler
235 SECTION .text:CODE:REORDER:NOROOT(1)
255 FLEX_INT0_IRQHandler:
257 FLEX_INT1_IRQHandler:
259 FLEX_INT2_IRQHandler:
261 FLEX_INT3_IRQHandler:
263 FLEX_INT4_IRQHandler:
265 FLEX_INT5_IRQHandler:
267 FLEX_INT6_IRQHandler:
269 FLEX_INT7_IRQHandler:
279 TIMER16_0_IRQHandler:
281 TIMER16_1_IRQHandler:
283 TIMER32_0_IRQHandler:
285 TIMER32_1_IRQHandler:
303 USBWakeup_IRQHandler:
310 SECTION .crp:CODE:ROOT(2)
312 /* Code Read Protection
313 NO_ISP 0x4E697370 - Prevents sampling of pin PIO0_1 for entering ISP mode
314 CRP1 0x12345678 - Write to RAM command cannot access RAM below 0x10000300.
315 - Copy RAM to flash command can not write to Sector 0.
316 - Erase command can erase Sector 0 only when all sectors
317 are selected for erase.
318 - Compare command is disabled.
319 - Read Memory command is disabled.
320 CRP2 0x87654321 - Read Memory is disabled.
321 - Write to RAM is disabled.
322 - "Go" command is disabled.
323 - Copy RAM to flash is disabled.
324 - Compare is disabled.
325 CRP3 0x43218765 - Access to chip via the SWD pins is disabled. ISP entry
326 by pulling PIO0_1 LOW is disabled if a valid user code is
327 present in flash sector 0.
328 Caution: If CRP3 is selected, no future factory testing can be
329 performed on the device.