Subversion Repositories ScreenTimer

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/**
2
  ******************************************************************************
3
  * @file      startup_stm32f070x6.s
4
  * @author    MCD Application Team
5
  * @brief     STM32F070x4/STM32F070x6 devices vector table for GCC toolchain.
6
  *            This module performs:
7
  *                - Set the initial SP
8
  *                - Set the initial PC == Reset_Handler,
9
  *                - Set the vector table entries with the exceptions ISR address
10
  *                - Branches to main in the C library (which eventually
11
  *                  calls main()).
12
  *            After Reset the Cortex-M0 processor is in Thread mode,
13
  *            priority is Privileged, and the Stack is set to Main.
14
  ******************************************************************************
15
  * @attention
16
  *
17
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
18
  * All rights reserved.</center></h2>
19
  *
20
  * This software component is licensed by ST under BSD 3-Clause license,
21
  * the "License"; You may not use this file except in compliance with the
22
  * License. You may obtain a copy of the License at:
23
  *                        opensource.org/licenses/BSD-3-Clause
24
  *
25
  ******************************************************************************
26
  */
27
 
28
  .syntax unified
29
  .cpu cortex-m0
30
  .fpu softvfp
31
  .thumb
32
 
33
.global g_pfnVectors
34
.global Default_Handler
35
 
36
/* start address for the initialization values of the .data section.
37
defined in linker script */
38
.word _sidata
39
/* start address for the .data section. defined in linker script */
40
.word _sdata
41
/* end address for the .data section. defined in linker script */
42
.word _edata
43
/* start address for the .bss section. defined in linker script */
44
.word _sbss
45
/* end address for the .bss section. defined in linker script */
46
.word _ebss
47
 
48
/**
49
 * @brief  This is the code that gets called when the processor first
50
 *          starts execution following a reset event. Only the absolutely
51
 *          necessary set is performed, after which the application
52
 *          supplied main() routine is called.
53
 * @param  None
54
 * @retval : None
55
*/
56
 
57
  .section .text.Reset_Handler
58
  .weak Reset_Handler
59
  .type Reset_Handler, %function
60
Reset_Handler:
61
  ldr   r0, =_estack
62
  mov   sp, r0          /* set stack pointer */
63
 
64
/*Check if boot space corresponds to test memory*/
65
 
66
    LDR R0,=0x00000004
67
    LDR R1, [R0]
68
    LSRS R1, R1, #24
69
    LDR R2,=0x1F
70
    CMP R1, R2
71
    BNE ApplicationStart
72
 
73
 /*SYSCFG clock enable*/
74
 
75
    LDR R0,=0x40021018
76
    LDR R1,=0x00000001
77
    STR R1, [R0]
78
 
79
/*Set CFGR1 register with flash memory remap at address 0*/
80
    LDR R0,=0x40010000
81
    LDR R1,=0x00000000
82
    STR R1, [R0]
83
 
84
ApplicationStart:
85
/* Copy the data segment initializers from flash to SRAM */
86
  ldr r0, =_sdata
87
  ldr r1, =_edata
88
  ldr r2, =_sidata
89
  movs r3, #0
90
  b LoopCopyDataInit
91
 
92
CopyDataInit:
93
  ldr r4, [r2, r3]
94
  str r4, [r0, r3]
95
  adds r3, r3, #4
96
 
97
LoopCopyDataInit:
98
  adds r4, r0, r3
99
  cmp r4, r1
100
  bcc CopyDataInit
101
 
102
/* Zero fill the bss segment. */
103
  ldr r2, =_sbss
104
  ldr r4, =_ebss
105
  movs r3, #0
106
  b LoopFillZerobss
107
 
108
FillZerobss:
109
  str  r3, [r2]
110
  adds r2, r2, #4
111
 
112
LoopFillZerobss:
113
  cmp r2, r4
114
  bcc FillZerobss
115
 
