AnsweredAssumed Answered

Handling large constants arrays with paging?

Question asked by Tim Drake on Nov 1, 2015
Latest reply on Nov 4, 2015 by ZhangJennie

I am having difficulty with using paging properly.  I have 32 kbytes of constant values that I need stored in arrays.  I can store the data in chunks as small as 1 kbyte or larger up to 9 kbytes.  I then need to transfer these constants to variables in 1Khz chunks for usage.  I have studied how paging works and feel I understand the concepts, but I am not convinced I have it programmed correctly. Here is a snippet: 

 

#pragma CONST_SEG __PPAGE_SEG PAGEDCONSTANTS1

volatile const short __far testwave_S [3584]={0, 0, 1301, 393, 0, -31470, 3, 8488, -28334,…..}

#pragma CONST_SEG __PPAGE_SEG DEFAULT

#pragma CONST_SEG __PPAGE_SEG PAGEDCONSTANTS2

volatile const short __far PHYwave_S [4608]={25908, 30594, -31982, 18178, 1860, 21617,….]

#pragma CONST_SEG __PPAGE_SEG DEFAULT

#pragma CONST_SEG __PPAGE_SEG PAGEDCONSTANTS3

volatile const short __far testwave_D [3584]={0, 0, 8215, 328, 0, -32746, 2, -27388, 25476,….}

#pragma CONST_SEG __PPAGE_SEG DEFAULT

#pragma CONST_SEG __PPAGE_SEG PAGEDCONSTANTS4

volatile const short __far PHYwave_D [4608]={16936, 9766, -32206, 25704, 584, 28691,….}

#pragma CONST_SEG __PPAGE_SEG DEFAULT

 

With the following added to my *.prm file:

      DEFAULT_ROM       INTO PAGE_01, PAGE_02, PAGE_03, PAGE_04, PAGE_05, PAGE_06, PAGE_07, PAGE_08, PAGE_09;

      PAGEDCONSTANTS1   INTO PAGE_0A;

      PAGEDCONSTANTS2   INTO PAGE_0B;

      PAGEDCONSTANTS3   INTO PAGE_0C;

      PAGEDCONSTANTS4   INTO PAGE_0E;

 

When I compile (using CodeWarrior for 9S12GA240 on an Esduino Xtreme board), I get the following error message:  Link Error: L4025: This limited version allows only 32768 bytes of C code.  My Main.c which includes the 32 kBytes on of constants has a file size of 36462 (>32768).  Considering that the 32 kBytes of constants = 32768, how do I get under? 

 

It appears I am not handling the constants right or paging properly.  Any advice? Where am I going wrong.  Thanks.

Outcomes