Zilog ZUSBOPTS User Manual
Page 221

UM017105-0511
Linker Command Files for C Programs
Zilog Developer Studio II – ZNEO™
User Manual
193
RANGE ERAM $800000 : $81ffff
The ranges for the four address spaces are defined here. These ranges are taken from the
settings in Address Spaces page (see
).
CHANGE NEAR_TEXT=NEAR_DATA
CHANGE FAR_TEXT=FAR_DATA
The NEAR_TEXT and FAR_TEXT segments are renamed to NEAR_DATA and
FAR_DATA segments, respectively, by the above command. This allows the linker to
merge them with the material that has already been placed into the NEAR_DATA and
FAR_DATA segments. The NEAR_TEXT and FAR_TEXT segments contain constant
strings in RAM and ERAM, respectively. This reduces the number of initialized segments
from four to two, and the C startup then only must initialize two segments.
ORDER FAR_BSS, FAR_DATA
ORDER NEAR_BSS,NEAR_DATA
These ORDER commands specify the link order of these segments. The FAR_BSS seg-
ment is placed at lower addresses with the FAR_DATA segment immediately following it
in the ERAM space. Similarly, NEAR_DATA follows after NEAR_BSS in RAM space.
COPY NEAR_DATA EROM
COPY FAR_DATA EROM
This COPY command is a linker directive to make the linker place a copy of the initialized
data segments NEAR_DATA and FAR_DATA into the EROM address space. At run time,
the C start-up module then copies the initialized data back from the EROM address space
to the RAM (NEAR_DATA segment) and ERAM (FAR_DATA segment) address spaces.
This is the standard method to ensure that variables get their required initialization from a
nonvolatile stored copy in a typical embedded application where there is no offline mem-
ory such as disk storage from which initialized variables can be loaded.
define _low_near_romdata = copy base of NEAR_DATA
define _low_neardata = base of NEAR_DATA
define _len_neardata = length of NEAR_DATA
define _low_far_romdata = copy base of FAR_DATA
define _low_fardata = base of FAR_DATA
define _len_fardata = length of FAR_DATA
define _low_nearbss = base of NEAR_BSS
define _len_nearbss = length of NEAR_BSS
define _low_farbss = base of FAR_BSS
define _len_farbss = length of FAR_BSS
define _far_heapbot = top of ERAM
define _far_heaptop = highaddr of ERAM
define _far_stack = highaddr of ERAM
define _near_heapbot = top of RAM
define _near_heaptop = highaddr of RAM
define _near_stack = highaddr of RAM