Variable Initialization too large

Thread Starter

DrStu

Joined Dec 11, 2008
6
Hi all, (using PIC18F4550 with C18 Compiler)

I'm trying to initialize a 2D array variable:
Rich (BB code):
long testArray[5][32];
and i get this error msg:
Error - section '.udata_GlobalVariables.o' can not fit the section. Section '.udata_GlobalVariables.o' length=0x00000280

I've done searching at its sth like i dun have enuf program memory/RAM/ROM to INITIALIZE this variable.

So i'm juz wondering is there any way around this? ...or is this simply up to its limit......

btw,
Rich (BB code):
long testArray[2][32];
it works.....anything more than that does not work
 

AlexR

Joined Jan 16, 2008
732
Your problem is that the RAM in the PIC18/16 chips is internally divided into pages, each page is 256 byte long. Most C compilers for PICs (at least all compiler that I am familiar with) can not handle an array that crosses a page boundary so this limits the maximum array size to 256 bytes.
 
Top