Barcode Reader User Manual

Getting Started With the Assembler and Linker
5-2
5.1 Getting Started With the Assembler and Linker
This section provides a quick walkthrough of the assembler and linker so that
you can get started without reading the entire
TMS470R1x Assembly
Language Tools User’s Guide
. Example 5–1 through Example 5–6 show the
most common methods for invoking the assembler and linker.
1) Create two short source files to use for the walkthrough; call them
file1.asm and file2.asm. (See Example 5–1 and Example 5–2.)
Example 5–1. file1.asm
.global inclw
start: MOV r6, #0
MOV r7, #0
loop: BL inclw
BCC loop
.end
Example 5–2. file2.asm
.global inclw
inclw: ADDS r7, r7, #1
ADDCSS r6, r6, #1
MOV pc, lr
.end
2) Enter the following command to assemble file1.asm:
asm470 file1
The asm470 command invokes the assembler. The input source file is
file1.asm. (If the input file extension is .asm, you do not have to specify the
extension; the assembler uses .asm as the default.)
This example creates an object file called file1.obj. The assembler creates
an object file only if there are no errors in assembly. You can specify a
name for the object file, but if you do not, the assembler uses the input file-
name with an extension of .obj.