The following machine-specific options are recognized by the C compiler frontend. In addition to the preprocessor macros indicated in the tables below, the preprocessor will define the macros __AVR and __AVR__ (to the value 1) when compiling for an AVR target. The macro AVR will be defined as well when using the standard levels gnu89 (default) and gnu99 but not with c89 and c99.

Compile code for architecture. Currently known architectures are

Architecture

Macros

Description

avr1

__AVR_ARCH__=1 __AVR_ASM_ONLY__ __AVR_2_BYTE_PC__[2]

Simple CPU core, only assembler support

avr2

__AVR_ARCH__=2 __AVR_2_BYTE_PC__[2]

"Classic" CPU core, up to 8 KB of ROM

avr25[1]

__AVR_ARCH__=25 __AVR_HAVE_MOVW__[1] __AVR_HAVE_LPMX__[1] __AVR_2_BYTE_PC__[2]

"Classic" CPU core with 'MOVW' and 'LPM Rx, Z[+]' instruction, up to 8 KB of ROM

avr3

__AVR_ARCH__=3 __AVR_MEGA__[5] __AVR_HAVE_JMP_CALL__[4] __AVR_2_BYTE_PC__[2]

"Classic" CPU core, 16 KB to 64 KB of ROM

avr31

__AVR_ARCH__=31 __AVR_MEGA__[5] __AVR_HAVE_JMP_CALL__[4] __AVR_HAVE_RAMPZ__[4] __AVR_HAVE_ELPM__[4] __AVR_2_BYTE_PC__[2]

"Classic" CPU core, 128 KB of ROM

avr35[3]

__AVR_ARCH__=35 __AVR_MEGA__[5] __AVR_HAVE_JMP_CALL__[4] __AVR_HAVE_MOVW__[1] __AVR_HAVE_LPMX__[1] __AVR_2_BYTE_PC__[2]

"Classic" CPU core with 'MOVW' and 'LPM Rx, Z[+]' instruction, 16 KB to 64 KB of ROM

avr4

__AVR_ARCH__=4 __AVR_ENHANCED__[5] __AVR_HAVE_MOVW__[1] __AVR_HAVE_LPMX__[1] __AVR_HAVE_MUL__[1] __AVR_2_BYTE_PC__[2]

"Enhanced" CPU core, up to 8 KB of ROM

avr5

__AVR_ARCH__=5 __AVR_MEGA__[5] __AVR_ENHANCED__[5] __AVR_HAVE_JMP_CALL__[4] __AVR_HAVE_MOVW__[1] __AVR_HAVE_LPMX__[1] __AVR_HAVE_MUL__[1] __AVR_2_BYTE_PC__[2]

"Enhanced" CPU core, 16 KB to 64 KB of ROM

avr51

__AVR_ARCH__=51 __AVR_MEGA__[5] __AVR_ENHANCED__[5] __AVR_HAVE_JMP_CALL__[4] __AVR_HAVE_MOVW__[1] __AVR_HAVE_LPMX__[1] __AVR_HAVE_MUL__[1] __AVR_HAVE_RAMPZ__[4] __AVR_HAVE_ELPM__[4] __AVR_HAVE_ELPMX__[4] __AVR_2_BYTE_PC__[2]

"Enhanced" CPU core, 128 KB of ROM

avr6[2]

__AVR_ARCH__=6 __AVR_MEGA__[5] __AVR_ENHANCED__[5] __AVR_HAVE_JMP_CALL__[4] __AVR_HAVE_MOVW__[1] __AVR_HAVE_LPMX__[1] __AVR_HAVE_MUL__[1] __AVR_HAVE_RAMPZ__[4] __AVR_HAVE_ELPM__[4] __AVR_HAVE_ELPMX__[4] __AVR_3_BYTE_PC__[2]

"Enhanced" CPU core, 256 KB of ROM

[1] New in GCC 4.2 [2] Unofficial patch for GCC 4.1 [3] New in GCC 4.2.3 [4] New in GCC 4.3 [5] Obsolete.

By default, code is generated for the avr2 architecture.

Note that when only using -mmcu=architecture but no -mmcu=MCU type, including the file <avr/io.h> cannot work since it cannot decide which device's definitions to select.

The following MCU types are currently understood by avr-gcc. The table matches them against the corresponding avr-gcc architecture name, and shows the preprocessor symbol declared by the -mmcu option.

Architecture

MCU name

Macro

avr1

at90s1200

__AVR_AT90S1200__

avr1

attiny11

__AVR_ATtiny11__

avr1

attiny12

__AVR_ATtiny12__

avr1

attiny15

