User’s Manual
45
5.2.4 SRAM Use
The RCM4510W module has a battery-backed data SRAM and a program-execution SRAM.
Dynamic C provides the
protected
keyword to identify variables that are to be placed into the
battery-backed SRAM. The compiler generates code that maintains two copies of each protected
variable in the battery-backed SRAM. The compiler also generates a flag to indicate which copy of
the protected variable is valid at the current time. This flag is also stored in the battery-backed
SRAM. When a protected variable is updated, the “inactive” copy is modified, and is made
“active” only when the update is 100% complete. This assures the integrity of the data in case a
reset or a power failure occurs during the update process. At power-on the application program
uses the active copy of the variable pointed to by its associated flag.
The sample code below shows how a protected variable is defined and how its value can be
restored.
main() {
protected int state1, state2, state3;
...
_sysIsSoftReset(); // restore any protected variables
Additional information on
protected
variables is available in the
Dynamic C User’s Manual
.
5.2.5 RCM4510W Cloning
The RCM4510W does not have a pull-up resistor on the PB1 (CLKA) line of the programming
port. Because of this, the procedure to generate clones from the RCM4510W differs from that
used for other RabbitCore modules and single-boards computers. You must set the
CL_FORCE_
MASTER_MODE
macro to 1 in the Dynamic C
LIB\Rabbit4000\BIOSLIB\CLONECONFIG.LIB
library to use the RCM4510W as a master for cloning. An RCM4510W master will not run the
application, and further debugging is not possible as long as the
CL_FORCE_MASTER_MODE
macro is set to 1. Any cloned RCM4510W modules will be “sterile,” meaning that they cannot be
used as a master for cloning. To develop and debug an application on an RCM4510W, comment
out the
CL_FORCE_MASTER_MODE
macro or set it to 0.
NOTE:
Instead of defining this macro is your application, you may simply add the line
CL_
FORCE_MASTER_MODE=1
under the Dynamic C
Options > Project Options
“Defines”
tab, then click
OK
. When you recompile your program, this will have the same effect as setting
the macro to 1 within the
CLONECONFIG.LIB
library.
See Technical Note TN207,
Rabbit Cloning Board
, for additional information on Rabbit’s clon-
ing board and how cloning is done.