| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.17.4.3 AVR Built-in Macros
GCC defines several built-in macros so that the user code can test
for the presence or absence of features. Almost any of the following
built-in macros are deduced from device capabilities and thus
triggered by the -mmcu= command-line option.
For even more AVR-specific built-in macros see AVR Named Address Spaces and AVR Built-in Functions.
__AVR_ARCH__Build-in macro that resolves to a decimal number that identifies the architecture and depends on the
-mmcu=mcuoption. Possible values are:2,25,3,31,35,4,5,51,6,102,104,105,106,107for mcu=
avr2,avr25,avr3,avr31,avr35,avr4,avr5,avr51,avr6,avrxmega2,avrxmega4,avrxmega5,avrxmega6,avrxmega7, respectively. If mcu specifies a device, this built-in macro is set accordingly. For example, with-mmcu=atmega8the macro will be defined to4.__AVR_Device__Setting
-mmcu=devicedefines this built-in macro which reflects the device’s name. For example,-mmcu=atmega8defines the built-in macro__AVR_ATmega8__,-mmcu=attiny261adefines__AVR_ATtiny261A__, etc.The built-in macros’ names follow the scheme
__AVR_Device__where Device is the device name as from the AVR user manual. The difference between Device in the built-in macro and device in-mmcu=deviceis that the latter is always lowercase.If device is not a device but only a core architecture like
avr51, this macro will not be defined.__AVR_XMEGA__The device / architecture belongs to the XMEGA family of devices.
__AVR_HAVE_ELPM__The device has the the
ELPMinstruction.__AVR_HAVE_ELPMX__The device has the
ELPM Rn,ZandELPM Rn,Z+instructions.__AVR_HAVE_MOVW__The device has the
MOVWinstruction to perform 16-bit register-register moves.__AVR_HAVE_LPMX__The device has the
LPM Rn,ZandLPM Rn,Z+instructions.__AVR_HAVE_MUL__The device has a hardware multiplier.
__AVR_HAVE_JMP_CALL__The device has the
JMPandCALLinstructions. This is the case for devices with at least 16 KiB of program memory.__AVR_HAVE_EIJMP_EICALL____AVR_3_BYTE_PC__The device has the
EIJMPandEICALLinstructions. This is the case for devices with more than 128 KiB of program memory. This also means that the program counter (PC) is 3 bytes wide.__AVR_2_BYTE_PC__The program counter (PC) is 2 bytes wide. This is the case for devices with up to 128 KiB of program memory.
__AVR_HAVE_8BIT_SP____AVR_HAVE_16BIT_SP__The stack pointer (SP) register is treated as 8-bit respectively 16-bit register by the compiler. The definition of these macros is affected by
-mtiny-stack.__AVR_HAVE_SPH____AVR_SP8__The device has the SPH (high part of stack pointer) special function register or has an 8-bit stack pointer, respectively. The definition of these macros is affected by
-mmcu=and in the cases of-mmcu=avr2and-mmcu=avr25also by-msp8.__AVR_HAVE_RAMPD____AVR_HAVE_RAMPX____AVR_HAVE_RAMPY____AVR_HAVE_RAMPZ__The device has the
RAMPD,RAMPX,RAMPY,RAMPZspecial function register, respectively.__NO_INTERRUPTS__This macro reflects the
-mno-interruptscommand line option.__AVR_ERRATA_SKIP____AVR_ERRATA_SKIP_JMP_CALL__Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit instructions because of a hardware erratum. Skip instructions are
SBRS,SBRC,SBIS,SBICandCPSE. The second macro is only defined if__AVR_HAVE_JMP_CALL__is also set.__AVR_SFR_OFFSET__=offsetInstructions that can address I/O special function registers directly like
IN,OUT,SBI, etc. may use a different address as if addressed by an instruction to access RAM likeLDorSTS. This offset depends on the device architecture and has to be subtracted from the RAM address in order to get the respective I/O address.__WITH_AVRLIBC__The compiler is configured to be used together with AVR-Libc. See the
--with-avrlibcconfigure option.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on October 19, 2013 using texi2html 5.0.
