Skip to content

Commit 7bd9952

Browse files
authored
Merge pull request #2030 from mlnx/memap_docs
Adding memap documentation
2 parents f7ad7d2 + 2594c49 commit 7bd9952

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

docs/memap.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# memap - Static Memory Map Analysis
2+
3+
## Introduction
4+
5+
*memap* is a simple utility useful to display static memory information required by [mbed](https://github.com/mbedmicro/mbed) applications. This information is produced by analysing the memory map file previously generated by your toolchain.
6+
7+
Note: this tool is showing static RAM usage and the total size of allocated heap and stack space defined at compile time, not the actual heap and stack usage (which may be different depending on your application).
8+
9+
## Table of Contents
10+
11+
1. [Using memap](#using-memap)
12+
1. [Information on memory sections](#info-mem-sections)
13+
1. [Current support](#current-support)
14+
1. [Known problems](#known-problems)
15+
16+
## Using memap
17+
18+
*memap* is automatically invoked after an mbed build finishes succesfully. But it's also possible to manually run the program with different command line options, for example:
19+
20+
```
21+
$> python memap.py
22+
usage: memap.py [-h] -t TOOLCHAIN [-o OUTPUT] [-e EXPORT] [-v] file
23+
24+
Memory Map File Analyser for ARM mbed version 0.3.11
25+
26+
positional arguments:
27+
file memory map file
28+
29+
optional arguments:
30+
-h, --help show this help message and exit
31+
-t TOOLCHAIN, --toolchain TOOLCHAIN
32+
select a toolchain used to build the memory map file
33+
(ARM, GCC_ARM, IAR)
34+
-o OUTPUT, --output OUTPUT
35+
output file name
36+
-e EXPORT, --export EXPORT
37+
export format (examples: 'json', 'csv-ci', 'table':
38+
default)
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+
| Fill | 170 | 0 | 2294 |
51+
| Misc | 36282 | 2220 | 2152 |
52+
| core/hal | 15396 | 16 | 568 |
53+
| core/rtos | 6751 | 24 | 2662 |
54+
| features/FEATURE_IPV4 | 96 | 0 | 48 |
55+
| frameworks/greentea-client | 912 | 28 | 44 |
56+
| frameworks/utest | 3079 | 0 | 732 |
57+
| Subtotals | 62686 | 2288 | 8500 |
58+
+----------------------------+-------+-------+------+
59+
Allocated Heap: 65540 bytes
60+
Allocated Stack: 32768 bytes
61+
Total Static RAM memory (data + bss): 10788 bytes
62+
Total RAM memory (data + bss + heap + stack): 109096 bytes
63+
Total Flash memory (text + data + misc): 66014 bytes
64+
65+
```
66+
67+
## Information on memory sections
68+
69+
Find here extended description on the multiple memory sections shown in the previous table.
70+
71+
- text: is where the code application and constants are located in Flash
72+
- data: non-zero initialized variables; allocated in both RAM and Flash memory (variables are initialized in RAM at run time from Flash)
73+
- bss: uninitialized data allocated in RAM, or variables initialized to zero
74+
- heap: dynamic allocated memory defined at build time, usually used by malloc, etc, in RAM
75+
- stack: used to store local data, temporary data when branching to a subroutine and context switch info; it's considered dynamic allocated memory region in RAM defined at build time
76+
77+
On the other hand, there are other entries which do not correspond to modules directly and require a bit of clarification:
78+
79+
- Fill: this entry represents the bytes in multiple sections (RAM and Flash) that the toolchain has filled with zeros because requires subsequent data or code to be aligment appropriately in memory
80+
- Misc: it mainly represents helper libraries introduced by the toolchain (e.g. libc) but there might be other modules not part of mbed
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, ARM (ARM Compiler 5) and IAR.
87+
88+
## Known problems & New features
89+
90+
This utility is considered 'Alpha' quality at the moment.
91+
Please note, the information generated by this utility may not be fully 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/mbedmicro/mbed/issues) and use ```[memap] ``` in the title.

0 commit comments

Comments
 (0)