《朱老师物联网大讲堂》学习笔记
学习地址:www.zhulaoshi.org
_TEXT_PHY_BASE: .word CFG_PHY_UBOOT_BASE物理地址的基地址,追看其定义处,可知这个地址范围属于DDR,
是uboot在DDR中的物理地址,
.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 #if defined(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这里有好多start,应该是为重定位做准备,
/* * the actual reset code */ reset: /* * set the cpu to SVC32 mode and IRQ & FIQ disable */ @;mrs r0,cpsr @;bic r0,r0,#0x1f @;orr r0,r0,#0xd3 @;msr cpsr,r0 msr cpsr_c, #0xd3 @ I & F disable, Mode: 0x13 - SVC这里才是真正的复位,@之后的是被注释掉的,
最后句指令的意思是,禁止irq,fiq中断,ARM指令模式,SVC模式,
#ifndef CONFIG_EVT1这句指令的意思是,如果没有定义(在SI中点击,没有显示源头就是没有定义)后面那个符号,后面的指令就执行,而我们定义了,所以。。。
bl disable_l2cache禁止L2 cache,
bl set_l2cache_auxctrl_cycle
L2 cache相关的初始化,
bl enable_l2cache使能L2 cache,
/* * Invalidate L1 I/D */ mov r0, #0 @ set up for MCR mcr p15, 0, r0, c8, c7, 0 @ invalidate TLBs mcr p15, 0, r0, c7, c5, 0 @ invalidate icache刷新L1 cache的icache和dcache,
/* * disable MMU stuff and caches */ mrc p15, 0, r0, c1, c0, 0 bic r0, r0, #0x00002000 @ clear bits 13 (--V-) bic r0, r0, #0x00000007 @ clear bits 2:0 (-CAM) orr r0, r0, #0x00000002 @ set bit 1 (--A-) Align orr r0, r0, #0x00000800 @ set bit 12 (Z---) BTB把MMU关掉,
/* Read booting information */ ldr r0, =PRO_ID_BASE ldr r1, [r0,#OMR_OFFSET] bic r2, r1, #0xffffffc1OM引脚相关的选择,读取其中的值,判断是那种启动方式,
/* NAND BOOT */ cmp r2, #0x0 @ 512B 4-cycle moveq r3, #BOOT_NAND cmp r2, #0x2 @ 2KB 5-cycle moveq r3, #BOOT_NAND cmp r2, #0x4 @ 4KB 5-cycle 8-bit ECC moveq r3, #BOOT_NAND cmp r2, #0x6 @ 4KB 5-cycle 16-bit ECC moveq r3, #BOOT_NAND cmp r2, #0x8 @ OneNAND Mux moveq r3, #BOOT_ONENAND /* SD/MMC BOOT */ cmp r2, #0xc moveq r3, #BOOT_MMCSD /* NOR BOOT */ cmp r2, #0x14 moveq r3, #BOOT_NOR通过cmp判断启动方式,把值存进r3,后面会用,
ldr sp, =0xd0036000 /* end of sram dedicated to u-boot */ sub sp, sp, #12 /* set stack */ mov fp, #0设置SRAM中的栈,也算是为后面调用函数做准备工作,否则调用函数中的一些环境值保存怎么办?