当前位置:网站首页>通过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空间
二、总结
详细了解,也可以阅读我之前写的文章,链接,时间久了都忘差不多了,好在做了笔录,方便以后翻阅。
边栏推荐
- 详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
- [pytorch practice] use pytorch to realize image style migration based on neural network
- 【统计学习方法】学习笔记——第四章:朴素贝叶斯法
- [statistical learning method] learning notes - support vector machine (Part 2)
- Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
- 图形对象的创建与赋值
- 处理链中断后如何继续/子链出错removed from scheduling
- Day22 deadlock, thread communication, singleton mode
- 3D content generation based on nerf
- What kind of methods or functions can you view the laravel version of a project?
猜你喜欢

BGP third experiment report

The left-hand side of an assignment expression may not be an optional property access. ts(2779)

MPLS experiment

Day22 deadlock, thread communication, singleton mode

ICLR 2022 | pre training language model based on anti self attention mechanism

Multi row and multi column flex layout

3D content generation based on nerf

leetcode刷题:二叉树20(二叉搜索树中的搜索)
![[crawler] avoid script detection when using selenium](/img/3a/85ea729be2aa76c3de4a822ca6939b.png)
[crawler] avoid script detection when using selenium
![[pytorch practice] use pytorch to realize image style migration based on neural network](/img/20/8ed7113115709b6169be289b0c280a.png)
[pytorch practice] use pytorch to realize image style migration based on neural network
随机推荐
HZOJ #236. 递归实现组合型枚举
Day-16 set
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
leetcode刷题:二叉树19(合并二叉树)
【统计学习方法】学习笔记——支持向量机(上)
[pytorch practice] use pytorch to realize image style migration based on neural network
图像像素读写操作
What if does not match your user account appears when submitting the code?
Master公式。(用于计算递归的时间复杂度。)
2022危险化学品生产单位安全生产管理人员考题及在线模拟考试
Aike AI frontier promotion (7.7)
Multi row and multi column flex layout
处理链中断后如何继续/子链出错removed from scheduling
@Resource和@Autowired的区别?
SSM框架搭建的步骤
NPM instal reports agent or network problems
广州市召开安全生产工作会议
ip2long与long2IP 分析
Cryptography series: detailed explanation of online certificate status protocol OCSP
用mysql查询某字段是否有索引