• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gcc/
1<html lang="en">
2<head>
3<title>AVR Options - Using the GNU Compiler Collection (GCC)</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Using the GNU Compiler Collection (GCC)">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Submodel-Options.html#Submodel-Options" title="Submodel Options">
9<link rel="prev" href="ARM-Options.html#ARM-Options" title="ARM Options">
10<link rel="next" href="Blackfin-Options.html#Blackfin-Options" title="Blackfin Options">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Funding Free Software'', the Front-Cover
19Texts being (a) (see below), and with the Back-Cover Texts being (b)
20(see below).  A copy of the license is included in the section entitled
21``GNU Free Documentation License''.
22
23(a) The FSF's Front-Cover Text is:
24
25     A GNU Manual
26
27(b) The FSF's Back-Cover Text is:
28
29     You have freedom to copy and modify this GNU Manual, like GNU
30     software.  Copies published by the Free Software Foundation raise
31     funds for GNU development.-->
32<meta http-equiv="Content-Style-Type" content="text/css">
33<style type="text/css"><!--
34  pre.display { font-family:inherit }
35  pre.format  { font-family:inherit }
36  pre.smalldisplay { font-family:inherit; font-size:smaller }
37  pre.smallformat  { font-family:inherit; font-size:smaller }
38  pre.smallexample { font-size:smaller }
39  pre.smalllisp    { font-size:smaller }
40  span.sc    { font-variant:small-caps }
41  span.roman { font-family:serif; font-weight:normal; } 
42  span.sansserif { font-family:sans-serif; font-weight:normal; } 
43--></style>
44<link rel="stylesheet" type="text/css" href="../cs.css">
45</head>
46<body>
47<div class="node">
48<a name="AVR-Options"></a>
49<p>
50Next:&nbsp;<a rel="next" accesskey="n" href="Blackfin-Options.html#Blackfin-Options">Blackfin Options</a>,
51Previous:&nbsp;<a rel="previous" accesskey="p" href="ARM-Options.html#ARM-Options">ARM Options</a>,
52Up:&nbsp;<a rel="up" accesskey="u" href="Submodel-Options.html#Submodel-Options">Submodel Options</a>
53<hr>
54</div>
55
56<h4 class="subsection">3.17.4 AVR Options</h4>
57
58<p><a name="index-AVR-Options-1151"></a>
59These options are defined for AVR implementations:
60
61     <dl>
62<dt><code>-mmcu=</code><var>mcu</var><dd><a name="index-mmcu-1152"></a>Specify Atmel AVR instruction set architectures (ISA) or MCU type.
63
64     <p>The default for this option is&nbsp;<code>avr2</code>.
65
66     <p>GCC supports the following AVR devices and ISAs:
67
68     <!-- Copyright (C) 2012-2013 Free Software Foundation, Inc. -->
69     <!-- This is part of the GCC manual. -->
70     <!-- For copying conditions, see the file gcc/doc/include/fdl.texi. -->
71     <!-- This file is generated automatically using -->
72     <!-- gcc/config/avr/gen-avr-mmcu-texi.c from: -->
73     <!-- gcc/config/avr/avr-arch.h -->
74     <!-- gcc/config/avr/avr-devices.c -->
75     <!-- gcc/config/avr/avr-mcus.def -->
76     <!-- Please do not edit manually. -->
77          <dl>
78<dt><code>avr2</code><dd>&ldquo;Classic&rdquo; devices with up to 8&nbsp;KiB of program memory. 
79<br><var>mcu</var>&nbsp;= <code>attiny22</code>, <code>attiny26</code>, <code>at90c8534</code>, <code>at90s2313</code>, <code>at90s2323</code>, <code>at90s2333</code>, <code>at90s2343</code>, <code>at90s4414</code>, <code>at90s4433</code>, <code>at90s4434</code>, <code>at90s8515</code>, <code>at90s8535</code>.
80
81          <br><dt><code>avr25</code><dd>&ldquo;Classic&rdquo; devices with up to 8&nbsp;KiB of program memory and with the <code>MOVW</code> instruction. 
82<br><var>mcu</var>&nbsp;= <code>ata5272</code>, <code>ata6289</code>, <code>attiny13</code>, <code>attiny13a</code>, <code>attiny2313</code>, <code>attiny2313a</code>, <code>attiny24</code>, <code>attiny24a</code>, <code>attiny25</code>, <code>attiny261</code>, <code>attiny261a</code>, <code>attiny43u</code>, <code>attiny4313</code>, <code>attiny44</code>, <code>attiny44a</code>, <code>attiny45</code>, <code>attiny461</code>, <code>attiny461a</code>, <code>attiny48</code>, <code>attiny84</code>, <code>attiny84a</code>, <code>attiny85</code>, <code>attiny861</code>, <code>attiny861a</code>, <code>attiny87</code>, <code>attiny88</code>, <code>at86rf401</code>.
83
84          <br><dt><code>avr3</code><dd>&ldquo;Classic&rdquo; devices with 16&nbsp;KiB up to 64&nbsp;KiB of  program memory. 
85<br><var>mcu</var>&nbsp;= <code>at43usb355</code>, <code>at76c711</code>.
86
87          <br><dt><code>avr31</code><dd>&ldquo;Classic&rdquo; devices with 128&nbsp;KiB of program memory. 
88<br><var>mcu</var>&nbsp;= <code>atmega103</code>, <code>at43usb320</code>.
89
90          <br><dt><code>avr35</code><dd>&ldquo;Classic&rdquo; devices with 16&nbsp;KiB up to 64&nbsp;KiB of program memory and with the <code>MOVW</code> instruction. 
91<br><var>mcu</var>&nbsp;= <code>ata5505</code>, <code>atmega16u2</code>, <code>atmega32u2</code>, <code>atmega8u2</code>, <code>attiny1634</code>, <code>attiny167</code>, <code>at90usb162</code>, <code>at90usb82</code>.
92
93          <br><dt><code>avr4</code><dd>&ldquo;Enhanced&rdquo; devices with up to 8&nbsp;KiB of program memory. 
94<br><var>mcu</var>&nbsp;= <code>ata6285</code>, <code>ata6286</code>, <code>atmega48</code>, <code>atmega48a</code>, <code>atmega48p</code>, <code>atmega48pa</code>, <code>atmega8</code>, <code>atmega8a</code>, <code>atmega8hva</code>, <code>atmega8515</code>, <code>atmega8535</code>, <code>atmega88</code>, <code>atmega88a</code>, <code>atmega88p</code>, <code>atmega88pa</code>, <code>at90pwm1</code>, <code>at90pwm2</code>, <code>at90pwm2b</code>, <code>at90pwm3</code>, <code>at90pwm3b</code>, <code>at90pwm81</code>.
95
96          <br><dt><code>avr5</code><dd>&ldquo;Enhanced&rdquo; devices with 16&nbsp;KiB up to 64&nbsp;KiB of program memory. 
97<br><var>mcu</var>&nbsp;= <code>ata5790</code>, <code>ata5790n</code>, <code>ata5795</code>, <code>atmega16</code>, <code>atmega16a</code>, <code>atmega16hva</code>, <code>atmega16hva</code>, <code>atmega16hva2</code>, <code>atmega16hva2</code>, <code>atmega16hvb</code>, <code>atmega16hvb</code>, <code>atmega16hvbrevb</code>, <code>atmega16m1</code>, <code>atmega16m1</code>, <code>atmega16u4</code>, <code>atmega16u4</code>, <code>atmega161</code>, <code>atmega162</code>, <code>atmega163</code>, <code>atmega164a</code>, <code>atmega164p</code>, <code>atmega164pa</code>, <code>atmega165</code>, <code>atmega165a</code>, <code>atmega165p</code>, <code>atmega165pa</code>, <code>atmega168</code>, <code>atmega168a</code>, <code>atmega168p</code>, <code>atmega168pa</code>, <code>atmega169</code>, <code>atmega169a</code>, <code>atmega169p</code>, <code>atmega169pa</code>, <code>atmega26hvg</code>, <code>atmega32</code>, <code>atmega32a</code>, <code>atmega32a</code>, <code>atmega32c1</code>, <code>atmega32c1</code>, <code>atmega32hvb</code>, <code>atmega32hvb</code>, <code>atmega32hvbrevb</code>, <code>atmega32m1</code>, <code>atmega32m1</code>, <code>atmega32u4</code>, <code>atmega32u4</code>, <code>atmega32u6</code>, <code>atmega32u6</code>, <code>atmega323</code>, <code>atmega324a</code>, <code>atmega324p</code>, <code>atmega324pa</code>, <code>atmega325</code>, <code>atmega325a</code>, <code>atmega325p</code>, <code>atmega3250</code>, <code>atmega3250a</code>, <code>atmega3250p</code>, <code>atmega3250pa</code>, <code>atmega328</code>, <code>atmega328p</code>, <code>atmega329</code>, <code>atmega329a</code>, <code>atmega329p</code>, <code>atmega329pa</code>, <code>atmega3290</code>, <code>atmega3290a</code>, <code>atmega3290p</code>, <code>atmega3290pa</code>, <code>atmega406</code>, <code>atmega48hvf</code>, <code>atmega64</code>, <code>atmega64a</code>, <code>atmega64c1</code>, <code>atmega64c1</code>, <code>atmega64hve</code>, <code>atmega64m1</code>, <code>atmega64m1</code>, <code>atmega64rfa2</code>, <code>atmega64rfr2</code>, <code>atmega640</code>, <code>atmega644</code>, <code>atmega644a</code>, <code>atmega644p</code>, <code>atmega644pa</code>, <code>atmega645</code>, <code>atmega645a</code>, <code>atmega645p</code>, <code>atmega6450</code>, <code>atmega6450a</code>, <code>atmega6450p</code>, <code>atmega649</code>, <code>atmega649a</code>, <code>atmega649p</code>, <code>atmega6490</code>, <code>atmega6490a</code>, <code>atmega6490p</code>, <code>at90can32</code>, <code>at90can64</code>, <code>at90pwm161</code>, <code>at90pwm216</code>, <code>at90pwm316</code>, <code>at90scr100</code>, <code>at90usb646</code>, <code>at90usb647</code>, <code>at94k</code>, <code>m3000</code>.
98
99          <br><dt><code>avr51</code><dd>&ldquo;Enhanced&rdquo; devices with 128&nbsp;KiB of program memory. 
100<br><var>mcu</var>&nbsp;= <code>atmega128</code>, <code>atmega128a</code>, <code>atmega128rfa1</code>, <code>atmega1280</code>, <code>atmega1281</code>, <code>atmega1284</code>, <code>atmega1284p</code>, <code>at90can128</code>, <code>at90usb1286</code>, <code>at90usb1287</code>.
101
102          <br><dt><code>avr6</code><dd>&ldquo;Enhanced&rdquo; devices with 3-byte PC, i.e. with more than 128&nbsp;KiB of program memory. 
103<br><var>mcu</var>&nbsp;= <code>atmega2560</code>, <code>atmega2561</code>.
104
105          <br><dt><code>avrxmega2</code><dd>&ldquo;XMEGA&rdquo; devices with more than 8&nbsp;KiB and up to 64&nbsp;KiB of program memory. 
106<br><var>mcu</var>&nbsp;= <code>atmxt112sl</code>, <code>atmxt224</code>, <code>atmxt224e</code>, <code>atmxt336s</code>, <code>atxmega16a4</code>, <code>atxmega16a4u</code>, <code>atxmega16c4</code>, <code>atxmega16d4</code>, <code>atxmega16x1</code>, <code>atxmega32a4</code>, <code>atxmega32a4u</code>, <code>atxmega32c4</code>, <code>atxmega32d4</code>, <code>atxmega32e5</code>, <code>atxmega32x1</code>.
107
108          <br><dt><code>avrxmega4</code><dd>&ldquo;XMEGA&rdquo; devices with more than 64&nbsp;KiB and up to 128&nbsp;KiB of program memory. 
109<br><var>mcu</var>&nbsp;= <code>atxmega64a3</code>, <code>atxmega64a3u</code>, <code>atxmega64a4u</code>, <code>atxmega64b1</code>, <code>atxmega64b3</code>, <code>atxmega64c3</code>, <code>atxmega64d3</code>, <code>atxmega64d4</code>.
110
111          <br><dt><code>avrxmega5</code><dd>&ldquo;XMEGA&rdquo; devices with more than 64&nbsp;KiB and up to 128&nbsp;KiB of program memory and more than 64&nbsp;KiB of RAM. 
112<br><var>mcu</var>&nbsp;= <code>atxmega64a1</code>, <code>atxmega64a1u</code>.
113
114          <br><dt><code>avrxmega6</code><dd>&ldquo;XMEGA&rdquo; devices with more than 128&nbsp;KiB of program memory. 
115<br><var>mcu</var>&nbsp;= <code>atmxt540s</code>, <code>atmxt540sreva</code>, <code>atxmega128a3</code>, <code>atxmega128a3u</code>, <code>atxmega128b1</code>, <code>atxmega128b3</code>, <code>atxmega128c3</code>, <code>atxmega128d3</code>, <code>atxmega128d4</code>, <code>atxmega192a3</code>, <code>atxmega192a3u</code>, <code>atxmega192c3</code>, <code>atxmega192d3</code>, <code>atxmega256a3</code>, <code>atxmega256a3b</code>, <code>atxmega256a3bu</code>, <code>atxmega256a3u</code>, <code>atxmega256c3</code>, <code>atxmega256d3</code>, <code>atxmega384c3</code>, <code>atxmega384d3</code>.
116
117          <br><dt><code>avrxmega7</code><dd>&ldquo;XMEGA&rdquo; devices with more than 128&nbsp;KiB of program memory and more than 64&nbsp;KiB of RAM. 
118<br><var>mcu</var>&nbsp;= <code>atxmega128a1</code>, <code>atxmega128a1u</code>, <code>atxmega128a4u</code>.
119
120          <br><dt><code>avr1</code><dd>This ISA is implemented by the minimal AVR core and supported for assembler only. 
121<br><var>mcu</var>&nbsp;= <code>attiny11</code>, <code>attiny12</code>, <code>attiny15</code>, <code>attiny28</code>, <code>at90s1200</code>.
122
123     </dl>
124
125     <br><dt><code>-maccumulate-args</code><dd><a name="index-maccumulate_002dargs-1153"></a>Accumulate outgoing function arguments and acquire/release the needed
126stack space for outgoing function arguments once in function
127prologue/epilogue.  Without this option, outgoing arguments are pushed
128before calling a function and popped afterwards.
129
130     <p>Popping the arguments after the function call can be expensive on
131AVR so that accumulating the stack space might lead to smaller
132executables because arguments need not to be removed from the
133stack after such a function call.
134
135     <p>This option can lead to reduced code size for functions that perform
136several calls to functions that get their arguments on the stack like
137calls to printf-like functions.
138
139     <br><dt><code>-mbranch-cost=</code><var>cost</var><dd><a name="index-mbranch_002dcost-1154"></a>Set the branch costs for conditional branch instructions to
140<var>cost</var>.  Reasonable values for <var>cost</var> are small, non-negative
141integers. The default branch cost is 0.
142
143     <br><dt><code>-mcall-prologues</code><dd><a name="index-mcall_002dprologues-1155"></a>Functions prologues/epilogues are expanded as calls to appropriate
144subroutines.  Code size is smaller.
145
146     <br><dt><code>-mint8</code><dd><a name="index-mint8-1156"></a>Assume <code>int</code> to be 8-bit integer.  This affects the sizes of all types: a
147<code>char</code> is 1 byte, an <code>int</code> is 1 byte, a <code>long</code> is 2 bytes,
148and <code>long long</code> is 4 bytes.  Please note that this option does not
149conform to the C standards, but it results in smaller code
150size.
151
152     <br><dt><code>-mno-interrupts</code><dd><a name="index-mno_002dinterrupts-1157"></a>Generated code is not compatible with hardware interrupts. 
153Code size is smaller.
154
155     <br><dt><code>-mrelax</code><dd><a name="index-mrelax-1158"></a>Try to replace <code>CALL</code> resp. <code>JMP</code> instruction by the shorter
156<code>RCALL</code> resp. <code>RJMP</code> instruction if applicable. 
157Setting <code>-mrelax</code> just adds the <code>--relax</code> option to the
158linker command line when the linker is called.
159
160     <p>Jump relaxing is performed by the linker because jump offsets are not
161known before code is located. Therefore, the assembler code generated by the
162compiler is the same, but the instructions in the executable may
163differ from instructions in the assembler code.
164
165     <p>Relaxing must be turned on if linker stubs are needed, see the
166section on <code>EIND</code> and linker stubs below.
167
168     <br><dt><code>-msp8</code><dd><a name="index-msp8-1159"></a>Treat the stack pointer register as an 8-bit register,
169i.e. assume the high byte of the stack pointer is zero. 
170In general, you don't need to set this option by hand.
171
172     <p>This option is used internally by the compiler to select and
173build multilibs for architectures <code>avr2</code> and <code>avr25</code>. 
174These architectures mix devices with and without <code>SPH</code>. 
175For any setting other than <code>-mmcu=avr2</code> or <code>-mmcu=avr25</code>
176the compiler driver will add or remove this option from the compiler
177proper's command line, because the compiler then knows if the device
178or architecture has an 8-bit stack pointer and thus no <code>SPH</code>
179register or not.
180
181     <br><dt><code>-mstrict-X</code><dd><a name="index-mstrict_002dX-1160"></a>Use address register <code>X</code> in a way proposed by the hardware.  This means
182that <code>X</code> is only used in indirect, post-increment or
183pre-decrement addressing.
184
185     <p>Without this option, the <code>X</code> register may be used in the same way
186as <code>Y</code> or <code>Z</code> which then is emulated by additional
187instructions. 
188For example, loading a value with <code>X+const</code> addressing with a
189small non-negative <code>const &lt; 64</code> to a register <var>Rn</var> is
190performed as
191
192     <pre class="example">          adiw r26, const   ; X += const
193          ld   <var>Rn</var>, X        ; <var>Rn</var> = *X
194          sbiw r26, const   ; X -= const
195</pre>
196     <br><dt><code>-mtiny-stack</code><dd><a name="index-mtiny_002dstack-1161"></a>Only change the lower 8&nbsp;bits of the stack pointer.
197
198     <br><dt><code>-Waddr-space-convert</code><dd><a name="index-Waddr_002dspace_002dconvert-1162"></a>Warn about conversions between address spaces in the case where the
199resulting address space is not contained in the incoming address space. 
200</dl>
201
202<h5 class="subsubsection">3.17.4.1 <code>EIND</code> and Devices with more than 128 Ki Bytes of Flash</h5>
203
204<p><a name="index-g_t_0040code_007bEIND_007d-1163"></a>Pointers in the implementation are 16&nbsp;bits wide. 
205The address of a function or label is represented as word address so
206that indirect jumps and calls can target any code address in the
207range of 64&nbsp;Ki words.
208
209 <p>In order to facilitate indirect jump on devices with more than 128&nbsp;Ki
210bytes of program memory space, there is a special function register called
211<code>EIND</code> that serves as most significant part of the target address
212when <code>EICALL</code> or <code>EIJMP</code> instructions are used.
213
214 <p>Indirect jumps and calls on these devices are handled as follows by
215the compiler and are subject to some limitations:
216
217     <ul>
218<li>The compiler never sets <code>EIND</code>.
219
220     <li>The compiler uses <code>EIND</code> implicitely in <code>EICALL</code>/<code>EIJMP</code>
221instructions or might read <code>EIND</code> directly in order to emulate an
222indirect call/jump by means of a <code>RET</code> instruction.
223
224     <li>The compiler assumes that <code>EIND</code> never changes during the startup
225code or during the application. In particular, <code>EIND</code> is not
226saved/restored in function or interrupt service routine
227prologue/epilogue.
228
229     <li>For indirect calls to functions and computed goto, the linker
230generates <em>stubs</em>. Stubs are jump pads sometimes also called
231<em>trampolines</em>. Thus, the indirect call/jump jumps to such a stub. 
232The stub contains a direct jump to the desired address.
233
234     <li>Linker relaxation must be turned on so that the linker will generate
235the stubs correctly an all situaltion. See the compiler option
236<code>-mrelax</code> and the linler option <code>--relax</code>. 
237There are corner cases where the linker is supposed to generate stubs
238but aborts without relaxation and without a helpful error message.
239
240     <li>The default linker script is arranged for code with <code>EIND = 0</code>. 
241If code is supposed to work for a setup with <code>EIND != 0</code>, a custom
242linker script has to be used in order to place the sections whose
243name start with <code>.trampolines</code> into the segment where <code>EIND</code>
244points to.
245
246     <li>The startup code from libgcc never sets <code>EIND</code>. 
247Notice that startup code is a blend of code from libgcc and AVR-LibC. 
248For the impact of AVR-LibC on <code>EIND</code>, see the
249<a href="http://nongnu.org/avr-libc/user-manual/">AVR-LibC&nbsp;user&nbsp;manual</a><!-- /@w -->.
250
251     <li>It is legitimate for user-specific startup code to set up <code>EIND</code>
252early, for example by means of initialization code located in
253section <code>.init3</code>. Such code runs prior to general startup code
254that initializes RAM and calls constructors, but after the bit
255of startup code from AVR-LibC that sets <code>EIND</code> to the segment
256where the vector table is located.
257     <pre class="example">          #include &lt;avr/io.h&gt;
258          
259          static void
260          __attribute__((section(".init3"),naked,used,no_instrument_function))
261          init3_set_eind (void)
262          {
263            __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
264                            "out %i0,r24" :: "n" (&amp;EIND) : "r24","memory");
265          }
266</pre>
267     <p class="noindent">The <code>__trampolines_start</code> symbol is defined in the linker script.
268
269     <li>Stubs are generated automatically by the linker if
270the following two conditions are met:
271          <ul>
272<li>The address of a label is taken by means of the <code>gs</code> modifier
273(short for <em>generate stubs</em>) like so:
274          <pre class="example">               LDI r24, lo8(gs(<var>func</var>))
275               LDI r25, hi8(gs(<var>func</var>))
276</pre>
277          <li>The final location of that label is in a code segment
278<em>outside</em> the segment where the stubs are located. 
279</ul>
280
281     <li>The compiler emits such <code>gs</code> modifiers for code labels in the
282following situations:
283          <ul>
284<li>Taking address of a function or code label. 
285<li>Computed goto. 
286<li>If prologue-save function is used, see <samp><span class="option">-mcall-prologues</span></samp>
287command-line option. 
288<li>Switch/case dispatch tables. If you do not want such dispatch
289tables you can specify the <samp><span class="option">-fno-jump-tables</span></samp> command-line option. 
290<li>C and C++ constructors/destructors called during startup/shutdown. 
291<li>If the tools hit a <code>gs()</code> modifier explained above. 
292</ul>
293
294     <li>Jumping to non-symbolic addresses like so is <em>not</em> supported:
295
296     <pre class="example">          int main (void)
297          {
298              /* Call function at word address 0x2 */
299              return ((int(*)(void)) 0x2)();
300          }
301</pre>
302     <p>Instead, a stub has to be set up, i.e. the function has to be called
303through a symbol (<code>func_4</code> in the example):
304
305     <pre class="example">          int main (void)
306          {
307              extern int func_4 (void);
308          
309              /* Call function at byte address 0x4 */
310              return func_4();
311          }
312</pre>
313     <p>and the application be linked with <code>-Wl,--defsym,func_4=0x4</code>. 
314Alternatively, <code>func_4</code> can be defined in the linker script. 
315</ul>
316
317<h5 class="subsubsection">3.17.4.2 Handling of the <code>RAMPD</code>, <code>RAMPX</code>, <code>RAMPY</code> and <code>RAMPZ</code> Special Function Registers</h5>
318
319<p><a name="index-g_t_0040code_007bRAMPD_007d-1164"></a><a name="index-g_t_0040code_007bRAMPX_007d-1165"></a><a name="index-g_t_0040code_007bRAMPY_007d-1166"></a><a name="index-g_t_0040code_007bRAMPZ_007d-1167"></a>Some AVR devices support memories larger than the 64&nbsp;KiB range
320that can be accessed with 16-bit pointers.  To access memory locations
321outside this 64&nbsp;KiB range, the contentent of a <code>RAMP</code>
322register is used as high part of the address:
323The <code>X</code>, <code>Y</code>, <code>Z</code> address register is concatenated
324with the <code>RAMPX</code>, <code>RAMPY</code>, <code>RAMPZ</code> special function
325register, respectively, to get a wide address. Similarly,
326<code>RAMPD</code> is used together with direct addressing.
327
328     <ul>
329<li>The startup code initializes the <code>RAMP</code> special function
330registers with zero.
331
332     <li>If a <a href="AVR-Named-Address-Spaces.html#AVR-Named-Address-Spaces">named address space</a> other than
333generic or <code>__flash</code> is used, then <code>RAMPZ</code> is set
334as needed before the operation.
335
336     <li>If the device supports RAM larger than 64&nbsp;KiB and the compiler
337needs to change <code>RAMPZ</code> to accomplish an operation, <code>RAMPZ</code>
338is reset to zero after the operation.
339
340     <li>If the device comes with a specific <code>RAMP</code> register, the ISR
341prologue/epilogue saves/restores that SFR and initializes it with
342zero in case the ISR code might (implicitly) use it.
343
344     <li>RAM larger than 64&nbsp;KiB is not supported by GCC for AVR targets. 
345If you use inline assembler to read from locations outside the
34616-bit address range and change one of the <code>RAMP</code> registers,
347you must reset it to zero after the access.
348
349 </ul>
350
351<h5 class="subsubsection">3.17.4.3 AVR Built-in Macros</h5>
352
353<p>GCC defines several built-in macros so that the user code can test
354for the presence or absence of features.  Almost any of the following
355built-in macros are deduced from device capabilities and thus
356triggered by the <code>-mmcu=</code> command-line option.
357
358 <p>For even more AVR-specific built-in macros see
359<a href="AVR-Named-Address-Spaces.html#AVR-Named-Address-Spaces">AVR Named Address Spaces</a> and <a href="AVR-Built_002din-Functions.html#AVR-Built_002din-Functions">AVR Built-in Functions</a>.
360
361     <dl>
362<dt><code>__AVR_ARCH__</code><dd>Build-in macro that resolves to a decimal number that identifies the
363architecture and depends on the <code>-mmcu=</code><var>mcu</var> option. 
364Possible values are:
365
366     <p><code>2</code>, <code>25</code>, <code>3</code>, <code>31</code>, <code>35</code>,
367<code>4</code>, <code>5</code>, <code>51</code>, <code>6</code>, <code>102</code>, <code>104</code>,
368<code>105</code>, <code>106</code>, <code>107</code>
369
370     <p>for <var>mcu</var>=<code>avr2</code>, <code>avr25</code>, <code>avr3</code>,
371<code>avr31</code>, <code>avr35</code>, <code>avr4</code>, <code>avr5</code>, <code>avr51</code>,
372<code>avr6</code>, <code>avrxmega2</code>, <code>avrxmega4</code>, <code>avrxmega5</code>,
373<code>avrxmega6</code>, <code>avrxmega7</code>, respectively. 
374If <var>mcu</var> specifies a device, this built-in macro is set
375accordingly. For example, with <code>-mmcu=atmega8</code> the macro will be
376defined to <code>4</code>.
377
378     <br><dt><code>__AVR_</code><var>Device</var><code>__</code><dd>Setting <code>-mmcu=</code><var>device</var> defines this built-in macro which reflects
379the device's name. For example, <code>-mmcu=atmega8</code> defines the
380built-in macro <code>__AVR_ATmega8__</code>, <code>-mmcu=attiny261a</code> defines
381<code>__AVR_ATtiny261A__</code>, etc.
382
383     <p>The built-in macros' names follow
384the scheme <code>__AVR_</code><var>Device</var><code>__</code> where <var>Device</var> is
385the device name as from the AVR user manual. The difference between
386<var>Device</var> in the built-in macro and <var>device</var> in
387<code>-mmcu=</code><var>device</var> is that the latter is always lowercase.
388
389     <p>If <var>device</var> is not a device but only a core architecture like
390<code>avr51</code>, this macro will not be defined.
391
392     <br><dt><code>__AVR_XMEGA__</code><dd>The device / architecture belongs to the XMEGA family of devices.
393
394     <br><dt><code>__AVR_HAVE_ELPM__</code><dd>The device has the the <code>ELPM</code> instruction.
395
396     <br><dt><code>__AVR_HAVE_ELPMX__</code><dd>The device has the <code>ELPM R</code><var>n</var><code>,Z</code> and <code>ELPM
397R</code><var>n</var><code>,Z+</code> instructions.
398
399     <br><dt><code>__AVR_HAVE_MOVW__</code><dd>The device has the <code>MOVW</code> instruction to perform 16-bit
400register-register moves.
401
402     <br><dt><code>__AVR_HAVE_LPMX__</code><dd>The device has the <code>LPM R</code><var>n</var><code>,Z</code> and
403<code>LPM R</code><var>n</var><code>,Z+</code> instructions.
404
405     <br><dt><code>__AVR_HAVE_MUL__</code><dd>The device has a hardware multiplier.
406
407     <br><dt><code>__AVR_HAVE_JMP_CALL__</code><dd>The device has the <code>JMP</code> and <code>CALL</code> instructions. 
408This is the case for devices with at least 16&nbsp;KiB of program
409memory.
410
411     <br><dt><code>__AVR_HAVE_EIJMP_EICALL__</code><dt><code>__AVR_3_BYTE_PC__</code><dd>The device has the <code>EIJMP</code> and <code>EICALL</code> instructions. 
412This is the case for devices with more than 128&nbsp;KiB of program memory. 
413This also means that the program counter
414(PC) is 3&nbsp;bytes wide.
415
416     <br><dt><code>__AVR_2_BYTE_PC__</code><dd>The program counter (PC) is 2&nbsp;bytes wide. This is the case for devices
417with up to 128&nbsp;KiB of program memory.
418
419     <br><dt><code>__AVR_HAVE_8BIT_SP__</code><dt><code>__AVR_HAVE_16BIT_SP__</code><dd>The stack pointer (SP) register is treated as 8-bit respectively
42016-bit register by the compiler. 
421The definition of these macros is affected by <code>-mtiny-stack</code>.
422
423     <br><dt><code>__AVR_HAVE_SPH__</code><dt><code>__AVR_SP8__</code><dd>The device has the SPH (high part of stack pointer) special function
424register or has an 8-bit stack pointer, respectively. 
425The definition of these macros is affected by <code>-mmcu=</code> and
426in the cases of <code>-mmcu=avr2</code> and <code>-mmcu=avr25</code> also
427by <code>-msp8</code>.
428
429     <br><dt><code>__AVR_HAVE_RAMPD__</code><dt><code>__AVR_HAVE_RAMPX__</code><dt><code>__AVR_HAVE_RAMPY__</code><dt><code>__AVR_HAVE_RAMPZ__</code><dd>The device has the <code>RAMPD</code>, <code>RAMPX</code>, <code>RAMPY</code>,
430<code>RAMPZ</code> special function register, respectively.
431
432     <br><dt><code>__NO_INTERRUPTS__</code><dd>This macro reflects the <code>-mno-interrupts</code> command line option.
433
434     <br><dt><code>__AVR_ERRATA_SKIP__</code><dt><code>__AVR_ERRATA_SKIP_JMP_CALL__</code><dd>Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
435instructions because of a hardware erratum.  Skip instructions are
436<code>SBRS</code>, <code>SBRC</code>, <code>SBIS</code>, <code>SBIC</code> and <code>CPSE</code>. 
437The second macro is only defined if <code>__AVR_HAVE_JMP_CALL__</code> is also
438set.
439
440     <br><dt><code>__AVR_SFR_OFFSET__=</code><var>offset</var><dd>Instructions that can address I/O special function registers directly
441like <code>IN</code>, <code>OUT</code>, <code>SBI</code>, etc. may use a different
442address as if addressed by an instruction to access RAM like <code>LD</code>
443or <code>STS</code>. This offset depends on the device architecture and has
444to be subtracted from the RAM address in order to get the
445respective I/O&nbsp;address.
446
447     <br><dt><code>__WITH_AVRLIBC__</code><dd>The compiler is configured to be used together with AVR-Libc. 
448See the <code>--with-avrlibc</code> configure option.
449
450 </dl>
451
452 </body></html>
453
454