嵌入式linux软件平台--SPL
介绍嵌入式linux软件平台相关内容,记录嵌入式linux软件平台搭建过程。
功能
SPL抽取u-boot的部分代码进行编译生成,SPL完成cpu的初始化,DDR初始化,spi接口及nor flash的初始化等内容,然后载入u-boot代码到DDR,跳转到u-boot执行.
在SPL模块实现对power,clock,ddr,uart0,spi nor flash的配置,并读取spi nor flash中的内容到ddr中,同时实现从uart启动后,通过xmodem下载spl到内存,启动后通过ymodem下载u-boot并启动,主要包括以下内容:
- 设置外部时钟频率
- 配置core, mpu电源
- 配置core, mpu频率
- 配置pin mux
- 根据DDR3的参数配置DDR
- 配置spi nor flash驱动
- 实现从spi nor flash载入u-boot并启动
- 实现从ymodem下载u-boot并启动
代码流程
SPL的执行流程:
reset: (start.S)
lowlevel_init(lowlevel_init.S)
s_init(board.c),配置引脚,UART0, DDR
_main: (crt0.S)
board_init_f(arch/arm/lib/spl.c)
board_init_r(common/spl.c)//申请内存,初始化主板,判断启动类型
spl_board_init(common/spl.c)//初始化gpmc,mpu,musb
spl_spi_load_image(spi_spl_load.c)
spi_flash_probe(spi_flash.c)//配置spi总线并检测flash
spi_flash_read//读取u-boot头结构
spl_parse_image_header//u-boot头结构校验处理
spi_flash_read//读取u-boot数据
jump_to_image_no_args//跳转到u-boot执行
s_init:
board_init_r:
- 配置watch dog timer
- 配置PLL
- 配置RTC
- 配置UART
- 输出版本信息
- 配置外部引脚
- 初始化DDR
- 初始化u-boot载入使用的DDR空间
- 获取当前使用的启动类型(根据片上ROM载入SPL代码的方式决定)
- 根据载入模式读取u-boot文件
- 跳转到u-boot入口
编译
编译生成SPL文件:make clean ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-make distclean ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_evm_spiboot_configmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
使用
下载SPL文件到spi nor flash:
通过UART的xmodem下载编译生成的u-boot-spl.bin文件
CPB启动后ROM进入UART启动模式,PC端通过xmodem发送u-boot-spl.bin文件
u-boot-spl.bin文件发送结束后会自动执行,进入ymodem接收模式,PC端可以通过ymodem发送u-boot.bin文件
posted on 2016-10-10 16:39 gp_scorpius 阅读(1795) 评论(1) 编辑 收藏 举报