RO,RW,ZI概念

RO:
RO=read-only
RW:
RW=read-write
ZI:
ZI=zero-initialized

各部分在空间上的分配结构如下图:
在这里插入图片描述
When you compile a standalone firmware for a microcontroller (as opposed to a user-mode program to be run in an OS), in the end you usually get a single monolithic image that will be flashed into the flash ROM and executed in-place. This is fine for code which usually is not modified, or read-only (const) data, but not so great for writable data. That’s where RW and ZI regions come in. The compiler inserts a small bootstrap code which takes a chunk with initial values of initialized data from the ROM image and copies it into RAM (this is the RW region). It then zeroes out the rest of the used RAM (ZI region). Then the control is transferred to the actual code written by the programmer.
当你编译一个独立的应用程序时,编译完后生成一个整体的image,然后烧录到flash并且执行,对于代码(code)和只读常数(read-only const data)是可行的,但对要求读写的数据(writable data)就不太好了.所以才需要RW和ZI区的加入.编译器插入一段代码用于从ROM复制一大块初始数据到RAM(RW区),然后清零剩下的RAM(ZI区).

Thus, to calculate the used ROM (flash) space, you need to add up code, RO-data and RW-data. Used RAM will be the sum of RW-data and ZI-data. So, for your case, it’s 1264+16+0=1280 bytes of flash and 0+1384=1384 bytes of RAM.
因此,ROM空间你需要把code,RO-data和RW-data区加起来,RAM空间要把RW-data和ZI-data区加起来.即
Total RO Size (Code + RO Data)
Total RW Size (RW Data + ZI Data)
Total ROM Size (Code + RO Data + RW Data)

参考链接ROM and RAM in ARM

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值