
118
Evaluating and Programming the 29K RISC Family
When developing software for embedded applications there is always the prob-
lem of what to do with initialized data variables. The problem arises because vari-
ables must be located in RAM, but embedded programs are typically not
loaded
by an
operating system which prepares the data memory locations with initialized values.
Embedded programs are stored in ROM; this means there is no problem with pro-
gram instructions unless a program wishes to modify its own code at run–time.
Embedded system support tools typically provide a means of locating initial-
ized data in ROM; and transferring the ROM contents to RAM locations before pro-
gram execution starts. The High C 29K linker,
ld29
, provides the INITDATA com-
mand for this purpose. Programs must be linked such that all references to writeable
data occur to RAM addresses. The INITDATA scans a list of sections and transfers
the data variables found into a new
.initdat
section. The list contains the names of
sections containing initialized data. The linker is then directed to locate the new
.init-
data
section in ROM.The start address of the new section is marked with symbol
initdat
.
Developers are provided with the source to a program called
initcopy()
which
must be included in the application program. This program accesses the data in ROM
starting at label
initdat
and transfers the data to RAM locations. The format of the
data located in the
.initdat
section is understood by the
initcopy()
routine. This rou-
tine must be run before the application
main()
program. A user could place a call to
the initialization routine inside
crt0.s
.
Note, because
initcopy()
must be able to read the appropriate ROM devices,
these devices must be placed in an accessible address space. This is not a problem for
2–bus members of the 29K family, but 3–bus members can have a problem if the
.in-
itdat
section is located in a ROM device along with program code. Processors with
3–bus architectures, such as the Am29000, have separately addressed Instruction
and ROM spaces which are used for all instruction accesses. The Am29000 proces-
sor has no means of reading these two spaces to access data unless an external bridge
is provided. If program code and initialized data are located in the same ROM device,
the
initcopy()
program can only be used if an external
bridge
is provided. This bridge
connects the Am29000 processor data memory bus to the instruction memory bus. If
a 3–bus system does not have a bridge the
romcoff
utility can be used to initialize data
memory.
The
romcoff
utility can be used when the
ld29
linker is not available and the
INITDATA linker command option is not provided. Besides being able to work with
3–bus architectures which have no bridge, it can be used to process program sections
other than just initialized data. Sections which ultimately must reside in RAM can be
initialized from code located in ROM.
Fully linked executables are processed by
romcoff
to produce a new linkable
COFF file. This new module has a section called
RI_text
which contains a routine
called
RAMInit()
. When invoked, this routine initializes the processed sections,dur-