Hi,
I'm wondering if I am doing something wrong here. I am trying to store an array for a large 256 byte look-up table.
I have a pretty small 8051 MCU of 8 KB flash memory (IROM), 256 bytes internal RAM (IRAM) and 256 bytes on-chip external RAM (XRAM).
Prior to adding this look-up table, my current build from Keil reports:
"Program Size: data=54.1 xdata=0 code=1984"
I take that to mean I am using 54 bytes of IRAM, 0 bytes of XRAM, and 1984 bytes of IROM?
Here is the variable declaration I am using:
code unsigned char CRC8LookupTable[256];
When I define the CRC8LookupTable and populate values, I get the Segment Too Large error.
If you use "code" doesn't that store the values in ROM, which I should have plenty of space for?
Is there something else I need to add to that variable declaration?
Thanks -Tim
So when I call the syntax for CODE bizarre, maybe you shouldn't be so dismissive cause that C Language has got a whole-lotta side-loops and exceptions all over the place. Lot of hands have touched it over the years.
OK, let's look at it
you have, in a module blah = ralph[i];
ralph is defined extern in an included header
the compiler, working on this module has no informationhus about 'ralph' except what is in that header thus it will (correctly) assume ralph is in DATA and create code accordingly. so if you want the compiler to use MOVC to access ralph, you must let the compiler working on that module know ralph is in code by including the qualifier on the definition in the header.
Just noticed this thread and was going to reply, but then saw what Erik says. He explains the requirement well. All that is meeded is a reaonable understanding of what a compiler does and what it is capable of.
Also, if you have this understanding for one environment, you will have a better chance of understanding for another.