|
| 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. |
0 commit comments