没有合适的资源?快使用搜索试试~ 我知道了~
首页uboot代码详细分析(88页)
uboot代码详细分析(88页)

linux启动代码详细解释u-boot-1.1.6 之cpu/arm920t/start.s 分析 ........................................................................................... 2 u-boot 中.lds 连接脚本文件的分析 ...................................................................................................12 分享一篇我总结的uboot 学习笔记(转) .....................................................................................15 U-BOOT 内存布局及启动过程浅析 ...................................................................................................22 u-boot 中的命令实现 .......................................................................................................................... 25 U-BOOT 环境变量实现 .............................
资源详情
资源评论
资源推荐

目录
u-boot-1.1.6 之 cpu/arm920t/start.s 分析 ........................................................................................... 2
u-boot 中.lds 连接脚本文件的分析 ...................................................................................................12
分享一篇我总结的 uboot 学习笔记(转) .....................................................................................15
U-BOOT 内存布局及启动过程浅析 ...................................................................................................22
u-boot 中的命令实现 .......................................................................................................................... 25
U-BOOT 环境变量实现 ........................................................................................................................28
1.相关文件 ....................................................................................................................................28
2.数据结构 ....................................................................................................................................28
3.ENV 的初始化...........................................................................................................................30
3.1env_init ............................................................................................................................30
3.2 env_relocate ...................................................................................................................30
3.3*env_relocate_spec ........................................................................................................31
4. ENV 的保存 ..............................................................................................................................31
U-Boot 环境变量 ..........................................................................................................................32
u-boot 代码链接的问题 ......................................................................................................................35
ldr 和 adr 在使用标号表达式作为操作数的区别 ............................................................................40
start_armboot 浅析 ..............................................................................................................................42
1.全局数据结构的初始化 ..........................................................................................................42
2.调用通用初始化函数...............................................................................................................43
3.初始化具体设备 .......................................................................................................................44
4.初始化环境变量 .......................................................................................................................44
5.进入主循环 ...............................................................................................................................44
u-boot 编译过程 ...................................................................................................................................44
mkconfig 文件的分析 .......................................................................................................................... 47
从 NAND 闪存中启动 U-BOOT 的设计 ..............................................................................................50
引言 ...............................................................................................................................................50
NAND 闪存工作原理 ................................................................................................................... 51
从 NAND 闪存启动 U-BOOT 的设计思路.................................................................................. 51
具体设计 ....................................................................................................................................... 51
支持 NAND 闪存的启动程序设计 ..................................................................................... 51
支持 U-BOOT 命令设计 ...................................................................................................... 52
结语 ............................................................................................................................................... 53
参考文献 ....................................................................................................................................... 53
U-boot 给 kernel 传参数和 kernel 读取参数—struct tag (以及补充) ............................................ 53
1 、u-boot 给 kernel 传 RAM 参数 ........................................................................................54
2 、Kernel 读取 U-boot 传递的相关参数 .............................................................................56
3 、关于 U-boot 中的 bd 和 gd...............................................................................................59
U-BOOT 源码分析及移植 ....................................................................................................................60
一、
u-boot
工程的总体结构:
..................................................................................................61
1、源代码组织 ....................................................................................................................61
2.makefile 简要分析 ............................................................................................................61

3、u-boot 的通用目录是怎么做到与平台无关的?......................................................63
4、smkd2410 其余重要的文件 : ...................................................................................63
二、u-boot 的流程、主要的数据结构、内存分配 ................................................................64
1、u-boot 的启动流程: ...................................................................................................64
2、u-boot 主要的数据结构 ...............................................................................................66
3、u-boot 重定位后的内存分布: ...................................................................................68
三、u-boot 的重要细节 。 ........................................................................................................68
关于 U-boot 中命令相关的编程 : ................................................................................. 73
四、U-boot 在 ST2410 的移植,基于 NOR FLASH 和 NAND FLASH 启动。......................... 76
1、从 smdk2410 到 ST2410: .............................................................................................. 76
2、移植过程: .................................................................................................................... 76
3、移植要考虑的问题: ...................................................................................................77
4、SST39VF1601: .................................................................................................................77
5、我实现的 flash.c 主要部分: ...................................................................................... 78
6、增加从 Nand 启动的代码 : ..................................................................................... 82
7、添加网络命令。 ............................................................................................................ 87
u-boot-1.1.6 之 cpu/arm920t/start.s 分析
/*
* armboot - Startup Code for ARM920 CPU-core
*
* Copyright (c) 2001 Marius Gr 鰃 er <mag@sysgo.de>
* Copyright (c) 2002 Alex Z 黳 ke <azu@sysgo.de>
* Copyright (c) 2002 Gary Jennejohn <gj@denx.de>
*
* 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
*/
#include <config.h>
#include <version.h>
/*
*************************************************************
************
*
* Jump vector table as in table 3.1 in [1]
*
*************************************************************
************
*/
//global 声明一个符号可被其他文档引用,相当于声明了一个全局变量,.globl 和.global 相同。
//该部分为处理器的异常处理向量表。地址范围为 0x0000 0000 ~ 0x0000 0020,刚好 8条指令。
.globl _start //u-boot 启动入口
_start: b reset //复位向量并且跳转到 reset
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
ldr pc, _prefetch_abort
ldr pc, _data_abort
ldr pc, _not_used
ldr pc, _irq //中断向量
ldr pc, _fiq //中断向量
// .word 伪操作用于分配一段字内存单元(分配的单元都是字对齐的),并用伪操作中的 expr 初始
化。.long 和.int 作用与之相同。
_undefined_instruction: .word undefined_instruction
_software_interrupt: .word software_interrupt
_prefetch_abort: .word prefetch_abort
_data_abort: .word data_abort
_not_used: .word not_used
_irq: .word irq
_fiq: .word fiq
// .align 伪操作用于表示对齐方式:通过添加填充字节使当前位置满足一定的对齐方式。.balign 的作用
同.align。
// .align {alignment} {,fill} {,max}
// 其中:alignment 用于指定对齐方式,可能的取值为 2 的次幂,缺省为 4。fill 是填充内容,缺省用 0
填充。max 是填充字节数最大值,假如填充字节数超过 max,
// 就不进行对齐,例如:

