Ram keyword (for functions) – Echelon Neuron C User Manual
Page 195

Neuron C Programmer’s Guide
183
offchip Keyword (for Functions and Data
Declarations)
The Neuron linker typically places code, const data, and far variables in off-chip
areas, if it can, and in on-chip areas when it must. However, the linker’s default
behavior is different when linking for flash memory. See
on page 184 for more information. To explicitly control the placement of these
objects, any data or function declaration can include the offchip keyword.
If the appropriate off-chip memory area is available, the object is placed in the
area. If the memory area is not available, the linker terminates with an error
message to that effect. Examples of using the offchip keyword are shown below:
far offchip int a;
// offchip RAMFAR
far eeprom offchip int b;
// offchip EEFAR
const eeprom offchip int c = init;
// offchip EECODE (no need for far kwd)
eeprom offchip void fn () {...}
// offchip EECODE
onchip Keyword (for Functions and Data
Declarations)
The Neuron linker typically places code, const data, and far variables in off-chip
areas, if it can, and in on-chip areas when it must. To explicitly control the
placement of these objects, any data or function declaration can include the
onchip keyword. If the appropriate on-chip memory area is available, the object
is placed in the area. If the memory area is not available, the linker terminates
with an error message to that effect. See
on page 184 for
more information. Examples of using the onchip keyword are shown below:
far onchip int a;
// onchip RAMFAR
far eeprom onchip int b;
// onchip EEFAR
const eeprom onchip int c = init;
// onchip EECODE (no need for far kwd)
eeprom onchip void fn () {...}
// onchip EECODE – would be in EEPROM
// even without the eeprom keyword
The onchip keyword is useful for moving data to on-chip EEPROM when off-chip
flash memory is used. The on-chip EEPROM supports more write cycles than off-
chip flash memory. Frequently updated EEPROM variables should be located
on-chip when off-chip flash memory is used. See the EEPROM vendor’s data
sheets for maximum write specifications.
ram Keyword (for Functions)
By default, functions and other executable code, as well as const data, are all
placed in ROM, if available (on the Neuron 3150 Chip or FT 3150 Smart
Transceiver), and then in off-chip or on-chip EECODE. You can redirect
functions to the off-chip RAMCODE area of memory by including the ram
keyword in the Neuron C function definition. The RAMCODE area is only
available in off-chip RAM memory attached to a Neuron 3150 Chip or FT 3150
Smart Transceiver. The RAM must be non-volatile (for example, battery-backed),