1 @c Copyright 2002, 2004 Free Software Foundation, Inc.
2 @c This is part of the GAS manual.
3 @c For copying conditions, see the file as.texinfo.
7 @chapter MSP 430 Dependent Features
10 @node Machine Dependencies
11 @chapter MSP 430 Dependent Features
14 @cindex MSP 430 support
17 * MSP430 Options:: Options
18 * MSP430 Syntax:: Syntax
19 * MSP430 Floating Point:: Floating Point
20 * MSP430 Directives:: MSP 430 Machine Directives
21 * MSP430 Opcodes:: Opcodes
22 * MSP430 Profiling Capability:: Profiling Capability
27 @cindex MSP 430 options (none)
28 @cindex options for MSP430 (none)
29 @code{@value{AS}} has only -m flag which selects the mpu arch. Currently has
35 * MSP430-Macros:: Macros
36 * MSP430-Chars:: Special Characters
37 * MSP430-Regs:: Register Names
38 * MSP430-Ext:: Assembler Extensions
44 @cindex Macros, MSP 430
45 @cindex MSP 430 macros
46 The macro syntax used on the MSP 430 is like that described in the MSP
47 430 Family Assembler Specification. Normal @code{@value{AS}}
48 macros should still work.
50 Additional built-in macros are:
55 Extracts least significant word from 32-bit expression 'exp'.
58 Extracts most significant word from 32-bit expression 'exp'.
61 Extracts 3rd word from 64-bit expression 'exp'.
64 Extracts 4rd word from 64-bit expression 'exp'.
68 They normally being used as an immediate source operand.
70 mov #llo(1), r10 ; == mov #1, r10
71 mov #lhi(1), r10 ; == mov #0, r10
75 @subsection Special Characters
77 @cindex line comment character, MSP 430
78 @cindex MSP 430 line comment character
79 @samp{;} is the line comment character.
81 @cindex identifiers, MSP 430
82 @cindex MSP 430 identifiers
83 The character @samp{$} in jump instructions indicates current location and
84 implemented only for TI syntax compatibility.
87 @subsection Register Names
89 @cindex MSP 430 register names
90 @cindex register names, MSP 430
91 General-purpose registers are represented by predefined symbols of the
92 form @samp{r@var{N}} (for global registers), where @var{N} represents
93 a number between @code{0} and @code{15}. The leading
94 letters may be in either upper or lower case; for example, @samp{r13}
95 and @samp{R7} are both valid register names.
97 @cindex special purpose registers, MSP 430
98 Register names @samp{PC}, @samp{SP} and @samp{SR} cannot be used as register names
99 and will be treated as variables. Use @samp{r0}, @samp{r1}, and @samp{r2} instead.
103 @subsection Assembler Extensions
104 @cindex MSP430 Assembler Extensions
109 As destination operand being treated as @samp{0(rn)}
112 As source operand being treated as @samp{@@rn}
115 Skips next N bytes followed by jump instruction and equivalent to
120 Also, there are some instructions, which cannot be found in other assemblers.
121 These are branch instructions, which has different opcodes upon jump distance.
122 They all got PC relative addressing mode.
126 A polymorph instruction which is @samp{jeq label} in case if jump distance
127 within allowed range for cpu's jump instruction. If not, this unrolls into
135 A polymorph instruction which is @samp{jne label} or @samp{jeq +4; br label}
138 A polymorph instruction which is @samp{jl label} or @samp{jge +4; br label}
141 A polymorph instruction which is @samp{jn label} or @samp{jn +2; jmp +4; br label}
144 A polymorph instruction which is @samp{jlo label} or @samp{jhs +2; br label}
147 A polymorph instruction which is @samp{jge label} or @samp{jl +4; br label}
150 A polymorph instruction which is @samp{jhs label} or @samp{jlo +4; br label}
153 A polymorph instruction which is @samp{jeq +2; jge label} or @samp{jeq +6; jl +4; br label}
156 A polymorph instruction which is @samp{jeq +2; jhs label} or @samp{jeq +6; jlo +4; br label}
159 A polymorph instruction which is @samp{jeq label; jlo label} or @samp{jeq +2; jhs +4; br label}
162 A polymorph instruction which is @samp{jeq label; jl label} or @samp{jeq +2; jge +4; br label}
165 A polymorph instruction which is @samp{jmp label} or @samp{br label}
169 @node MSP430 Floating Point
170 @section Floating Point
172 @cindex floating point, MSP 430 (@sc{ieee})
173 @cindex MSP 430 floating point (@sc{ieee})
174 The MSP 430 family uses @sc{ieee} 32-bit floating-point numbers.
176 @node MSP430 Directives
177 @section MSP 430 Machine Directives
179 @cindex machine directives, MSP 430
180 @cindex MSP 430 machine directives
182 @cindex @code{file} directive, MSP 430
184 This directive is ignored; it is accepted for compatibility with other
188 @emph{Warning:} in other versions of the @sc{gnu} assembler, @code{.file} is
189 used for the directive called @code{.app-file} in the MSP 430 support.
192 @cindex @code{line} directive, MSP 430
194 This directive is ignored; it is accepted for compatibility with other
197 @cindex @code{sect} directive, MSP 430
199 Currently this directive is ignored; it is accepted for compatibility with other
202 @cindex @code{profiler} directive, MSP 430
204 This directive instructs assembler to add new profile entry to the object file.
211 @cindex MSP 430 opcodes
212 @cindex opcodes for MSP 430
213 @code{@value{AS}} implements all the standard MSP 430 opcodes. No
214 additional pseudo-instructions are needed on this family.
216 For information on the 430 machine instruction set, see @cite{MSP430
217 User's Manual, document slau049b}, Texas Instrument, Inc.
219 @node MSP430 Profiling Capability
220 @section Profiling Capability
222 @cindex MSP 430 profiling capability
223 @cindex profiling capability for MSP 430
224 It is a performance hit to use gcc's profiling approach for this tiny target.
225 Even more -- jtag hardware facility does not perform any profiling functions.
226 However we've got gdb's built-in simulator where we can do anything.
228 We define new section @samp{.profiler} which holds all profiling information.
229 We define new pseudo operation @samp{.profiler} which will instruct assembler to
230 add new profile entry to the object file. Profile should take place at the
233 Pseudo operation format:
235 @samp{.profiler flags,function_to_profile [, cycle_corrector, extra]}
244 @samp{flags} is a combination of the following characters:
251 function is in init section
253 function is in fini section
261 interrupt service routine
271 long jump / sjlj unwind
273 an arbitrary code fragment
275 extra parameter saved (a constant value like frame size)
278 @item function_to_profile
280 @item cycle_corrector
281 a value which should be added to the cycle counter, zero if omitted.
283 any extra parameter, zero if omitted.
292 .LFrameOffset_fxx=0x08
293 .profiler "scdP", fxx ; function entry.
294 ; we also demand stack value to be saved
299 .profiler "cdpt",fxx,0, .LFrameOffset_fxx ; check stack value at this point
300 ; (this is a prologue end)
301 ; note, that spare var filled with
305 .profiler cdE,fxx ; check stack
310 .profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
311 ret ; cause 'ret' insn takes 3 cycles