We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a C8051F340 cygnal processor and a section of code that does a CRC calculation. The calculation uses a 256 variable 16 bit integer thats initialized at compile time. Like this: static const uint16_t fcstab[256] = { initialization values };
The code compiles, but locks up before it gets to main with this variable and its initialization. If i take out the initialization and leave the variable simply declared, the code runs fine.
I've tried pdata, and idata keywords, but it seems like the array is too large. Any ideas? Thanks.
"'code' instead of 'const' worked! What does the code keyword do?"
You should never consider a problem to be fixed if you don't understand why your changes fixed it...
The code keyword extension is described here:
http://www.keil.com/support/man/docs/c51/c51_le_code.htm http://www.keil.com/support/man/docs/c51/c51_le_pgmmem.htm
Sounds like you need to spend some time familiarising yourself with the contents of the C51 Manual
Possibly also the so-called "bible" for the 8051:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf