AnsweredAssumed Answered

Problem with putting a function in global memory

Question asked by Steve Barriault on Apr 14, 2009
Latest reply on Apr 27, 2009 by Steve Barriault

Hi there:

 

Sorry - I already posted a similar message in another section of the forum, but I realized that this is the right forum for this question. If a mod wants to remove my other message, please do.

 

My environment: XDP512 on simulator, using the banked memory model on CW 4.6.

 

Basically, I have a function that goes above 12K (code) that I want to put in a global memory allocation in ROM. I used #pragma CODE_SEG __FAR_SEG MY_GLOBAL_SPACE at the beginning of my function (I do not have a header file where these are defined), and at the end of the function I put #pragma CODE_SEG DEFAULT.

 

Here's an excerpt of my PRM:

 

      PAGE_FB       = READ_ONLY   0xFB8000 TO 0xFBBFFF; 

      PAGE_FC       = READ_ONLY   0xFC8000 TO 0xFCBFFF;
      PAGE_FD       = READ_ONLY   0xFD8000 TO 0xFDBFFF;

/*    PAGE_FE       = READ_ONLY   0xFE8000 TO 0xFEBFFF; */
/*    PAGE_FF       = READ_ONLY   0xFF8000 TO 0xFFBFFF; intentionally not defined: equivalent to ROM_C000 */

      GLOBAL_ROM    = READ_ONLY   0x7F8000'G TO 0x7FFFFF'G;

 

If the function is <12K, Code Warrior readily puts this function inside that global space. No problem there.

 

If the function is >= 12K, then the program compiles and links fine, but when executing, upon loading HIWAVE complains of several faults. Here are some of these faults (most of them repeat):


main 0xFB8000'L T
STARTED
RUNNING
FCS Warning (ID 26): reading from reserved register at pc = 0xfb801e'L. Value: 0x0, Memory Address: 0x5. MEBI module is affected.
...
FCS Warning (ID 13): writing to unimplemented register at pc = 0xfb8022'L. Value: 0x0, Memory Address: 0xB0. IIC module not implemented
FCS Warning (ID 13): writing to unimplemented register at pc = 0xfb8022'L. Value: 0x0, Memory Address: 0xB1. IIC module not implemented
FCS Warning (ID 25): writing to reserved register at pc = 0xfb8022'L. Value: 0x0, Memory Address: 0xDC. SPI module is affected.

...

 

Etc. And then finally:


No memory at [384'G:1]

 

The problem is that I am not sure how I end up violating memory in PAGE_FB when I am not trying to access it. It seems my main gets put in there and somehow ends up causing a fault. 

 

COuld you help me shed some light on what is going on here? Is it possible to have a function that is larger than 12K here?

 

Best Regards,

 

Steve

Outcomes