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

4.104.115
Last change on this file since 820d1ab0 was 820d1ab0, checked in by Chris Johns <chrisj@…>, on 04/28/09 at 06:34:00

2009-04-28 Chris Johns <chrisj@…>

  • start/start.S: Update for boot_card command line change.
  • Property mode set to 100644
File size: 4.7 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#warning Call to boot_card has changed and needs checking.
37#warning The call is "void boot_card(const char* cmdline);"
38#warning You need to pass a NULL.
39#warning Please check and remove these warnings.
40       
41/*
42 *  The initial stack is set to run BELOW the code base address.
43 *  (between the vectors and text sections)
44 *
45 *  The entry veneer has to clear the BSS and copy the read only
46 *  version of the data segment to the correct location.
47 */
48
49        .section ".entry"  /* This might have to be the first thing in the
50                            * text section. At one time, it had to be
51                            * first, but I don't believe it is true
52                            * any more. */
53        PUBLIC_VAR (start)
54SYM(start):
55        bl      .startup
56base_addr:
57
58/*
59 * Parameters from linker
60 */
61toc_pointer:
62        .long   s.got
63bss_length:
64        .long   bss.size
65bss_addr:
66        .long   bss.start
67
68PUBLIC_VAR (data_length )
69data_length:
70        .long   data.size
71PUBLIC_VAR (data_addr )
72data_addr:
73        .long   data.start
74
75PUBLIC_VAR (text_addr)
76text_addr:
77        .long   text.start
78
79PUBLIC_VAR (text_length)
80text_length:
81        .long   text.size
82
83/*
84 * Initialization code
85 */
86.startup:
87    /* Get start address */
88        mflr    r1
89
90    /* --------------------------------------------------
91     * Clear MSR[EE] to disable interrupts
92     * Clear MSR[IP] bit to put vectors at 0x00000000
93     * Set MSR[FP] to enable FPU - not on my eval board!
94     * -------------------------------------------------- */
95        mfmsr   r5
96        lis     r13, 0xFFFF
97        ori     r13, r13, 0x7FBF
98        and     r5, r5, r13                     /* Clear EE and IP */
99#if 1
100        ori     r5, r5, 0x2000                  /* Enable FPU */
101#endif
102        mtmsr   r5
103
104#ifdef ENABLE_CACHE
105        /* Enable caches */
106        mfspr   r5, 1008
107        ori     r5, r5, 0x8000
108        isync
109        mtspr   1008, r5
110
111/*      Leave D-cache disabled for now */
112#if 0
113        ori     r5, r5, 0x4000
114        sync
115        mtspr   1008, r5
116#endif
117#endif
118
119        /*--------------------------------------------------
120         * Set up the power management modes
121         * The 8260 has a dynamic power management mode that
122         * is automatically invoked if the unit is idle.
123         * We invoke the NAP mode in the RTEMS idle task.
124         *-------------------------------------------------- */
125
126        lis     r13, 0x0050     /* set nap mode and DPM */
127        or      r5, r5, r13
128        mtspr   1008, r5
129
130        /*--------------------------------------------------
131         *
132         *-------------------------------------------------- */
133
134        /* clear the bss section */
135        bl      bssclr
136
137/*
138 * C_setup.
139 */
140
141        /* set toc */
142        lwz r2, toc_pointer-base_addr(r1)
143
144        /* Set up stack pointer = beginning of text section - 56 */
145        addi    r1, r1, -56-4
146
147        /* Clear cmdline */
148        xor r3, r3, r3
149
150        .extern SYM (boot_card)
151        bl       SYM (boot_card)        /* call the first C routine */
152
153        /* we don't expect to return from boot_card but if we do */
154        /* wait here for watchdog to kick us into hard reset     */
155
156twiddle:
157        b               twiddle
158
159/*
160 * bssclr - zero out bss
161 */
162bssclr:
163        lwz     r4, bss_addr-base_addr(r1)      /* Start of bss */
164        lwz     r5, bss_length-base_addr(r1)    /* Length of bss */
165
166        rlwinm. r5,r5,30,0x3FFFFFFF             /* form length/4 */
167        beqlr                                   /* no bss */
168        mtctr   r5                              /* set ctr reg */
169        xor     r6,r6,r6                        /* r6 = 0 */
170clear_bss:
171        stswi   r6,r4,0x4                       /* store r6 */
172        addi    r4,r4,0x4                       /* update r2 */
173
174        bdnz    clear_bss                       /* dec counter and loop */
175        blr                                     /* return */
Note: See TracBrowser for help on using the repository browser.