__AVR_ATtiny15__

avr1

attiny28

__AVR_ATtiny28__

avr2

at90s2313

__AVR_AT90S2313__

avr2

at90s2323

__AVR_AT90S2323__

avr2

at90s2333

__AVR_AT90S2333__

avr2

at90s2343

__AVR_AT90S2343__

avr2

attiny22

__AVR_ATtiny22__

avr2

attiny26

__AVR_ATtiny26__

avr2

at90s4414

__AVR_AT90S4414__

avr2

at90s4433

__AVR_AT90S4433__

avr2

at90s4434

__AVR_AT90S4434__

avr2

at90s8515

__AVR_AT90S8515__

avr2

at90c8534

__AVR_AT90C8534__

avr2

at90s8535

__AVR_AT90S8535__

avr2/avr25[1]

at86rf401

__AVR_AT86RF401__

avr2/avr25[1]

ata6289

__AVR_ATA6289__

avr2/avr25[1]

ata5272

__AVR_ATA5272__

avr2/avr25[1]

ata6616c

__AVR_ATA6616C__

avr2/avr25[1]

attiny13

__AVR_ATtiny13__

avr2/avr25[1]

attiny13a

__AVR_ATtiny13A__

avr2/avr25[1]

attiny2313

__AVR_ATtiny2313__

avr2/avr25[1]

attiny2313a

__AVR_ATtiny2313A__

avr2/avr25[1]

attiny24

__AVR_ATtiny24__

avr2/avr25[1]

attiny24a

__AVR_ATtiny24A__

avr2/avr25[1]

attiny25

__AVR_ATtiny25__

avr2/avr25[1]

attiny261

__AVR_ATtiny261__

avr2/avr25[1]

attiny261a

__AVR_ATtiny261A__

avr2/avr25[1]

attiny4313

__AVR_ATtiny4313__

avr2/avr25[1]

attiny43u

__AVR_ATtiny43U__

avr2/avr25[1]

attiny44

__AVR_ATtiny44__

avr2/avr25[1]

attiny44a

__AVR_ATtiny44A__

avr2/avr25[1]

attiny441

__AVR_ATtiny441__

avr2/avr25[1]

attiny45

__AVR_ATtiny45__

avr2/avr25[1]

attiny461

__AVR_ATtiny461__

avr2/avr25[1]

attiny461a

__AVR_ATtiny461A__

avr2/avr25[1]

attiny48

__AVR_ATtiny48__

avr2/avr25[1]

attiny828

__AVR_ATtiny828__

avr2/avr25[1]

attiny84

__AVR_ATtiny84__

avr2/avr25[1]

attiny84a

__AVR_ATtiny84A__

avr2/avr25[1]

attiny841

__AVR_ATtiny841__

avr2/avr25[1]

attiny85

__AVR_ATtiny85__

avr2/avr25[1]

attiny861

__AVR_ATtiny861__

avr2/avr25[1]

attiny861a

__AVR_ATtiny861A__

avr2/avr25[1]

attiny87

__AVR_ATtiny87__

avr2/avr25[1]

attiny88

__AVR_ATtiny88__

avr3

atmega603

__AVR_ATmega603__

avr3

at43usb355

__AVR_AT43USB355__

avr3/avr31[3]

atmega103

__AVR_ATmega103__

avr3/avr31[3]

at43usb320

__AVR_AT43USB320__

avr3/avr35[2]

at90usb82

__AVR_AT90USB82__

avr3/avr35[2]

at90usb162

__AVR_AT90USB162__

avr3/avr35[2]

ata5505

__AVR_ATA5505__

avr3/avr35[2]

ata6617c

__AVR_ATA6617C__

avr3/avr35[2]

ata664251

__AVR_ATA664251__

avr3/avr35[2]

atmega8u2

__AVR_ATmega8U2__

avr3/avr35[2]

atmega16u2

__AVR_ATmega16U2__

avr3/avr35[2]

atmega32u2

__AVR_ATmega32U2__

avr3/avr35[2]

attiny167

__AVR_ATtiny167__

avr3/avr35[2]

attiny1634

__AVR_ATtiny1634__

avr3

at76c711

__AVR_AT76C711__

avr4

ata6285

__AVR_ATA6285__

avr4

ata6286

__AVR_ATA6286__

avr4

ata6612c

__AVR_ATA6612C__

avr4

atmega48

__AVR_ATmega48__

avr4

atmega48a

__AVR_ATmega48A__

avr4

atmega48pa

__AVR_ATmega48PA__

avr4

atmega48p

__AVR_ATmega48P__

avr4

atmega8

__AVR_ATmega8__