116
/* Call the clock system intitialization function.*/
117
  bl  SystemInit
118
/* Call static constructors */
119
  bl __libc_init_array
120
/* Call the application's entry point.*/
121
  bl main
122
 
123
LoopForever:
124
    b LoopForever
125
 
126
 
127
.size Reset_Handler, .-Reset_Handler
128
 
129
/**
130
 * @brief  This is the code that gets called when the processor receives an
131
 *         unexpected interrupt.  This simply enters an infinite loop, preserving
132
 *         the system state for examination by a debugger.
133
 *
134
 * @param  None
135
 * @retval : None
136
*/
137
    .section .text.Default_Handler,"ax",%progbits
138
Default_Handler:
139
Infinite_Loop:
140
  b Infinite_Loop
141
  .size Default_Handler, .-Default_Handler
142
/******************************************************************************
143
*
144
* The minimal vector table for a Cortex M0.  Note that the proper constructs
145
* must be placed on this to ensure that it ends up at physical address
146
* 0x0000.0000.
147
*
148
******************************************************************************/
149
   .section .isr_vector,"a",%progbits
150
  .type g_pfnVectors, %object
151
  .size g_pfnVectors, .-g_pfnVectors
152
 
153
 
154
g_pfnVectors:
155
  .word  _estack
156
  .word  Reset_Handler
157
  .word  NMI_Handler
158
  .word  HardFault_Handler
159
  .word  0
160
  .word  0
161
  .word  0
162
  .word  0
163
  .word  0
164
  .word  0
165
  .word  0
166
  .word  SVC_Handler
167
  .word  0
168
  .word  0
169
  .word  PendSV_Handler
170
  .word  SysTick_Handler
171
  .word  WWDG_IRQHandler                   /* Window WatchDog              */
172
  .word  0                                 /* Reserved                     */
173
  .word  RTC_IRQHandler                    /* RTC through the EXTI line    */
174
  .word  FLASH_IRQHandler                  /* FLASH                        */
175
  .word  RCC_IRQHandler                    /* RCC                          */
176
  .word  EXTI0_1_IRQHandler                /* EXTI Line 0 and 1            */
177
  .word  EXTI2_3_IRQHandler                /* EXTI Line 2 and 3            */
178
  .word  EXTI4_15_IRQHandler               /* EXTI Line 4 to 15            */
179
  .word  0                                 /* Reserved                     */
180
  .word  DMA1_Channel1_IRQHandler          /* DMA1 Channel 1               */
181
  .word  DMA1_Channel2_3_IRQHandler        /* DMA1 Channel 2 and Channel 3 */
182
  .word  DMA1_Channel4_5_IRQHandler        /* DMA1 Channel 4 and Channel 5 */
183
  .word  ADC1_IRQHandler                   /* ADC1                         */
184
  .word  TIM1_BRK_UP_TRG_COM_IRQHandler    /* TIM1 Break, Update, Trigger and Commutation */
185
  .word  TIM1_CC_IRQHandler                /* TIM1 Capture Compare         */
186
  .word  0                                 /* Reserved                     */
187
  .word  TIM3_IRQHandler                   /* TIM3                         */
188
  .word  0                                 /* Reserved                     */
189
  .word  0                                 /* Reserved                     */
190
  .word  TIM14_IRQHandler                  /* TIM14                        */
191
  .word  0                                 /* Reserved                     */
192
  .word  TIM16_IRQHandler                  /* TIM16                        */
193
  .word  TIM17_IRQHandler                  /* TIM17                        */
194
  .word  I2C1_IRQHandler                   /* I2C1                         */
195
  .word  0                                 /* Reserved                     */
196
  .word  SPI1_IRQHandler                   /* SPI1                         */
197
  .word  0                                 /* Reserved                     */
198
  .word  USART1_IRQHandler                 /* USART1                       */
199
  .word  USART2_IRQHandler                 /* USART2                       */
200
  .word  0                                 /* Reserved                     */
