/*
* unicoreboot - Startup Code for UNICORE-II CPU-core
*
* Copyright (c) 2009 Tony Hook <suyonggang@pkunity.com>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*********************************************************************
* Author: chinawrj chinawrj@gmail.com, SEUIC
* TODO:fix dead_loop to display some information through the UART
* Add detect for booting from NORFLASH, Now we can boot from
* Nand and sdcard
*********************************************************************
*/
#include <config.h>
#include <version.h>
.globl _start \\.global =c语言中的extern ,就是告诉编译器我这里有个变量叫_start,其他地方定义过了_start=TEXT_BASE=0x33D00000
_start:\\这里可以看出来,_start是个标号,内容是b reset,就是说uboot一开始就要跳到reset处。
b reset
ldw pc, _extend_handle \\这里就是传说中的中断向量表了,发生中断就会跳到相应的某条处,为什么不直接装exterd_handle 到pc?汇编里面只能把第二个操作数里面的内容(第二个操作数是个地址)赋给第一个操作数,所以第二个操作数只能是存放真正地址的地址,用c来说就是 pc = *(& exterd_handle),不得不这么做,实际上&extend_handle == _extend_handle,懂了吧?
ldw pc, _swi_handle
ldw pc, _iabort_handle
ldw pc, _dabort_handle
ldw pc, _reserve_handle
ldw pc, _IRQ_handle
ldw pc, _FIQ_handle
_extend_handle: .word extend_handle
_swi_handle: .word swi_handle
_iabort_handle: .word iabort_handle
_dabort_handle: .word dabort_handle
_reserve_handle: .word reserve_handle
_IRQ_handle: .word IRQ_handle
_FIQ_handle: .word FIQ_handle
.balignl 16,0xdeadbeef
.global _TEXT_BASE//表明此位置分配了一个字存放text_base地址,下同,为嘛要在这声明?很简单,后面要用了呗,想想你extern的时候是不是想要调用其他文件的东西?
_TEXT_BASE:
.word CONFIG_SYS_TEXT_BASE @ load address
.globl _unicoreboot_start
_unicoreboot_start:
.word _start @ u-boot run address
.globl _bss_start
_bss_start:
.word __bss_start @ load end address
.globl _bss_end
_bss_end:
.word _end
.globl IRQ_STACK_START
IRQ_STACK_START:
.word 0x0badc0de
.globl FIQ_STACK_START
FIQ_STACK_START:
.word 0x0badc0de
/*
*************************************************************************
*
* Startup Code (called from the UNICORE reset exception vector)
*
* do important init only if we don't start from memory!
* relocate unicoreboot to ram
* setup stack
* jump to second stage
*
*************************************************************************
*/
/*
* the actual start code
*/
reset:
@Are we in the ESRAM?
@If not, skip copy uboot
mov r0, pc
mov.a r0, r0 >> #16
bne skip_uboot_copy
lowlevel_init:
@CLK
@=======================config PMU=========================