This is a linker default limitation. There is a method for supporting stacks > 256 as outlined in the MCC18 user guide, it involves merging multiple banks of registers. This seems to work for variable space too, but there may be limitations I'm unaware of. The code would need to be thoroughly reviewed and tested but this should work as I've seen it used on other PIC projects.
In the linker file, change:
Code:
DATABANK NAME=gpr6 START=0x600 END=0x6FF
DATABANK NAME=gpr7 START=0x700 END=0x7FF
to
DATABANK NAME=gpr6 START=0x600 END=0x7FF
//DATABANK NAME=gpr7 START=0x700 END=0x7FF
This merges two banks into one available segment. There are run-time costs associated with doing this so it isn't recommended practice.
I built three int [11][5] arrays and got the same linker error. Then I merged the banks and did it again and it will link. I poked at some of the arrays with C code and looked at the machine code -- it looks correct.
Code:
int vars1[11][5];
int vars2[11][5];
int vars3[11][5];
void testtest1( void )
{
static int var;
static int *ptr;
static int row,col;
var = vars1[4][3];
var = vars2[8][4];
376: var = vars3[3][1];
05762 C6FF MOVFF 0x6ff, 0x74d
05764 F74D NOP
05766 C700 MOVFF 0x700, 0x74e
05768 F74E NOP
377: var = vars3[3][2];
0576A C701 MOVFF 0x701, 0x74d
0576C F74D NOP
0576E C702 MOVFF 0x702, 0x74e
05770 F74E NOP
var = vars3[6][2];
for (row=0; row<11; row++)
for (col=0; col<5; col++)
var = vars2[row][col];
ptr = &vars3[0][0];
var = *ptr++;
}