SPNU118Z September 1995 – March 2023 66AK2E05 , 66AK2H06 , 66AK2H12 , 66AK2H14 , AM1705 , AM1707 , AM1802 , AM1806 , AM1808 , AM1810 , AM5K2E04 , OMAP-L132 , OMAP-L137 , OMAP-L138 , SM470R1B1M-HT , TMS470R1A288 , TMS470R1A384 , TMS470R1A64 , TMS470R1B1M , TMS470R1B512 , TMS470R1B768
Normally, any reference to a symbol refers to its run-time address. However, it may be necessary at run time to refer to a load-time address. Specifically, the code that copies a section from its load address to its run address must have access to the load address. The .label directive defines a special symbol that refers to the section's load address. Thus, whereas normal symbols are relocated with respect to the run address, .label symbols are relocated with respect to the load address. See Create a Load-Time Address Label for more information on the .label directive.
#STDZ0755089 and #STDZ0754221 show the use of the .label directive to copy a section from its load address in SLOW_MEM to its run address in FAST_MEM. Figure 8-3 illustrates the run-time execution of #STDZ0755089.
If you use the table operator, the .label directive is not needed. See Section 8.8.4.1.
;-----------------------------------------------------------
; define a section to be copied from SLOW_MEM to FAST_MEM
;-----------------------------------------------------------
.sect ".fir"
.label fir_src ; load address of section
fir: ; run address of section
<code here> ; code for section
.label fir_end ; load address of section end
;-----------------------------------------------------------
; copy .fir section from SLOW_MEM to FAST_MEM
;-----------------------------------------------------------
.text
LDR r4, fir_s ; get fir load address start
LDR r5, fir_e ; get fir load address stop
LDR r3, fir_a ; get fir run address
$1: CMP r4, r5
LDRCC r0, [r4], #4 ; copy fir routine to its
; run address
STRCC r0, [r3], #4
BCC $1
;-----------------------------------------------------------
; jump to fir routine, now in FAST_MEM
;-----------------------------------------------------------
B fir
fir_a .word fir
fir_s .word fir_start
fir_e .word fir_end
/******************************************************/
/* PARTIAL LINKER COMMAND FILE FOR FIR EXAMPLE */
/******************************************************/
MEMORY
{
FAST_MEM : origin = 0x00001000, length = 0x00001000
SLOW_MEM : origin = 0x10000000, length = 0x00001000
}
SECTIONS
{
.text: load = FAST_MEM
.fir: load = SLOW_MEM, run FAST_MEM
}
See Section 8.6 for information about referring to linker symbols in C/C++ code.