当前位置:网站首页>通过Keil如何查看MCU的RAM与ROM使用情况
通过Keil如何查看MCU的RAM与ROM使用情况
2022-07-07 10:43:00 【Ch_champion】
概述
在很多偏门MCU,还是使用keil进行开发,开发过程中能免会出现ram,rom不够问题,怎么查看呢?下面揭晓答案^_^。
一、查看方式
1)、编译后

2)、通过map查看

方法很简单,鼠标对准红色圈,双击即可。

有时,双击不了,只要按照上图配置,此 .map文件一定会在本工程里面,如下所示:
找到.map,拖拽到keil中打开,即可。通过此文件可以分析,对应各个部分使用情况与合理性,从而进行做相应的优化处理。
Keil 生成的 Map 文件里面内容大致分为五大类(按照.map文件分类的顺序)如下所示:
1.Section Cross References
指的是各个源文件生成的模块、段(定义的入口)之间相互引用的关系,配置中需勾选上:Cross Reference,例如:
startup_stm32f401xe.o(RESET) refers to stm32f4xx_it.o(i.NMI_Handler) for NMI_Handler
上面表示 startup_stm32f401xe.o 文件中的 main 函数调用了 stm32f4xx_it文件中的 NMI_Handler函数

2.Removing Unused input sections from the image
移除未使用的模块,配置中需勾选上:Unused Sections Info,就是删除工程代码中,没有被调用的模块。最后面还有个统计信息,例如

表明有294段没用使用,总的占17904字节
3.Image Symbol Table
映射符号表,配置中需勾选上:Symbols,从中可以看出符号名称,存储地址,存储大小,所在的目标文件

4.Memory Map of the image
内存映射分布,配置中需勾选上:Memory Map

Image Entry point : 0x08000195:指程序入口地址。
Load Region LR_IROM1 (Base: 0x08000000, Size: 0x000021f8, Max: 0x00080000, ABSOLUTE):
指加载区域 LR_IROM1 起始地址为 0x08000000,大小有0x000021f8,这块区域最大为0x00080000.
Execution Region ER_IROM1 (Exec base: 0x08000000, Load base: 0x08000000, Size: 0x000021d0, Max: 0x00080000, ABSOLUTE):
指可执行区域 ROM_VECTOR 起始地址为 0x08000000,大小有0x000021d0,这块区域最大为0x00080000.
5.Image component sizes
存储组成大小,配置中需勾选上:Size Info,其实主要就是对模块进行汇总存储大小信息

Code:指代码的大小;
RO-data:指除了内联数据(inline data)之外的常量数据;
RW-data:指可读写(RW)、已初始化的变量数据;
ZI-data:指未初始化(ZI)的变量数据;
Code、RO-data:位于FLASH中;
RW-data、ZI-data:位于RAM中;
提醒:RW-data已初始化的数据会存储在Flash中,上电会从FLASH搬移至RAM中。
关系如下:
RO Size = Code + RO Data
RW Size = RW Data + ZI Data
ROM Size = Code + RO Data + RW Data
现在已经弄明白Map文件的内容,可以做以下分析。
(1)函数和变量所在的地址,这在推导函数调用栈时非常有用
(2)根据Code RO data RW data 的组成部分,可针对性的优化ROM空间和RAM空间
二、总结
详细了解,也可以阅读我之前写的文章,链接,时间久了都忘差不多了,好在做了笔录,方便以后翻阅。
边栏推荐
- opencv的四个函数
- HZOJ #240. Graphic printing IV
- 用mysql查询某字段是否有索引
- Vxlan static centralized gateway
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
- BGP third experiment report
- 通讯协议设计与实现
- Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
- ip2long与long2IP 分析
猜你喜欢

JS to convert array to tree data

【PyTorch实战】图像描述——让神经网络看图讲故事

BGP actual network configuration

【统计学习方法】学习笔记——支持向量机(下)

2022聚合工艺考试题模拟考试题库及在线模拟考试

MPLS experiment

Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)

Visual stdio 2017 about the environment configuration of opencv4.1
![[deep learning] image multi label classification task, Baidu paddleclas](/img/dd/6f213a396e8bb240a6872e4c03afab.png)
[deep learning] image multi label classification task, Baidu paddleclas

ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
随机推荐
leetcode刷题:二叉树27(删除二叉搜索树中的节点)
Error in compiling libssl
Guangzhou held work safety conference
非分区表转换成分区表以及注意事项
Aike AI frontier promotion (7.7)
Cookie
On valuation model (II): PE index II - PE band
Day-17 connection set
Charles: four ways to modify the input parameters or return results of the interface
Leetcode skimming: binary tree 20 (search in binary search tree)
Utiliser la pile pour convertir le binaire en décimal
[statistical learning method] learning notes - logistic regression and maximum entropy model
[binary tree] delete points to form a forest
ip2long与long2IP 分析
MySQL导入SQL文件及常用命令
Cryptography series: detailed explanation of online certificate status protocol OCSP
The left-hand side of an assignment expression may not be an optional property access. ts(2779)
leetcode刷题:二叉树25(二叉搜索树的最近公共祖先)
企业级自定义表单引擎解决方案(十二)--体验代码目录结构
What if does not match your user account appears when submitting the code?