mbed os with nrf51 internal bandgap enabled to read battery level

Dependents:   BLE_file_test BLE_Blink ExternalEncoder

Committer:
elessair
Date:
Sun Oct 23 15:10:02 2016 +0000
Revision:
0:f269e3021894
Initial commit

Who changed what in which revision?

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