如何计算eMMC大小

摘要:
//ericnode.info/post/how_to_determine_emmc_规范中给出了大小/计算方法,7.3.12C _ size[73:8)BLOCK_LEN=2^READ_BL_LEN、C_size_MULT和READ_BL_ LEN是CSD寄存器中的字段(使用C_size/C_size_MULT时,请注意大小端)。
User Area

from:http://ericnode.info/post/how_to_determine_emmc_size/

计算方法其实已经在规范中给出了,参考eMMC 5.0 spec里的段落。首先是:

7.3.12 C_SIZE [73:62]

The C_SIZE parameter is used to compute the device capacity for devices up to2 GB of density. See 7.4.52, SEC_COUNT [215:212] , for details on calculatingdensities greater than 2 GB. When the device density is greater than 2GB, themaximum possible value should be set to this register (0xFFF). This parameteris used to compute the device capacity.

The memory capacity of the device is computed from the entries C_SIZE,C_SIZE_MULT and READ_BL_LEN as follows:

  • Memory capacity = BLOCKNR * BLOCK_LEN where BLOCKNR = (C_SIZE+1) * MULT
  • MULT = 2 ^ (C_SIZE_MULT+2), (C_SIZE_MULT < 8)
  • BLOCK_LEN = 2 ^ READ_BL_LEN, (READ_BL_LEN < 12)

Therefore, the maximal capacity that can be coded is 4096*512*2048 = 4 GBytes.

Example: A 4 MByte device with BLOCK_LEN = 512 can be coded by C_SIZE_MULT = 0and C_SIZE = 2047. When the partition configuration is executed by host, devicewill re-calculate the C_SIZE value that can indicate the size of user data areaafter the partition.

其次是

7.4.52 SEC_COUNT [215:212]

The device density is calculated from the register by multiplying the value ofthe register (sector count) by 512B/sector as shown in following equation.

Device density = SEC_COUNT x 512B

The maximum density possible to be indicated is thus 4 294 967 295x 512B.

The addressable sector range for the device will be from Sector 0 to Sector(SEC_COUNT-1).

The least significant byte (LSB) of the sector count value is the byte [212].

When the partition configuration is executed by host, device will re-calculatethe SEC_COUNT value that can indicate the size of user data area after thepartition.

简而言之,对于容量小于2GB的,采用第一种方法,即:

  • Memory capacity = BLOCKNR * BLOCK_LEN where BLOCKNR = (C_SIZE+1) * MULT
  • MULT = 2 ^ (C_SIZE_MULT+2), (C_SIZE_MULT < 8)
  • BLOCK_LEN = 2 ^ READ_BL_LEN, (READ_BL_LEN < 12)

其中C_SIZEC_SIZE_MULTREAD_BL_LEN为CSD寄存器中的字段(注意在C_SIZE/C_SIZE_MULT时注意大小端的情况)。然而时代在发展,对于目前使用的eMMC来说,2GB显然都被淘汰了,因此制定了新的计算方法,即:

Device density = SEC_COUNT x 512B

直接使用Extended CSD中的SEC_COUNT,更加简单。

Boot Area

对于Boot Area分区,规范中规定有两个Boot Area分区,大小为128KB的整数倍。通常每个为4MB,一共8MB。

7.4.42 BOOT_SIZE_MULT [226]

The boot partition size is calculated from the register by using the followingequation:

Boot Partition size = 128Kbytes × BOOT_SIZE_MULT

RPMP

协议中规定必须有一个RPMP分区,大小为128KB的整数倍,通常为8MB。

7.4.77 RPMB_SIZE_MULT [168]

The RPMB partition size is calculated from the register by using the followingequation:

RPMB partition size = 128kB x RPMB_SIZE_MULT

免责声明:文章转载自《如何计算eMMC大小》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇支付宝转账到银行卡的二维码ZooKeeper下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

STM32 对内部FLASH读写接口函数

因为要用内部FLASH代替外部EEPROM,把参数放在STM32的0x08000000+320K处,其中20K是bootloader,300K是应用程序。 原理:先要把整页FLASH的内容搬到RAM中,然后在RAM中改动,然后擦除整页FLASH,再把改动后的内容写入原Flash页。下面程序调试通过。 /***************************...