Skip to content

Commit 07c3a10

Browse files
committed
Merge pull request #218 from screamerbg/use-memap
Add memory analysis to mbed-os build system
2 parents 9b70729 + f4827b7 commit 07c3a10

File tree

4 files changed

+636
-42
lines changed

4 files changed

+636
-42
lines changed

docs/memap.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
# memap - Static Memory Map Analysis
3+
4+
## Introduction
5+
6+
*memap* is a simple utility useful to display static memory information required by [mbed-OS](https://github.com/ARMmbed/mbed-os) applications. This information is produced by analysing the memory map file previously generated by your toolchain.
7+
8+
Note: this tool is only showing static RAM usage and the total size of allocated heap and stack space, not the actual heap and stack usage.
9+
10+
## Table of Contents
11+
12+
1. [Using memap](#using-memap)
13+
1. [Running pytest](#running-pytest)
14+
1. [Current support](#current-support)
15+
1. [Known problems](#known-problems)
16+
17+
## Using memap
18+
19+
*memap* is a simple utility which is automatically invoked after an mbed-os build finishes succesfully.
20+
It's also possible to manually run the program with differnt command line options:
21+
22+
```
23+
$> python memap.py
24+
usage: memap-script.py [-h] -t TOOLCHAIN [-o OUTPUT] [-j] [-v] file
25+
26+
Memory Map File Analyser for ARM mbed OS version 0.3.7
27+
28+
positional arguments:
29+
file memory map file
30+
31+
optional arguments:
32+
-h, --help show this help message and exit
33+
-t TOOLCHAIN, --toolchain TOOLCHAIN
34+
select a toolchain that corresponds to the memory map
35+
file (ARM, GCC_ARM, IAR)
36+
-o OUTPUT, --output OUTPUT
37+
output file name
38+
-j, --json output in JSON formatted list
39+
-v, --version show program's version number and exit
40+
```
41+
42+
Example:
43+
44+
```
45+
$> python memap.py GCC_ARM\myprog3.map -t GCC_ARM
46+
47+
+-----------------------------------+-------+-------+------+
48+
| Module | .text | .data | .bss |
49+
+-----------------------------------+-------+-------+------+
50+
| Misc | 248 | 12 | 28 |
51+
| core/mbed-rtos | 5638 | 24 | 2494 |
52+
| core/util | 323 | 0 | 8 |
53+
| core/uvisor-mbed-lib | 4 | 0 | 0 |
54+
| frameworks/greentea-client | 416 | 28 | 0 |
55+
| frameworks/utest | 3055 | 32 | 688 |
56+
| hal/common | 2453 | 4 | 272 |
57+
| hal/targets | 9796 | 0 | 672 |
58+
| net/LWIPInterface | 172 | 4 | 272 |
59+
| net/atmel-rf-driver | 332 | 8 | 212 |
60+
| net/mbed-client | 64 | 4 | 12 |
61+
| net/nanostack-hal-mbed-cmsis-rtos | 100 | 4 | 56 |
62+
| net/nanostack-interface | 40 | 4 | 16 |
63+
| Subtotals | 22641 | 124 | 4730 |
64+
+-----------------------------------+-------+-------+------+
65+
Static RAM memory (data + bss): 4854
66+
Heap: 131072
67+
Stack: 3072
68+
Total RAM memory (data + bss + heap + stack): 138998
69+
Total Flash memory (text + data): 22765
70+
Elapsed time: 55mS
71+
```
72+
73+
Information on memory sections:
74+
75+
- text: is where the code application and constants are located in Flash
76+
- data: initialized variables, allocated in both RAM and Flash memory
77+
- bss: uninitialized data allocated in RAM
78+
- heap: dynamic allocated memory, usually used by malloc, etc, in RAM
79+
- stack: used to store local data, temporary data when branching to a subroutine and context switch info; considered dynamic allocated memory region in RAM.
80+
81+
82+
## Current support
83+
84+
*memap* has been tested on Windows 7, Linux and Mac.
85+
86+
Supported map files generated by the following toolchains: gcc, ARM Compiler 5 and IAR.
87+
88+
## Known problems & New features
89+
90+
This utility is considered 'Alpha' quality at the moment.
91+
The report generated may not be accurate and may vary from one toolchain to another.
92+
93+
If you are seeing problems or would like new features to be added then please raise a ticket on [GitHub](https://github.com/ARMmbed/mbed-os/issues) and use ```[memap] ``` in the title.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
url='https://github.com/mbedmicro/mbed',
4141
packages=find_packages(),
4242
license=LICENSE,
43-
install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.8.11,<0.9.0", "junit-xml", "requests", "pyelftools"])
43+
install_requires=["PrettyTable>=0.7.2", "PySerial>=2.7", "IntelHex>=1.3", "colorama>=0.3.3", "Jinja2>=2.7.3", "project-generator>=0.8.11,<0.9.0", "junit-xml", "requests"])
4444

4545
# Restore previous private_settings if needed
4646
if backup:

0 commit comments

Comments
 (0)