Jump to content

Rom Array Bug?


Recommended Posts

I've been able to use rom character arrays in other modules, but I'm having trouble with the code below. It looks correct to me, if I'm understanding the 'rom' keyword correctly. Is this a compiler bug, or am I overlooking something?

 

Source:

 

unsigned char crc;

// CRC arrays for the nibble-wise routine.
rom char* r1 = {
0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 
0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41, 
};

rom char* r2 = {
0x00, 0x9d, 0x23, 0xbe, 0x46, 0xdb, 0x65, 0xf8,
0x8c, 0x11, 0xaf, 0x32, 0xca, 0x57, 0xe9, 0x74
};

unsigned char crc8(unsigned char data)
{
unsigned char i = (data ^ crc);

crc = r1[i & 0xf] ^ r2[i >> 4];
return crc;
}

 

I get these errors:

 

failure
...\romArrayBug.c(19:8): error: failed to generate expression
...\romArrayBug.c(19:8): error: invalid operand 'r1[i & 0xf] '
...\romArrayBug.c(19:20): error: failed to generate expression
...\romArrayBug.c(19:20): error: invalid operand '^ '
...\romArrayBug.c(19:6): error: failed to generate expression

 

IDE version: 6.60

Compiler: BoostC 6.60

Target device: PIC16F688

OS: XP Pro SP2

Link to post
Share on other sites
I get these errors:

 

failure
...\romArrayBug.c(19:8): error: failed to generate expression
...\romArrayBug.c(19:8): error: invalid operand 'r1[i & 0xf] '
...\romArrayBug.c(19:20): error: failed to generate expression
...\romArrayBug.c(19:20): error: invalid operand '^ '
...\romArrayBug.c(19:6): error: failed to generate expression

Missing #include <system.h> ?

 

Regards

Dave

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...