201
  .word  0                                 /* Reserved                     */
202
  .word  USB_IRQHandler                    /* USB                          */
203
 
204
/*******************************************************************************
205
*
206
* Provide weak aliases for each Exception handler to the Default_Handler.
207
* As they are weak aliases, any function with the same name will override
208
* this definition.
209
*
210
*******************************************************************************/
211
 
212
  .weak      NMI_Handler
213
  .thumb_set NMI_Handler,Default_Handler
214
 
215
  .weak      HardFault_Handler
216
  .thumb_set HardFault_Handler,Default_Handler
217
 
218
  .weak      SVC_Handler
219
  .thumb_set SVC_Handler,Default_Handler
220
 
221
  .weak      PendSV_Handler
222
  .thumb_set PendSV_Handler,Default_Handler
223
 
224
  .weak      SysTick_Handler
225
  .thumb_set SysTick_Handler,Default_Handler
226
 
227
  .weak      WWDG_IRQHandler
228
  .thumb_set WWDG_IRQHandler,Default_Handler
229
 
230
  .weak      RTC_IRQHandler
231
  .thumb_set RTC_IRQHandler,Default_Handler
232
 
233
  .weak      FLASH_IRQHandler
234
  .thumb_set FLASH_IRQHandler,Default_Handler
235
 
236
  .weak      RCC_IRQHandler
237
  .thumb_set RCC_IRQHandler,Default_Handler
238
 
239
  .weak      EXTI0_1_IRQHandler
240
  .thumb_set EXTI0_1_IRQHandler,Default_Handler
241
 
242
  .weak      EXTI2_3_IRQHandler
243
  .thumb_set EXTI2_3_IRQHandler,Default_Handler
244
 
245
  .weak      EXTI4_15_IRQHandler
246
  .thumb_set EXTI4_15_IRQHandler,Default_Handler
247
 
248
  .weak      DMA1_Channel1_IRQHandler
249
  .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
250
 
251
  .weak      DMA1_Channel2_3_IRQHandler
252
  .thumb_set DMA1_Channel2_3_IRQHandler,Default_Handler
253
 
254
  .weak      DMA1_Channel4_5_IRQHandler
255
  .thumb_set DMA1_Channel4_5_IRQHandler,Default_Handler
256
 
257
  .weak      ADC1_IRQHandler
258
  .thumb_set ADC1_IRQHandler,Default_Handler
259
 
260
  .weak      TIM1_BRK_UP_TRG_COM_IRQHandler
261
  .thumb_set TIM1_BRK_UP_TRG_COM_IRQHandler,Default_Handler
262
 
263
  .weak      TIM1_CC_IRQHandler
264
  .thumb_set TIM1_CC_IRQHandler,Default_Handler
265
 
266
  .weak      TIM3_IRQHandler
267
  .thumb_set TIM3_IRQHandler,Default_Handler
268
 
269
  .weak      TIM14_IRQHandler
270
  .thumb_set TIM14_IRQHandler,Default_Handler
271
 
272
  .weak      TIM16_IRQHandler
273
  .thumb_set TIM16_IRQHandler,Default_Handler
274
 
275
  .weak      TIM17_IRQHandler
276
  .thumb_set TIM17_IRQHandler,Default_Handler
277
 
278
  .weak      I2C1_IRQHandler
279
  .thumb_set I2C1_IRQHandler,Default_Handler
280
 
281
  .weak      SPI1_IRQHandler
282
  .thumb_set SPI1_IRQHandler,Default_Handler
283
 
284
  .weak      USART1_IRQHandler
285
  .thumb_set USART1_IRQHandler,Default_Handler
286
 
287
  .weak      USART2_IRQHandler
288
  .thumb_set USART2_IRQHandler,Default_Handler
289
 
290
  .weak      USB_IRQHandler
291
  .thumb_set USB_IRQHandler,Default_Handler
292
 
293
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
294