Specifying a Section’s Runtime Address
7-41
Linker Description
7.9
Specifying a Section’s Runtime Address
At times, you may want to load code into one area of memory and run it in
another. For example, you may have performance-critical code in a ROM-
based system. The code must be loaded into ROM, but it would run faster in
RAM.
The linker provides a simple way to accomplish this. You can use the
SECTIONS directive to direct the linker to allocate a section twice: once to set
its load address and again to set its run address. For example:
.fir: load = ROM, run = RAM
Use the
load keyword for the load address and the run keyword for the run
address.
Refer to Section 2.6,
Runtime Relocation, on page 2-17 for an overview on
runtime relocation.
7.9.1
Specifying Load and Run Addresses
The load address determines where a loader will place the raw data for the
section. All references to the section (such as labels in it) refer to its run
address. The application must copy the section from its load address to its run
address; this does
not happen automatically when you specify a separate run
address.
If you provide only one allocation (either load or run) for a section, the section
is allocated only once and will load and run at the same address. If you provide
both allocations, the section is allocated as if it were two sections of the same
size. This means that both allocations occupy space in the memory map and
cannot overlay each other or other sections. (The UNION directive provides
a way to overlay sections; see subsection 7.10.1,
Overlaying Sections With the
UNION Statement, on page 7-45.)
If either the load or run address has additional parameters, such as alignment
or blocking, list them after the appropriate keyword. Everything related to
allocation after the keyword
load affects the load address until the keyword run
is seen, after which, everything affects the run address. The load and run
allocations are completely independent, so any qualification of one (such as
alignment) has no effect on the other. You may also specify run first, then load.
Use parentheses to improve readability.
Summary of Contents for TMS320C54x
Page 38: ......
Page 39: ......
Page 40: ......
Page 41: ......
Page 42: ......
Page 43: ......
Page 44: ......
Page 45: ......
Page 46: ......
Page 47: ......
Page 48: ......
Page 49: ......
Page 50: ......
Page 51: ......
Page 52: ......
Page 53: ......
Page 54: ......
Page 55: ......
Page 56: ......
Page 57: ......
Page 58: ......
Page 59: ......
Page 60: ......
Page 61: ......
Page 62: ......
Page 276: ......
Page 277: ......
Page 278: ......
Page 279: ......
Page 280: ......
Page 281: ......
Page 282: ......
Page 283: ......
Page 284: ......
Page 285: ......
Page 286: ......
Page 287: ......
Page 288: ......
Page 289: ......
Page 290: ......
Page 291: ......
Page 292: ......
Page 293: ......
Page 294: ......
Page 295: ......
Page 296: ......
Page 297: ......
Page 298: ......
Page 299: ......
Page 300: ......
Page 301: ......
Page 302: ......