OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [lwIP_Demo_Rowley_ARM7/] [boot.s] - Blame information for rev 603

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 583 jeremybenn
        /* Sample initialization file */
2
 
3
        .extern main
4
        .extern exit
5
        .extern AT91F_LowLevelInit
6
 
7
        .text
8
        .code 32
9
 
10
 
11
        .align  0
12
 
13
        .extern __stack_end__
14
        .extern __bss_beg__
15
        .extern __bss_end__
16
        .extern __data_beg__
17
        .extern __data_end__
18
        .extern __data+beg_src__
19
 
20
        .global start
21
        .global endless_loop
22
 
23
        /* Stack Sizes */
24
    .set  UND_STACK_SIZE, 0x00000004
25
    .set  ABT_STACK_SIZE, 0x00000004
26
    .set  FIQ_STACK_SIZE, 0x00000004
27
    .set  IRQ_STACK_SIZE, 0X00000400
28
    .set  SVC_STACK_SIZE, 0x00000400
29
 
30
        /* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
31
    .set  MODE_USR, 0x10            /* User Mode */
32
    .set  MODE_FIQ, 0x11            /* FIQ Mode */
33
    .set  MODE_IRQ, 0x12            /* IRQ Mode */
34
    .set  MODE_SVC, 0x13            /* Supervisor Mode */
35
    .set  MODE_ABT, 0x17            /* Abort Mode */
36
    .set  MODE_UND, 0x1B            /* Undefined Mode */
37
    .set  MODE_SYS, 0x1F            /* System Mode */
38
 
39
    .equ  I_BIT, 0x80               /* when I bit is set, IRQ is disabled */
40
    .equ  F_BIT, 0x40               /* when F bit is set, FIQ is disabled */
41
 
42
 
43
start:
44
_start:
45
_mainCRTStartup:
46
 
47
        /* Setup a stack for each mode - note that this only sets up a usable stack
48
        for system/user, SWI and IRQ modes.   Also each mode is setup with
49
        interrupts initially disabled. */
50
    ldr   r0, .LC6
51
    msr   CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode */
52
    mov   sp, r0
53
    sub   r0, r0, #UND_STACK_SIZE
54
    msr   CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
55
    mov   sp, r0
56
    sub   r0, r0, #ABT_STACK_SIZE
57
    msr   CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
58
    mov   sp, r0
59
    sub   r0, r0, #FIQ_STACK_SIZE
60
    msr   CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
61
    mov   sp, r0
62
    sub   r0, r0, #IRQ_STACK_SIZE
63
    msr   CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
64
    mov   sp, r0
65
    sub   r0, r0, #SVC_STACK_SIZE
66
    msr   CPSR_c, #MODE_SYS|I_BIT|F_BIT /* System Mode */
67
    mov   sp, r0
68
 
69
        /* We want to start in supervisor mode.  Operation will switch to system
70
        mode when the first task starts. */
71
        msr   CPSR_c, #MODE_SVC|I_BIT|F_BIT
72
 
73
    bl          AT91F_LowLevelInit
74
 
75
        /* Clear BSS. */
76
 
77
        mov     a2, #0                   /* Fill value */
78
        mov             fp, a2                  /* Null frame pointer */
79
        mov             r7, a2                  /* Null frame pointer for Thumb */
80
 
81
        ldr             r1, .LC1                /* Start of memory block */
82
        ldr             r3, .LC2                /* End of memory block */
83
        subs    r3, r3, r1      /* Length of block */
84
        beq             .end_clear_loop
85
        mov             r2, #0
86
 
87
.clear_loop:
88
        strb    r2, [r1], #1
89
        subs    r3, r3, #1
90
        bgt             .clear_loop
91
 
92
.end_clear_loop:
93
 
94
        /* Initialise data. */
95
 
96
        ldr             r1, .LC3                /* Start of memory block */
97
        ldr             r2, .LC4                /* End of memory block */
98
        ldr             r3, .LC5
99
        subs    r3, r3, r1              /* Length of block */
100
        beq             .end_set_loop
101
 
102
.set_loop:
103
        ldrb    r4, [r2], #1
104
        strb    r4, [r1], #1
105
        subs    r3, r3, #1
106
        bgt             .set_loop
107
 
108
.end_set_loop:
109
 
110
        mov             r0, #0          /* no arguments  */
111
        mov             r1, #0          /* no argv either */
112
 
113
    ldr lr, =main
114
        bx      lr
115
 
116
endless_loop:
117
        b               endless_loop
118
 
119
 
120
        .align 0
121
 
122
        .LC1:
123
        .word   __bss_beg__
124
        .LC2:
125
        .word   __bss_end__
126
        .LC3:
127
        .word   __data_beg__
128
        .LC4:
129
        .word   __data_beg_src__
130
        .LC5:
131
        .word   __data_end__
132
        .LC6:
133
        .word   __stack_end__
134
 
135
 
136
        /* Setup vector table.  Note that undf, pabt, dabt, fiq just execute
137
        a null loop. */
138
 
139
.section .startup,"ax"
140
         .code 32
141
         .align 0
142
 
143
        b     _start                                            /* reset - _start                       */
144
        ldr   pc, _undf                                         /* undefined - _undf            */
145
        ldr   pc, _swi                                          /* SWI - _swi                           */
146
        ldr   pc, _pabt                                         /* program abort - _pabt        */
147
        ldr   pc, _dabt                                         /* data abort - _dabt           */
148
        nop                                                                     /* reserved                                     */
149
        ldr   pc, [pc,#-0xF20]                          /* IRQ - read the AIC           */
150
        ldr   pc, _fiq                                          /* FIQ - _fiq                           */
151
 
152
_undf:  .word __undf                    /* undefined                            */
153
_swi:   .word swi_handler                               /* SWI                                          */
154
_pabt:  .word __pabt                    /* program abort                        */
155
_dabt:  .word __dabt                    /* data abort                           */
156
_fiq:   .word __fiq                     /* FIQ                                          */
157
 
158
__undf: b     .                         /* undefined                            */
159
__pabt: b     .                         /* program abort                        */
160
__dabt: b     .                         /* data abort                           */
161
__fiq:  b     .                         /* FIQ                                          */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.