summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/bfin/shared/start/start.S
blob: 56a37aa73c5c7a520f2aa409a056a22da30a2a51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71


#include <rtems/bfin/bfin.h>   
        .section .init
        .globl  __init
        .type   __init,@function
__init:
        .section .fini
        .globl  __fini
        .type   __fini,@function
__fini:


    .text
    .align  2

    .global __start
__start:

    /* Start by setting up a stack */
    sp.h = 0xFFB0;
    sp.l = 0x0F00;
    
    /* Maybe we should zero the memory in the .bss section.  */

    /* This changes to the supervisor mode */
    p0.l = START;
    p0.h = START;
    p1.l = LO(EVT15);
    p1.h = HI(EVT15);
    
    [P1] = P0;
    
    P0.h = HI(IMASK);
    P0.l = LO(IMASK);
    R0 = [P0];
    /* R1.l = EVT_IVG15 & 0xFFFF; */
    R1.l = 0x8000;
    
    R0 = R0 | R1;
    
    [P0] = R0;

    RAISE 15;
    
    PO.l = WAIT;
    P0.h = WAIT;

    RETI = P0;
    RTI;
    
    /* endless loop to wait */
    WAIT:   
    jump WAIT;
    
    START:
    [--SP] = RETI;
    p0.l = _boot_card;
    p0.h = _boot_card;

    call (p0);

    p0.l = _exit;
    p0.h = _exit; 
    P3 = P4; 
    jump    (p0)        /* Should not return.  */

.global _null_isr
_null_isr:
    rti;