Preliminary main mbed library for nexpaq development

Committer:
nexpaq
Date:
Fri Nov 04 20:27:58 2016 +0000
Revision:
0:6c56fb4bc5f0
Moving to library for sharing updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:6c56fb4bc5f0 1 # memap - Static Memory Map Analysis
nexpaq 0:6c56fb4bc5f0 2
nexpaq 0:6c56fb4bc5f0 3 ## Introduction
nexpaq 0:6c56fb4bc5f0 4
nexpaq 0:6c56fb4bc5f0 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.
nexpaq 0:6c56fb4bc5f0 6
nexpaq 0:6c56fb4bc5f0 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).
nexpaq 0:6c56fb4bc5f0 8
nexpaq 0:6c56fb4bc5f0 9 ## Table of contents
nexpaq 0:6c56fb4bc5f0 10
nexpaq 0:6c56fb4bc5f0 11 1. [Using memap](#using-memap)
nexpaq 0:6c56fb4bc5f0 12 1. [Information on memory sections](#info-mem-sections)
nexpaq 0:6c56fb4bc5f0 13 1. [Current support](#current-support)
nexpaq 0:6c56fb4bc5f0 14 1. [Known problems](#known-problems)
nexpaq 0:6c56fb4bc5f0 15
nexpaq 0:6c56fb4bc5f0 16 ## Using memap
nexpaq 0:6c56fb4bc5f0 17
nexpaq 0:6c56fb4bc5f0 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:
nexpaq 0:6c56fb4bc5f0 19
nexpaq 0:6c56fb4bc5f0 20 ```
nexpaq 0:6c56fb4bc5f0 21 $> python memap.py
nexpaq 0:6c56fb4bc5f0 22 usage: memap.py [-h] -t TOOLCHAIN [-o OUTPUT] [-e EXPORT] [-v] file
nexpaq 0:6c56fb4bc5f0 23
nexpaq 0:6c56fb4bc5f0 24 Memory Map File Analyser for ARM mbed version 0.3.11
nexpaq 0:6c56fb4bc5f0 25
nexpaq 0:6c56fb4bc5f0 26 positional arguments:
nexpaq 0:6c56fb4bc5f0 27 file memory map file
nexpaq 0:6c56fb4bc5f0 28
nexpaq 0:6c56fb4bc5f0 29 optional arguments:
nexpaq 0:6c56fb4bc5f0 30 -h, --help show this help message and exit
nexpaq 0:6c56fb4bc5f0 31 -t TOOLCHAIN, --toolchain TOOLCHAIN
nexpaq 0:6c56fb4bc5f0 32 select a toolchain used to build the memory map file
nexpaq 0:6c56fb4bc5f0 33 (ARM, GCC_ARM, IAR)
nexpaq 0:6c56fb4bc5f0 34 -o OUTPUT, --output OUTPUT
nexpaq 0:6c56fb4bc5f0 35 output file name
nexpaq 0:6c56fb4bc5f0 36 -e EXPORT, --export EXPORT
nexpaq 0:6c56fb4bc5f0 37 export format (examples: 'json', 'csv-ci', 'table':
nexpaq 0:6c56fb4bc5f0 38 default)
nexpaq 0:6c56fb4bc5f0 39 -v, --version show program's version number and exit
nexpaq 0:6c56fb4bc5f0 40 ```
nexpaq 0:6c56fb4bc5f0 41
nexpaq 0:6c56fb4bc5f0 42 Result example:
nexpaq 0:6c56fb4bc5f0 43
nexpaq 0:6c56fb4bc5f0 44 ```
nexpaq 0:6c56fb4bc5f0 45 $> python memap.py GCC_ARM\myprog3.map -t GCC_ARM
nexpaq 0:6c56fb4bc5f0 46
nexpaq 0:6c56fb4bc5f0 47 +----------------------------+-------+-------+------+
nexpaq 0:6c56fb4bc5f0 48 | Module | .text | .data | .bss |
nexpaq 0:6c56fb4bc5f0 49 +----------------------------+-------+-------+------+
nexpaq 0:6c56fb4bc5f0 50 | Fill | 170 | 0 | 2294 |
nexpaq 0:6c56fb4bc5f0 51 | Misc | 36282 | 2220 | 2152 |
nexpaq 0:6c56fb4bc5f0 52 | core/hal | 15396 | 16 | 568 |
nexpaq 0:6c56fb4bc5f0 53 | core/rtos | 6751 | 24 | 2662 |
nexpaq 0:6c56fb4bc5f0 54 | features/FEATURE_IPV4 | 96 | 0 | 48 |
nexpaq 0:6c56fb4bc5f0 55 | frameworks/greentea-client | 912 | 28 | 44 |
nexpaq 0:6c56fb4bc5f0 56 | frameworks/utest | 3079 | 0 | 732 |
nexpaq 0:6c56fb4bc5f0 57 | Subtotals | 62686 | 2288 | 8500 |
nexpaq 0:6c56fb4bc5f0 58 +----------------------------+-------+-------+------+
nexpaq 0:6c56fb4bc5f0 59 Allocated Heap: 65540 bytes
nexpaq 0:6c56fb4bc5f0 60 Allocated Stack: 32768 bytes
nexpaq 0:6c56fb4bc5f0 61 Total Static RAM memory (data + bss): 10788 bytes
nexpaq 0:6c56fb4bc5f0 62 Total RAM memory (data + bss + heap + stack): 109096 bytes
nexpaq 0:6c56fb4bc5f0 63 Total Flash memory (text + data + misc): 66014 bytes
nexpaq 0:6c56fb4bc5f0 64
nexpaq 0:6c56fb4bc5f0 65 ```
nexpaq 0:6c56fb4bc5f0 66
nexpaq 0:6c56fb4bc5f0 67 ## Information on memory sections
nexpaq 0:6c56fb4bc5f0 68
nexpaq 0:6c56fb4bc5f0 69 The table above showed multiple memory sections.
nexpaq 0:6c56fb4bc5f0 70
nexpaq 0:6c56fb4bc5f0 71 - ``.text``: is where the code application and constants are located in Flash.
nexpaq 0:6c56fb4bc5f0 72 - ``.data``: non-zero initialized variables; allocated in both RAM and Flash memory (variables are copied from Flash to RAM at run time)
nexpaq 0:6c56fb4bc5f0 73 - ``.bss``: uninitialized data allocated in RAM, or variables initialized to zero.
nexpaq 0:6c56fb4bc5f0 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.
nexpaq 0:6c56fb4bc5f0 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.
nexpaq 0:6c56fb4bc5f0 76
nexpaq 0:6c56fb4bc5f0 77 There are other entries that require a bit of clarification:
nexpaq 0:6c56fb4bc5f0 78
nexpaq 0:6c56fb4bc5f0 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.
nexpaq 0:6c56fb4bc5f0 80 - Misc: usually represents helper libraries introduced by the toolchain (like ``libc``), but can also represent modules that are not part of mbed.
nexpaq 0:6c56fb4bc5f0 81
nexpaq 0:6c56fb4bc5f0 82 ## Current support
nexpaq 0:6c56fb4bc5f0 83
nexpaq 0:6c56fb4bc5f0 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.
nexpaq 0:6c56fb4bc5f0 85
nexpaq 0:6c56fb4bc5f0 86 ## Known issues and new features
nexpaq 0:6c56fb4bc5f0 87
nexpaq 0:6c56fb4bc5f0 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.
nexpaq 0:6c56fb4bc5f0 89
nexpaq 0:6c56fb4bc5f0 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.