Keil™, An ARM® Company

Technical Support

C166: PUTTING INITIALIZED VARIABLES IN XDATA

Information in this article applies to:

  • C166 Version 3.12
  • C166 Version 4.03

SYMPTOMS

I have a very large program with many large, initialized variables. When I build my project, I receive one of the following error messages:

*** ERROR 172 IN LINE 9 OF test.c: 'HDATA0': length exceeded: act=172032, max=65536
Error 106: Section Overflow
Section: ?C_INITSEC

CAUSE

This error occurs because the section used to initialize global variables is overflowing. The following example program demonstrates this error.

int big_array1 [0x7000] = { 1, 2, 3, 4, };
int big_array2 [0x7000] = { 1, 2, 3, 4, };
int big_array3 [0x7000] = { 1, 2, 3, 4, };

void main (void)
{
}

RESOLUTION

The best solution is to place some of your variables in XDATA by using the XHUGE memory type when you declare the variable. For example:

int xhuge big_array1 [0x7000] = { 1, 2, 3, 4, };
int xhuge big_array2 [0x7000] = { 1, 2, 3, 4, };
int xhuge big_array3 [0x7000] = { 1, 2, 3, 4, };

void main (void)
{
}

MORE INFORMATION

  • Refer to xhuge in the C166 User's Guide.

SEE ALSO

Last Reviewed: Friday, July 15, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure