【u-boot-2015.10源码分析】crt0.S

本文详细分析了u-boot-2015.10版本中crt0.S的源码,探讨了其在启动过程中的作用,涉及嵌入式系统的初始化和机器感知技术。
摘要由CSDN通过智能技术生成

机器感知

一个专注于SLAM、机器视觉、Linux 等相关技术文章分享的公众号
 

/*
 * start.S的分支
 *
 * _main 执行流:
 *
 * 1. 为board_init_f()设置运行环境.
 *
 * 2. 调用board_init_f(). 
 *
 * 3. 设置交互环境
 *
 * 4a.调用relocate_code(). 
 *
 * 4b.对于SPL而言,直接返回到crt0.S中去,因为SPL不存在重定位
 *
 * 5. 设置调用board_init_r()的执行环境.
 *
 * 6. 调用c_runtime_cpu_setup.
 *
 * 7. 分支到board_init_r().
 */

ENTRY(_main)

/*
 * 设置初始C运行环境并调用board_init_f(0).
 */

#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
	ldr	sp, =(CONFIG_SPL_STACK)
#else
	ldr	sp, =(CONFIG_SYS_INIT_SP_ADDR)
#endif
#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
	mov	r3, sp
	bic	r3, r3, #7
	mov	sp, r3
#else
	bic	sp, sp, #7	/* 为了兼容ABI而进行8字节对齐 */
#endif
	mov	r2, sp
	sub	sp, sp, #GD_SIZE	/* 在SP之上分配一个GD结构 */
#if defined(CONFIG_CPU_V7M)	/* v7M forbids using SP as BIC destination */
	mov	r3, sp
	bic	r3, r3, #7
	mov	sp, r3
#else
	bic	sp, sp, #7	/* 为了兼容ABI而进行8字节对齐 */
#endif
	mov	r9, sp		/* GD在SP之上 */
	mov	r1, sp
	mov	r0, #0
clr_gd:
	cmp	r1, r2			
#if defined(CONFIG_CPU_V7M)
	it
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值