guowenxue
2020-08-21 d8f122f0c6475fe6317d95358e2dcc978a61b906
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
 
/********************************************************************************************
 *        File:  start.S - Startup Code for ARM920 CPU-core
 *     Version:  1.0.0
 *   Copyright:  2011 (c) Guo Wenxue <guowenxue@gmail.com>
 * Description:  When system power up, the CPU will comes here to excute the first code here.
 *   ChangeLog:  1, Release initial version on "Tue Jul 12 16:43:18 CST 2011"
 *
 *******************************************************************************************/
 
 
/*
 *************************************************************************
 *
 * Jump vector table as in table 3.1 in [1]
 *
 *************************************************************************
 */
 
.globl _start
_start:    b    start_code
 
_TEXT_BASE:
    .word   TEXT_BASE 
    
.globl _armboot_start
_armboot_start:
    .word _start
 
/*
 * These are defined in the board-specific linker script.
 */
.globl _bss_start
_bss_start:
    .word __bss_start
 
.globl _bss_end
_bss_end:
    .word _end
 
start_code:
    /* Set up the stack    */
stack_setup:
    ldr    r0, =TEXT_BASE        /* upper 128 KiB: relocated uboot   */
    sub    r0, r0, #CONFIG_SYS_MALLOC_LEN    /* malloc area              */
    sub    sp, r0, #12        /* leave 3 words for abort-stack    */
    bic    sp, sp, #7        /* 8-byte alignment for ABI compliance */
 
clear_bss:
    ldr    r0, _bss_start        /* find start of bss segment        */
    ldr    r1, _bss_end        /* stop here                        */
    mov    r2, #0x00000000        /* clear                            */
 
clbss_l:str    r2, [r0]        /* clear loop...                    */
    add    r0, r0, #4
    cmp    r0, r1
    ble    clbss_l
 
    bl  bootstrap_main