Skip to content

Latest commit

 

History

History
107 lines (53 loc) · 5.71 KB

ResearchNotes.md

File metadata and controls

107 lines (53 loc) · 5.71 KB

Compiler/Linker memory map research

Our research notes, references and different notes about terms and examples used for inspiration during development of the Memory Map Plugin.

Linker command files memory map analysis in general

All compilation requires a linker command file (configuration) of memory and hardware.

Especially for embedded system development they are in focus and memory are often limited.

The linker command file is to some extend common for all compilers.

  • common syntax (not identical, nor compatible tbough)
  • first part is the hardware cfg, tell the linker about the hardware
  • second part is configuring which memory goes to what physical memory
  • there are standard segments, for all compilers (eg. .text, .data and .bss)
  • some compilers have their own names and special sections (.cinit for TI)
  • there is a user defined section and layout as well

Typically the memory map file have memory sections and another section called sections

Typical memory sections

  • .text is program code

  • .data is initialized data

  • .bss is un-initialized data

http://stackoverflow.com/a/1910006

Code and data size explained for text, data and bss: http://mcuoneclipse.com/2013/04/14/text-data-and-bss-code-and-data-size-explained/

Illustrations

image alt textimage alt text

More information

  • Two linker-command files?: There will always only be one pr. hardware setup and compilation, thus if users will build twice, they have to output also two memory map files - one pr. compilation.

  • Debug sections can be left out!: Memory map files can contain debug information, which can be left out of the analysis, as debug symbols does not affect the target as they are not transferred to target.

  • Formats - dwarf, corf and elf: dwarf and corf are usual output formats, while elf is for debugging

Possible example projects

Tips and tricks

If declaring inside functions and memory usage isn’t change it might be on the stack:

http://stackoverflow.com/questions/24431015/where-does-constant-local-variable-array-go-in-memory-for-a-c-program

Linux command line tools

  • size %programexecuteable

  • readelf -a %programexecuteable

Existing tools like the plugin

Resources

Unknowns

  • Determine file formats: How can we determine memory map output file or linker configuration file formats? We know for example that GCC 4.3.2 memory map output file format is different from GCC 4.8.2. Also that TI delivers in different formats from GCC and AIR.

  • BFD: What is BFD? http://www.eecs.umich.edu/courses/eecs373/readings/Linker.pdf

  • Can we establish a common "way" that all compiler/linkers work? Data structures, functionality supported, reporting formats etc. ?

  • Ensure compatibility with core API plans?: We already decided we want to move toward a generic memory map API where a core parses and delivers data and the Jenkins plugin can use that API. How can we already now try to work toward that approach without inflicting too much extra work on planned changes?

  • Ensure drill-down-data structure?: We would like to support drill-down into data - how can we design toward that approach. Mads could show current data flow and structures.

  • Map files are not versioned! I could find any descriptions or writing about if GCC describe their different memory map output file formats and that they are actually versioned. Researched mostly GCC.