Keil Logo

C166: Putting Initialized Variables in XDATA

Information in this article applies to:

  • C166 Version 3.12 and later

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: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.