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

Subversion Repositories mips32r1

[/] [mips32r1/] [trunk/] [Software/] [demos/] [XD3_I2C/] [src/] [os/] [boot.asm] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ayersg
###############################################################################
2
# TITLE: Boot Up Code
3
# AUTHOR: Grant Ayers (ayers@cs.utah.edu)
4
# DATE: 19 July 2011
5
# FILENAME: boot.asm
6
# PROJECT: University of Utah XUM Single Core
7
# DESCRIPTION:
8
#   Initializes the global pointer and stack pointer.
9
#   Zeros BSS memory region and jumps to main().
10
#
11
###############################################################################
12
 
13
 
14
        .text
15
        .balign 4
16
        .global boot
17
        .ent    boot
18
        .set    noreorder
19
boot:
20
        la      $t0, _bss_start         # Defined in linker script
21
        la      $t1, _bss_end
22
        la      $sp, _sp
23
        la      $gp, _gp
24
 
25
$bss_clear:
26
        beq     $t0, $t1, $cp0_setup    # Loop until BSS is cleared
27
        nop
28
        sb      $0, 0($t0)
29
        j       $bss_clear
30
        addiu   $t0, $t0, 1
31
 
32
$cp0_setup:
33
        la      $26, $run               # Load the address of $run into
34
        mtc0    $26, $30, 0             #   the ErrorEPC
35
        mfc0    $26, $13, 0             # Load Cause register
36
        lui     $27, 0x0080             # Use "special" interrupt vector
37
        or      $26, $26, $27
38
        mtc0    $26, $13, 0             # Commit new Cause register
39
        mfc0    $26, $12, 0             # Load Status register
40
        lui     $27, 0x0fff             # Disable access to Coprocessors,
41
        ori     $27, $27, 0xffef        # Base operating mode is Kernel
42
        and     $26, $26, $27
43
        ori     $27, $0, 0xff01         # Enable all interrupts
44
        or      $26, $26, $27
45
        mtc0    $26, $12, 0             # Commit new Status register
46
 
47
        #lui    $26, 0x0000             # 1ms timer (50 MHz)
48
        #ori    $26, $26, 0xc350
49
        #lui    $26, 0x0007             # 10ms timer (50 MHz)
50
        #ori    $26, $26, 0xa120
51
        #lui    $26, 0x004c             # 100ms timer (50 MHz)
52
        #ori    $26, $26, 0x4b40
53
        lui     $26, 0x00be             # 250ms timer (50 MHz)
54
        ori     $26, 0xbc20
55
        #lui    $26, 0x017d             # 500ms timer (50 MHz)
56
        #ori    $26, 0x7840
57
        #lui    $26, 0x02fa             # 1 sec timer (50 MHz)
58
        #ori    $26, $26, 0xf080
59
        mtc0    $26, $11, 0             # Set Compare register to timer value
60
 
61
        eret                            # Return from Reset Exception
62
 
63
$run:
64
        jal     main
65
        nop
66
 
67
$done:
68
        j       $done
69
        nop
70
 
71
        .end boot
72
 

powered by: WebSVN 2.1.0

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