source: rtems/bsps/powerpc/ss555/start/start.S @ 90232bc

5
Last change on this file since 90232bc was ff081aee, checked in by Sebastian Huber <sebastian.huber@…>, on 11/06/18 at 15:58:02

score: Rename interrupt stack symbols

Rename

  • _Configuration_Interrupt_stack_area_begin in _ISR_Stack_area_begin,
  • _Configuration_Interrupt_stack_area_end in _ISR_Stack_area_end, and
  • _Configuration_Interrupt_stack_size in _ISR_Stack_size.

Move definitions to <rtems/score/isr.h>. The new names are considerable
shorter and in the right namespace.

Update #3459.

  • Property mode set to 100644
File size: 9.4 KB
Line 
1/*
2 *  This file contains the entry veneer for RTEMS programs on the Intec
3 *  SS555 board.  It jumps to the BSP which is responsible for performing
4 *  all remaining initialization.
5 */
6
7/*
8 * This file is based on several others:
9 *
10 * (1) start360.s from the gen68360 BSP by
11 *     W. Eric Norum (eric@skatter.usask.ca)
12 *     with the following copyright and license:
13 *
14 *     COPYRIGHT (c) 1989-1998.
15 *     On-Line Applications Research Corporation (OAR).
16 *
17 *     The license and distribution terms for this file may in
18 *     the file LICENSE in this distribution or at
19 *     http://www.rtems.org/license/LICENSE.
20 *
21 * (2) start.s for the eth_comm port by
22 *     Jay Monkman (jmonkman@fracsa.com),
23 *     which itself is based on the
24 *
25 * (3) dlentry.s for the Papyrus BSP, written by:
26 *     Andrew Bray <andy@i-cubed.co.uk>
27 *     with the following copyright and license:
28 *
29 *     COPYRIGHT (c) 1995 by i-cubed ltd.
30 *
31 * (4) start860.S for the MBX821/MBX860, written by:
32 *     Darlene A. Stewart <darlene.stewart@iit.nrc.ca>
33 *     Copyright (c) 1999, National Research Council of Canada
34 *
35 *     To anyone who acknowledges that this file is provided "AS IS"
36 *     without any express or implied warranty:
37 *         permission to use, copy, modify, and distribute this file
38 *         for any purpose is hereby granted without fee, provided that
39 *         the above copyright notice and this notice appears in all
40 *         copies, and that the name of i-cubed limited not be used in
41 *         advertising or publicity pertaining to distribution of the
42 *         software without specific, written prior permission.
43 *         i-cubed limited makes no representations about the suitability
44 *         of this software for any purpose.
45 *
46 * (5) Modifications (for MBX8xx) of respective RTEMS files:
47 *     Copyright (c) 1999, National Research Council of Canada
48 *
49 * SS555 port sponsored by Defence Research and Development Canada - Suffield
50 * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
51 */
52
53#include <rtems/asm.h>
54#include <rtems/powerpc/registers.h>
55
56#include <bsp.h>
57
58/*
59 *  The initial stack is set to the top of the internal RAM.
60 *
61 *  All the entry veneer has to do is to clear the .bss section and copy the
62 *  initializers into the .data section.
63 */
64
65/*
66 *  GDB likes to have debugging information for the entry veneer.
67 *  Play compiler and provide some DWARF information.
68 *
69 *  CHANGE TO SUIT YOUR SETUP!
70 */
71
72        .section .entry,"ax",@progbits
73.L_text_b:
74.L_LC1:
75        .previous
76
77.section        .debug_sfnames
78.L_sfnames_b:
79        .byte "rtems/c/src/lib/libbsp/powerpc/ss555/startup/"
80        .byte 0
81.L_F0:
82        .byte "start.S"
83        .byte 0
84        .previous
85
86.section        .line
87.L_line_b:
88        .4byte  .L_line_e-.L_line_b
89        .4byte  .L_text_b
90.L_LE1:
91.L_line_last:
92        .4byte  0x0
93        .2byte  0xffff
94        .4byte  .L_text_e-.L_text_b
95.L_line_e:
96        .previous
97
98.section        .debug_srcinfo
99.L_srcinfo_b:
100        .4byte  .L_line_b
101        .4byte  .L_sfnames_b
102        .4byte  .L_text_b
103        .4byte  .L_text_e
104        .4byte  0xffffffff
105        .4byte  .L_LE1-.L_line_b
106        .4byte  .L_F0-.L_sfnames_b
107        .4byte  .L_line_last-.L_line_b
108        .4byte  0xffffffff
109        .previous
110
111.section        .debug_pubnames
112        .4byte  .L_debug_b
113        .4byte  .L_P0
114        .byte "start"
115        .byte 0
116        .4byte  0x0
117        .byte 0
118        .previous
119
120.section        .debug_aranges
121        .4byte  .L_debug_b
122        .4byte  .L_text_b
123        .4byte  .L_text_e-.L_text_b
124        .4byte  0
125        .4byte  0
126        .4byte  0
127        .4byte  0
128        .4byte  0
129        .4byte  0
130        .4byte  0x0
131        .4byte  0x0
132        .previous
133
134.section        .debug
135.L_debug_b:
136.L_D1:
137        .4byte  .L_D1_e-.L_D1
138        .2byte  0x11    /* TAG_compile_unit */
139        .2byte  0x12    /* AT_sibling */
140        .4byte  .L_D2
141        .2byte  0x38    /* AT_name */
142        .byte "start.S"
143        .byte 0
144        .2byte  0x258   /* AT_producer */
145        .byte "GAS 2.5.2"
146        .byte 0
147        .2byte  0x111   /* AT_low_pc */
148        .4byte  .L_text_b
149        .2byte  0x121   /* AT_high_pc */
150        .4byte  .L_text_e
151        .2byte  0x106   /* AT_stmt_list */
152        .4byte  .L_line_b
153        .2byte  0x1b8   /* AT_comp_dir */
154        .byte "rtems/c/src/lib/libbsp/powerpc/ss555/startup/"
155        .byte 0
156        .2byte  0x8006  /* AT_sf_names */
157        .4byte  .L_sfnames_b
158        .2byte  0x8016  /* AT_src_info */
159        .4byte  .L_srcinfo_b
160.L_D1_e:
161.L_P0:
162.L_D3:
163        .4byte  .L_D3_e-.L_D3
164        .2byte  0x6     /* TAG_global_subroutine */
165        .2byte  0x12    /* AT_sibling */
166        .4byte  .L_D4
167        .2byte  0x38    /* AT_name */
168        .byte "start"
169        .byte 0
170        .2byte  0x278   /* AT_prototyped */
171        .byte 0
172        .2byte  0x111   /* AT_low_pc */
173        .4byte  .L_text_b
174        .2byte  0x121   /* AT_high_pc */
175        .4byte  .L_text_e
176        .2byte  0x8041  /* AT_body_begin */
177        .4byte  .L_text_b
178        .2byte  0x8051  /* AT_body_end */
179        .4byte  .L_text_e
180.L_D3_e:
181
182.L_D4:
183        .4byte  .L_D4_e-.L_D4
184        .align 2
185.L_D4_e:
186.L_D2:
187        .previous
188
189/*
190 * Tell C's eabi-ctor's that we have an atexit function,
191 * and that it is to register __do_global_dtors.
192 */
193        EXTERN_PROC(atexit)
194        PUBLIC_VAR(__atexit)
195        .section ".sdata","aw"
196        .align  2
197SYM(__atexit):
198        EXT_PROC_REF(atexit)@fixup
199        .previous
200
201        .section ".fixup","aw"
202        .align  2
203        EXT_SYM_REF(__atexit)
204        .previous
205
206/* That should do it */
207
208/*
209 *  Put the entry point in its own section. That way, we can guarantee
210 *  to put it first in the .text section in the linker script.
211 */
212        .section .entry
213
214        PUBLIC_VAR (start)
215SYM(start):
216        bl      .startup        /* or bl .spin */
217base_addr:
218
219/*
220 * Parameters from linker
221 */
222stack_top:
223        .long   _ISR_Stack_area_end
224
225toc_pointer:
226        .long   __GOT_START__
227
228bss_length:
229        .long   bss.size
230bss_addr:
231        .long   bss.start
232
233data_length:
234        .long   data.size
235data_addr:
236        .long   data.start
237contents_addr:
238        .long   data.contents.start
239
240PUBLIC_VAR (text_addr)
241text_addr:
242        .long   text.start
243
244PUBLIC_VAR (text_length)
245text_length:
246        .long   text.size
247
248/*
249 * Spin, if necessary, to acquire control from debugger (CodeWarrior).
250 */
251spin:
252        .long   0x0001
253.spin:
254        lis     r3, spin@ha
255        lwz     r3, spin@l(r3)
256        cmpwi   r3, 0x1
257        beq     .spin
258
259/*
260 * Initialization code
261 */
262.startup:
263        /* Capture address of linker parameters. */
264        mflr    r3
265
266        /* Set initial stack pointer to end of internal RAM - 56. */
267        lwz     r1, stack_top-base_addr(r3)
268        addi    r1, r1, -56
269
270        /* Initialize essential registers. */
271        bl      initregs
272
273        /* Set TOC pointer */
274        lwz r2, toc_pointer-base_addr(r3)
275
276        /* Initialize the memory mapped MPC555 registers (done in C). */
277        EXTERN_PROC (_InitSS555)
278        bl      PROC (_InitSS555)
279
280        /* Clear the .bss section. */
281        bl      bssclr
282
283        /* Copy initializers into the .data section */
284        bl      datacopy
285
286        /* Enable floating point, since gcc sometimes uses the floating
287         * point registers for data moves, even if the C source code doesn't
288         * include floating point operations.
289         */
290        mfmsr   r0
291        ori     r0, r0, MSR_FP
292        mtmsr   r0
293
294        /* Start system. */
295        li      r3, 0                   /* command line */
296        EXTERN_PROC (boot_card)
297        bl       PROC (boot_card)       /* call the first C routine */
298
299        /* We should never return from boot_card, but in case we do ... */
300        /* The next instructions are dependent on your runtime environment. */
301
302stop_here:
303        b       stop_here
304
305/*
306 * datacopy - copy initializers into .data section
307 */
308datacopy:
309        lis     r3, base_addr@ha                /* point to linker data */
310        addi    r3, r3, base_addr@l
311
312        lwz     r4, contents_addr-base_addr(r3) /* .data contents in ROM */
313        lwz     r5, data_addr-base_addr(r3)     /* .data section in RAM */
314        lwz     r6, data_length-base_addr(r3)   /* length of .data */
315
316        rlwinm. r6, r6, 30, 0x3FFFFFFF          /* form length / 4 */
317        beqlr                                   /* no .data - return */
318
319        mtctr   r6                              /* set ctr reg */
320dc1:
321        lwz     r6, 0(r4)                       /* get word */
322        stw     r6, 0(r5)                       /* store word */
323        addi    r4, r4, 0x4                     /* next source */
324        addi    r5, r5, 0x4                     /* next target */
325        bdnz    dc1                             /* dec counter and loop */
326
327        blr                                     /* return */
328
329/*
330 * bssclr - zero out bss
331 */
332bssclr:
333        lis     r3, base_addr@ha                /* point to linker data */
334        addi    r3, r3, base_addr@l
335
336        lwz     r4, bss_addr-base_addr(r3)      /* Start of bss */
337        lwz     r5, bss_length-base_addr(r3)    /* Length of bss */
338
339        rlwinm. r5, r5, 30, 0x3FFFFFFF          /* form length/4 */
340        beqlr                                   /* no bss - return */
341
342        mtctr   r5                              /* set ctr reg */
343        li      r5, 0x0000                      /* r5 = 0 */
344clear_bss:
345        stw     r5, 0(r4)                       /* store r6 */
346        addi    r4, r4, 0x4                     /* update r4 */
347        bdnz    clear_bss                       /* dec counter and loop */
348
349        blr                                     /* return */
350
351/*
352 * initregs
353 *      Initialize the MSR and basic core PowerPC registers
354 *
355 * Register usage:
356 *      r0 - scratch
357 */
358initregs:
359        /*
360         * Set the processor for big-endian mode, exceptions vectored to
361         * 0x000n_nnnn, no execution tracing, machine check exceptions
362         * enabled, floating-point not available, supervisor priviledge
363         * level, external interrupts disabled, power management disabled
364         * (normal operation mode).
365         */
366        li      r0, 0x1000      /* MSR_ME */
367        mtmsr   r0              /* Context-synchronizing */
368        isync
369
370        /*
371         * Clear the exception handling registers.
372         */
373        li      r0, 0x0000
374        mtdar   r0
375        mtspr   sprg0, r0
376        mtspr   sprg1, r0
377        mtspr   sprg2, r0
378        mtspr   sprg3, r0
379        mtspr   srr0, r0
380        mtspr   srr1, r0
381
382        mr      r6, r0
383        mr      r7, r0
384        mr      r8, r0
385        mr      r9, r0
386        mr      r10, r0
387        mr      r11, r0
388        mr      r12, r0
389        mr      r13, r0
390        mr      r14, r0
391        mr      r15, r0
392        mr      r16, r0
393        mr      r17, r0
394        mr      r18, r0
395        mr      r19, r0
396        mr      r20, r0
397        mr      r21, r0
398        mr      r22, r0
399        mr      r23, r0
400        mr      r24, r0
401        mr      r25, r0
402        mr      r26, r0
403        mr      r27, r0
404        mr      r28, r0
405        mr      r29, r0
406        mr      r30, r0
407        mr      r31, r0
408
409        blr                     /* return */
410
411.L_text_e:
Note: See TracBrowser for help on using the repository browser.