This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SEGMENT TOO LARGE

Hi,
first of all, thanks a lot to Dan Henry and Drew Davis for their answers about generic pointers.

And now my problem is: compiling this dummy code I get the following error:

void tst_mem_large() large
{
   { char data buf [128] = ""; }
   { char data buf [128] = ""; }
}

...error C249: 'DATA': SEGMENT TOO LARGE


But why is there NO ERRORS in this sample?

void tst_mem_small() small
{
   { char data buf [128] = ""; }
   { char data buf [128] = ""; }
}

... 0 Error(s), 0 Warning(s).


Thank you.

Parents
  • I'd send this example to Keil support via email. (This forum isn't an official method of support, though Keil employees to read messages and respond.)

    I suspect the compiler is being challenged in this case :)

    I had run some experiments on block declarations with version 7, and found that the compiler did not take advantage of that information for overlaying. Essentially the variables were all promoted out of their block and existed at the level of the enclosing function. Perhaps version 8 has more capabilities in this regard.

    But the memory model shouldn't make a difference. In one case, the memory qualifer ("data") matches the default for the memory model, and in the other, it does not. (The experiment of declaring the variables "xdata" and seeing if they overlay in either or both cases suggests itself. Perhaps the overlaying only occurs with small model, or perhaps it only occurs when the memory qualifers match, or perhaps something else.)

Reply
  • I'd send this example to Keil support via email. (This forum isn't an official method of support, though Keil employees to read messages and respond.)

    I suspect the compiler is being challenged in this case :)

    I had run some experiments on block declarations with version 7, and found that the compiler did not take advantage of that information for overlaying. Essentially the variables were all promoted out of their block and existed at the level of the enclosing function. Perhaps version 8 has more capabilities in this regard.

    But the memory model shouldn't make a difference. In one case, the memory qualifer ("data") matches the default for the memory model, and in the other, it does not. (The experiment of declaring the variables "xdata" and seeing if they overlay in either or both cases suggests itself. Perhaps the overlaying only occurs with small model, or perhaps it only occurs when the memory qualifers match, or perhaps something else.)

Children