u-boot 移植 --->3、S5PV210启动序列
通过三星官方的资料S5PV210_iROM_ApplicationNote_Preliminary_20091126.pdf,了解到S5PVS10这款芯片的复位过程启动序列。芯片在出厂时就在内部固化了一段程序internal ROM简称iROM,这段代码在芯片复位一后会自动运行,他主要负责初始化系统的时钟等具体如下:
1. Disable the Watch-Dog Timer \\关闭看门狗
2. Initialize the instruction cache \\关闭指定cache
3. Initialize the stack region (see “memory map” on chap 2.5) \\设置不同模式的栈指针
4. Initialize the heap region. (see “memory map” on chap 2.5) \\设置堆
5. Initialize the Block Device Copy Function. (see “Device Copy Function” on chap 2.7) \\初始化块设备拷贝的函数这些函数对用户开放
6. Initialize the PLL and Set system clock. (see “clock configuration” on chap 2.11) \\系统时钟配置
7. Copy the BL1 to the internal SRAM region (see “Device Copy Function” on chap 2.7) \\自动拷贝启动介质指定的地方指定长度的代码到IRAM中
8. Verify the checksum of BL1.
If checksum fails, iROM will try the second boot up. (SD/MMC channel 2)\\校验拷贝的代码,格式和拷贝过程校验,失败的话会尝试其他的启动方式
9. Check if it is secure-boot mode or not.
If the security key value is written in S5PV210, It’s secure-boot mode. \\检查是否是安全启动,进而进行更严格的验证。
If it is secure-boot mode, verify the integrity of BL1.
10. Jump to the start address of BL1 \\跳转到指定的地址0xD002_0010开始执行。此时就开始把执行权交给用户了。
三星原厂的资料中有一个流程图可更加详细形象的展示内嵌的IROM程序的操作详细。不用安全模式则只需要将可执行程序的头上按照其手册添加指定的hearer info 就可以了,这里借鉴网上的代码,参也可以考手册字节写,比较简单源码如下:
/* 在BL0阶段,Irom内固化的代码读取nandflash或SD卡前16K的内容,
* 并比对前16字节中的校验和是否正确,正确则继续,错误则停止。
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h> #define BUFSIZE (16*1024)
#define IMG_SIZE (16*1024)
#define SPL_HEADER_SIZE 16
#define SPL_HEADER "S5PC110 HEADER " int main (int argc, char *argv[])
{
FILE *fp;
char *Buf, *a;
int BufLen;
int nbytes, fileLen;
unsigned int checksum, count;
int i; // 1. 3个参数
if (argc != 3)
{
printf("Usage: mkbl1 <source file> <destination file>\n");
return -1;
} // 2. 分配16K的buffer
BufLen = BUFSIZE;
Buf = (char *)malloc(BufLen);
if (!Buf)
{
printf("Alloc buffer failed!\n");
return -1;
} memset(Buf, 0x00, BufLen); // 3. 读源bin到buffer
// 3.1 打开源bin
fp = fopen(argv[1], "rb");
if( fp == NULL)
{
printf("source file open error\n");
free(Buf);
return -1;
}
// 3.2 获取源bin长度
fseek(fp, 0L, SEEK_END);
fileLen = ftell(fp);
fseek(fp, 0L, SEEK_SET);
// 3.3 源bin长度不得超过16K-16byte
count = (fileLen < (IMG_SIZE - SPL_HEADER_SIZE))
? fileLen : (IMG_SIZE - SPL_HEADER_SIZE);
// 3.4 buffer[0~15]存放"S5PC110 HEADER "
memcpy(&Buf[0], SPL_HEADER, SPL_HEADER_SIZE);
// 3.5 读源bin到buffer[16]
nbytes = fread(Buf + SPL_HEADER_SIZE, 1, count, fp);
if ( nbytes != count )
{
printf("source file read error\n");
free(Buf);
fclose(fp);
return -1;
}
fclose(fp); // 4. 计算校验和
// 4.1 从第16byte开始统计buffer中共有几个1
a = Buf + SPL_HEADER_SIZE;
for(i = 0, checksum = 0; i < IMG_SIZE - SPL_HEADER_SIZE; i++)
checksum += (0x000000FF) & *a++;
// 4.2 将校验和保存在buffer[8~15]
a = Buf + 8;
*( (unsigned int *)a ) = checksum; // 5. 拷贝buffer中的内容到目的bin
// 5.1 打开目的bin
fp = fopen(argv[2], "wb");
if (fp == NULL)
{
printf("destination file open error\n");
free(Buf);
return -1;
}
// 5.2 将16k的buffer拷贝到目的bin中
a = Buf;
nbytes = fwrite( a, 1, BufLen, fp);
if ( nbytes != BufLen )
{
printf("destination file write error\n");
free(Buf);
fclose(fp);
return -1;
} free(Buf);
fclose(fp); return 0;
}
编译生成可执行文件 这里为imagemeker最后可以使用 ./imagemeker u-boot.bin outputfilename 提取U-boot的前16K代码生成BL1代码,进而烧写到SD卡中选择好SD启动后就可以运行了,BL1这一段代码的任务就是初始化DRAM然后将后续剩余的u-boot或其他代码拷贝到DRAM中去,因为内部IRAM 的空间太小。
第一启动方案是按外部OM脚的配置情况来决定启动方式的如果启动方式失败了(非安全模式,安全模式启动失败芯片将停止任何动作),则会执行第二启动方案其中包括UART和USB启动。第二启动方案会再次尝试OM选择的启动介质,如果还是失败则会执行默认的第二个启动介质引导启动这个过程成功后同上面的启动方式相同会执行BL1,否则将尝试UART启动,成功后也将执行BL1,否则尝试USB启动,行为同上面的UART启动,这里将额BL1指用户代码的前16K-16字节+16字节的header info。
u-boot 移植 --->3、S5PV210启动序列的更多相关文章
- 第一章之s5pv210启动顺序
我所使用的开发板是:友善之臂smart210,cpu为s5pv210.u-boot版本是:u-boot-2012-10 1,首先在u-boot中配置相对应的开发板的配置文件 #make s5p_gon ...
- Linux移植之内核启动过程start_kernel函数简析
在Linux移植之内核启动过程引导阶段分析中从arch/arm/kernel/head.S开始分析,最后分析到课start_kernel这个C函数,下面就简单分析下这个函数,因为涉及到Linux的内容 ...
- S5PV210 启动流程
S3C6410启动流程 首先,看一下S3C6410启动流程 ① iROM supports initial boot up : initialize system clock, D-TCM, devi ...
- Spring Boot 2 (七):Spring Boot 如何解决项目启动时初始化资源
Spring Boot 2 (七):Spring Boot 如何解决项目启动时初始化资源 在项目启动的时候需要做一些初始化的操作,比如初始化线程池,提前加载好加密证书等.今天就给大家介绍一个 Spri ...
- Intellij IDEA Spring Boot 项目Debug模式启动缓慢问题
问题 Intellij IDEA Spring Boot 项目Debug模式启动缓慢 环境 os: windows10 idea :2018.1 解决方法 去除所有断点就正常了,很诡异,原因未知.
- 【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8
spring boot整合elasticsearch, 启动报错: Caused by: java.lang.IllegalStateException: availableProcessors ], ...
- spring boot 在eclipse里启动正常,但打包后启动不起来
现象描述: spring boot 在eclipse里启动正常,但打包后启动不起来. 错误日志如下: D:\Project>java -jar MKKY_CMS.jar . ____ _ __ ...
- Spring Boot 项目几种启动方式
Spring Boot 项目几种启动方式 1. 使用 main 启动 jar xxxx.jar 2. 使用 mvn 启动 mvn spring-boot:run 3. 使用 Spring Boot c ...
- MPlayer在ARM上的移植(S5PV210开发板)
MPlayer 1.0已经把大部分解码库都自带了,如ffmpeg,但是自带的音频库在S5PV210下效果非常不好.换成使用libmad效果不错.因此MPlayer 在ARM-Linux的最简单的移植只 ...
随机推荐
- Linux定时任务crontab通俗易懂简单扼要地解析
1.安装crontab 在配置好yum源的情况下,直接执行如下命令即可: yum install crontab 2.查看当前环境上已经有的定时任务有哪些? 执行如下命令即可 crontab -l 如 ...
- linux通过ntpd同步服务器时间,
ntpd得rpm包下载地址:https://pkgs.org/download/ntp 比如我得服务器版本是centos7 x86的,那选择我点击的这一个: 下拉到最下面就有安装包下载了,我选择的是二 ...
- Connection reset by peer的常见原因及解决办法 RST 大文件上传
Connection reset by peer的常见原因及解决办法 Connection reset by peer的常见原因 - 简书 https://www.jianshu.com/p/263e ...
- 在不同情况下connect失败和ping不通的数据分析
- 【Python网络编程】epoll用法
epoll发展进程 此处添加一下select.poll历程及其优缺点 原理 使用步骤 Create an epoll object--创建1个epoll对象 Tell the epoll object ...
- Prometheus为你的SpringBoot应用保驾护航
前面我们介绍了Prometheus的作用和整体的架构,相信大家对Prometheus有了一定的了解. 具体可以查看这篇文章:https://mp.weixin.qq.com/s/QoAs0-AYy8k ...
- SpringBoot启动方式,Spring Boot 定义系统启动任务
SpringBoot启动方式,Spring Boot 定义系统启动任务 SpringBoot启动方式 1.1 方法一 1.2 方法二 1.2.1 start.sh 1.2.2 stop.sh 1.2. ...
- Linux 使用Vmware克隆,修改克隆机器内容
在Vmware中搭建好一台虚拟机,拍照快照,然后克隆其他集群进行练习,克隆后的机器都需要修改的内容有如下几点: 1:各机器之间,在网络上能够互相ping通 每台机器的IP地址必须是唯一的. 进入 ca ...
- Golang内建库学习笔记(2)-web服务器相关
package main import ( "net/http" "fmt" "strings" "log" ) fun ...
- java HashMap and HashMultimap 区别
http://stackoverflow.com/questions/19222029/what-is-difference-between-hashmap-and-hashmultimap The ...