1 @c Copyright 2002-2013 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)
32 selects the mpu arch. If the architecture is 430Xv2 then this also
33 enables NOP generation unless the @option{-mN} is also specified.
36 selects the cpu architecture. If the architecture is 430Xv2 then this
37 also enables NOP generation unless the @option{-mN} is also
41 enables polymorph instructions handler.
44 enables relaxation at assembly time. DANGEROUS!
47 indicates that the input uses the large code model.
50 disables the generation of a NOP instruction following any instruction
51 that might change the interrupts enabled/disabled state. For the
52 430Xv2 architecture the instructions: @code{EINT}, @code{DINT},
53 @code{BIC #8, SR}, @code{BIS #8, SR} and @code{MOV.W <>, SR} must be
54 followed by a NOP instruction in order to ensure the correct
55 processing of interrupts. By default generation of the NOP
56 instruction happens automatically, but this command line option
57 disables this behaviour. It is then up to the programmer to ensure
58 that interrupts are enabled and disabled correctly.
65 * MSP430-Macros:: Macros
66 * MSP430-Chars:: Special Characters
67 * MSP430-Regs:: Register Names
68 * MSP430-Ext:: Assembler Extensions
74 @cindex Macros, MSP 430
75 @cindex MSP 430 macros
76 The macro syntax used on the MSP 430 is like that described in the MSP
77 430 Family Assembler Specification. Normal @code{@value{AS}}
78 macros should still work.
80 Additional built-in macros are:
85 Extracts least significant word from 32-bit expression 'exp'.
88 Extracts most significant word from 32-bit expression 'exp'.
91 Extracts 3rd word from 64-bit expression 'exp'.
94 Extracts 4rd word from 64-bit expression 'exp'.
98 They normally being used as an immediate source operand.
100 mov #llo(1), r10 ; == mov #1, r10
101 mov #lhi(1), r10 ; == mov #0, r10
105 @subsection Special Characters
107 @cindex line comment character, MSP 430
108 @cindex MSP 430 line comment character
109 A semicolon (@samp{;}) appearing anywhere on a line starts a comment
110 that extends to the end of that line.
112 If a @samp{#} appears as the first character of a line then the whole
113 line is treated as a comment, but it can also be a logical line number
114 directive (@pxref{Comments}) or a preprocessor control command
115 (@pxref{Preprocessing}).
117 @cindex line separator, MSP 430
118 @cindex statement separator, MSP 430
119 @cindex MSP 430 line separator
120 Multiple statements can appear on the same line provided that they are
121 separated by the @samp{@{} character.
123 @cindex identifiers, MSP 430
124 @cindex MSP 430 identifiers
125 The character @samp{$} in jump instructions indicates current location and
126 implemented only for TI syntax compatibility.
129 @subsection Register Names
131 @cindex MSP 430 register names
132 @cindex register names, MSP 430
133 General-purpose registers are represented by predefined symbols of the
134 form @samp{r@var{N}} (for global registers), where @var{N} represents
135 a number between @code{0} and @code{15}. The leading
136 letters may be in either upper or lower case; for example, @samp{r13}
137 and @samp{R7} are both valid register names.
139 @cindex special purpose registers, MSP 430
140 Register names @samp{PC}, @samp{SP} and @samp{SR} cannot be used as register names
141 and will be treated as variables. Use @samp{r0}, @samp{r1}, and @samp{r2} instead.
145 @subsection Assembler Extensions
146 @cindex MSP430 Assembler Extensions
151 As destination operand being treated as @samp{0(rn)}
154 As source operand being treated as @samp{@@rn}
157 Skips next N bytes followed by jump instruction and equivalent to
162 Also, there are some instructions, which cannot be found in other assemblers.
163 These are branch instructions, which has different opcodes upon jump distance.
164 They all got PC relative addressing mode.
168 A polymorph instruction which is @samp{jeq label} in case if jump distance
169 within allowed range for cpu's jump instruction. If not, this unrolls into
177 A polymorph instruction which is @samp{jne label} or @samp{jeq +4; br label}
180 A polymorph instruction which is @samp{jl label} or @samp{jge +4; br label}
183 A polymorph instruction which is @samp{jn label} or @samp{jn +2; jmp +4; br label}
186 A polymorph instruction which is @samp{jlo label} or @samp{jhs +2; br label}
189 A polymorph instruction which is @samp{jge label} or @samp{jl +4; br label}
192 A polymorph instruction which is @samp{jhs label} or @samp{jlo +4; br label}
195 A polymorph instruction which is @samp{jeq +2; jge label} or @samp{jeq +6; jl +4; br label}
198 A polymorph instruction which is @samp{jeq +2; jhs label} or @samp{jeq +6; jlo +4; br label}
201 A polymorph instruction which is @samp{jeq label; jlo label} or @samp{jeq +2; jhs +4; br label}
204 A polymorph instruction which is @samp{jeq label; jl label} or @samp{jeq +2; jge +4; br label}
207 A polymorph instruction which is @samp{jmp label} or @samp{br label}
211 @node MSP430 Floating Point
212 @section Floating Point
214 @cindex floating point, MSP 430 (@sc{ieee})
215 @cindex MSP 430 floating point (@sc{ieee})
216 The MSP 430 family uses @sc{ieee} 32-bit floating-point numbers.
218 @node MSP430 Directives
219 @section MSP 430 Machine Directives
221 @cindex machine directives, MSP 430
222 @cindex MSP 430 machine directives
224 @cindex @code{file} directive, MSP 430
226 This directive is ignored; it is accepted for compatibility with other
230 @emph{Warning:} in other versions of the @sc{gnu} assembler, @code{.file} is
231 used for the directive called @code{.app-file} in the MSP 430 support.
234 @cindex @code{line} directive, MSP 430
236 This directive is ignored; it is accepted for compatibility with other
239 @cindex @code{arch} directive, MSP 430
241 Sets the target microcontroller in the same way as the @option{-mmcu}
244 @cindex @code{cpu} directive, MSP 430
246 Sets the target architecture in the same way as the @option{-mcpu}
249 @cindex @code{profiler} directive, MSP 430
251 This directive instructs assembler to add new profile entry to the object file.
258 @cindex MSP 430 opcodes
259 @cindex opcodes for MSP 430
260 @code{@value{AS}} implements all the standard MSP 430 opcodes. No
261 additional pseudo-instructions are needed on this family.
263 For information on the 430 machine instruction set, see @cite{MSP430
264 User's Manual, document slau049d}, Texas Instrument, Inc.
266 @node MSP430 Profiling Capability
267 @section Profiling Capability
269 @cindex MSP 430 profiling capability
270 @cindex profiling capability for MSP 430
271 It is a performance hit to use gcc's profiling approach for this tiny target.
272 Even more -- jtag hardware facility does not perform any profiling functions.
273 However we've got gdb's built-in simulator where we can do anything.
275 We define new section @samp{.profiler} which holds all profiling information.
276 We define new pseudo operation @samp{.profiler} which will instruct assembler to
277 add new profile entry to the object file. Profile should take place at the
280 Pseudo operation format:
282 @samp{.profiler flags,function_to_profile [, cycle_corrector, extra]}
291 @samp{flags} is a combination of the following characters:
298 function is in init section
300 function is in fini section
308 interrupt service routine
318 long jump / sjlj unwind
320 an arbitrary code fragment
322 extra parameter saved (a constant value like frame size)
325 @item function_to_profile
327 @item cycle_corrector
328 a value which should be added to the cycle counter, zero if omitted.
330 any extra parameter, zero if omitted.
339 .LFrameOffset_fxx=0x08
340 .profiler "scdP", fxx ; function entry.
341 ; we also demand stack value to be saved
346 .profiler "cdpt",fxx,0, .LFrameOffset_fxx ; check stack value at this point
347 ; (this is a prologue end)
348 ; note, that spare var filled with
352 .profiler cdE,fxx ; check stack
357 .profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
358 ret ; cause 'ret' insn takes 3 cycles