Atmel CAVR-4 사용자 설명서
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:
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.
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.
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
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.
executed.
1) --eeprom_size ≤ 256 bytes
2) --eeprom_size ≥ 512 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