Keil Logo Arm Logo

Discussion Forum

Problems with CRC table

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Jason Krein
Posted
29-Jan-2007 18:34 GMT
Toolset
None
New! Problems with CRC table

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.

Read-Only
Author
erik malund
Posted
29-Jan-2007 18:40 GMT
Toolset
None
New! RE: Problems with CRC table

static const uint16_t fcstab[256] = { initialization values };
Guessing that your uint16_t does not include a memory area qualifier, you are "initializing" the registers, the stack and each and every DATA and IDAT variable.

"initializing" the stack in the middle of the code WILL blow whatever you are doing.

Erik

PS why have you declared the toolset 'none' the F340 (at least regarding tools) is a '51.

Read-Only
Author
Hans-Bernhard Broeker
Posted
29-Jan-2007 18:58 GMT
Toolset
None
New! RE: Problems with CRC table
static const uint16_t fcstab[256] = { initialization values };


Write "code" instead of "const", and it'll probably work out a good deal better.

Read-Only
Author
Jason Krein
Posted
29-Jan-2007 20:13 GMT
Toolset
C51
New! RE: Problems with CRC table

Thanks! "code" instead of "const" worked! What does the code keyword do?

Read-Only
Author
Andy Neil
Posted
29-Jan-2007 23:00 GMT
Toolset
C51
New! RTFM!

"'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:
http://www.nxp.com/acrobat_download/various/80C51_FAM_ARCH_1.pdf

Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set:
http://www.nxp.com/acrobat_download/various/80C51_FAM_PROG_GUIDE_1.pdf

Chapter 3 - 80C51 Family Hardware Description:
http://www.nxp.com/acrobat_download/various/80C51_FAM_HARDWARE_1.pdf

Next Thread | Thread List | Previous Thread Start a Thread | Settings

arm-logo-small

Keil logo
Important information

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