Home/Support/Support Forum/Out of constant data space
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Out of constant data space

+1 vote
We are using RCM6760. The message during compiling shown the code size is 292k bytes when compiled successfully. We like to add about 50 bytes string literals then got the following error:

line 1 : ERROR MEM.LIB : Out of constant data space. Please refer to the Dynamic C User's Manual for more information.

The following is from the map file:
Root Code 0000:0000 003c76
Root Data 0010:33ae 0087c9
Xmem Code 0000:e760 04ba24

I believe 292k bytes is still under the memory size limit which is 1M RAM and 1M flash. Would you suggest any reason why getting this error?

Thanks,
asked Nov 5 in Rabbit Software by andyfung New to the Community (2 points)

Please log in or register to answer this question.

1 Answer

0 votes
You need to start moving some of your constant data into far memory using the "far" keyword in the declaration.

There's a good discussion in this forum question: https://www.digi.com/support/forum/29188/out-of-constant-data-space

One of the solutions for that poster was to list "ROOT_SIZE_4K=6U" in the project's macro list. Be sure you have enabled "Separate Instruction & Data" space in the compiler options as well. You can take that macro up to 9U, as recommended in Device_Cloud.lib:

#define CLOUD_VERBOSE
If defined, turns on debugging printfs for all Device Cloud subsystems. This can cause shortage of root constant space. If so, add ROOT_SIZE_4K=9U in the project defines box, and turn on the separate I and D option in the compiler settings.

And this Forum question provides some additional background information on memory configuration:
https://www.digi.com/support/forum/58707/out-of-xmem-code-space-when-there-should-be-plenty-of-xmem-left
answered Nov 5 by TomCollins Veteran of the Digi Community (1,453 points)
...