Cyclone® V Hard Processor System Technical Reference Manual

ID 683126
Date 8/28/2023
Public
Document Table of Contents

A.4.4.1. SD/MMC Flash Devices

The following figure shows an SD/MMC flash image layout example for boot. The master boot record (MBR) is located in the first 512 bytes of the memory. The MBR contains information about the partitions (address and size of partition). The preloader image is stored in partition A2. Partition A2 is a custom raw partition with no file system.

Figure 147. SD/MMC Flash Image Layout

The SD/MMC controller supports two booting modes:

  • MBR (partition) mode
    • The boot image is read from a custom partition (0xA2)
    • The first image is located at the beginning of the partition, at offset 0x0
    • Start address = partition start address
  • Raw mode
    • If the MBR signature is not found, SD/MMC driver assumes it is in raw mode
    • The boot image data is read directly from sectors in the user area and is located at the first sector of the SD/MMC
    • The first image is located at the start of the memory card, at offset 0x0
    • Start address = 0x0

The MBR contains the partition table, which is always located in the first sector (LBA0) with a memory size of 512 bytes. The MBR consists of executable code, four partition entries, and the MBR signature. A MBR can be created by specific tools like the FDISK program.

Table 271.  MBR Structure

Offset

Size (In Bytes)

Description

0x000

446

Code area

0x1BE

16

Partition entry for partition 1

0x1CE

16

Partition entry for partition 2

0x1DE

16

Partition entry for partition 3

0x1EE

16

Partition entry for partition 4

0x1FE

2

MBR signature: 0xAA55

The standard MBR structure contains a partition with four 16-byte entries. Thus, memory cards using this standard table cannot have more than four primary partitions or up to three primary partitions and one extended partition.

Each partition type is defined by the partition entry. The boot images are stored in a primary partition with custom partition type (0xA2). The SD/MMC flash driver does not support a file system, so the boot images are located in partition A2 at fixed locations.

Table 272.  Partition Entry

Offset

Size (In Bytes)

Description

0x0

1

Boot indicator. 0x80 indicates that it is bootable.

0x1

3

Starting CHS value

0x4

1

Partition type

0x5

3

Ending CHS value

0x8

4

LBA of first sector in partition

0xB

4

Number of sectors in partition

The boot ROM code configures the SD/MMC controller to default settings for the supported SD/MMC flash memory.