imx50芯片基于SD卡启动分析

启动概述:

Mx50的在上电复位的时候开始启动:执行on-chip boot ROMboot ROM根据配置的模式,及其OCOTP bits值和GPIO的设置,判断具体启动方式。

boot ROM的代码主要功能:

支持多种启动设备

USB下载支持DCDDevice Configuration Data)

数字签名基于HABHigh Assurance Boot)

Mx50 boot ROM支持一下设备启动:

Parallel NOR Flash

NAND Flash

ONFI 2.x BA-NAND

Toggle-Mode High speed NAND

OneNAND Flash

SD/eSD/MMC/eMMC

Serial ROM devices, including SPI NOR/EEPROM, I  C EEPROM

boot ROM由启动引(GPIO)和OCOTP bits位配置,根据启动模式,判断其具体作用。

boot ROM支持下载程序运行:

例如:为方便NAND启动,可以通过USB串行no-stream模式链接到外部的带有imageboot device,下载image到内部RAM中。

DCD Device Configuration Data):

允许ROM从外部boot device中的 program image 获得IC 配置数据(例如mx508 u-boot 把它放在image的开始,详情参看u-bootlds分析和image分析)。

一, 4种启动模式:

BOOT_MODE[1:0]        Boot Type 

00                       Internal Boot

01                       Reserved 

10                       Internal Boot—Fuses Only 

11                       USB Downloader

所有的启动模式都支持HABHigh Assurance Boot),

1Internal Boot (BOOT_MODE[1:0] = 00):

BT_FUSE_SEL = 1,  OCOTP  bit 配置启动参数

BT_FUSE_SEL = 0,  GPIO 值会覆盖OCOTP的值,配置启动参数(主要用于开发,freescale官方推荐用OCOTP配置)

2Internal Boot—Fuses Only (BOOT_MODE[1:0] = 10):

internal boot mode一样,唯一的区别是忽视掉GPIO,也就是说只是OCOTP配置起作用。

BT_BLANK=0,表示启动设备例如flashSD/MMC等不被使用,直接通过串口下载。

BT_BLANK=1,表示正常启动,从所选择的启动设备中ROM启动

3USB Downloader (BOOT_MODE[1:0] = 11) 

a)。USB Downloader 在以下几种情况会被激活;

   

* USB Downloader mode 

       * Internal boot—Fuses Only 且 OCOTP bit  BT_BLANK = 0 

* Internal Boot 或者 Internal Boot—Fuses Only模式中,启动设备中找不到image,或者image无效

     * 内部错误

     * 运行异常发生

    * HAB 中SEC_CONFIG = HAB_CLOSED,运行错误返回. 

          (在 SEC_CONFIG = HAB_OPENED 配置中,错误被忽略).        

b)。安全启动设置

SEC_CONFIG = HAB_CLOSED  

用于产品安全,所有的HAB功能生效

SEC_CONFIG = HAB_CLOSED  

与上面相反。

NOR Flash Boot Operation:

Booting from the NOR Flash is supported via WEIM interface. The ROM reads Image Vector Table and Boot Data structures to determine if the image can be executed directly from WEIM address space or should be copied to other memory. The start field of Boot Data Structure specifies the final location of the image.

OneNAND Flash boot option:

ROM中的onenand 驱动程序 通过发送软件命令,接受回应,得到页大小。

上电的时候,onenand 自动读取前1k的代码到ROOT RAM里面。

例如,boot ram包括onenand image向量表(也就是onenand启动的入口地址),boot rom拷贝前1k代码到boot ram

At system power-up, OneNAND automatically copies 1 Kbyte data from start of Flash array (sector 0 and sector 1, page 0, block 0) to its Boot RAM 。For example, the Boot RAM contains the OneNAND Image Vector Table. Boot ROM copies the 1 Kbyte OneNAND Boot RAM1 contents to the application destination pointer (located in the app_dest_ptr entry of application header) and decrements the length of the image to be read from OneNAND by 1k. Because the Boot RAM1 area is memory mapped, the copy operation is a simple memory copying operation. The length of image to be read from the OneNAND device is specified in Image Vector Table structure described in Figure 7-15. Failure loading data from OneNAND flash for any reason forces the processor Boot ROM to switch to serial download. Due to limited 1Kbyte size of OneNAND Boot RAM both IVT and DCD must fit in first 1Kbyte. This limits the max size of DCD for OneNAND device to 736 bytes as specified in Table 7-21. ROM reads rest of image and copies it to destination address during HAB authentication process. 

At system power-up, the voltage detector in the device detects the rising edge of Vcc and releases internal power-up reset signal which triggers bootcode loading. Bootcode loading means that the boot loader in the OneNAND copies the designated sized data (1Kbyte) from the beginning of memory to the BootRAM1. The Bootcode copy operation starts 400 μs later than POR activation and the 1Kbyte Bootcode copy takes 

70 μs (estimated) from sector0 and sector1/page0/block0 of NAND Flash array to the BootRAM. The INT bit of Interrupt status register goes from ‘Low’ to ‘High’ on the condition of ‘Bootcode-copy done’ and RP rising edge.

外部设备启动支持:

Mx508中的ROOT ROM 支持MMMC/eMMC and SD/eSD启动。

通过配置 BOOT_CFG3[5:4]和GPIO选择 eSDHC-1, eSDHC-2, eSDHC-3, or eSDHC-4

详细见imx50RM.pdfp209

启动代码支持以下格式:

 •   MMCv4.4 or less 

     •   eMMCv4.4 or less 

     •   SDv2.0 or less 

     •   eSDv2.10 rev-0.9, with or without FAST_BOOT.

当启动时,拷贝前2k的代码到内部ram中,然后检测boot image 中的Image Vector Table header value (0xD1) ,ROM code执行DCD检测,检测成功后提取出需要拷贝的image的目的指针和大小。

基于SD卡启动分析过程:

normal boot mode 初始化开始后,SDeSD频率被设置到357.143kHZ,然后鉴别MMC还是SD ,鉴别完成后,boot code 首先高电压检测,失败后,检测低电压。同时并检测容量,rom root code 支持大,小容量的SDeSD卡。电压设定后,初始化完成。

初始化期间还会检测分区,如果失败则按照普通SDeSD处理。初始化完毕后,boot

Code将频率提高到20Mnormal speed mode)或者40Mhight speed mode)。

ROM boot cade也支持eSD卡的FAST_BOOT mode,这种模式的可在BOOT_CFG1[4](fast boot)设置。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值