1. We will be in Read Only mode (no new threads, replies, registration) starting at 9:00 EDT for a number of hours as we migrate the forums to upgraded software.

Variable Initialization too large

Discussion in 'Embedded Systems and Microcontrollers' started by DrStu, Feb 14, 2009.

  1. DrStu

    Thread Starter New Member

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

    I'm trying to initialize a 2D array variable:
    Code ( (Unknown Language)):
    1.  
    2. long testArray[5][32];
    3.  
    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,
    Code ( (Unknown Language)):
    1.  
    2. long testArray[2][32];
    3.  
    it works.....anything more than that does not work
     
  2. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    55
    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.
     
Loading...