Specifications

CAVR-4
Part 2. Compiler reference
Extended keywords
205
asm, __asm
The asm and __asm extended keywords both insert an assembler instruction. However,
when compiling C source code, the
asm keyword is not available when the option
--strict_ansi is used. The __asm keyword is always available.
Note: Not all assembler directives or operators can be inserted using this keyword.
Syntax
asm ("string");
The string can be a valid assembler instruction or an assembler directive, but not a
comment. You can write several consecutive inline assembler instructions, for example:
asm ("Label: nop\n"
" jmp Label");
where \n (new line) separates each new assembler instruction. Note that you can define
and use local labels in inline assembler instructions.
For more information about inline assembler, see Mixing C and assembler, page 93.
__eeprom
Controls the storage of data objects in eeprom memory space.
The
__eeprom memory attribute allows you to place initialized and non-initialized
variables in the built-in EEPROM of the AVR microcontroller. These variables can be
used like any other variable and provide a convenient way to access the built-in
EEPROM.
You can also override the supplied support functions to make the __eeprom memory
attribute access an EEPROM or flash memory that is placed externally but not on the
normal data bus, for example on an I2C bus.
To do this, you must write a new EEPROM library routines file and include it in your
project. The new file must use the same interface as the
eeprom.s90 file in the
avr\src\lib\ directory (visible register use, the same entry points and the same
semantics).
Note: Variables declared
__eeprom are initialized only when a downloadable linker
output file is downloaded to the system, and not every time the system startup code is
executed.
1) --eeprom_size 256 bytes
2) --eeprom_size 512 bytes
Address range Max object size Pointer size Memory space
0-0xFF (255 bytes) 255 bytes 8 bits Eeprom
1)
0-0xFFFF (64 kbytes) 65535 bytes 16 bits Eeprom
2)
Table 55: EEPROM address ranges