When locking registers in user code, the same set of registers must be locked in the library you are using.
Since the pre-built libraries delivered with the product do not lock any registers, a library function may potentially use of any of the lockable registers. Any such resource conflict between locked registers and compiler-used registers will be reported at link time.
If register-locking is necessary in user code, the library must therefore be rebuilt with the same set of locked registers.
Consider these declarations:
__eeprom int i1 = 0xFFFF; __eeprom const int i2 = 0xFFFF; __eeprom __no_init int i3; __eeprom __no_init int i4@0x10; __eeprom const int i5@0x12 = 0xFFFF;The variables i1 and i2 will be stored in the EEPROM_I segment. They will be initialized at program download, but not reinitialized on a program reset.
The variable i3 will be stored in the EEPROM_N segment and is not initialized at program download or a program reset.
The variables i4 and i5 will be stored in the EEPROM_AN segment. Only i5 will be initialized at program download. None of the variables will be reinitialized on a program reset.
__regvar __no_init type_name variable_name @ location
__regvar __no_init int counter @ 14;This will create the 16-bit integer variable counter, which will always be available in R15:R14. Please note that at least two registers must be locked (using the command line switch --lock_regs which is described in the manuals).
This intrinsic function reverses the byte order of the value given as parameter. Avoid using __reverse in complex expressions as it might introduce extra register copying.
--no_clustering
DESCRIPTION
This option will disable clustering of variables. Clustered variables may be accessed through a common base pointer which will, in most cases, reduce the size of the generated code.
--enable_external_bus
DESCRIPTION
This option will make the compiler add the special __require statement which will make XLINK include the code in CSTARTUP that enables the external data bus.
--do_cross_call
DESCRIPTION
Using this option will force the compiler to run the cross-call optimizer, regardless of the optimization level. The cross-call optimizer is otherwise only run at high size optimization (z9).
--zero_register
DESCRIPTION
Tell the compiler to use R15 as zero register. This will, in most cases, reduce the size of the generated code, but may be incompatible with the supplied run-time libraries. The linker will issue a link-time error if any incompatibilities arise.
--64k_flash
DESCRIPTION
This option is only usable together with the -v2, -v3, and -v4 processor options. It tells the compiler that the intended target processor does not have more than 64 Kbytes program flash memory, and that the AVR core therefore does not have the RAMPZ register nor the ELPM instruction.
RSEG MY_CODE
RSEG CODE
_TID = __orderInterrupt("0x0E", #CYCLES + 256L * (256L - _TCNT), 256L * 256L, 0, 0, 100);
Copyright 2000-2001 IAR Systems. All rights reserved.