source: rtems/c/src/lib/libbsp/lm32/shared/start/start.S @ b11e05f

4.104.115
Last change on this file since b11e05f was b11e05f, checked in by Joel Sherrill <joel.sherrill@…>, on 05/27/09 at 15:36:09

2009-05-27 Michael Walle <michael@…>

  • shared/start/start.S: Export crt0 symbol because the debug.S uses that.
  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*  LM32 startup code
2 *
3 *  This is the entry point on reset and when loading the
4 *  executive from a bootloader.
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 *
12 *  Jukka Pietarinen <jukka.pietarinen@mrf.fi>, 2008,
13 *  Micro-Research Finland Oy
14 */
15
16#include "bspopts.h"
17
18     .section .boot,"a",@progbits
19     .align    4
20
21     .globl  start
22     .type   start,@function
23     .globl  _start
24     .type   _start,@function
25     .globl  __start
26     .type   __start,@function
27     .globl  LatticeDDInit
28     .type   LatticeDDInit,@function
29     .globl  crt0
30     .type   crt0,@function
31
32LatticeDDInit: 
33__start:       
34_start:
35start:
36        /* Clear r0 */
37        xor     r0,r0,r0
38        /* Disable interrupts */
39        wcsr    IE, r0
40        /* Mask all interrupts */
41        wcsr    IM,r0
42        /* Set exception base address */
43        mvhi    r1, hi(start)
44        ori     r1, r1, lo(start)
45        wcsr    EBA, r1
46        bi      crt0
47        nop
48/*
49 * Unused handlers call debug handlers
50 */
51breakpoint_handler:
52        rcsr    r7, DEBA
53        addi    r7, r7, 32
54        b       r7
55        nop
56        nop
57        nop
58        nop
59        nop
60instruction_bus_error_handler:
61        rcsr    r7, DEBA
62        addi    r7, r7, 64
63        b       r7
64        nop
65        nop
66        nop
67        nop
68        nop
69watchpoint_handler:
70        rcsr    r7, DEBA
71        addi    r7, r7, 96
72        b       r7
73        nop
74        nop
75        nop
76        nop
77        nop
78data_bus_error_handler:
79        rcsr    r7, DEBA
80        addi    r7, r7, 128
81        b       r7
82        nop
83        nop
84        nop
85        nop
86        nop
87divide_by_zero_handler:
88        rcsr    r7, DEBA
89        addi    r7, r7, 160
90        b       r7
91        nop
92        nop
93        nop
94        nop
95        nop
96interrupt_handler:
97        .extern _ISR_Handler
98        mvhi    r0, hi(_ISR_Handler)
99        ori     r0, r0, lo(_ISR_Handler)
100        b       r0
101        nop
102        nop
103        nop
104        nop
105        nop
106system_call_handler:
107        rcsr    r7, DEBA
108        addi    r7, r7, 224
109        b       r7
110        nop
111        nop
112        nop
113        nop
114        nop
115
116crt0:   
117        /* Flush data cache */
118        addi    r1, r0, 1
119        wcsr    DCC, r1
120        nop
121        nop
122        nop
123        nop
124        /* Flush Instruction Cache */
125        wcsr    ICC, r1
126        nop
127        nop
128        nop
129        nop
130        /* Initialize stack pointer */
131        mvhi    sp, hi(_fstack-4)
132        ori     sp, sp, lo(_fstack-4)
133        /* Initialize global pointer */
134        mvhi    gp, hi(_edata)
135        ori     gp, gp, lo(_edata)
136        /* Clear bss */
137        mvhi    r1, hi(_clear_start)
138        ori     r1, r1, lo(_clear_start)
139        mvhi    r3, hi(_clear_end)
140        ori     r3, r3, lo(_clear_end)
141.clear_bss:
142        be      r1, r3, .end_clear_bss
143        sw      (r1+0), r0
144        addi    r1, r1, 4
145        bi      .clear_bss
146.end_clear_bss:
147        mvi     r1, 0
148        mvhi    r7, hi(boot_card)
149        ori     r7, r7, lo(boot_card)
150        call    r7
151        # boot_card returns when RTEMS is shutdown
152#if ON_SIMULATOR
153        #define SYS_exit        1
154
155        mvi     r8, SYS_exit
156        scall   
157#endif
158
159.dead_end:
160        bi      .dead_end
161
Note: See TracBrowser for help on using the repository browser.