summaryrefslogtreecommitdiff
path: root/midi-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/ARMCLANG/startup_armv7-m.S
blob: 93ba4a9157d0a0e6074a76bbd131c7171e2d9d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/* File: startup_armv7-m.S
 * Purpose: startup file for armv7-m architecture devices.
 *          Should be used with ARMCLANG
 * Version: V2.00
 * Date: 16 November 2015
 *
 */
/* Copyright (c) 2011 - 2015 ARM LIMITED

   All rights reserved.
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:
   - Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
   - Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
   - Neither the name of ARM nor the names of its contributors may be used
     to endorse or promote products derived from this software without
     specific prior written permission.
   *
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   POSSIBILITY OF SUCH DAMAGE.
   ---------------------------------------------------------------------------*/
/*
  ;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
*/


    .syntax unified
    .arch   armv6-m

/* .eabi_attribute Tag_ABI_align8_preserved,1    www.support.code-red-tech.com/CodeRedWiki/Preserve8 */
.eabi_attribute 25, 1   /* Tag_ABI_align_preserved */


/*
  ;<h> Stack Configuration
  ;  <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  ;</h>
*/
    .equ    Stack_Size, 0x00000400

    .section STACK, "w"
    .align  3
    .globl  __StackTop
    .globl  __StackLimit
__StackLimit:
    .space  Stack_Size
__StackTop:   /* formerly known as __initial_sp */


/*
  ;<h> Heap Configuration
  ;  <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  ;</h>
*/
    .equ    Heap_Size, 0x00000C00

    .section HEAP, "w"
    .align  3
    .globl  __HeapBase
    .globl  __HeapLimit
__HeapBase:
    .if Heap_Size
    .space  Heap_Size
    .endif
__HeapLimit:


    .section RESET, "x"
    .align  2
    .globl  __Vectors
    .globl  __Vectors_End
    .globl  __Vectors_Size
__Vectors:
    .long   __StackTop            /* Top of Stack */
    .long   Reset_Handler         /* Reset Handler */
    .long   NMI_Handler           /* NMI Handler */
    .long   HardFault_Handler     /* Hard Fault Handler */
    .long   MemManage_Handler     /* MPU Fault Handler */
    .long   BusFault_Handler      /* Bus Fault Handler */
    .long   UsageFault_Handler    /* Usage Fault Handler */
    .long   0                     /* Reserved */
    .long   0                     /* Reserved */
    .long   0                     /* Reserved */
    .long   0                     /* Reserved */
    .long   SVC_Handler           /* SVCall Handler */
    .long   DebugMon_Handler      /* Debug Monitor Handler */
    .long   0                     /* Reserved */
    .long   PendSV_Handler        /* PendSV Handler */
    .long   SysTick_Handler       /* SysTick Handler */
__Vectors_End:

    .equ    __Vectors_Size, __Vectors_End - __Vectors


    .text
    .thumb
    .align  2

    .globl  Reset_Handler
    .weak   Reset_Handler
    .type   Reset_Handler, %function
    .thumb_func
Reset_Handler:
    bl      SystemInit
    bl      __main

    .globl  NMI_Handler
    .weak   NMI_Handler
    .type   NMI_Handler, %function
    .thumb_func
NMI_Handler:
    bkpt    #0
    b       .

    .globl  HardFault_Handler
    .weak   HardFault_Handler
    .type   HardFault_Handler, %function
    .thumb_func
HardFault_Handler:
    bkpt    #0
    b       .

    .globl  MemManage_Handler
    .weak   MemManage_Handler
    .type   MemManage_Handler, %function
    .thumb_func
MemManage_Handler:
    bkpt    #0
    b       .

    .globl  BusFault_Handler
    .weak   BusFault_Handler
    .type   BusFault_Handler, %function
    .thumb_func
BusFault_Handler:
    bkpt    #0
    b       .

    .globl  UsageFault_Handler
    .weak   UsageFault_Handler
    .type   UsageFault_Handler, %function
    .thumb_func
UsageFault_Handler:
    bkpt    #0
    b       .

    .globl  SVC_Handler
    .weak   SVC_Handler
    .type   SVC_Handler, %function
    .thumb_func
SVC_Handler:
    bkpt    #0
    b       .

    .globl  DebugMon_Handler
    .weak   DebugMon_Handler
    .type   DebugMon_Handler, %function
    .thumb_func
DebugMon_Handler:
    bkpt    #0
    b       .

    .globl  PendSV_Handler
    .weak   PendSV_Handler
    .type   PendSV_Handler, %function
    .thumb_func
PendSV_Handler:
    bkpt    #0
    b       .

    .globl  SysTick_Handler
    .weak   SysTick_Handler
    .type   SysTick_Handler, %function
    .thumb_func
SysTick_Handler:
    bkpt    #0
    b       .


    .global __use_two_region_memory

/*
  __user_setup_stackheap() returns the:
     - heap base in r0 (if the program uses the heap)
     - stack base in sp
     - heap limit in r2 (if the program uses the heap and uses two-region memory).
 */
    .globl  __user_setup_stackheap
    .type   __user_setup_stackheap, %function
    .thumb_func
__user_setup_stackheap:
    ldr     r0, =__StackTop
    mov     sp, r0
    .if Heap_Size
    ldr     r0, =__HeapBase
    ldr     r2, =__HeapLimit
    .else
    mov     r0, #0
    mov     r2, #0
    .endif
    bx      lr


/*
__user_initial_stackheap() returns the:
   - heap base in r0
   - stack base in r1, that is, the highest address in the stack region
   - heap limit in r2
   - stack limit in r3, that is, the lowest address in the stack region.
 */
/* DEPRICATED
    .globl  __user_initial_stackheap
    .type   __user_initial_stackheap, %function
    .thumb_func
__user_initial_stackheap:
    ldr     r0, = __HeapBase
    ldr     r1, = __StackTop
    ldr     r2, = __HeapLimit
    ldr     r3, = __StackLimit
    bx      lr
*/

    .end