source: rtems/c/src/lib/libbsp/powerpc/mpc8260ads/start/start.S @ f05b2ac

4.104.114.84.95
Last change on this file since f05b2ac was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/*  start.S
2 *
3 *  $Id$
4 *
5 *  Modified for the Motorola PQII ADS board by
6 *  Andy Dachs <a.dachs@sstl.co.uk> 23-11-00.
7 *  Surrey Satellite Technology Limited
8 *
9 *  I have a proprietary bootloader programmed into the flash
10 *  on the board which initialises the SDRAM prior to calling
11 *  this function.
12 *
13 *  This file is based on the one by Jay Monkman (jmonkman@fracsa.com)
14 *  which in turn was based on the dlentry.s file for the Papyrus BSP,
15 *  written by:
16 *
17 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
18 *
19 *  COPYRIGHT (c) 1995 by i-cubed ltd.
20 *
21 *  To anyone who acknowledges that this file is provided "AS IS"
22 *  without any express or implied warranty:
23 *      permission to use, copy, modify, and distribute this file
24 *      for any purpose is hereby granted without fee, provided that
25 *      the above copyright notice and this notice appears in all
26 *      copies, and that the name of i-cubed limited not be used in
27 *      advertising or publicity pertaining to distribution of the
28 *      software without specific, written prior permission.
29 *      i-cubed limited makes no representations about the suitability
30 *      of this software for any purpose.
31 *
32 */
33
34#include <rtems/asm.h>
35
36/*
37 *  The initial stack is set to run BELOW the code base address.
38 *  (between the vectors and text sections)
39 *
40 *  The entry veneer has to clear the BSS and copy the read only
41 *  version of the data segment to the correct location.
42 */
43
44        .section ".entry"  /* This might have to be the first thing in the
45                            * text section. At one time, it had to be
46                            * first, but I don't believe it is true
47                            * any more. */
48        PUBLIC_VAR (start)
49SYM(start):
50        bl      .startup
51base_addr:
52
53/*
54 * Parameters from linker
55 */
56toc_pointer:
57        .long   s.got
58bss_length:
59        .long   bss.size
60bss_addr:
61        .long   bss.start
62
63PUBLIC_VAR (data_length )
64data_length:
65        .long   data.size
66PUBLIC_VAR (data_addr )
67data_addr:
68        .long   data.start
69
70PUBLIC_VAR (text_addr)
71text_addr:
72        .long   text.start
73
74PUBLIC_VAR (text_length)
75text_length:
76        .long   text.size
77
78/*
79 * Initialization code
80 */
81.startup:
82    /* Get start address */
83        mflr    r1
84
85    /* --------------------------------------------------
86     * Clear MSR[EE] to disable interrupts
87     * Clear MSR[IP] bit to put vectors at 0x00000000
88     * Set MSR[FP] to enable FPU - not on my eval board!
89     * -------------------------------------------------- */
90        mfmsr   r5
91        lis     r13, 0xFFFF
92        ori     r13, r13, 0x7FBF
93        and     r5, r5, r13                     /* Clear EE and IP */
94#if 1
95        ori     r5, r5, 0x2000                  /* Enable FPU */
96#endif
97        mtmsr   r5
98
99#ifdef ENABLE_CACHE
100        /* Enable caches */
101        mfspr   r5, 1008
102        ori     r5, r5, 0x8000
103        isync
104        mtspr   1008, r5
105
106/*      Leave D-cache disabled for now */
107#if 0
108        ori     r5, r5, 0x4000
109        sync
110        mtspr   1008, r5
111#endif
112#endif
113
114        /*--------------------------------------------------
115         * Set up the power management modes
116         * The 8260 has a dynamic power management mode that
117         * is automatically invoked if the unit is idle.
118         * We invoke the NAP mode in the RTEMS idle task.
119         *-------------------------------------------------- */
120
121        lis     r13, 0x0050     /* set nap mode and DPM */
122        or      r5, r5, r13
123        mtspr   1008, r5
124
125        /*--------------------------------------------------
126         *
127         *-------------------------------------------------- */
128
129        /* clear the bss section */
130        bl      bssclr
131
132/*
133 * C_setup.
134 */
135
136        /* set toc */
137        lwz r2, toc_pointer-base_addr(r1)
138
139        /* Set up stack pointer = beginning of text section - 56 */
140        addi    r1, r1, -56-4
141
142        /* clear argc and argv */
143        xor     r3, r3, r3
144        xor     r4, r4, r4
145
146        .extern SYM (boot_card)
147        bl       SYM (boot_card)        /* call the first C routine */
148
149        /* we don't expect to return from boot_card but if we do */
150        /* wait here for watchdog to kick us into hard reset     */
151
152twiddle:
153        b               twiddle
154
155/*
156 * bssclr - zero out bss
157 */
158bssclr:
159        lwz     r4, bss_addr-base_addr(r1)      /* Start of bss */
160        lwz     r5, bss_length-base_addr(r1)    /* Length of bss */
161
162        rlwinm. r5,r5,30,0x3FFFFFFF             /* form length/4 */
163        beqlr                                   /* no bss */
164        mtctr   r5                              /* set ctr reg */
165        xor     r6,r6,r6                        /* r6 = 0 */
166clear_bss:
167        stswi   r6,r4,0x4                       /* store r6 */
168        addi    r4,r4,0x4                       /* update r2 */
169
170        bdnz    clear_bss                       /* dec counter and loop */
171        blr                                     /* return */
Note: See TracBrowser for help on using the repository browser.