SPNU118Y September 1995 – February 2020
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:
armcl module1
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:
armcl --run_linker bttest.cmd
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:
armabs bttest.out
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):
armcl --absolute_listing module1.abs
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 Example 1 ) and module2.lst (see Example 2). |