avr4

atmega8a

__AVR_ATmega8A__

avr4

atmega8515

__AVR_ATmega8515__

avr4

atmega8535

__AVR_ATmega8535__

avr4

atmega88

__AVR_ATmega88__

avr4

atmega88a

__AVR_ATmega88A__

avr4

atmega88p

__AVR_ATmega88P__

avr4

atmega88pa

__AVR_ATmega88PA__

avr4

atmega8hva

__AVR_ATmega8HVA__

avr4

at90pwm1

__AVR_AT90PWM1__

avr4

at90pwm2

__AVR_AT90PWM2__

avr4

at90pwm2b

__AVR_AT90PWM2B__

avr4

at90pwm3

__AVR_AT90PWM3__

avr4

at90pwm3b

__AVR_AT90PWM3B__

avr4

at90pwm81

__AVR_AT90PWM81__

avr5

at90can32

__AVR_AT90CAN32__

avr5

at90can64

__AVR_AT90CAN64__

avr5

at90pwm161

__AVR_AT90PWM161__

avr5

at90pwm216

__AVR_AT90PWM216__

avr5

at90pwm316

__AVR_AT90PWM316__

avr5

at90scr100

__AVR_AT90SCR100__

avr5

at90usb646

__AVR_AT90USB646__

avr5

at90usb647

__AVR_AT90USB647__

avr5

at94k

__AVR_AT94K__

avr5

atmega16

__AVR_ATmega16__

avr5

ata5790

__AVR_ATA5790__

avr5

ata5702m322

__AVR_ATA5702M322__

avr5

ata5782

__AVR_ATA5782__

avr5

ata6613c

__AVR_ATA6613C__

avr5

ata6614q

__AVR_ATA6614Q__

avr5

ata5790n

__AVR_ATA5790N__

avr5

ata5795

__AVR_ATA5795__

avr5

ata5831

__AVR_ATA5831__

avr5

atmega161

__AVR_ATmega161__

avr5

atmega162

__AVR_ATmega162__

avr5

atmega163

__AVR_ATmega163__

avr5

atmega164a

__AVR_ATmega164A__

avr5

atmega164p

__AVR_ATmega164P__

avr5

atmega164pa

__AVR_ATmega164PA__

avr5

atmega165

__AVR_ATmega165__

avr5

atmega165a

__AVR_ATmega165A__

avr5

atmega165p

__AVR_ATmega165P__

avr5

atmega165pa

__AVR_ATmega165PA__

avr5

atmega168

__AVR_ATmega168__

avr5

atmega168a

__AVR_ATmega168A__

avr5

atmega168p

__AVR_ATmega168P__

avr5

atmega168pa

__AVR_ATmega168PA__

avr5

atmega169

__AVR_ATmega169__

avr5

atmega169a

__AVR_ATmega169A__

avr5

atmega169p

__AVR_ATmega169P__

avr5

atmega169pa

__AVR_ATmega169PA__

avr5

atmega16a

__AVR_ATmega16A__

avr5

atmega16hva

__AVR_ATmega16HVA__

avr5

atmega16hva2

__AVR_ATmega16HVA2__

avr5

atmega16hvb

__AVR_ATmega16HVB__

avr5

atmega16hvbrevb

__AVR_ATmega16HVBREVB__

avr5

atmega16m1

__AVR_ATmega16M1__

avr5

atmega16u4

__AVR_ATmega16U4__

avr5

atmega32

__AVR_ATmega32__

avr5

atmega32a

__AVR_ATmega32A__

avr5

atmega323

__AVR_ATmega323__

avr5

atmega324a

__AVR_ATmega324A__

avr5

atmega324p

__AVR_ATmega324P__

avr5

atmega324pa

__AVR_ATmega324PA__

avr5

atmega325

__AVR_ATmega325__

avr5

atmega325a

__AVR_ATmega325A__

avr5

atmega325p

__AVR_ATmega325P__

avr5

atmega325pa

__AVR_ATmega325PA__

avr5

atmega3250

__AVR_ATmega3250__

avr5

atmega3250a

__AVR_ATmega3250A__

avr5

atmega3250p

__AVR_ATmega3250P__

avr5

atmega3250pa

__AVR_ATmega3250PA__

avr5

atmega328

__AVR_ATmega328__

avr5

atmega328p

__AVR_ATmega328P__

avr5

atmega329

__AVR_ATmega329__

avr5

atmega329a

__AVR_ATmega329A__

avr5

atmega329p

__AVR_ATmega329P__

avr5

atmega329pa

__AVR_ATmega329PA__

avr5

atmega3290

