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
This example uses three source files. The files module1.asm and module2.asm both include the file globals.def.
module1.asm
.text
.bss dflag, 1
.bss array, 100
dflag_a .word dflag
array_a .word array
offst_a .word offst
.copy globals.def
LDR r4, array_a
LDR r5, offst_a
LDR r3, dflag_a
LDR r0, [r4, r5]
STR r0, [r3]
module2.asm
.text
.bss offst, 1
offst_a .word offst
.copy globals.def
LDR r4, offst_a
STR r0, [r4]
globals.def
.global array
.global offst
.global dflag
The following steps create absolute listings for the files module1.asm and module2.asm:
Step 1: | First,
assemble module1.asm and module2.asm:
This creates two object files called module1.obj and module2.obj. |
Step 2: | Next, link module1.obj and module2.obj using the following linker command file, called bttest.cmd: |
--output_file=bttest.out
--map_file=bttest.map
module1.obj
module2.obj
MEMORY
{
P_MEM : org = 0x00000000 len = 0x00001000
D_MEM : org = 0x00001000 len = 0x00001000
}
SECTIONS
{
.data: >D_MEM
.text: >P_MEM
.bss: >D_MEM
}
Invoke the linker:
This command creates an executable object file called bttest.out; use this file as input for the absolute lister. |
|
Step 3: | Now, invoke the absolute lister:
This command creates two files called module1.abs and module2.abs: module1.abs: |
.nolist
array .setsym 000001001h
dflag .setsym 000001000h
offst .setsym 000001068h
.data .setsym 000001000h
edata .setsym 000001000h
.text .setsym 000000000h
etext .setsym 00000002ch
.bss .setsym 000001000h
end .setsym 00000106ch
.setsect ".text",000000000h
.setsect ".data",000001000h
.setsect ".bss",000001000h
.list
.text
.copy "module1.asm"
module2.abs: |
.nolist
array .setsym 000001001h
dflag .setsym 000001000h
offst .setsym 000001068h
.data .setsym 000001000h
edata .setsym 000001000h
.text .setsym 000000000h
etext .setsym 00000002ch
.bss .setsym 000001000h
end .setsym 00000106ch
.setsect ".text",000000020h
.setsect ".data",000001000h
.setsect ".bss",000001068h
.list
.text
.copy "module2.asm"
These files contain the following
information that the assembler needs for Step 4:
The .setsym and .setsect directives are useful only for creating absolute listings, not normal assembly. |
|
Step 4: | Finally, assemble the .abs files
created by the absolute lister (remember that you
must use the --absolute_listing option when you
invoke the assembler):
This command sequence creates two listing files called module1.lst and module2.lst; no object code is produced. These listing files are similar to normal listing files; however, the addresses shown are absolute addresses. The absolute listing files created are module1.lst (see module1.lst ) and module2.lst (see module2.lst). |
module1.abs PAGE 1
15 00000000 .text
16 .copy "module1.asm"
A 1 00000000 .text
A 2 00001000 .bss dflag, 1
A 3 00001001 .bss array, 100
A 4 00000000 00001000- dflag_a .word dflag
A 5 00000004 00001001- array_a .word array
A 6 00000008 00001068! offst_a .word offst
A 7 .copy globals.def
B 1 .global array
B 2 .global offst
B 3 .global dflag
A 8
A 9 0000000c E51F4010 LDR r4, array_a
A 10 00000010 E51F5010 LDR r5, offst_a
A 11 00000014 E51F301C LDR r3, dflag_a
A 12 00000018 E7940005 LDR r0, [r4, r5]
A 13 0000001c E5830000 STR r0, [r3]
No Errors, No Warnings
module2.abs PAGE 1
15 00000020 .text
16 .copy "module2.asm"
A 1 00000020 .text
A 2 00001068 .bss offst, 1
A 3 00000020 00001068- offst_a .word offst
A 4 .copy globals.def
B 1 .global array
B 2 .global offst
B 3 .global dflag
A 5
A 6 00000024 E51F400C LDR r4, offst_a
A 7 00000028 E5840000 STR r0, [r4]
No Errors, No Warnings