source: rtems/bsps/m68k/mcf5329/start/start.S @ 511dc4b

5
Last change on this file since 511dc4b was 511dc4b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 07:09:51

Rework initialization and interrupt stack support

Statically initialize the interrupt stack area
(_Configuration_Interrupt_stack_area_begin,
_Configuration_Interrupt_stack_area_end, and
_Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the
interrupt stack area in a special section ".rtemsstack.interrupt". Let
BSPs define the optimal placement of this section in their linker
command files (e.g. in a fast on-chip memory).

This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and
CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the
low level initialization code has all information available via global
symbols.

This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define
superfluous, since the interrupt stacks are allocated by confdefs.h for
all architectures. There is no need for BSP-specific linker command
file magic (except the section placement), see previous ARM linker
command file as a bad example.

Remove _CPU_Install_interrupt_stack(). Initialize the hardware
interrupt stack in _CPU_Initialize() if necessary (e.g.
m68k_install_interrupt_stack()).

The optional _CPU_Interrupt_stack_setup() is still useful to customize
the registration of the interrupt stack area in the per-CPU information.

The initialization stack can reuse the interrupt stack, since

  • interrupts are disabled during the sequential system initialization, and
  • the boot_card() function does not return.

This stack resuse saves memory.

Changes per architecture:

arm:

  • Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases.
  • Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp.

bfin:

  • Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value.

lm32, m32c, mips, nios2, riscv, sh, v850:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

m68k:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

powerpc:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.
  • Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA).

sparc:

  • Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM.

Update #3459.

  • Property mode set to 100644
