@c Copyright 2002, 2004 Free Software Foundation, Inc.
|
@c Copyright 2002, 2004 Free Software Foundation, Inc.
|
@c This is part of the GAS manual.
|
@c This is part of the GAS manual.
|
@c For copying conditions, see the file as.texinfo.
|
@c For copying conditions, see the file as.texinfo.
|
@ifset GENERIC
|
@ifset GENERIC
|
@page
|
@page
|
@node MSP430-Dependent
|
@node MSP430-Dependent
|
@chapter MSP 430 Dependent Features
|
@chapter MSP 430 Dependent Features
|
@end ifset
|
@end ifset
|
@ifclear GENERIC
|
@ifclear GENERIC
|
@node Machine Dependencies
|
@node Machine Dependencies
|
@chapter MSP 430 Dependent Features
|
@chapter MSP 430 Dependent Features
|
@end ifclear
|
@end ifclear
|
|
|
@cindex MSP 430 support
|
@cindex MSP 430 support
|
@cindex 430 support
|
@cindex 430 support
|
@menu
|
@menu
|
* MSP430 Options:: Options
|
* MSP430 Options:: Options
|
* MSP430 Syntax:: Syntax
|
* MSP430 Syntax:: Syntax
|
* MSP430 Floating Point:: Floating Point
|
* MSP430 Floating Point:: Floating Point
|
* MSP430 Directives:: MSP 430 Machine Directives
|
* MSP430 Directives:: MSP 430 Machine Directives
|
* MSP430 Opcodes:: Opcodes
|
* MSP430 Opcodes:: Opcodes
|
* MSP430 Profiling Capability:: Profiling Capability
|
* MSP430 Profiling Capability:: Profiling Capability
|
@end menu
|
@end menu
|
|
|
@node MSP430 Options
|
@node MSP430 Options
|
@section Options
|
@section Options
|
@cindex MSP 430 options (none)
|
@cindex MSP 430 options (none)
|
@cindex options for MSP430 (none)
|
@cindex options for MSP430 (none)
|
@table @code
|
@table @code
|
|
|
@item -m
|
@item -m
|
select the mpu arch. Currently has no effect.
|
select the mpu arch. Currently has no effect.
|
@item -mP
|
@item -mP
|
enables polymorph instructions handler.
|
enables polymorph instructions handler.
|
|
|
@item -mQ
|
@item -mQ
|
enables relaxation at assembly time. DANGEROUS!
|
enables relaxation at assembly time. DANGEROUS!
|
|
|
@end table
|
@end table
|
|
|
@node MSP430 Syntax
|
@node MSP430 Syntax
|
@section Syntax
|
@section Syntax
|
@menu
|
@menu
|
* MSP430-Macros:: Macros
|
* MSP430-Macros:: Macros
|
* MSP430-Chars:: Special Characters
|
* MSP430-Chars:: Special Characters
|
* MSP430-Regs:: Register Names
|
* MSP430-Regs:: Register Names
|
* MSP430-Ext:: Assembler Extensions
|
* MSP430-Ext:: Assembler Extensions
|
@end menu
|
@end menu
|
|
|
@node MSP430-Macros
|
@node MSP430-Macros
|
@subsection Macros
|
@subsection Macros
|
|
|
@cindex Macros, MSP 430
|
@cindex Macros, MSP 430
|
@cindex MSP 430 macros
|
@cindex MSP 430 macros
|
The macro syntax used on the MSP 430 is like that described in the MSP
|
The macro syntax used on the MSP 430 is like that described in the MSP
|
430 Family Assembler Specification. Normal @code{@value{AS}}
|
430 Family Assembler Specification. Normal @code{@value{AS}}
|
macros should still work.
|
macros should still work.
|
|
|
Additional built-in macros are:
|
Additional built-in macros are:
|
|
|
@table @code
|
@table @code
|
|
|
@item llo(exp)
|
@item llo(exp)
|
Extracts least significant word from 32-bit expression 'exp'.
|
Extracts least significant word from 32-bit expression 'exp'.
|
|
|
@item lhi(exp)
|
@item lhi(exp)
|
Extracts most significant word from 32-bit expression 'exp'.
|
Extracts most significant word from 32-bit expression 'exp'.
|
|
|
@item hlo(exp)
|
@item hlo(exp)
|
Extracts 3rd word from 64-bit expression 'exp'.
|
Extracts 3rd word from 64-bit expression 'exp'.
|
|
|
@item hhi(exp)
|
@item hhi(exp)
|
Extracts 4rd word from 64-bit expression 'exp'.
|
Extracts 4rd word from 64-bit expression 'exp'.
|
|
|
@end table
|
@end table
|
|
|
They normally being used as an immediate source operand.
|
They normally being used as an immediate source operand.
|
@smallexample
|
@smallexample
|
mov #llo(1), r10 ; == mov #1, r10
|
mov #llo(1), r10 ; == mov #1, r10
|
mov #lhi(1), r10 ; == mov #0, r10
|
mov #lhi(1), r10 ; == mov #0, r10
|
@end smallexample
|
@end smallexample
|
|
|
@node MSP430-Chars
|
@node MSP430-Chars
|
@subsection Special Characters
|
@subsection Special Characters
|
|
|
@cindex line comment character, MSP 430
|
@cindex line comment character, MSP 430
|
@cindex MSP 430 line comment character
|
@cindex MSP 430 line comment character
|
@samp{;} is the line comment character.
|
@samp{;} is the line comment character.
|
|
|
@cindex identifiers, MSP 430
|
@cindex identifiers, MSP 430
|
@cindex MSP 430 identifiers
|
@cindex MSP 430 identifiers
|
The character @samp{$} in jump instructions indicates current location and
|
The character @samp{$} in jump instructions indicates current location and
|
implemented only for TI syntax compatibility.
|
implemented only for TI syntax compatibility.
|
|
|
@node MSP430-Regs
|
@node MSP430-Regs
|
@subsection Register Names
|
@subsection Register Names
|
|
|
@cindex MSP 430 register names
|
@cindex MSP 430 register names
|
@cindex register names, MSP 430
|
@cindex register names, MSP 430
|
General-purpose registers are represented by predefined symbols of the
|
General-purpose registers are represented by predefined symbols of the
|
form @samp{r@var{N}} (for global registers), where @var{N} represents
|
form @samp{r@var{N}} (for global registers), where @var{N} represents
|
a number between @code{0} and @code{15}. The leading
|
a number between @code{0} and @code{15}. The leading
|
letters may be in either upper or lower case; for example, @samp{r13}
|
letters may be in either upper or lower case; for example, @samp{r13}
|
and @samp{R7} are both valid register names.
|
and @samp{R7} are both valid register names.
|
|
|
@cindex special purpose registers, MSP 430
|
@cindex special purpose registers, MSP 430
|
Register names @samp{PC}, @samp{SP} and @samp{SR} cannot be used as register names
|
Register names @samp{PC}, @samp{SP} and @samp{SR} cannot be used as register names
|
and will be treated as variables. Use @samp{r0}, @samp{r1}, and @samp{r2} instead.
|
and will be treated as variables. Use @samp{r0}, @samp{r1}, and @samp{r2} instead.
|
|
|
|
|
@node MSP430-Ext
|
@node MSP430-Ext
|
@subsection Assembler Extensions
|
@subsection Assembler Extensions
|
@cindex MSP430 Assembler Extensions
|
@cindex MSP430 Assembler Extensions
|
|
|
@table @code
|
@table @code
|
|
|
@item @@rN
|
@item @@rN
|
As destination operand being treated as @samp{0(rn)}
|
As destination operand being treated as @samp{0(rn)}
|
|
|
@item 0(rN)
|
@item 0(rN)
|
As source operand being treated as @samp{@@rn}
|
As source operand being treated as @samp{@@rn}
|
|
|
@item jCOND +N
|
@item jCOND +N
|
Skips next N bytes followed by jump instruction and equivalent to
|
Skips next N bytes followed by jump instruction and equivalent to
|
@samp{jCOND $+N+2}
|
@samp{jCOND $+N+2}
|
|
|
@end table
|
@end table
|
|
|
Also, there are some instructions, which cannot be found in other assemblers.
|
Also, there are some instructions, which cannot be found in other assemblers.
|
These are branch instructions, which has different opcodes upon jump distance.
|
These are branch instructions, which has different opcodes upon jump distance.
|
They all got PC relative addressing mode.
|
They all got PC relative addressing mode.
|
|
|
@table @code
|
@table @code
|
@item beq label
|
@item beq label
|
A polymorph instruction which is @samp{jeq label} in case if jump distance
|
A polymorph instruction which is @samp{jeq label} in case if jump distance
|
within allowed range for cpu's jump instruction. If not, this unrolls into
|
within allowed range for cpu's jump instruction. If not, this unrolls into
|
a sequence of
|
a sequence of
|
@smallexample
|
@smallexample
|
jne $+6
|
jne $+6
|
br label
|
br label
|
@end smallexample
|
@end smallexample
|
|
|
@item bne label
|
@item bne label
|
A polymorph instruction which is @samp{jne label} or @samp{jeq +4; br label}
|
A polymorph instruction which is @samp{jne label} or @samp{jeq +4; br label}
|
|
|
@item blt label
|
@item blt label
|
A polymorph instruction which is @samp{jl label} or @samp{jge +4; br label}
|
A polymorph instruction which is @samp{jl label} or @samp{jge +4; br label}
|
|
|
@item bltn label
|
@item bltn label
|
A polymorph instruction which is @samp{jn label} or @samp{jn +2; jmp +4; br label}
|
A polymorph instruction which is @samp{jn label} or @samp{jn +2; jmp +4; br label}
|
|
|
@item bltu label
|
@item bltu label
|
A polymorph instruction which is @samp{jlo label} or @samp{jhs +2; br label}
|
A polymorph instruction which is @samp{jlo label} or @samp{jhs +2; br label}
|
|
|
@item bge label
|
@item bge label
|
A polymorph instruction which is @samp{jge label} or @samp{jl +4; br label}
|
A polymorph instruction which is @samp{jge label} or @samp{jl +4; br label}
|
|
|
@item bgeu label
|
@item bgeu label
|
A polymorph instruction which is @samp{jhs label} or @samp{jlo +4; br label}
|
A polymorph instruction which is @samp{jhs label} or @samp{jlo +4; br label}
|
|
|
@item bgt label
|
@item bgt label
|
A polymorph instruction which is @samp{jeq +2; jge label} or @samp{jeq +6; jl +4; br label}
|
A polymorph instruction which is @samp{jeq +2; jge label} or @samp{jeq +6; jl +4; br label}
|
|
|
@item bgtu label
|
@item bgtu label
|
A polymorph instruction which is @samp{jeq +2; jhs label} or @samp{jeq +6; jlo +4; br label}
|
A polymorph instruction which is @samp{jeq +2; jhs label} or @samp{jeq +6; jlo +4; br label}
|
|
|
@item bleu label
|
@item bleu label
|
A polymorph instruction which is @samp{jeq label; jlo label} or @samp{jeq +2; jhs +4; br label}
|
A polymorph instruction which is @samp{jeq label; jlo label} or @samp{jeq +2; jhs +4; br label}
|
|
|
@item ble label
|
@item ble label
|
A polymorph instruction which is @samp{jeq label; jl label} or @samp{jeq +2; jge +4; br label}
|
A polymorph instruction which is @samp{jeq label; jl label} or @samp{jeq +2; jge +4; br label}
|
|
|
@item jump label
|
@item jump label
|
A polymorph instruction which is @samp{jmp label} or @samp{br label}
|
A polymorph instruction which is @samp{jmp label} or @samp{br label}
|
@end table
|
@end table
|
|
|
|
|
@node MSP430 Floating Point
|
@node MSP430 Floating Point
|
@section Floating Point
|
@section Floating Point
|
|
|
@cindex floating point, MSP 430 (@sc{ieee})
|
@cindex floating point, MSP 430 (@sc{ieee})
|
@cindex MSP 430 floating point (@sc{ieee})
|
@cindex MSP 430 floating point (@sc{ieee})
|
The MSP 430 family uses @sc{ieee} 32-bit floating-point numbers.
|
The MSP 430 family uses @sc{ieee} 32-bit floating-point numbers.
|
|
|
@node MSP430 Directives
|
@node MSP430 Directives
|
@section MSP 430 Machine Directives
|
@section MSP 430 Machine Directives
|
|
|
@cindex machine directives, MSP 430
|
@cindex machine directives, MSP 430
|
@cindex MSP 430 machine directives
|
@cindex MSP 430 machine directives
|
@table @code
|
@table @code
|
@cindex @code{file} directive, MSP 430
|
@cindex @code{file} directive, MSP 430
|
@item .file
|
@item .file
|
This directive is ignored; it is accepted for compatibility with other
|
This directive is ignored; it is accepted for compatibility with other
|
MSP 430 assemblers.
|
MSP 430 assemblers.
|
|
|
@quotation
|
@quotation
|
@emph{Warning:} in other versions of the @sc{gnu} assembler, @code{.file} is
|
@emph{Warning:} in other versions of the @sc{gnu} assembler, @code{.file} is
|
used for the directive called @code{.app-file} in the MSP 430 support.
|
used for the directive called @code{.app-file} in the MSP 430 support.
|
@end quotation
|
@end quotation
|
|
|
@cindex @code{line} directive, MSP 430
|
@cindex @code{line} directive, MSP 430
|
@item .line
|
@item .line
|
This directive is ignored; it is accepted for compatibility with other
|
This directive is ignored; it is accepted for compatibility with other
|
MSP 430 assemblers.
|
MSP 430 assemblers.
|
|
|
@cindex @code{sect} directive, MSP 430
|
@cindex @code{sect} directive, MSP 430
|
@item .arch
|
@item .arch
|
Currently this directive is ignored; it is accepted for compatibility with other
|
Currently this directive is ignored; it is accepted for compatibility with other
|
MSP 430 assemblers.
|
MSP 430 assemblers.
|
|
|
@cindex @code{profiler} directive, MSP 430
|
@cindex @code{profiler} directive, MSP 430
|
@item .profiler
|
@item .profiler
|
This directive instructs assembler to add new profile entry to the object file.
|
This directive instructs assembler to add new profile entry to the object file.
|
|
|
@end table
|
@end table
|
|
|
@node MSP430 Opcodes
|
@node MSP430 Opcodes
|
@section Opcodes
|
@section Opcodes
|
|
|
@cindex MSP 430 opcodes
|
@cindex MSP 430 opcodes
|
@cindex opcodes for MSP 430
|
@cindex opcodes for MSP 430
|
@code{@value{AS}} implements all the standard MSP 430 opcodes. No
|
@code{@value{AS}} implements all the standard MSP 430 opcodes. No
|
additional pseudo-instructions are needed on this family.
|
additional pseudo-instructions are needed on this family.
|
|
|
For information on the 430 machine instruction set, see @cite{MSP430
|
For information on the 430 machine instruction set, see @cite{MSP430
|
User's Manual, document slau049d}, Texas Instrument, Inc.
|
User's Manual, document slau049d}, Texas Instrument, Inc.
|
|
|
@node MSP430 Profiling Capability
|
@node MSP430 Profiling Capability
|
@section Profiling Capability
|
@section Profiling Capability
|
|
|
@cindex MSP 430 profiling capability
|
@cindex MSP 430 profiling capability
|
@cindex profiling capability for MSP 430
|
@cindex profiling capability for MSP 430
|
It is a performance hit to use gcc's profiling approach for this tiny target.
|
It is a performance hit to use gcc's profiling approach for this tiny target.
|
Even more -- jtag hardware facility does not perform any profiling functions.
|
Even more -- jtag hardware facility does not perform any profiling functions.
|
However we've got gdb's built-in simulator where we can do anything.
|
However we've got gdb's built-in simulator where we can do anything.
|
|
|
We define new section @samp{.profiler} which holds all profiling information.
|
We define new section @samp{.profiler} which holds all profiling information.
|
We define new pseudo operation @samp{.profiler} which will instruct assembler to
|
We define new pseudo operation @samp{.profiler} which will instruct assembler to
|
add new profile entry to the object file. Profile should take place at the
|
add new profile entry to the object file. Profile should take place at the
|
present address.
|
present address.
|
|
|
Pseudo operation format:
|
Pseudo operation format:
|
|
|
@samp{.profiler flags,function_to_profile [, cycle_corrector, extra]}
|
@samp{.profiler flags,function_to_profile [, cycle_corrector, extra]}
|
|
|
|
|
where:
|
where:
|
|
|
@table @code
|
@table @code
|
|
|
@table @code
|
@table @code
|
|
|
@samp{flags} is a combination of the following characters:
|
@samp{flags} is a combination of the following characters:
|
|
|
@item s
|
@item s
|
function entry
|
function entry
|
@item x
|
@item x
|
function exit
|
function exit
|
@item i
|
@item i
|
function is in init section
|
function is in init section
|
@item f
|
@item f
|
function is in fini section
|
function is in fini section
|
@item l
|
@item l
|
library call
|
library call
|
@item c
|
@item c
|
libc standard call
|
libc standard call
|
@item d
|
@item d
|
stack value demand
|
stack value demand
|
@item I
|
@item I
|
interrupt service routine
|
interrupt service routine
|
@item P
|
@item P
|
prologue start
|
prologue start
|
@item p
|
@item p
|
prologue end
|
prologue end
|
@item E
|
@item E
|
epilogue start
|
epilogue start
|
@item e
|
@item e
|
epilogue end
|
epilogue end
|
@item j
|
@item j
|
long jump / sjlj unwind
|
long jump / sjlj unwind
|
@item a
|
@item a
|
an arbitrary code fragment
|
an arbitrary code fragment
|
@item t
|
@item t
|
extra parameter saved (a constant value like frame size)
|
extra parameter saved (a constant value like frame size)
|
@end table
|
@end table
|
|
|
@item function_to_profile
|
@item function_to_profile
|
a function address
|
a function address
|
@item cycle_corrector
|
@item cycle_corrector
|
a value which should be added to the cycle counter, zero if omitted.
|
a value which should be added to the cycle counter, zero if omitted.
|
@item extra
|
@item extra
|
any extra parameter, zero if omitted.
|
any extra parameter, zero if omitted.
|
|
|
@end table
|
@end table
|
|
|
For example:
|
For example:
|
@smallexample
|
@smallexample
|
.global fxx
|
.global fxx
|
.type fxx,@@function
|
.type fxx,@@function
|
fxx:
|
fxx:
|
.LFrameOffset_fxx=0x08
|
.LFrameOffset_fxx=0x08
|
.profiler "scdP", fxx ; function entry.
|
.profiler "scdP", fxx ; function entry.
|
; we also demand stack value to be saved
|
; we also demand stack value to be saved
|
push r11
|
push r11
|
push r10
|
push r10
|
push r9
|
push r9
|
push r8
|
push r8
|
.profiler "cdpt",fxx,0, .LFrameOffset_fxx ; check stack value at this point
|
.profiler "cdpt",fxx,0, .LFrameOffset_fxx ; check stack value at this point
|
; (this is a prologue end)
|
; (this is a prologue end)
|
; note, that spare var filled with
|
; note, that spare var filled with
|
; the farme size
|
; the farme size
|
mov r15,r8
|
mov r15,r8
|
...
|
...
|
.profiler cdE,fxx ; check stack
|
.profiler cdE,fxx ; check stack
|
pop r8
|
pop r8
|
pop r9
|
pop r9
|
pop r10
|
pop r10
|
pop r11
|
pop r11
|
.profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
|
.profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
|
ret ; cause 'ret' insn takes 3 cycles
|
ret ; cause 'ret' insn takes 3 cycles
|
@end smallexample
|
@end smallexample
|
|
|