// .align 4 /* 指定对齐方式为字对齐 */
.balignl 16,0xdeadbeef
/*
*************************************************************
************
*
* Startup Code (reset vector)
*
* do important init only if we don't start from memory!
* relocate armboot to ram
* setup stack
* jump to second stage
*
*************************************************************
************
*/
// TEXT_BASE 在研发板相关的目录中的 config.mk 文档中定义, 他定义了
// 代码在运行时所在的地址, 那么_TEXT_BASE 中保存了这个地址
_TEXT_BASE:
.word TEXT_BASE
// 声明 _armboot_start 并用 _start 来进行初始化,在 board/u-boot.lds 中定义。
.globl _armboot_start
_armboot_start:
.word _start
/*
* These are defined in the board-specific linker script.
*/
// 声明_bss_start 并用__bss_start 来初始化,其中__bss_start 定义在和板相关的 u-boot.lds 中。
// _bss_start 保存的是__bss_start 这个标号所在的地址, 这里涉及到当前代码所在
// 的地址不是编译时的地址的情况, 这里直接取得该标号对应的地址, 不受编译时
// 地址的影响. _bss_end 也是同样的道理.
.globl _bss_start
_bss_start:
.word __bss_start
// 同上
.globl _bss_end
_bss_end:
.word _end
#ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */
.globl IRQ_STACK_START

IRQ_STACK_START:
.word 0x0badc0de
/* IRQ stack memory (calculated at run-time) */
.globl FIQ_STACK_START
FIQ_STACK_START:
.word 0x0badc0de
#endif
/*
* the actual reset code
*/
// MRS {} Rd,CPSR|SPSR 将 CPSR|SPSR 传送到 Rd
// 使用这两条指令将状态寄存器传送到一般寄存器,只修改必要的位,再将结果传送回状态寄存器,这
样能够最好地完成对 CRSP 或 SPSR 的修改
// MSR {} CPSR_|SPSR_,Rm 或是 MSR {} CPSR_f|SPSR_f,#
// MRS 和 MSR 配合使用,作为更新 PSR 的“读取--修改--写回”序列的一部分
// bic r0,r1,r2 ;r0:=r1 and not r2
// orr ro,r1,r2 ;r0:=r1 or r2
// 这几条指令执行完毕后,进入 SVC32 模式,该模式主要用来处理软件中断(SWI)
reset:
/*
* set the cpu to SVC32 mode
*/
mrs r0,cpsr //将 CPSR 状态寄存器读取,保存到 R0 中
bic r0,r0,#0x1f
orr r0,r0,#0xd3
msr cpsr,r0 //将 R0 写入状态寄存器中
/* turn off the watchdog */
//关闭看门狗
#if defined(CONFIG_S3C2400)
# define pWTCON 0x15300000
# define INTMSK 0x14400008 /* Interupt-Controller base addresses */
# define CLKDIVN 0x14800014 /* clock divisor register */
#elif defined(CONFIG_S3C2410)
# define pWTCON 0x53000000
# define INTMSK 0x4A000008 /* Interupt-Controller base addresses */
# define INTSUBMSK 0x4A00001C
# define CLKDIVN 0x4C000014 /* clock divisor register */
#endif
#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
ldr r0, =pWTCON
mov r1, #0x0
str r1, [r0]
/*
剩余87页未读,继续阅读












安全验证
文档复制为VIP权益,开通VIP直接复制

评论5