Skip to content

Commit d09a248

Browse files
committed
Added memap documentation
1 parent 647ba3d commit d09a248

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

docs/memap.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
## Introduction
2+
3+
*memap* is a simple command line 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.
4+
5+
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.
6+
7+
## Table of Contents
8+
9+
1. [Installation](#installation)
10+
1. [Using memap](#using-memap)
11+
1. [Running pytest](#running-pytest)
12+
1. [Current support](#current-support)
13+
1. [Known problems](#known-problems)
14+
15+
## Installation
16+
17+
*memap* lives in https://github.com/ARMmbed/memap.
18+
19+
To get the latest version of *memap*, clone the repository and installed it:
20+
21+
```
22+
git clone https://github.com/ARMmbed/memap
23+
cd memap
24+
python setup.py install
25+
```
26+
27+
## Using memap
28+
29+
*memap* is a simple utility. These are the command line options:
30+
31+
```
32+
$> memap
33+
usage: memap-script.py [-h] -t TOOLCHAIN [-o OUTPUT] [-j] [-v] file
34+
35+
Memory Map File Analyser for ARM mbed OS version 0.3.2
36+
37+
positional arguments:
38+
file memory map file
39+
40+
optional arguments:
41+
-h, --help show this help message and exit
42+
-t TOOLCHAIN, --toolchain TOOLCHAIN
43+
select a toolchain that corresponds to the memory map
44+
file (ARM, GCC_ARM, IAR)
45+
-o OUTPUT, --output OUTPUT
46+
output file name
47+
-j, --json output in JSON formatted list
48+
-v, --version show program's version number and exit
49+
```
50+
51+
Example:
52+
53+
```
54+
$> memap GCC_ARM\myprog3.map -t GCC_ARM
55+
56+
+-----------------------------------+-------+-------+------+
57+
| Module | .text | .data | .bss |
58+
+-----------------------------------+-------+-------+------+
59+
| Misc | 248 | 12 | 28 |
60+
| core/mbed-rtos | 5638 | 24 | 2494 |
61+
| core/util | 323 | 0 | 8 |
62+
| core/uvisor-mbed-lib | 4 | 0 | 0 |
63+
| frameworks/greentea-client | 416 | 28 | 0 |
64+
| frameworks/utest | 3055 | 32 | 688 |
65+
| hal/common | 2453 | 4 | 272 |
66+
| hal/targets | 9796 | 0 | 672 |
67+
| net/LWIPInterface | 172 | 4 | 272 |
68+
| net/atmel-rf-driver | 332 | 8 | 212 |
69+
| net/mbed-client | 64 | 4 | 12 |
70+
| net/nanostack-hal-mbed-cmsis-rtos | 100 | 4 | 56 |
71+
| net/nanostack-interface | 40 | 4 | 16 |
72+
| Subtotals | 22641 | 124 | 4730 |
73+
+-----------------------------------+-------+-------+------+
74+
Static RAM memory (data + bss): 4854
75+
Heap: 131072
76+
Stack: 3072
77+
Total RAM memory (data + bss + heap + stack): 138998
78+
Total Flash memory (text + data): 22765
79+
Elapsed time: 55mS
80+
```
81+
82+
Information on memory sections:
83+
84+
- text: is where the code application and constants are located in Flash
85+
- data: initialized variables, allocated in both RAM and Flash memory
86+
- bss: uninitialized data allocated in RAM
87+
- heap: dynamic allocated memory, usually used by malloc, etc, in RAM
88+
- stack: used to store local data, temporary data when branching to a subroutine and context switch info; considered dynamic allocated memory region in RAM.
89+
90+
91+
## Running pytest
92+
93+
- Run automated tests, for example:
94+
95+
```
96+
$> py.test
97+
============================= test session starts =============================
98+
platform win32 -- Python 2.7.11, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
99+
rootdir: ...\memap, inifile:
100+
collected 3 items
101+
102+
test\test_memap.py ...
103+
104+
========================== 3 passed in 0.11 seconds ===========================
105+
106+
```
107+
108+
## Current support
109+
110+
*memap* has been tested on Windows 7.
111+
112+
Supported map files generated by the following toolchains: gcc, ARM Compiler 5 and IAR.
113+
114+
## Known problems & New features
115+
116+
This utility is considered 'Alpha' quality at the moment.
117+
The report generated may not be accurate and may vary from one toolchain to another.
118+
119+
If you are seeing problems or would like new features to be added then please raise a ticket on [GitHub](https://github.com/ARMmbed/memap/issues).

0 commit comments

Comments
 (0)