Home/Support/Support Forum/Stored in SRAM RCM6700
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Stored in SRAM RCM6700

0 votes
I am using the Development Kit Rabbit RCM6700. I have a variable in the code to be stored in the SRAM. I declare:

#class auto
#memmap xmem
bbram typeStruct myStruct;

But the compiler takes me an error: "out of variable data space Please refer to the Dynamic C User's Manual for more information."

The RCM6700 has 1M of RAM and 32K of SRAM memory, there is some special statement to access the backup memory space? I am using Dynamic C and 10.72A and configure the compiler option "enable separate instruction & data spaces"

Help me please.... !
asked Jun 24, 2016 in Rabbit Software by jleon New to the Community (1 point)

Please log in or register to answer this question.

2 Answers

0 votes
For variables to be stored in BBRAM use the keyword 'protected'. This directs the compiler to store your variable in battery-backed RAM.

protected unsigned long MagicNumber;
protected int EPArule, tZone, pattern;
answered Jun 27, 2016 by mfuhrer New to the Community (4 points)
Be sure to reference the Dynamic C manual on how to properly use protected variables, including calling _sysIsSoftReset(); at the start of main to restore variables that may have been mid-write during a board reset.  Also note that "protected" probably won't work for a structure.
You are right Tom! I forgot about calling _sysIs....(), it's been a while for me ;-)
0 votes
How large is your struct? Know that some of the 32K of SRAM is reserved by the BIOS, specifically if you're using the FAT filesystem.

This test program of mine compiled fine:
#class auto #memmap xmem typedef struct { int a, b, c; } typeStruct; bbram typeStruct myStruct; int main() { return 1; }
answered Jun 28, 2016 by TomCollins Veteran of the Digi Community (1,453 points)