Embedded Software Development Tools
Host and Target Machines • The programming work for embedded systems is
done on a host, a computer system on which all the programming tools run. • After the program has been written, complied, assembled, and linked is it moved to the target, the system that is shipped to customers.
Cross Compliers • Most of the desktop systems used as hosts come
with compilers, assemblers, linkers, and so on for building programs that will run on the host. • These tools are called as the native tools. • The complier that runs on your host system but produces the binary instructions understood by the target microprocessor is called as cross compiler.
Cross Compliers • A cross complier understands the same C
language as a native complier (with few exceptions), but its output uses the instruction set of the target cross complier.
Cross Assemblers & Tool chains • Cross assembler is an assembler that runs on your host but produces binary instructions appropriate for your target. • The input to the cross-assembler must be assembly language appropriate for the target. • Output files from each tool become the input files for the next.Because of this ,the tools must be compatible with one another. • A set of tools that is compatible in this way is called a tool chain.
Linker/locators for Embedded Software • A linker/locator combines separately compiled and assembled modules into an executable image. • In addition ,it places code,data,startup code,constant strings,and so on at suitable addresses in ROM and RAM
Address Resolution • The native linker creates a file on the disk drive of the host system that is read by a part of the operating system called loader. • The first difference between a native linker and a locator is the nature of the output files that they create. • The loader finds memory into which to load the program, copies the program from the disk into the memory, and may then do various other processing before starting the program.
Address Resolution • The locator creates a file that will be used by some program that copies the output to the target system. • Later,the output from the locator will have to run on its own. • One problem in particular that the tool chain must solve is that many microprocessor instrucions contain the addresses of their operands.
Address Resolution • Example • The MOVE instruction in ABBOTT.c that loads the value of the variable I dunno into register R1 must contain the address of the variable I dunno. • Similarly,the call to whosonfirst must eventually turn into a binary CALL instruction that contains the address of whosonfirst. • The process of solving this problem is often called address resolution.
Address Resolution • When it is compiling ABBOTT.c the compiler has no idea what the addresses of idunno and whosonfirst will be. • Therefore ,it leaves flags in the object file ABBOTT.OBJ for the linker,indicating that the address of idunno must be patched into the MOVE instruction and that the address of whosonfirst must be patched into the CALL instruction.
Address Resolution • When it is compiling COSTELLO.c, the compiler leaves a flag in the object file indicating the location of whosonfirst within the object file COSTELLO.OBJ. • When the linker puts the two object files together, it figures out wher idunno and whosonfirst are in relation to the start of the ececutable image and places that information in the executable file. • After trhe loader copies the program iinto memory,it knows exactly where idunno and whosonfirst are in memory, and it can fix up the CALL andMOVE instructions that originally came from ABBOTT.c with those address.