Table of Contents Previous topic Next topic
LINKER->Linker Command Line Options->Specify Segment Addresses and Order (/CODE /DATA)
These options allow the location addresses of specific segments to be specified and for segments in the same address space to be placed in a particular order relative to each other. The format for the options is:
/[address space]([segment list])
where [address space] is one of CODE or DATA.
[segment list] is a comma separated list specifying the segment name and optionally the required location address in the following format:
[segment name]([base address])
The base address should be specified in hexadecimal.
If the base address is omitted, the segment is placed immediately following the preceding segment in the list. If none of the segments in the list specify a base address, then the option serves to order the segments and the linker will place them at a convenient location.
As an example of the use of these options, suppose the target system has 256 bytes of battery backed-up ram located at decimal address 1024. Relocatable data segments named as BBR1, BBR2 and BBR3 can be forced to use this ram space via the option:
Segment BBR1 will begin at ram address 400 hex. Segment BB2 will be located immediately above segment BBR1 and segment BBR3 will be placed immediately above segment BBR2.
The link map can be examined to ensure that the combined size of these three segments does not exceed 256 bytes.