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

4.104.115
Last change on this file since 8259452 was 8259452, checked in by Joel Sherrill <joel.sherrill@…>, on 05/05/09 at 21:22:49

2009-05-05 Joel Sherrill <joel.sherrill@…>

  • shared/start/start.S: Confirmed OK by mwalle.
  • Property mode set to 100644
File size: 2.3 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
30LatticeDDInit: 
31__start:       
32_start:
33start:
34        /* Clear r0 */
35        xor     r0,r0,r0
36        /* Disable interrupts */
37        wcsr    IE, r0
38        /* Mask all interrupts */
39        wcsr    IM,r0
40        /* Set exception base address */
41        mvhi    r1, hi(start)
42        ori     r1, r1, lo(start)
43        wcsr    EBA, r1
44        bi      crt0
45        nop
46/*
47 * Unused handlers call debug handlers
48 */
49breakpoint_handler:
50        rcsr    r7, DEBA
51        addi    r7, r7, 32
52        b       r7
53        nop
54        nop
55        nop
56        nop
57        nop
58instruction_bus_error_handler:
59        rcsr    r7, DEBA
60        addi    r7, r7, 64
61        b       r7
62        nop
63        nop
64        nop
65        nop
66        nop
67watchpoint_handler:
68        rcsr    r7, DEBA
69        addi    r7, r7, 96
70        b       r7
71        nop
72        nop
73        nop
74        nop
75        nop
76data_bus_error_handler:
77        rcsr    r7, DEBA
78        addi    r7, r7, 128
79        b       r7
80        nop
81        nop
82        nop
83        nop
84        nop
85divide_by_zero_handler:
86        rcsr    r7, DEBA
87        addi    r7, r7, 160
88        b       r7
89        nop
90        nop
91        nop
92        nop
93        nop
94interrupt_handler:
95        .extern _ISR_Handler
96        mvhi    r0, hi(_ISR_Handler)
97        ori     r0, r0, lo(_ISR_Handler)
98        b       r0
99        nop
100        nop
101        nop
102        nop
103        nop
104system_call_handler:
105        rcsr    r7, DEBA
106        addi    r7, r7, 224
107        b       r7
108        nop
109        nop
110        nop
111        nop
112        nop
113
114crt0:   
115        /* Flush data cache */
116        addi    r1, r0, 1
117        wcsr    DCC, r1
118        nop
119        nop
120        nop
121        nop
122        /* Flush Instruction Cache */
123        wcsr    ICC, r1
124        nop
125        nop
126        nop
127        nop
128        /* Initialize stack pointer */
129        mvhi    sp, hi(_fstack-4)
130        ori     sp, sp, lo(_fstack-4)
131        /* Initialize global pointer */
132        mvhi    gp, hi(_edata)
133        ori     gp, gp, lo(_edata)
134        /* Clear bss */
135        mvhi    r1, hi(_clear_start)
136        ori     r1, r1, lo(_clear_start)
137        mvhi    r3, hi(_clear_end)
138        ori     r3, r3, lo(_clear_end)
139.clear_bss:
140        be      r1, r3, .end_clear_bss
141        sw      (r1+0), r0
142        addi    r1, r1, 4
143        bi      .clear_bss
144.end_clear_bss:
145        mvi     r1, 0
146        mvhi    r7, hi(boot_card)
147        ori     r7, r7, lo(boot_card)
148        call    r7
149        # boot_card returns when RTEMS is shutdown
150#if ON_SIMULATOR
151        #define SYS_exit        1
152
153        mvi     r8, SYS_exit
154        scall   
155#endif
156
157.dead_end:
158        bi      .dead_end
159
Note: See TracBrowser for help on using the repository browser.