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
Are you sure on volatile? I'm looking at some code from another programmer who built some PIC routines, and I see they use volatile on both the definition and declaration.
Are you sure that the compiler cares? If you add volatile to the definition or not when you initialize the variable, the compiler doesn't utter a warning / error either way. I'm sure there is some way (memory map or something) to see if the variable is being optimized or not.
But for extern, you clearly need it in the declaration....
I actually appreciate the help Andrew! This like a master class in qualifiers...!
I have no skin in the game -- if the compiler wants volatile in both declaration and definition. It can have them!