Echelon Neuron C User Manual

Page 211

Advertising
background image

Neuron C Programmer’s Guide

199

unsigned short int

controlReg2;

unsigned long int

dataReg;

} *PMemMapDev;

const PMemMapDev pDevice = (PMemMapDev) 0x8800;

void read() {
// Read from device ...
unsigned int x, y;
unsigned long z;

x = pDevice->controlReg1;
y = pDevice->controlReg2;
z = pDevice->dataReg;
}

void write() {
// Write to device ...
unsigned int x, y;
unsigned long z;

pDevice->controlReg1 = x;
pDevice->controlReg2 = y;
pDevice->dataReg = z;
}

What to Try When a Program Does Not Fit on a
Neuron Chip

The following discussion contains tips and techniques for reducing the EEPROM

requirements of a program for purposes of getting it to fit or having it use less
code space. Some of the techniques are tailored to a Neuron 3120 Chip or FT

3120 Smart Transceiver, but most are applicable to any Neuron C language

program. Most of these manual optimization techniques improve both aspects of
code size and code performance. The techniques below should be attempted

roughly in the order presented.

While the memory map for a Series 3100 device is usually fixed and defined by

hardware, some out-of-memory link-time errors for a Series 5000 chip can be

addressed by adjusting the memory map according to the application’s needs.
Although you cannot define the memory map to exceed the FT 5000 Smart

Transceiver’s or Neuron 5000 Processor’s inherent limits, you can increase or

decrease the amount of RAM available (at the expense of EEPROM or flash
memory available) in steps of 256 bytes.
Many of the suggestions presented in the sections that follow lead not only to

smaller code or data (to better fit the target device), but also lead to faster, more
efficient, code. It is, therefore, recommended that you familiarize yourself with

the all of the following recommendations, regardless of your preferred target

Neuron Chip or Smart Transceiver model.

The link map contains information about a program’s current memory usage.

The summary information includes an estimate of the additional memory
required. The link summary is optionally output to the BUILD.LOG file, and is

Advertising