Far keyword (for data declarations) – Echelon Neuron C User Manual

Page 194

Advertising
background image

182 Memory

Management

eeprom variables. Restarting a device or powering it up does

not

re-initialize the

eeprom variables – they retain their existing values from before the restart or
power outage. For an exception to these initialization rules, see the description of

the uninit keyword, below.
Writing a value in on-chip EEPROM typically takes approximately 20 ms before
the value takes effect (though this time can vary depending on the particular

chip). If the device loses power or is reset during this write time, the value might
not have been written or, if written, the value might not be non-volatile.

far Keyword (for Data Declarations)

When data objects do not fit into the RAMNEAR area of memory, the following

linker error messages appear:

Error: No more memory in RAMNEAR area
Error: Could not relocate segment in file ‘<program>.no’

You can direct the linker to put the objects into the RAMFAR area of memory by
including the far keyword in the Neuron C data declaration. For example, the

following declaration moves

varname

to the RAMFAR area:

far int varname;

To direct the linker to put the objects into the RAMFAR area of memory within

the NodeBuilder CodeWizard:

1. Right-click the network variable and select Properties to open the NV

Properties dialog.

2. Within the NV Properties dialog, click Advanced to open the Advanced

NV Properties dialog.

3. Within the Advanced NV Properties dialog, select far. Click OK to close

the dialog.

4. Within the NV Properties dialog, click OK to close the dialog.

Similarly, when config or eeprom objects do not fit into the EENEAR area of
memory, the following messages appear:

Error: No more memory in EENEAR area
Error: Could not relocate segment in file ‘<program>.no’

You can direct the linker to put the objects into the EEFAR area of memory by

also including the far keyword in the Neuron C data declaration. For example,

the following declaration moves

varname

to the EEFAR area:

far eeprom int varname;

You could, for example, move a data table that is too large to fit into the
EENEAR area to the EEFAR area of memory using this type of declaration.
As a general guideline, leave data that is

more

frequently used in the NEAR

areas of memory if possible. Use of the NEAR areas generates relatively smaller

instructions (which additionally execute in fewer cycles) than use of the FAR

areas. Arrays that are referenced only with non-constant indices or pointers can
be placed in FAR memory with no loss of efficiency.

Advertising