__AVR_ATmega3290__

avr5

atmega3290a

__AVR_ATmega3290A__

avr5

atmega3290p

__AVR_ATmega3290P__

avr5

atmega3290pa

__AVR_ATmega3290PA__

avr5

atmega32c1

__AVR_ATmega32C1__

avr5

atmega32hvb

__AVR_ATmega32HVB__

avr5

atmega32hvbrevb

__AVR_ATmega32HVBREVB__

avr5

atmega32m1

__AVR_ATmega32M1__

avr5

atmega32u4

__AVR_ATmega32U4__

avr5

atmega32u6

__AVR_ATmega32U6__

avr5

atmega406

__AVR_ATmega406__

avr5

atmega64rfr2

__AVR_ATmega64RFR2__

avr5

atmega644rfr2

__AVR_ATmega644RFR2__

avr5

atmega64

__AVR_ATmega64__

avr5

atmega64a

__AVR_ATmega64A__

avr5

atmega640

__AVR_ATmega640__

avr5

atmega644

__AVR_ATmega644__

avr5

atmega644a

__AVR_ATmega644A__

avr5

atmega644p

__AVR_ATmega644P__

avr5

atmega644pa

__AVR_ATmega644PA__

avr5

atmega645

__AVR_ATmega645__

avr5

atmega645a

__AVR_ATmega645A__

avr5

atmega645p

__AVR_ATmega645P__

avr5

atmega6450

__AVR_ATmega6450__

avr5

atmega6450a

__AVR_ATmega6450A__

avr5

atmega6450p

__AVR_ATmega6450P__

avr5

atmega649

__AVR_ATmega649__

avr5

atmega649a

__AVR_ATmega649A__

avr5

atmega6490

__AVR_ATmega6490__

avr5

atmega6490a

__AVR_ATmega6490A__

avr5

atmega6490p

__AVR_ATmega6490P__

avr5

atmega649p

__AVR_ATmega649P__

avr5

atmega64c1

__AVR_ATmega64C1__

avr5

atmega64hve

__AVR_ATmega64HVE__

avr5

atmega64hve2

__AVR_ATmega64HVE2__

avr5

atmega64m1

__AVR_ATmega64M1__

avr5

m3000

__AVR_M3000__

avr5/avr51[3]

at90can128

__AVR_AT90CAN128__

avr5/avr51[3]

at90usb1286

__AVR_AT90USB1286__

avr5/avr51[3]

at90usb1287

__AVR_AT90USB1287__

avr5/avr51[3]

atmega128

__AVR_ATmega128__

avr5/avr51[3]

atmega128a

__AVR_ATmega128A__

avr5/avr51[3]

atmega1280

__AVR_ATmega1280__

avr5/avr51[3]

atmega1281

__AVR_ATmega1281__

avr5/avr51[3]

atmega1284

__AVR_ATmega1284__

avr5/avr51[3]

atmega1284p

__AVR_ATmega1284P__

avr5/avr51[3]

atmega128rfr2

__AVR_ATmega128RFR2__

avr5/avr51[3]

atmega1284rfr2

__AVR_ATmega1284RFR2__

avr6

atmega2560

__AVR_ATmega2560__

avr6

atmega2561

__AVR_ATmega2561__

avr6

atmega256rfr2

__AVR_ATmega256RFR2__

avr6

atmega2564rfr2

__AVR_ATmega2564RFR2__

avrxmega2

atxmega16a4

__AVR_ATxmega16A4__

avrxmega2

atxmega16a4u

__AVR_ATxmega16A4U__

avrxmega2

atxmega16c4

__AVR_ATxmega16C4__

avrxmega2

atxmega16d4

__AVR_ATxmega16D4__

avrxmega2

atxmega32a4

__AVR_ATxmega32A4__

avrxmega2

atxmega32a4u

__AVR_ATxmega32A4U__

avrxmega2

atxmega32c3

__AVR_ATxmega32C3__

avrxmega2

atxmega32c4

__AVR_ATxmega32C4__

avrxmega2

atxmega32d3

__AVR_ATxmega32D3__

avrxmega2

atxmega32d4

__AVR_ATxmega32D4__

avrxmega2

atxmega8e5

__AVR_ATxmega8E5__

avrxmega2

atxmega16e5

__AVR_ATxmega16E5__

avrxmega2

atxmega32e5

__AVR_ATxmega32E5__

avrxmega4

atxmega64a3

__AVR_ATxmega64A3__

avrxmega4

atxmega64a3u

__AVR_ATxmega64A3U__

avrxmega4

atxmega64a4u

__AVR_ATxmega64A4U__

