Tuesday, November 9, 2010

Embedded System Development ( linking process )


  1. cross-platform development methodology, includes 
    1. host system
    2. target embedded system
    3. connectivity solutions between host and target (Joint Test Action Group/Background Debug Module)
  2. development tools in the host environment are
    1. cross compiler
    2. linker
    3. source level debugger
  3. tools in the target embedded system
    1. dynamic loader
    2. link loader
    3. debug agent
  4. journey from code to executable
    1. developer writes in C/C++ and assembly
    2. make-file is created, to automate the process of building/rebuilding on modification
    3. compiler and assembler produce object file containing both machine binary code and data in the target system
    4. linker take these object files, and produces either a executable or an object file, used to additional linking with other object fiies
    5. the linker command file (linker script) instructs linker on how to combine the object files and where to place the binary code and data in the target embedded system
    6. the main
  5. symbol table  
    1. created by compiler and contains the symbol name to address mapping
    2. contains the global symbols defined in the file being compiled and the external symbols referenced in the file that the linker needs to resolve
  6. symbol resolution, part of linking process
    1. find where (in other object files) the external symbols are defined
    2. the statically linked library (in which the external symbols are defined) are copied to the final image
  7. symbol relocation, mapping a symbol reference to its defination
    1. done using a fix-up table or relocation table
    2. for fixing up references to addresses in other segments, as when multiple object files are linked together some addressed must be relocated
    3. because of the assumption of the assembler that each object file begins at address 0.
  8. for an executable image, all external symbols must be resolved such that each symbol has an absolute memory address (exception to this rule is DLL)
  9. a relocatable object file is concatenation of multiple object files and is partially resolved, so that it can be linked with other object files at run-time
References:
http://www.cs.princeton.edu/courses/archive/spr03/cs217/lectures/Linker.pdf