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.
61 mark the object file as one that requires data to copied from ROM to
62 RAM at execution startup. Disabled by default.
69 * MSP430-Macros:: Macros
70 * MSP430-Chars:: Special Characters
71 * MSP430-Regs:: Register Names
72 * MSP430-Ext:: Assembler Extensions
78 @cindex Macros, MSP 430
79 @cindex MSP 430 macros
80 The macro syntax used on the MSP 430 is like that described in the MSP
81 430 Family Assembler Specification. Normal @code{@value{AS}}
82 macros should still work.
84 Additional built-in macros are:
89 Extracts least significant word from 32-bit expression 'exp'.
92 Extracts most significant word from 32-bit expression 'exp'.
95 Extracts 3rd word from 64-bit expression 'exp'.
98 Extracts 4rd word from 64-bit expression 'exp'.
102 They normally being used as an immediate source operand.
104 mov #llo(1), r10 ; == mov #1, r10
105 mov #lhi(1), r10 ; == mov #0, r10
109 @subsection Special Characters
111 @cindex line comment character, MSP 430
112 @cindex MSP 430 line comment character
113 A semicolon (@samp{;}) appearing anywhere on a line starts a comment
114 that extends to the end of that line.
116 If a @samp{#} appears as the first character of a line then the whole
117 line is treated as a comment, but it can also be a logical line number
118 directive (@pxref{Comments}) or a preprocessor control command
119 (@pxref{Preprocessing}).
121 @cindex line separator, MSP 430
122 @cindex statement separator, MSP 430
123 @cindex MSP 430 line separator
124 Multiple statements can appear on the same line provided that they are
125 separated by the @samp{@{} character.
127 @cindex identifiers, MSP 430
128 @cindex MSP 430 identifiers
129 The character @samp{$} in jump instructions indicates current location and
130 implemented only for TI syntax compatibility.
133 @subsection Register Names
135 @cindex MSP 430 register names
136 @cindex register names, MSP 430
137 General-purpose registers are represented by predefined symbols of the
138 form @samp{r@var{N}} (for global registers), where @var{N} represents
139 a number between @code{0} and @code{15}. The leading
140 letters may be in either upper or lower case; for example, @samp{r13}
141 and @samp{R7} are both valid register names.
143 @cindex special purpose registers, MSP 430
144 Register names @samp{PC}, @samp{SP} and @samp{SR} cannot be used as register names
145 and will be treated as variables. Use @samp{r0}, @samp{r1}, and @samp{r2} instead.
149 @subsection Assembler Extensions
150 @cindex MSP430 Assembler Extensions
155 As destination operand being treated as @samp{0(rn)}
158 As source operand being treated as @samp{@@rn}
161 Skips next N bytes followed by jump instruction and equivalent to
166 Also, there are some instructions, which cannot be found in other assemblers.
167 These are branch instructions, which has different opcodes upon jump distance.
168 They all got PC relative addressing mode.
172 A polymorph instruction which is @samp{jeq label} in case if jump distance
173 within allowed range for cpu's jump instruction. If not, this unrolls into
181 A polymorph instruction which is @samp{jne label} or @samp{jeq +4; br label}
184 A polymorph instruction which is @samp{jl label} or @samp{jge +4; br label}
187 A polymorph instruction which is @samp{jn label} or @samp{jn +2; jmp +4; br label}
190 A polymorph instruction which is @samp{jlo label} or @samp{jhs +2; br label}
193 A polymorph instruction which is @samp{jge label} or @samp{jl +4; br label}
196 A polymorph instruction which is @samp{jhs label} or @samp{jlo +4; br label}
199 A polymorph instruction which is @samp{jeq +2; jge label} or @samp{jeq +6; jl +4; br label}
202 A polymorph instruction which is @samp{jeq +2; jhs label} or @samp{jeq +6; jlo +4; br label}
205 A polymorph instruction which is @samp{jeq label; jlo label} or @samp{jeq +2; jhs +4; br label}
208 A polymorph instruction which is @samp{jeq label; jl label} or @samp{jeq +2; jge +4; br label}
211 A polymorph instruction which is @samp{jmp label} or @samp{br label}
215 @node MSP430 Floating Point
216 @section Floating Point
218 @cindex floating point, MSP 430 (@sc{ieee})
219 @cindex MSP 430 floating point (@sc{ieee})
220 The MSP 430 family uses @sc{ieee} 32-bit floating-point numbers.
222 @node MSP430 Directives
223 @section MSP 430 Machine Directives
225 @cindex machine directives, MSP 430
226 @cindex MSP 430 machine directives
228 @cindex @code{file} directive, MSP 430
230 This directive is ignored; it is accepted for compatibility with other
234 @emph{Warning:} in other versions of the @sc{gnu} assembler, @code{.file} is
235 used for the directive called @code{.app-file} in the MSP 430 support.
238 @cindex @code{line} directive, MSP 430
240 This directive is ignored; it is accepted for compatibility with other
243 @cindex @code{arch} directive, MSP 430
245 Sets the target microcontroller in the same way as the @option{-mmcu}
248 @cindex @code{cpu} directive, MSP 430
250 Sets the target architecture in the same way as the @option{-mcpu}
253 @cindex @code{profiler} directive, MSP 430
255 This directive instructs assembler to add new profile entry to the object file.
262 @cindex MSP 430 opcodes
263 @cindex opcodes for MSP 430
264 @code{@value{AS}} implements all the standard MSP 430 opcodes. No
265 additional pseudo-instructions are needed on this family.
267 For information on the 430 machine instruction set, see @cite{MSP430
268 User's Manual, document slau049d}, Texas Instrument, Inc.
270 @node MSP430 Profiling Capability
271 @section Profiling Capability
273 @cindex MSP 430 profiling capability
274 @cindex profiling capability for MSP 430
275 It is a performance hit to use gcc's profiling approach for this tiny target.
276 Even more -- jtag hardware facility does not perform any profiling functions.
277 However we've got gdb's built-in simulator where we can do anything.
279 We define new section @samp{.profiler} which holds all profiling information.
280 We define new pseudo operation @samp{.profiler} which will instruct assembler to
281 add new profile entry to the object file. Profile should take place at the
284 Pseudo operation format:
286 @samp{.profiler flags,function_to_profile [, cycle_corrector, extra]}
295 @samp{flags} is a combination of the following characters:
302 function is in init section
304 function is in fini section
312 interrupt service routine
322 long jump / sjlj unwind
324 an arbitrary code fragment
326 extra parameter saved (a constant value like frame size)
329 @item function_to_profile
331 @item cycle_corrector
332 a value which should be added to the cycle counter, zero if omitted.
334 any extra parameter, zero if omitted.
343 .LFrameOffset_fxx=0x08
344 .profiler "scdP", fxx ; function entry.
345 ; we also demand stack value to be saved
350 .profiler "cdpt",fxx,0, .LFrameOffset_fxx ; check stack value at this point
351 ; (this is a prologue end)
352 ; note, that spare var filled with
356 .profiler cdE,fxx ; check stack
361 .profiler xcde,fxx,3 ; exit adds 3 to the cycle counter
362 ret ; cause 'ret' insn takes 3 cycles