avrxmega4

atxmega64b1

__AVR_ATxmega64B1__

avrxmega4

atxmega64b3

__AVR_ATxmega64B3__

avrxmega4

atxmega64c3

__AVR_ATxmega64C3__

avrxmega4

atxmega64d3

__AVR_ATxmega64D3__

avrxmega4

atxmega64d4

__AVR_ATxmega64D4__

avrxmega5

atxmega64a1

__AVR_ATxmega64A1__

avrxmega5

atxmega64a1u

__AVR_ATxmega64A1U__

avrxmega6

atxmega128a3

__AVR_ATxmega128A3__

avrxmega6

atxmega128a3u

__AVR_ATxmega128A3U__

avrxmega6

atxmega128b1

__AVR_ATxmega128B1__

avrxmega6

atxmega128b3

__AVR_ATxmega128B3__

avrxmega6

atxmega128c3

__AVR_ATxmega128C3__

avrxmega6

atxmega128d3

__AVR_ATxmega128D3__

avrxmega6

atxmega128d4

__AVR_ATxmega128D4__

avrxmega6

atxmega192a3

__AVR_ATxmega192A3__

avrxmega6

atxmega192a3u

__AVR_ATxmega192A3U__

avrxmega6

atxmega192c3

__AVR_ATxmega192C3__

avrxmega6

atxmega192d3

__AVR_ATxmega192D3__

avrxmega6

atxmega256a3

__AVR_ATxmega256A3__

avrxmega6

atxmega256a3u

__AVR_ATxmega256A3U__

avrxmega6

atxmega256a3b

__AVR_ATxmega256A3B__

avrxmega6

atxmega256a3bu

__AVR_ATxmega256A3BU__

avrxmega6

atxmega256c3

__AVR_ATxmega256C3__

avrxmega6

atxmega256d3

__AVR_ATxmega256D3__

avrxmega6

atxmega384c3

__AVR_ATxmega384C3__

avrxmega6

atxmega384d3

__AVR_ATxmega384D3__

avrxmega7

atxmega128a1

__AVR_ATxmega128A1__

avrxmega7

atxmega128a1u

__AVR_ATxmega128A1U__

avrxmega7

atxmega128a4u

__AVR_ATxmega128A4U__

avrtiny10

attiny4

__AVR_ATtiny4__

avrtiny10

attiny5

__AVR_ATtiny5__

avrtiny10

attiny9

__AVR_ATtiny9__

avrtiny10

attiny10

__AVR_ATtiny10__

avrtiny10

attiny20

__AVR_ATtiny20__

avrtiny10

attiny40

__AVR_ATtiny40__

[1] 'avr25' architecture is new in GCC 4.2 [2] 'avr35' architecture is new in GCC 4.2.3 [3] 'avr31' and 'avr51' architectures is new in GCC 4.3

Change the order of register assignment. The default is

r24, r25, r18, r19, r20, r21, r22, r23, r30, r31, r26, r27, r28, r29, r17, r16, r15, r14, r13, r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r0, r1

Order 1 uses

r18, r19, r20, r21, r22, r23, r24, r25, r30, r31, r26, r27, r28, r29, r17, r16, r15, r14, r13, r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r0, r1

Order 2 uses

r25, r24, r23, r22, r21, r20, r19, r18, r30, r31, r26, r27, r28, r29, r17, r16, r15, r14, r13, r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0

Assume int to be an 8-bit integer. Note that this is not really supported by avr-libc, so it should normally not be used. The default is to use 16-bit integers.

Generates code that changes the stack pointer without disabling interrupts. Normally, the state of the status register SREG is saved in a temporary register, interrupts are disabled while changing the stack pointer, and SREG is restored.

Specifying this option will define the preprocessor macro __NO_INTERRUPTS__ to the value 1.

Use subroutines for function prologue/epilogue. For complex functions that use many registers (that needs to be saved/restored on function entry/exit), this saves some space at the cost of a slightly increased execution time.

Change only the low 8 bits of the stack pointer.

Deprecated, use -fno-jump-tables instead.

Use rjmp/rcall (limited range) on >8K devices. On avr2 and avr4 architectures (less than 8 KB or flash memory), this is always the case. On avr3 and avr5 architectures, calls and jumps to targets outside the current function will by default use jmp/call instructions that can cover the entire address range, but that require more flash ROM and execution time.

Dump the internal compilation result called "RTL" into comments in the generated assembler code. Used for debugging avr-gcc.

Dump the address, size, and relative cost of each statement into comments in the generated assembler code. Used for debugging avr-gcc.

Generate lots of debugging information to stderr.