AnsweredAssumed Answered

const in ROM?

Question asked by Doug Paulsen on Mar 7, 2014
Latest reply on Mar 7, 2014 by Doug Paulsen

This should really one of those entry level C programming questions, but in CW 6.3, I'm finding my expectations for the keyword "const" not to match CW's output.  The following declaration seems to be putting bmask into RAM (where #define UINT8 unsigned char):

 

     UINT8 const bmask[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };

 

I suppose so long as one has RAM to spare and CW initializes the array (not yet determined) I shouldn't really care.  Elsewhere, however, I've got some huge structures which would be an utter waste of resources to keep in RAM.

 

I've tried #pragma INTO_ROM.  I get a "Warning : illegal pragma" for my effort. 

 

Elsewhere, I've seen reverences to add -Cc to the linker command line.  I can't translate that into action using the IDE.

 

Are there tricks to get classic CW to store initialized arrays and structures in ROM?

 

Thanks!

doug

Outcomes