Linker (Lk65)

The linker Lk65 combines a selection of individually assembled object files and libraries into a complete application and writes it out as a single HEX, S19 or binary file. The syntax of the link command is

Lk65 [-65C816|-65832][-code/data/bss regions][-bin|hex|s19][-output <file>]  object ... library ...

The linker will complain if an output format has not been specified.

The -65C816 option informs the linker that it is building for this processor. The code, data and bss options tell the linker where these areas will be in memory and consist of a series of memory addresses. For example my home brew has a 4K ROM from $F000 to $FFFF but one page ($FE00-$FEFF) is reserved for I/O hardware mapping, so I would tell the linker to place code as follows:

Lk65 -code $F000-FD00,$FF00-$FFFF rtos.obj

You need only define the areas for the section types you have used. If the linker finds a section type that you have not specified it will produce an error (and crash at the moment) and you can add a definition to the command line and rerun the link.

At the moment the code, data and bss areas should not overlap! Additionally the bss page should be somewhere other than page zero.

The linker can produces a binary file by default or when -bin is specified on the command line. You can generate a HEX file by specifying -hex instead.

 << Back
Home
Contents Next >>

This page was last updated on 17th September 2009