File size: 10.7 KB
Line 
1/*
2 *  mcf52235 startup code
3 *
4 *  This file contains the entry point for the application.
5 *  The name of this entry point is compiler dependent.
6 *  It jumps to the BSP which is responsible for performing
7 *  all initialization.
8 *
9 *  COPYRIGHT (c) 1989-1998.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#include <rtems/asm.h>
18
19BEGIN_CODE
20
21    PUBLIC (_INTERRUPT_VECTOR)
22SYM(_INTERRUPT_VECTOR):
23
24    .long   _Configuration_Interrupt_stack_area_end /* 00 Initial 'SSP' */
25    .long   SYM(start) /* 01 Initial PC */
26    .long   SYM(_uhoh) /* 02 Access Error */
27    .long   SYM(_uhoh) /* 03 Address Error */
28    .long   SYM(_uhoh) /* 04 Illegal Instruction */
29    .long   SYM(_uhoh) /* 05 Divide by Zero */
30    .long   SYM(_uhoh) /* 06 Reserved */
31    .long   SYM(_uhoh) /* 07 Reserved */
32    .long   SYM(_uhoh) /* 08 Privilege Violation */
33    .long   SYM(_uhoh) /* 09 Trace */
34    .long   SYM(_uhoh) /* 10 Unimplemented A-Line */
35    .long   SYM(_uhoh) /* 11 Unimplemented F-Line */
36    .long   SYM(_uhoh) /* 12 Debug Interrupt */
37    .long   SYM(_uhoh) /* 13 Reserved */
38    .long   SYM(_uhoh) /* 14 Format Error */
39    .long   SYM(_uhoh) /* 15 Reserved */
40    .long   SYM(_uhoh) /* 16 Reserved */
41    .long   SYM(_uhoh) /* 17 Reserved */
42    .long   SYM(_uhoh) /* 18 Reserved */
43    .long   SYM(_uhoh) /* 19 Reserved */
44    .long   SYM(_uhoh) /* 20 Reserved */
45    .long   SYM(_uhoh) /* 21 Reserved */
46    .long   SYM(_uhoh) /* 22 Reserved */
47    .long   SYM(_uhoh) /* 23 Reserved */
48    .long   SYM(_spuriousInterrupt) /* 24 Spurious Interrupt */
49    .long   SYM(_uhoh) /* Reserved */
50    .long   SYM(_uhoh) /* Reserved */
51    .long   SYM(_uhoh) /* Reserved */
52    .long   SYM(_uhoh) /* Reserved */
53    .long   SYM(_uhoh) /* Reserved */
54    .long   SYM(_uhoh) /* Reserved */
55    .long   SYM(_uhoh) /* Reserved */
56    .long   SYM(_uhoh) /* 32 TRAP #0 */
57    .long   SYM(_uhoh) /* 33 TRAP #1 */
58    .long   SYM(_uhoh) /* 34 TRAP #2 */
59    .long   SYM(_uhoh) /* 35 TRAP #3 */
60    .long   SYM(_uhoh) /* 36 TRAP #4 */
61    .long   SYM(_uhoh) /* 37 TRAP #5 */
62    .long   SYM(_uhoh) /* 38 TRAP #6 */
63    .long   SYM(_uhoh) /* 39 TRAP #7 */
64    .long   SYM(_uhoh) /* 40 TRAP #8 */
65    .long   SYM(_uhoh) /* 41 TRAP #9 */
66    .long   SYM(_uhoh) /* 42 TRAP #10 */
67    .long   SYM(_uhoh) /* 43 TRAP #11 */
68    .long   SYM(_uhoh) /* 44 TRAP #12 */
69    .long   SYM(_uhoh) /* 45 TRAP #13 */
70    .long   SYM(_uhoh) /* 46 TRAP #14 */
71    .long   SYM(_uhoh) /* 47 TRAP #15 */
72    .long   SYM(_uhoh) /* 48 Reserved */
73    .long   SYM(_uhoh) /* 49 Reserved */
74    .long   SYM(_uhoh) /* 50 Reserved */
75    .long   SYM(_uhoh) /* 51 Reserved */
76    .long   SYM(_uhoh) /* 52 Reserved */
77    .long   SYM(_uhoh) /* 53 Reserved */
78    .long   SYM(_uhoh) /* 54 Reserved */
79    .long   SYM(_uhoh) /* 55 Reserved */
80    .long   SYM(_uhoh) /* 56 Reserved */
81    .long   SYM(_uhoh) /* 57 Reserved */
82    .long   SYM(_uhoh) /* 58 Reserved */
83    .long   SYM(_uhoh) /* 59 Reserved */
84    .long   SYM(_uhoh) /* 60 Reserved */
85    .long   SYM(_uhoh) /* 61 Reserved */
86    .long   SYM(_uhoh) /* 62 Reserved */
87    .long   SYM(_uhoh) /* 63 Reserved */
88
89    /* INTC0 */
90
91    .long   SYM(_uhoh) /* 64*/
92    .long   SYM(_uhoh) /* 65*/
93    .long   SYM(_uhoh) /* 66*/
94    .long   SYM(_uhoh) /* 67*/
95    .long   SYM(_uhoh) /* 68*/
96    .long   SYM(_uhoh) /* 69*/
97    .long   SYM(_uhoh) /* 70*/
98    .long   SYM(_uhoh) /* 71*/
99    .long   SYM(_uhoh) /* 72*/
100    .long   SYM(_uhoh) /* 73*/
101    .long   SYM(_uhoh) /* 74*/
102    .long   SYM(_uhoh) /* 75*/
103    .long   SYM(_uhoh) /* 76*/
104    .long   SYM(_uhoh) /* 77*/
105    .long   SYM(_uhoh) /* 78*/
106    .long   SYM(_uhoh) /* 79*/
107    .long   SYM(_uhoh) /* 80*/
108    .long   SYM(_uhoh) /* 81*/
109    .long   SYM(_uhoh) /* 82*/
110    .long   SYM(_uhoh) /* 83*/
111    .long   SYM(_uhoh) /* 84*/
112    .long   SYM(_uhoh) /* 85*/
113    .long   SYM(_uhoh) /* 86*/
114    .long   SYM(_uhoh) /* 87*/
115    .long   SYM(_uhoh) /* 88*/
116    .long   SYM(_uhoh) /* 89*/
117    .long   SYM(_uhoh) /* 90*/
118    .long   SYM(_uhoh) /* 91*/
119    .long   SYM(_uhoh) /* 92*/
120    .long   SYM(_uhoh) /* 93*/
121    .long   SYM(_uhoh) /* 94*/
122    .long   SYM(_uhoh) /* 95*/
123    .long   SYM(_uhoh) /* 96*/
124    .long   SYM(_uhoh) /* 97*/
125    .long   SYM(_uhoh) /* 98*/
126    .long   SYM(_uhoh) /* 99*/
127    .long   SYM(_uhoh) /* 100*/
128    .long   SYM(_uhoh) /* 101*/
129    .long   SYM(_uhoh) /* 102*/
130    .long   SYM(_uhoh) /* 103*/
131    .long   SYM(_uhoh) /* 104*/
132    .long   SYM(_uhoh) /* 105*/
133    .long   SYM(_uhoh) /* 106*/
134    .long   SYM(_uhoh) /* 107*/
135    .long   SYM(_uhoh) /* 108*/
136    .long   SYM(_uhoh) /* 109*/
137    .long   SYM(_uhoh) /* 110*/
138    .long   SYM(_uhoh) /* 111*/
139    .long   SYM(_uhoh) /* 112*/
140    .long   SYM(_uhoh) /* 113*/
141    .long   SYM(_uhoh) /* 114*/
142    .long   SYM(_uhoh) /* 115*/
143    .long   SYM(_uhoh) /* 116*/
144    .long   SYM(_uhoh) /* 117*/
145    .long   SYM(_uhoh) /* 118*/
146    .long   SYM(_uhoh) /* 119*/
147    .long   SYM(_uhoh) /* 120*/
148    .long   SYM(_uhoh) /* 121*/
149    .long   SYM(_uhoh) /* 122*/
150    .long   SYM(_uhoh) /* 123*/
151    .long   SYM(_uhoh) /* 124*/
152    .long   SYM(_uhoh) /* 125*/
153    .long   SYM(_uhoh) /* 126*/
154    .long   SYM(_uhoh) /* 127*/
155
156    /* INTC1 */
157
158    .long   SYM(_uhoh) /* 128*/
159    .long   SYM(_uhoh) /* 129*/
160    .long   SYM(_uhoh) /* 130*/
161    .long   SYM(_uhoh) /* 131*/
162    .long   SYM(_uhoh) /* 132*/
163    .long   SYM(_uhoh) /* 133*/
164    .long   SYM(_uhoh) /* 134*/
165    .long   SYM(_uhoh) /* 135*/
166    .long   SYM(_uhoh) /* 136*/
167    .long   SYM(_uhoh) /* 137*/
168    .long   SYM(_uhoh) /* 138*/
169    .long   SYM(_uhoh) /* 139*/
170    .long   SYM(_uhoh) /* 140*/
171    .long   SYM(_uhoh) /* 141*/
172    .long   SYM(_uhoh) /* 142*/
173    .long   SYM(_uhoh) /* 143*/
174    .long   SYM(_uhoh) /* 144*/
175    .long   SYM(_uhoh) /* 145*/
176    .long   SYM(_uhoh) /* 146*/
177    .long   SYM(_uhoh) /* 147*/
178    .long   SYM(_uhoh) /* 148*/
179    .long   SYM(_uhoh) /* 149*/
180    .long   SYM(_uhoh) /* 150*/
181    .long   SYM(_uhoh) /* 151*/
182    .long   SYM(_uhoh) /* 152*/
183    .long   SYM(_uhoh) /* 153*/
184    .long   SYM(_uhoh) /* 154*/
185    .long   SYM(_uhoh) /* 155*/
186    .long   SYM(_uhoh) /* 156*/
187    .long   SYM(_uhoh) /* 157*/
188    .long   SYM(_uhoh) /* 158*/
189    .long   SYM(_uhoh) /* 159*/
190    .long   SYM(_uhoh) /* 160*/
191    .long   SYM(_uhoh) /* 161*/
192    .long   SYM(_uhoh) /* 162*/
193    .long   SYM(_uhoh) /* 163*/
194    .long   SYM(_uhoh) /* 164*/
195    .long   SYM(_uhoh) /* 165*/
196    .long   SYM(_uhoh) /* 166*/
197    .long   SYM(_uhoh) /* 167*/
198    .long   SYM(_uhoh) /* 168*/
199    .long   SYM(_uhoh) /* 169*/
200    .long   SYM(_uhoh) /* 170*/
201    .long   SYM(_uhoh) /* 171*/
202    .long   SYM(_uhoh) /* 172*/
203    .long   SYM(_uhoh) /* 173*/
204    .long   SYM(_uhoh) /* 174*/
205    .long   SYM(_uhoh) /* 175*/
206    .long   SYM(_uhoh) /* 176*/
207    .long   SYM(_uhoh) /* 177*/
208    .long   SYM(_uhoh) /* 178*/
209    .long   SYM(_uhoh) /* 179*/
210    .long   SYM(_uhoh) /* 180*/
211    .long   SYM(_uhoh) /* 181*/
212    .long   SYM(_uhoh) /* 182*/
213    .long   SYM(_uhoh) /* 183*/
214    .long   SYM(_uhoh) /* 184*/
215    .long   SYM(_uhoh) /* 185*/
216    .long   SYM(_uhoh) /* 186*/
217    .long   SYM(_uhoh) /* 187*/
218    .long   SYM(_uhoh) /* 188*/
219    .long   SYM(_uhoh) /* 189*/
220    .long   SYM(_uhoh) /* 190*/
221    .long   SYM(_uhoh) /* 191*/
222    .long   SYM(_uhoh) /* 192*/
223
224    /* */
225
226    .long   SYM(_uhoh) /* 193*/
227    .long   SYM(_uhoh) /* 194*/
228    .long   SYM(_uhoh) /* 195*/
229    .long   SYM(_uhoh) /* 196*/
230    .long   SYM(_uhoh) /* 197*/
231    .long   SYM(_uhoh) /* 198*/
232    .long   SYM(_uhoh) /* 199*/
233    .long   SYM(_uhoh) /* 200*/
234    .long   SYM(_uhoh) /* 201*/
235    .long   SYM(_uhoh) /* 202*/
236    .long   SYM(_uhoh) /* 203*/
237    .long   SYM(_uhoh) /* 204*/
238    .long   SYM(_uhoh) /* 205*/
239    .long   SYM(_uhoh) /* 206*/
240    .long   SYM(_uhoh) /* 207*/
241    .long   SYM(_uhoh) /* 208*/
242    .long   SYM(_uhoh) /* 209*/
243    .long   SYM(_uhoh) /* 210*/
244    .long   SYM(_uhoh) /* 211*/
245    .long   SYM(_uhoh) /* 212*/
246    .long   SYM(_uhoh) /* 213*/
247    .long   SYM(_uhoh) /* 214*/
248    .long   SYM(_uhoh) /* 215*/
249    .long   SYM(_uhoh) /* 216*/
250    .long   SYM(_uhoh) /* 217*/
251    .long   SYM(_uhoh) /* 218*/
252    .long   SYM(_uhoh) /* 219*/
253    .long   SYM(_uhoh) /* 220*/
254    .long   SYM(_uhoh) /* 221*/
255    .long   SYM(_uhoh) /* 222*/
256    .long   SYM(_uhoh) /* 223*/
257    .long   SYM(_uhoh) /* 224*/
258    .long   SYM(_uhoh) /* 225*/
259    .long   SYM(_uhoh) /* 226*/
260    .long   SYM(_uhoh) /* 227*/
261    .long   SYM(_uhoh) /* 228*/
262    .long   SYM(_uhoh) /* 229*/
263    .long   SYM(_uhoh) /* 230*/
264    .long   SYM(_uhoh) /* 231*/
265    .long   SYM(_uhoh) /* 232*/
266    .long   SYM(_uhoh) /* 233*/
267    .long   SYM(_uhoh) /* 234*/
268    .long   SYM(_uhoh) /* 235*/
269    .long   SYM(_uhoh) /* 236*/
270    .long   SYM(_uhoh) /* 237*/
271    .long   SYM(_uhoh) /* 238*/
272    .long   SYM(_uhoh) /* 239*/
273    .long   SYM(_uhoh) /* 240*/
274    .long   SYM(_uhoh) /* 241*/
275    .long   SYM(_uhoh) /* 242*/
276    .long   SYM(_uhoh) /* 243*/
277    .long   SYM(_uhoh) /* 244*/
278    .long   SYM(_uhoh) /* 245*/
279    .long   SYM(_uhoh) /* 246*/
280    .long   SYM(_uhoh) /* 247*/
281    .long   SYM(_uhoh) /* 248*/
282    .long   SYM(_uhoh) /* 249*/
283    .long   SYM(_uhoh) /* 250*/
284    .long   SYM(_uhoh) /* 251*/
285    .long   SYM(_uhoh) /* 252*/
286    .long   SYM(_uhoh) /* 253*/
287    .long   SYM(_uhoh) /* 254*/
288    .long   SYM(_uhoh) /* 255*/
289
290/*
291 * Default trap handler
292 * With an oscilloscope you can see AS* stop
293 */
294.align 4
295    PUBLIC (_uhoh)
296SYM(_uhoh):
297    nop                     | Leave spot for breakpoint
298    stop    #0x2700         | Stop with interrupts disabled
299    bra.w   SYM(_uhoh)      | Stuck forever
300
301/*
302 * Spurious Interrupt Handler
303 */
304.align 4
305    PUBLIC (_spuriousInterrupt)
306SYM(_spuriousInterrupt):
307    addql   #1, SYM(_M68kSpuriousInterruptCount)
308    rte
309
310/*
311 * Write VBR Register
312 */
313.align 4
314    PUBLIC (_wr_vbr)
315SYM(_wr_vbr):
316    move.l  4(sp), d0
317    movec   d0, vbr
318    nop
319    rts
320
321/*
322 * Board startup
323 * Disable watchdog, interrupts
324 * Enable sram
325 */
326.align 4
327    PUBLIC (start)
328SYM(start):
329
330    /* Mask off interupts */
331    move.w   #0x2700,sr
332
333    /* Save off reset values of D0 and D1 */
334    move.l  d0,d6
335    move.l  d1,d7
336
337    /* Initialize RAMBAR1: locate SRAM and validate it */
338    move.l  #_CoreSRamBase,d0
339    add.l   #0x221,d0
340    movec   d0,%rambar
341
342    /* Save off intial D0 and D1 to RAM */
343    move.l  d6, SYM(_d0_reset)
344    move.l  d7, SYM(_d1_reset)
345
346    /* Locate Stack Pointer */
347    move.l  #_Configuration_Interrupt_stack_area_end,sp
348
349    /*
350     * Remainder of the startup code is handled by C code
351     * This never returns
352     */
353    jmp SYM(Init5329)
354
355END_CODE
356
357
358BEGIN_DATA_DCL
359
360    .align 4
361
362PUBLIC (_M68kSpuriousInterruptCount)
363SYM (_M68kSpuriousInterruptCount):
364    .long   0
365
366PUBLIC (_d0_reset)
367SYM (_d0_reset):
368    .long   0
369
370PUBLIC (_d1_reset)
371SYM (_d1_reset):
372    .long   0
373
374END_DATA_DCL
375
376END
377
Note: See TracBrowser for help on using the repository browser.