|
Last change
on this file since 76 was
2,
checked in by phkim, 11 years ago
|
|
1.phkim
- revision copy newcon3sk r27
|
-
Property svn:executable set to
*
|
|
File size:
2.8 KB
|
| Line | |
|---|
| 1 | /************************************************************************* |
|---|
| 2 | ** Broadcom Corp. Confidential |
|---|
| 3 | ** Copyright 2010 Broadcom Corp. All Rights Reserved. |
|---|
| 4 | ** |
|---|
| 5 | ** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 6 | ** AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 7 | ** EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 8 | ** |
|---|
| 9 | ** File: bl.S |
|---|
| 10 | ** Description: low level board dependent startup code |
|---|
| 11 | ** Created: alex[ |
|---|
| 12 | ** |
|---|
| 13 | ** REVISION: |
|---|
| 14 | ** |
|---|
| 15 | ***************************************************************************/ |
|---|
| 16 | |
|---|
| 17 | #include "bmips3300.h" |
|---|
| 18 | #include "bchp_common.h" |
|---|
| 19 | #include "bchp_sun_top_ctrl.h" |
|---|
| 20 | #include "ramheader.h" |
|---|
| 21 | |
|---|
| 22 | #define BCHP_REG_BASE PHYS_TO_K1(BCHP_PHYSICAL_OFFSET) |
|---|
| 23 | #define INITIAL_SR ((CP0_STATUS_SR_MASK | CP0_STATUS_CU1_MASK | CP0_STATUS_BEV_MASK | CP0_STATUS_IE_MASK) & ~( CP0_STATUS_ERL_MASK | CP0_STATUS_EXL_MASK)) |
|---|
| 24 | BL_STACK_SIZE = 0x1000 |
|---|
| 25 | |
|---|
| 26 | .lcomm bl_stack, BL_STACK_SIZE |
|---|
| 27 | .text |
|---|
| 28 | .set noreorder |
|---|
| 29 | .extern _stage3_size |
|---|
| 30 | .globl __start_s3 |
|---|
| 31 | .ent __start_s3 |
|---|
| 32 | __start_s3: |
|---|
| 33 | b init_cpu |
|---|
| 34 | nop |
|---|
| 35 | nop |
|---|
| 36 | nop |
|---|
| 37 | /* size of stage3 */ |
|---|
| 38 | .word _stage3_size |
|---|
| 39 | /* flash map */ |
|---|
| 40 | .word FMAP_MAGIC |
|---|
| 41 | .word FMAP_APP0_OFFSET |
|---|
| 42 | .word FMAP_APP1_OFFSET |
|---|
| 43 | .word FMAP_DATA_OFFSET |
|---|
| 44 | .word FMAP_DATA_SIZE |
|---|
| 45 | |
|---|
| 46 | .org __start_s3+0x180 |
|---|
| 47 | rom_gen_ex: # general exception will loop here |
|---|
| 48 | b rom_gen_ex |
|---|
| 49 | nop |
|---|
| 50 | nop |
|---|
| 51 | nop |
|---|
| 52 | .org __start_s3+0x400 |
|---|
| 53 | .globl oem_key |
|---|
| 54 | oem_key: |
|---|
| 55 | /* oem key is placed here */ |
|---|
| 56 | .include "oem_example_key1.S" |
|---|
| 57 | init_cpu: |
|---|
| 58 | li t0, INITIAL_SR |
|---|
| 59 | mtc0 t0, CP0_STATUS |
|---|
| 60 | nop |
|---|
| 61 | nop |
|---|
| 62 | bal _writeasm |
|---|
| 63 | li a0, '1' |
|---|
| 64 | bal init_mips |
|---|
| 65 | nop |
|---|
| 66 | bal _writeasm |
|---|
| 67 | li a0, '2' |
|---|
| 68 | bal _writeasm |
|---|
| 69 | li a0, '3' |
|---|
| 70 | |
|---|
| 71 | la t0, start_cached |
|---|
| 72 | /* start execution from cached memory */ |
|---|
| 73 | jr t0 |
|---|
| 74 | nop |
|---|
| 75 | start_cached: |
|---|
| 76 | bal _writeasm |
|---|
| 77 | li a0, '4' |
|---|
| 78 | |
|---|
| 79 | /* copy data segment */ |
|---|
| 80 | la a0, _sdata |
|---|
| 81 | la a1, _fdata |
|---|
| 82 | la t2,_edata |
|---|
| 83 | subu a2,t2,a1 |
|---|
| 84 | |
|---|
| 85 | beqz a2, 2f |
|---|
| 86 | nop |
|---|
| 87 | 1: |
|---|
| 88 | lw t0, 0(a0) |
|---|
| 89 | sw t0, 0(a1) |
|---|
| 90 | sub a2, a2, 4 |
|---|
| 91 | addi a0, a0, 4 |
|---|
| 92 | addi a1, a1, 4 |
|---|
| 93 | bnez a2, 1b |
|---|
| 94 | nop |
|---|
| 95 | 2: |
|---|
| 96 | bal _writeasm |
|---|
| 97 | li a0, '5' |
|---|
| 98 | |
|---|
| 99 | /* clear bss segment */ |
|---|
| 100 | la a0,_fbss |
|---|
| 101 | la a1,_end |
|---|
| 102 | subu a1,a1,a0 |
|---|
| 103 | |
|---|
| 104 | beqz a1, 2f |
|---|
| 105 | nop |
|---|
| 106 | 1: |
|---|
| 107 | sw zero,0(a0) |
|---|
| 108 | sub a1, a1, 4 |
|---|
| 109 | addi a0, a0, 4 |
|---|
| 110 | bnez a1, 1b |
|---|
| 111 | nop |
|---|
| 112 | 2: |
|---|
| 113 | bal _writeasm |
|---|
| 114 | li a0, '6' |
|---|
| 115 | |
|---|
| 116 | /* load stack pointer*/ |
|---|
| 117 | la sp, bl_stack + BL_STACK_SIZE - 24 |
|---|
| 118 | /* jump in to cached segment */ |
|---|
| 119 | la t0, bootloader_main |
|---|
| 120 | jalr t0 |
|---|
| 121 | move a0, zero |
|---|
| 122 | loop: |
|---|
| 123 | b loop |
|---|
| 124 | nop |
|---|
| 125 | .end __start_s3 |
|---|
| 126 | |
|---|
| 127 | LEAF(aligned_copy) |
|---|
| 128 | |
|---|
| 129 | 1: |
|---|
| 130 | lw v0, 0(a0) |
|---|
| 131 | addiu a2, a2, -4 |
|---|
| 132 | sw v0, 0(a1) |
|---|
| 133 | addiu a0, a0, 4 |
|---|
| 134 | bnez a2, 1b |
|---|
| 135 | addiu a1, a1, 4 |
|---|
| 136 | |
|---|
| 137 | jr ra |
|---|
| 138 | nop |
|---|
| 139 | |
|---|
| 140 | END(aligned_copy) |
|---|
| 141 | |
|---|
| 142 | #include "uart.s" |
|---|
| 143 | #include "chip.s" |
|---|
| 144 | #undef RelAddrPrintChar |
|---|
| 145 | #undef RelAddrPrintHex32 |
|---|
| 146 | #include "common_routines.s" |
|---|
| 147 | #include "memc_0_client_prog.s" |
|---|
| 148 | #include "cache_lib.s" |
|---|
| 149 | #include "mips_libs.s" |
|---|
| 150 | #include "memc_0_access.s" |
|---|
Note: See
TracBrowser
for help on using the repository browser.