uboot

来源:互联网 发布:java开发图书管理系统 编辑:程序博客网 时间:2024/05/01 14:57

config.mk

    sinclude $(ARCH)_config.mk                                                  ;arm结构关系规则

    sinclude cpu/$(CPU)/config.mk                                              ;CPU特定规则

    sinclude cpu/$(CPU)/$(SOC)/config.mk                                ;SOC特定规则

    sinclude board/$(VENDOR)/$(BOARD)/config.mk              ;BOARD特定规则

    定义了编译器类型、编译器命令

$(ARCH)_config.mk

    PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__

mkconfig

    创建include/config.mk,创建include/config.h

include/config.mk

    定义ARCH=arm、CPU=s3c64xx、BOARD=smdk6410、VENDOR=samsung、SOC=s3c6410

include/config.h

    定义flash,ram等,包含预定义文件include/configs/smdk6410.h

include/configs/smdk6410.h

    预定义板级参数

    #define CONFIG_NAND

board/$(VENDOR)/$(BOARD)/u-boot.lds

    连接方式,定义__u_boot_cmd_start,__u_boot_cmd_end;__bss_start,_end

board/$(VENDOR)/$(BOARD)/config.mk

    定义TEXT_BASE=0xC7E00000

cpu/$(CPU)/config.mk

    PLATFORM_RELFLAGS += -fno-strict-aliasing  -fno-common -ffixed-r8 -msoft-float

    PLATFORM_CPPFLAGS += -march=armv5t

    PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))

cpu/$(CPU)/start.S

    #include <config.h>     #include <version.h>   #include <reg.h>

    _start:

    b reset

    reset:

    set the cpu to SVC32 mode

    cpu_init_crit:

    flush v4 I/D caches

    disable MMU stuff and caches

    Peri port setup

    bl lowlevel_init

    判断是否在RAM中执行(是:fater_copy)

    bl copy_from_nand

    after_copy:

    enable_mmu:

    copy_from_nand:

    bl copy_uboot_to_ram(c)

board/$(VENDOR)/$(BOARD)/lowlevel_init.S

    lowlevel_init:

    mov r12,lr

    disable watchdog,

    external interrupt pending clear,

    disable all interrupts(VIC0 and VIC1)

    set all interrupts as IRQ,

    pending interrupt clear

    init system clock,

    bl system_clock_init

    for UART

    bl uart_asm_init

    KKKK

    bl nand_asm_init

    bl mem_ctrl_asm_init

    if(sleep mode wake-up) wakeup_reset

    KKKK

    mov lr,r12

    mov pc,lr

cpu/$(CPU)/$(SOC)/config.mk

cpu/$(CPU)/$(SOC)/cpu_init.S

    mem_ctrl_asm_init: