裸机——210SD卡启动
1.通过阅读iROM_Application_note可以获取关于启动的全部信息
2.记录下代码
制作SD卡启动的代码,即添加校验和的
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define BL1SIZE        (16*1024)
#define HEADSIZE    (16)    
static void sys_err(char *str)
{
    perror(str);
    exit();
}
int main(int argc, char **argv)
{
    ) {
        printf("format: a.out [infile] [outfile]\n");
        ;
    }
    int fd;
    ], O_RDONLY)) < )
        sys_err("open");
    ;
    , SEEK_END)) < )
        sys_err("lseek");
    , SEEK_SET)) < )
        sys_err("lseek 2");
    ;
    char *newfile = NULL;
    if (filesize < BL1SIZE) {
        newfilesize = BL1SIZE + HEADSIZE;
    } else {
        newfilesize = filesize + HEADSIZE;
    }
    if ((newfile = (char *)malloc(newfilesize)) == NULL)
        sys_err("malloc newfile");
    bzero(newfile, newfilesize);
    int ncount;
    )
        sys_err("read err");
    if (ncount != filesize) {
        printf("read err 2\n");
        exit();
    }
    ;
    char *getsum = newfile + HEADSIZE;
    unsigned , count = ;
    for (; count < BL1SIZE - HEADSIZE; count++) {
        sum += getsum[count] & 0xff;
    }
    *(unsigned int *)checksum = sum;
    int newfd;
    ], O_WRONLY | O_CREAT | O_TRUNC, )) < )
        sys_err("open outfile");
    )
        sys_err("write outfile");
    if (ncount != newfilesize) {
        printf("write outfile err\n");
        exit();
    }
    ;
}
使用 dd 命令,将SD卡启动代码拷贝到 SD 的 block1
#/bin/sh sudo dd iflag=dsync oflag=dsync
使用iROM中的库将SD卡中的代码考到DDR上
typedef unsigned int bool;
typedef bool (*pfunc_t) (int , unsigned int , unsigned short, unsigned int* , bool );
/**
* This Function copy MMC(MoviNAND/iNand) Card Data to memory.
* Always use EPLL source clock.
* This function works at 20Mhz.
* @param u32 StartBlkAddress : Source card(MoviNAND/iNand MMC)) Address.(It must block address.)
* @param u16 blockSize : Number of blocks to copy.
* @param u32* memoryPtr : Buffer to copy from.
* @param bool with_init : determined card initialization.
* @return bool(u8) - Success or failure.
*/
#define channel            2
#define StartBlkAddress    1
#define blockSize        50
#define memoryPtr        0x20000000
#define with_init        0
void sd_relcate()
{
    pfunc_t pfunc = (pfunc_t)(*(unsigned int *)0xD0037F98);
    if (!pfunc(channel, StartBlkAddress, blockSize, memoryPtr, with_init))
        printf("sd_relcate err\n");
    else
        printf("sd_relcate success\n");
}
在汇编中,使用长跳转,跳转到DDR上的main
    bl sdram_asm_init
    bl sd_relcate
    ldr sp, =0x2E000000  // 在DDR上重新设置栈
    ldr pc, =main
裸机——210SD卡启动的更多相关文章
- 不从SD卡启动树莓派2
		本文你可以学到: berryboot使用,kali安装,开挂的MobaXterm,以及关于通过LABEL和UUID挂载的小技巧. 本文默认你有一定Linux基础,同时针对刚入门的水平,因为这是我的折腾 ... 
- am335x sd卡启动开启识别emmc  kernel 上的改动
		sbc 7109-454 sd 卡启动qt系统后一直识别不了 emmc 也就是mmc1口, 一开始以为是硬件初始化的问题,后面又以为是io口复用,最后才知道是根本没有注册mmc1设备. 更改下面的代 ... 
- am335x sd卡启动系统参数设置
		首先直接记录结果 在u-boot 中修改参数 #define AUTO_UPDATESYS */ 直接把这个参数注释掉. 这个参数是原来用来升级nor flash 启动系统设置的一个参数,也就是说, ... 
- Samsung_tiny4412(驱动笔记01)----linux 3.5,U-Boot,Busybox,SD卡启动环境搭建
		/*********************************************************************************** * * linux 3.5,U ... 
- Exynos4412从SD卡启动的简单网络文件系统制作
		Exynos4412从SD卡启动的简单网络文件系统制作 1. 简介 嵌入式系统能够在开发板上正常运行,需要先进行系统配置,一个完整的嵌入式系统应该包含的几个部分::uboot,kernel,rootf ... 
- 制作SD卡启动自己编译的uboot.bin
		README for FriendlyARM Tiny4412 -----------------------------------------------------1. Build uboot ... 
- [i.MX6q]i.MX6q处理器,linux操作系统平台搭建 从SD卡启动系统
		转自:http://www.07net01.com/linux/2016/02/1232094.html 参照1:http://blog.csdn.net/girlkoo/article/detail ... 
- imx6 android SD卡启动
		工作中需要将imx6的android系统从SD卡启动,所以就分析了MfgTool中的脚本,分析android的分区情况,并尝试自己操作,竟然成功了,记录于此. 参考文档 http://www.kanc ... 
- ZYNQ的Linux Linaro系统镜像制作SD卡启动
		ZYNQ的Linux Linaro系统镜像制作SD卡启动 0. 概述 ZYNQ生成uboot的时候和正常的ARM设备不太一样,ZYNQ属于二次辅助启动uboot然后由uboot启动内核,大概意思就是 ... 
随机推荐
- HTML知识点梳理
- tween.js   插件
			1.是什么? jQueryTween是一款轻量级的jQuery补间动画工具库插件.使用jQueryTween可以制作出各种平滑的动画过渡效果.该插件基于tween.js,旨在简化各种补间动画操作,提供 ... 
- Java Knowledge series 2
			JVM Analysis & Design The object-oriented paradigm is a new and different way of thingking about ... 
- springboot利用mail配置包,实现邮件发送
			了解邮件发送与接收的过程: A->S1->S2->B 1.计算机A通过SMTP协议将邮件发送到服务器S1上: 2.服务器S1再发送到服务器S2: 3.计算机B通过POP3协议接收服务 ... 
- check_mk检测插件编写
			参考 Writing Checks (Introduction) Writing agent based checks The New Check API http://www2.steinkogle ... 
- day002-List类、泛型
			1. 集合 集合是容器,可以存储任意类型的数据,集合的长度可变. 1.1 集合和数组的比较 1.2 集合分类 单列集合:每次存储时,存储一个元素(Collection),包括:list.set 双列集 ... 
- April 9 2017 Week 15 Sunday
			In the evening one may praise the day. 入夜方能赞美白昼. I think that could be understand in different ways, ... 
- reactjs--父组件调用子组件的内部方法(转载)
			reactjs--父组件调用子组件的内部方法 发表于2016/10/11 9:21:37 965人阅读 1.引入相关js <script src="js/react.js" ... 
- 154. Find Minimum in Rotated Sorted Array II(Binary search)
			https://leetcode.com/problems/find-minimum-in-rotated-sorted-array-ii/description/ -- leetcode follo ... 
- 富文本 文字图片点击,(TextView)
			textview上的富文本支持 文字,图片的点击事件 - (void)protocolIsSelect:(BOOL)select { NSMutableAttributedString *attrib ... 
