joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

MemapParser Class Reference

MemapParser Class Reference

Public Member Functions

def __init__
def module_add
def check_new_section_gcc
def path_object_to_module_name
def parse_section_gcc
def parse_map_file_gcc
def parse_section_armcc
def parse_section_iar
def parse_map_file_armcc
def parse_map_file_iar
def search_objects
def generate_output
def generate_json
def generate_csv
def generate_table
def parse

Detailed Description

An object that represents parsed results, parses the memory map files,
and writes out different file types of memory results

Definition at line 23 of file memap.py.


Constructor & Destructor Documentation

def __init__ (   self )
General initialization

Definition at line 40 of file memap.py.


Member Function Documentation

def check_new_section_gcc (   self,
  line 
)
Check whether a new section in a map file has been detected (only
applies to gcc)

Positional arguments:
line - the line to check for a new section

Definition at line 75 of file memap.py.

def generate_csv (   self,
  subtotal,
  misc_flash_mem,
  file_desc 
)
Generate a CSV file from a memoy map

Positional arguments:
subtotal - total sizes for each module
misc_flash_mem - size of misc flash sections
file_desc - the file to write out the final report to

Definition at line 463 of file memap.py.

def generate_json (   self,
  _,
  dummy,
  file_desc 
)
Generate a json file from a memory map

Positional arguments:
subtotal - total sizes for each module
misc_flash_mem - size of misc flash sections
file_desc - the file to write out the final report to

Definition at line 452 of file memap.py.

def generate_output (   self,
  export_format,
  file_output = None 
)
Generates summary of memory map data

Positional arguments:
export_format - the format to dump

Keyword arguments:
file_desc - descriptor (either stdout or file)

Definition at line 388 of file memap.py.

def generate_table (   self,
  subtotal,
  misc_flash_mem,
  file_desc 
)
Generate a table from a memoy map

Positional arguments:
subtotal - total sizes for each module
misc_flash_mem - size of misc flash sections
file_desc - the file to write out the final report to

Definition at line 506 of file memap.py.

def module_add (   self,
  module_name,
  size,
  section 
)
Adds a module / section to the list

Positional arguments:
module_name - name of the module to add
size - the size of the module being added
section - the section the module contributes to

Definition at line 57 of file memap.py.

def parse (   self,
  mapfile,
  toolchain 
)
Parse and decode map file depending on the toolchain

Positional arguments:
mapfile - the file name of the memory map file
toolchain - the toolchain used to create the file

Definition at line 570 of file memap.py.

def parse_map_file_armcc (   self,
  file_desc 
)
Main logic to decode armc5 map files

Positional arguments:
file_desc - a file like object to parse as an armc5 map file

Definition at line 297 of file memap.py.

def parse_map_file_gcc (   self,
  file_desc 
)
Main logic to decode gcc map files

Positional arguments:
file_desc - a stream object to parse as a gcc map file

Definition at line 162 of file memap.py.

def parse_map_file_iar (   self,
  file_desc 
)
Main logic to decode IAR map files

Positional arguments:
file_desc - a file like object to parse as an IAR map file

Definition at line 321 of file memap.py.

def parse_section_armcc (   self,
  line 
)
Parse data from an armcc map file

Examples of armcc map file:
    Base_Addr    Size         Type   Attr      Idx    E Section Name        Object
    0x00000000   0x00000400   Data   RO        11222    RESET               startup_MK64F12.o
    0x00000410   0x00000008   Code   RO        49364  * !!!main             c_w.l(__main.o)

Positional arguments:
line - the line to parse the section data from

Definition at line 202 of file memap.py.

def parse_section_gcc (   self,
  line 
)
Parse data from a section of gcc map file

examples:
        0x00004308       0x7c ./.build/K64F/GCC_ARM/mbed-os/hal/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/spi_api.o
 .text          0x00000608      0x198 ./.build/K64F/GCC_ARM/mbed-os/core/mbed-rtos/rtx/TARGET_CORTEX_M/TARGET_RTOS_M4_M7/TOOLCHAIN_GCC/HAL_CM4.o

Positional arguments:
line - the line to parse a section from

Definition at line 121 of file memap.py.

def parse_section_iar (   self,
  line 
)
Parse data from an IAR map file

Examples of IAR map file:
 Section             Kind        Address     Size  Object
 .intvec             ro code  0x00000000    0x198  startup_MK64F12.o [15]
 .rodata             const    0x00000198      0x0  zero_init3.o [133]
 .iar.init_table     const    0x00008384     0x2c  - Linker created -
 Initializer bytes   const    0x00000198     0xb2  <for P3 s0>
 .data               inited   0x20000000     0xd4  driverAtmelRFInterface.o [70]
 .bss                zero     0x20000598    0x318  RTX_Conf_CM.o [4]
 .iar.dynexit        uninit   0x20001448    0x204  <Block tail>
   HEAP              uninit   0x20001650  0x10000  <Block tail>

Positional_arguments:
line - the line to parse section data from

Definition at line 243 of file memap.py.

def path_object_to_module_name (   txt )
Parse a path to object file to extract it's module and object data

Positional arguments:
txt - the path to parse the object and module name from

Definition at line 94 of file memap.py.

def search_objects (   self,
  path,
  toolchain 
)
Check whether the specified map file matches with the toolchain.
Searches for object files and creates mapping: object --> module

Positional arguments:
path - the path to an object file
toolchain - the toolchain used to build the object file

Definition at line 345 of file memap.py.