50/317
3 - Programming a microcontroller
The tool that glues together all the object files, each the result of assembling the source files,
is called the Linker.
The linker performs the following tasks:
It takes all the object files, and merges them into a single object file by concatenating them
one after the other.
It corrects the address values in all the instruction operands that refer to objects whose
location in memory has been set or altered by the concatenation.
To do this, in addition to the set of object files, the linker requires a control file that tells it the
list of the object files to link together, the order in which they must be put, and the absolute ad-
dresses at which the result will be installed in the microcontroller's memory.
This may look complex; but actually, it make processing large programs easier and faster.
When a change has to be made to a particular source file, only this file must be edited. Then
only this one must be re-assembled, which saves time; then, all the object files must be linked
again. The linking process is fast, compared to assembly, since the files contain binary data
and their format is optimized to make the linker's job easier.
If a hardware change is made to the board that changes the address of some memory or a pe-
ripheral, it may be only necessary to alter the linker control file and link the program again.
Once the program is linked, the resulting object file contains the whole program. This file is
said to be an absolute object file, meaning that all addresses are defined; as distinct from ob-
ject files before the link process that are said to be relocatable, i.e. their addresses can be
changed later.
The absolute object file can be used either to be downloaded into an emulator to check and
debug the program; or into an EPROM programmer to program the chip that will hold the
code.
As for the assembler, the linker is built to process relocatable files produced by the assembler
frim the same tool set. It is usually not possible to mix the tools, like assembling with the as-
sembler from supplier A then linking with the linker from supplier B.
Содержание ST7 Series
Страница 1: ...ST7 8 BIT MCU FAMILY USER GUIDE JANUARY 1999 1 ...
Страница 238: ...238 317 8 C Language and the C Compiler 08 Burn bmp Then use the EPROMer programmer software as described in Chapter 7 ...
Страница 289: ...289 317 10 Second Application a Sailing Computer 10 befor Bs Rw Vw VMG AlphaR AlphaV Before the wind ...