当前位置:网站首页>通过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空间
二、总结
详细了解,也可以阅读我之前写的文章,链接,时间久了都忘差不多了,好在做了笔录,方便以后翻阅。
边栏推荐
- Day-14 common APIs
- Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
- Pule frog small 5D movie equipment | 5D movie dynamic movie experience hall | VR scenic area cinema equipment
- [statistical learning methods] learning notes - Chapter 4: naive Bayesian method
- 如何将 @Transactional 事务注解运用到炉火纯青?
- Utiliser la pile pour convertir le binaire en décimal
- Leetcode skimming: binary tree 21 (verifying binary search tree)
- [learn microservices from 0] [03] explore the microservice architecture
- 智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
- Master formula. (used to calculate the time complexity of recursion.)
猜你喜欢

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

Creation and assignment of graphic objects

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

图像像素读写操作

2022 polymerization process test question simulation test question bank and online simulation test

Day-16 set

What if does not match your user account appears when submitting the code?

Talk about four cluster schemes of redis cache, and their advantages and disadvantages

Pule frog small 5D movie equipment | 5D movie dynamic movie experience hall | VR scenic area cinema equipment
![[crawler] avoid script detection when using selenium](/img/3a/85ea729be2aa76c3de4a822ca6939b.png)
[crawler] avoid script detection when using selenium
随机推荐
leetcode刷题:二叉树26(二叉搜索树中的插入操作)
2022-07-07日报:GAN发明者Ian Goodfellow正式加入DeepMind
ip2long之后有什么好处?
数据库安全的重要性
[Q&A]AttributeError: module ‘signal‘ has no attribute ‘SIGALRM‘
Design and implementation of communication protocol
About IPSec
[statistical learning method] learning notes - support vector machine (Part 2)
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
Leetcode skimming: binary tree 21 (verifying binary search tree)
Decrypt gd32 MCU product family, how to choose the development board?
智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
2022A特种设备相关管理(锅炉压力容器压力管道)模拟考试题库模拟考试平台操作
Cookie
[pytorch practice] image description -- let neural network read pictures and tell stories
leetcode刷题:二叉树24(二叉树的最近公共祖先)
xshell评估期已过怎么办
【二叉树】删点成林
Session