SPRU513Y August 2001 – June 2022 SM320F28335-EP
This example uses three source files. The files module1.asm and module2.asm both include the file globals.def.
module1.asm
.text
array .usect ".ebss",100
dflag .usect ".ebss", 2
.copy globals.def
MOV ACC, #offset
MOV ACC, #dflag
module2.asm
offset .usect ".ebss", 2
.copy globals.def
MOV ACC, #offset
MOV ACC, #array
globals.def
.global dflag
.global array
.global offset
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
{
PAGE 0: ROM: origin=2000h length=2000h
PAGE 1: RAM: origin=8000h length=8000h
}
SECTIONS
{
.data: >RAM
.text: >ROM
.ebss: >RAM
}
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 000008000h
dflag .setsym 000008064h
offset .setsym 000008066h
.data .setsym 000008000h
edata .setsym 000008000h
.text .setsym 000002000h
etext .setsym 000002008h
.usect .setsym 000008000h
end .setsym 000008068h
.setsect ".text",000002000h
.setsect ".data",000008000h
.setsect ".ebss",00008000h
.list
.text
.copy "module1.asm"
module2.abs: |
.nolist
array .setsym 000008000h
dflag .setsym 000008064h
offset .setsym 000008066h
.data .setsym 000008000h
edata .setsym 000008000h
.text .setsym 000002000h
etext .setsym 000002008h
.usect .setsym 000008000h
end .setsym 000008068h
.setsect ".text",000002004h
.setsect ".data",000008000h
.setsect ".ebss",00008066h
.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 002000 .text
16 .copy "module1.asm"
1 002000 .text
2 008000 array .usect ".ebss",100
3 008064 dflag .usect ".ebss",2
4 .copy globals.def
1 .global dflag
2 .global array
3 .global offset
5 002000 FF20! MOV ACC,#offset
002001 8066
6 002002 FF20- MOV ACC,#dflag
002003 8064
module2.abs PAGE 1
15 002004 .text
16 .copy "module2.asm"
1 008066 offset .usect ".ebss",2
2 .copy globals.def
1 .global dflag
2 .global array
3 .global offset
3 002004 FF20- MOV ACC,#offset
002005 8066
4 002006 FF20! MOV ACC,#array
002007 8000