如何计算eMMC大小
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_SIZE
, C_SIZE_MULT
和READ_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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 在鹅厂做java开发是什么体验
· 百万级群聊的设计实践
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
· 永远不要相信用户的输入:从 SQL 注入攻防看输入验证的重要性
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析