Download TMS320C3X/C4X CODE GENERATION TOOLS GETTING

Transcript
Getting Started With the Assembler and Linker
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 TMS320C3x/C4x Assembly
Language Tools User’s Guide. These examples show the most common
methods for invoking the assembler and linker.
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
.file ”file1.asm”
.ref addvec
.global __stack
.global start
__stack
stack_a
vector
vector_a
start:
.usect ”.stack”, 0
.text
.word __stack
.float 10.0, 20.0, 30.0, 40.0
.word vector
ldp @stack_a
ldi @stack_a, sp
ldi @vector_a, ar0
call addvec
bu $
Example 5–2. file2.asm
.file ”file2.asm”
.def addvec
.text
addvec:
ldf 0,r0
rpts 3
addf *ar0++,r0
rets
5-2