Development mbed library for MAX32630FTHR
Dependents: blinky_max32630fthr
docs/memap.md@0:5c4d7b2438d3, 2016-11-11 (annotated)
- Committer:
- switches
- Date:
- Fri Nov 11 20:59:50 2016 +0000
- Revision:
- 0:5c4d7b2438d3
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:5c4d7b2438d3 | 1 | # memap - Static Memory Map Analysis |
switches | 0:5c4d7b2438d3 | 2 | |
switches | 0:5c4d7b2438d3 | 3 | ## Introduction |
switches | 0:5c4d7b2438d3 | 4 | |
switches | 0:5c4d7b2438d3 | 5 | *memap* is a simple utility that displays 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. |
switches | 0:5c4d7b2438d3 | 6 | |
switches | 0:5c4d7b2438d3 | 7 | **Note**: this tool shows 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). |
switches | 0:5c4d7b2438d3 | 8 | |
switches | 0:5c4d7b2438d3 | 9 | ## Table of contents |
switches | 0:5c4d7b2438d3 | 10 | |
switches | 0:5c4d7b2438d3 | 11 | 1. [Using memap](#using-memap) |
switches | 0:5c4d7b2438d3 | 12 | 1. [Information on memory sections](#info-mem-sections) |
switches | 0:5c4d7b2438d3 | 13 | 1. [Current support](#current-support) |
switches | 0:5c4d7b2438d3 | 14 | 1. [Known problems](#known-problems) |
switches | 0:5c4d7b2438d3 | 15 | |
switches | 0:5c4d7b2438d3 | 16 | ## Using memap |
switches | 0:5c4d7b2438d3 | 17 | |
switches | 0:5c4d7b2438d3 | 18 | *memap* is automatically invoked after an mbed build finishes successfully. It's also possible to manually run the program with different command line options, for example: |
switches | 0:5c4d7b2438d3 | 19 | |
switches | 0:5c4d7b2438d3 | 20 | ``` |
switches | 0:5c4d7b2438d3 | 21 | $> python memap.py |
switches | 0:5c4d7b2438d3 | 22 | usage: memap.py [-h] -t TOOLCHAIN [-o OUTPUT] [-e EXPORT] [-v] file |
switches | 0:5c4d7b2438d3 | 23 | |
switches | 0:5c4d7b2438d3 | 24 | Memory Map File Analyser for ARM mbed version 0.3.11 |
switches | 0:5c4d7b2438d3 | 25 | |
switches | 0:5c4d7b2438d3 | 26 | positional arguments: |
switches | 0:5c4d7b2438d3 | 27 | file memory map file |
switches | 0:5c4d7b2438d3 | 28 | |
switches | 0:5c4d7b2438d3 | 29 | optional arguments: |
switches | 0:5c4d7b2438d3 | 30 | -h, --help show this help message and exit |
switches | 0:5c4d7b2438d3 | 31 | -t TOOLCHAIN, --toolchain TOOLCHAIN |
switches | 0:5c4d7b2438d3 | 32 | select a toolchain used to build the memory map file |
switches | 0:5c4d7b2438d3 | 33 | (ARM, GCC_ARM, IAR) |
switches | 0:5c4d7b2438d3 | 34 | -o OUTPUT, --output OUTPUT |
switches | 0:5c4d7b2438d3 | 35 | output file name |
switches | 0:5c4d7b2438d3 | 36 | -e EXPORT, --export EXPORT |
switches | 0:5c4d7b2438d3 | 37 | export format (examples: 'json', 'csv-ci', 'table': |
switches | 0:5c4d7b2438d3 | 38 | default) |
switches | 0:5c4d7b2438d3 | 39 | -v, --version show program's version number and exit |
switches | 0:5c4d7b2438d3 | 40 | ``` |
switches | 0:5c4d7b2438d3 | 41 | |
switches | 0:5c4d7b2438d3 | 42 | Result example: |
switches | 0:5c4d7b2438d3 | 43 | |
switches | 0:5c4d7b2438d3 | 44 | ``` |
switches | 0:5c4d7b2438d3 | 45 | $> python memap.py GCC_ARM\myprog3.map -t GCC_ARM |
switches | 0:5c4d7b2438d3 | 46 | |
switches | 0:5c4d7b2438d3 | 47 | +----------------------------+-------+-------+------+ |
switches | 0:5c4d7b2438d3 | 48 | | Module | .text | .data | .bss | |
switches | 0:5c4d7b2438d3 | 49 | +----------------------------+-------+-------+------+ |
switches | 0:5c4d7b2438d3 | 50 | | Fill | 170 | 0 | 2294 | |
switches | 0:5c4d7b2438d3 | 51 | | Misc | 36282 | 2220 | 2152 | |
switches | 0:5c4d7b2438d3 | 52 | | core/hal | 15396 | 16 | 568 | |
switches | 0:5c4d7b2438d3 | 53 | | core/rtos | 6751 | 24 | 2662 | |
switches | 0:5c4d7b2438d3 | 54 | | features/FEATURE_IPV4 | 96 | 0 | 48 | |
switches | 0:5c4d7b2438d3 | 55 | | frameworks/greentea-client | 912 | 28 | 44 | |
switches | 0:5c4d7b2438d3 | 56 | | frameworks/utest | 3079 | 0 | 732 | |
switches | 0:5c4d7b2438d3 | 57 | | Subtotals | 62686 | 2288 | 8500 | |
switches | 0:5c4d7b2438d3 | 58 | +----------------------------+-------+-------+------+ |
switches | 0:5c4d7b2438d3 | 59 | Allocated Heap: 65540 bytes |
switches | 0:5c4d7b2438d3 | 60 | Allocated Stack: 32768 bytes |
switches | 0:5c4d7b2438d3 | 61 | Total Static RAM memory (data + bss): 10788 bytes |
switches | 0:5c4d7b2438d3 | 62 | Total RAM memory (data + bss + heap + stack): 109096 bytes |
switches | 0:5c4d7b2438d3 | 63 | Total Flash memory (text + data + misc): 66014 bytes |
switches | 0:5c4d7b2438d3 | 64 | |
switches | 0:5c4d7b2438d3 | 65 | ``` |
switches | 0:5c4d7b2438d3 | 66 | |
switches | 0:5c4d7b2438d3 | 67 | ## Information on memory sections |
switches | 0:5c4d7b2438d3 | 68 | |
switches | 0:5c4d7b2438d3 | 69 | The table above showed multiple memory sections. |
switches | 0:5c4d7b2438d3 | 70 | |
switches | 0:5c4d7b2438d3 | 71 | - ``.text``: is where the code application and constants are located in Flash. |
switches | 0:5c4d7b2438d3 | 72 | - ``.data``: non-zero initialized variables; allocated in both RAM and Flash memory (variables are copied from Flash to RAM at run time) |
switches | 0:5c4d7b2438d3 | 73 | - ``.bss``: uninitialized data allocated in RAM, or variables initialized to zero. |
switches | 0:5c4d7b2438d3 | 74 | - ``Heap``: dynamic allocations in the Heap area in RAM (for example, used by ``malloc``). The maximum size value may be defined at build time. |
switches | 0:5c4d7b2438d3 | 75 | - ``Stack``: dynamic allocations in the Stack area in RAM (for example, used to store local data, temporary data when branching to a subroutine or context switch information). The maximum size value may be defined at build time. |
switches | 0:5c4d7b2438d3 | 76 | |
switches | 0:5c4d7b2438d3 | 77 | There are other entries that require a bit of clarification: |
switches | 0:5c4d7b2438d3 | 78 | |
switches | 0:5c4d7b2438d3 | 79 | - Fill: represents the bytes in multiple sections (RAM and Flash) that the toolchain has filled with zeros because it requires subsequent data or code to be aligned appropriately in memory. |
switches | 0:5c4d7b2438d3 | 80 | - Misc: usually represents helper libraries introduced by the toolchain (like ``libc``), but can also represent modules that are not part of mbed. |
switches | 0:5c4d7b2438d3 | 81 | |
switches | 0:5c4d7b2438d3 | 82 | ## Current support |
switches | 0:5c4d7b2438d3 | 83 | |
switches | 0:5c4d7b2438d3 | 84 | *memap* has been tested on Windows 7, Linux and Mac OS X and works with memory map files are generated by the GCC_ARM, ARM (ARM Compiler 5) and IAR toochains. |
switches | 0:5c4d7b2438d3 | 85 | |
switches | 0:5c4d7b2438d3 | 86 | ## Known issues and new features |
switches | 0:5c4d7b2438d3 | 87 | |
switches | 0:5c4d7b2438d3 | 88 | This utility is considered 'alpha' quality at the moment. The information generated by this utility may not be fully accurate and may vary from one toolchain to another. |
switches | 0:5c4d7b2438d3 | 89 | |
switches | 0:5c4d7b2438d3 | 90 | If you are experiencing problems, or would like additional features, please raise a ticket on [GitHub](https://github.com/mbedmicro/mbed/issues) and use ```[memap] ``` in the title. |