i.MX233: information about SD/MMC boot from BCB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX233: information about SD/MMC boot from BCB

1,479 Views
PeterChan
NXP Employee
NXP Employee

For i.MX233, if the OTP bit HW_OCOTP_ROM0::SD_MBR_BOOT is blown, the device will boot from the Master Boot Record (MBR) on the card. If the HW_OCOTP_ROM0::SD_MBR_BOOT is NOT blown, it will boot from a Boot Control Clock (BCB) instead. By default, all i.MX233 EVK has this bit blown and the MBR is the default boot mode for SD/MMC.

It is because the description about BCB for SD/MMC in reference manual is not completely correct. If you need to boot from BCB, please follow the information here.

When boot from BCB, you need to have a BCB on the card. The BCB is a 512 byte data block which is written to the last physical sector of the card. The BCB tells the ROM the sector address of the boot image. The format of the BCB is:

typedef struct {

    uint32_t eDriveType;

    uint32_t Tag;

    uint32_t RegionSizeInSector;

} media_regions_t;

typedef struct {

    uint32_t Signature;

    uint32_t Version

    uint32_t NumRegions;

    media_regions_t Regions[];

} boot_control_block_t

ROM will first verify the Signature and Version of the BCB and then search all "NumRegions" for the firmware tag 0x00000050.

FieldValue
Signature0x00112233
Version0x00000001
Tag0x00000050

To elaborate in detail, here is a sample BCB.

00000000  33 22 11 00 01 00 00 00  02 00 00 00 00 00 00 00  |3"..............|

00000010  0a 00 00 00 24 00 00 00  01 00 00 00 50 00 00 00  |....$.......P...|

00000020  00 20 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |. ..............|

00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

00000200

The Signature and Version of i.MX233 BCB must be 0x00112233 and 0x00000001 respectively. Otherwise error code 0x8020A007 will return.

In this BCB sample, NumRegions=2. So, we have 2 media regions.

The first media region always starts from physical sector 0.

In the first media region, eDriveType=0, Tag=0x0A and RegionSizeInSector=0x24. eDriveType is a reserved field which is not used in SD/MMC boot. Since the Tag here is not 0x50, ROM will skip this media region to the next. The jump here is 0x24=36 sectors. So, the second media region starts from physical sector 36.

In the second media region, eDriveType=1, Tag=0x50 and RegionSizeInSector=0x2000. Here 4MB had been reserved for this media region. ROM finds that the Tag is correct and it will read the .SB from physical sector 36. Boot signature and version of the .SB will be verified and error 0x80501003 will return if the verification fails.

As you can see, the location of the BCB varies according to the card capacity and . Compared to MBR, there is no programming tool for BCB and firmware and dd command is used to program them. Firmware space must be reserved and BCB must be prepared manually and thus it is less attractive to use.

Tags (2)
0 Kudos
2 Replies

603 Views
YixingKong
Senior Contributor IV

Which space is your this document located?

0 Kudos

603 Views
PeterChan
NXP Employee
NXP Employee

It should be posted to i.MX Community and  I have moved it. Thanks!

0 Kudos