当前位置:网站首页>通过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空间
二、总结
详细了解,也可以阅读我之前写的文章,链接,时间久了都忘差不多了,好在做了笔录,方便以后翻阅。
边栏推荐
- 处理链中断后如何继续/子链出错removed from scheduling
- 图像像素读写操作
- 【统计学习方法】学习笔记——第四章:朴素贝叶斯法
- About IPSec
- Aike AI frontier promotion (7.7)
- leetcode刷题:二叉树19(合并二叉树)
- PHP调用纯真IP数据库返回具体地址
- [difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
- HZOJ #236. 递归实现组合型枚举
- 2022-07-07日报:GAN发明者Ian Goodfellow正式加入DeepMind
猜你喜欢
Creation and assignment of graphic objects
基于NeRF的三维内容生成
Financial data acquisition (III) when a crawler encounters a web page that needs to scroll with the mouse wheel to refresh the data (nanny level tutorial)
leetcode刷题:二叉树20(二叉搜索树中的搜索)
Vxlan static centralized gateway
[statistical learning methods] learning notes - Chapter 5: Decision Tree
[statistical learning method] learning notes - support vector machine (Part 2)
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
Leetcode brush questions: binary tree 19 (merge binary tree)
2022广东省安全员A证第三批(主要负责人)考试练习题及模拟考试
随机推荐
HZOJ #235. Recursive implementation of exponential enumeration
【PyTorch实战】用PyTorch实现基于神经网络的图像风格迁移
[pytorch practice] use pytorch to realize image style migration based on neural network
Day-15 common APIs and exception mechanisms
【从 0 开始学微服务】【03】初探微服务架构
MPLS experiment
[statistical learning methods] learning notes - improvement methods
红杉中国完成新一期90亿美元基金募集
Session
[learn micro services from 0] [02] move from single application to service
图形对象的创建与赋值
visual stdio 2017关于opencv4.1的环境配置
The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
leetcode刷题:二叉树27(删除二叉搜索树中的节点)
[statistical learning methods] learning notes - Chapter 5: Decision Tree
Utiliser la pile pour convertir le binaire en décimal
CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
test
HZOJ #240. Graphic printing IV
Multi row and multi column flex layout