Jump to content

Bug In Rom Char?


Recommended Posts

Version: SB 6.14 target is a PIC18F4620

#include <system.h>


rom char *table = "\0\36\71\106\139\171\199\225\248\11\25\35\39\38\30\16"
                 "\251\222\185\140\86\22\205\122\28\179\63\191\51\154\244\66"
                 "\129\179\214\235\241\231\206\165\108\35\201\94\225\84\181\3"
                 "\64\107\131\137\124\92\41\226\137\28\156\8\97\166\215\245"
                 "\255\245\215\166\97\8\156\28\137\226\41\92\124\137\131\107"
                 "\64\3\181\84\225\94\201\35\108\165\206\231\241\235\214\179"
                 "\129\66\244\154\51\191\63\179\28\122\205\22\86\140\185\222"
                 "\251\16\30\38\39\35\25\11\248\225\199\171\139\106\71\36"
                 "\0\220\185\150\117\85\56\30\8\245\231\221\216\218\225\239"
                 "\5\34\70\116\170\233\50\134\228\76\193\65\205\101\11\190"
                 "\126\76\41\20\14\24\49\90\147\220\54\161\30\171\75\252"
                 "\191\148\124\118\131\163\215\29\118\227\99\247\158\89\40\10"
                 "\0\10\40\89\158\247\99\227\118\29\215\163\131\118\124\148";


void main(void)
{

 while(1);

}

Result:

Building...

BoostC Optimizing C Compiler Version 6.14 (for PIC16 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

Licensed to Cornelis G.S. Kramer under Single user Full License for 1 node(s)

Limitations: PIC12/PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only

 

 

testrom.c

 

success

BoostLink Optimizing Linker Version 6.14

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

Licensed to Cornelis G.S. Kramer under Single user Full License for 1 node(s)

Limitations: PIC12/PIC16 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only

 

Error: ROM data max size of 256 bytes exceeded!

Error: ROM object generation Failed

 

Failure

Exit code was -1. [No error.]

Removing target: testrom.hex

Failed to locate output file 'testrom.hex'

Done

 

Failed

 

 

 

 

If I made the rom char table smaller by removing the last byte, this code compiles fine...

 

Any ideas?

 

Best regards, Teuniz

Link to post
Share on other sites

Dave,

 

Maybe I understood it wrong, can you explain me how the compiler counts the

size of the array?

 

In my code example I have 16 columns x 13 rows x 1 byte = 208 bytes!

 

"\128" means one byte representing the value 0x80, so the array is just 208 bytes...

 

Isn't it?

Link to post
Share on other sites

I think it's a bug in the parser, when I change my code example in:

 

#include <system.h>


rom char *table = "\0\36\71\106\139\171\199\225\248\11\25\35\39\38\30\16\251\222\185\140\86\22\205\122\28\179\63\191\51\154\244\66"
                 "\129\179\214\235\241\231\206\165\108\35\201\94\225\84\181\3"
                 "\64\107\131\137\124\92\41\226\137\28\156\8\97\166\215\245"
                 "\255\245\215\166\97\8\156\28\137\226\41\92\124\137\131\107"
                 "\64\3\181\84\225\94\201\35\108\165\206\231\241\235\214\179"
                 "\129\66\244\154\51\191\63\179\28\122\205\22\86\140\185\222"
                 "\251\16\30\38\39\35\25\11\248\225\199\171\139\106\71\36"
                 "\0\220\185\150\117\85\56\30\8\245\231\221\216\218\225\239"
                 "\5\34\70\116\170\233\50\134\228\76\193\65\205\101\11\190"
                 "\126\76\41\20\14\24\49\90\147\220\54\161\30\171\75\252"
                 "\191\148\124\118\131\163\215\29\118\227\99\247\158\89\40\10"
                 "\0\10\40\89\158\247\99\227\118\29\215\163\131\118\124\148";



void main(void)
{

 while(table[2]);

}

 

then it compiles fine. It looks like the parser can't handle too much newlines/quotes

and values in one declaration. Notice that the array still contains 208 bytes.

Link to post
Share on other sites
I think it's a bug in the parser, when I change my code example in:

 

...

...

...

 

then it compiles fine. It looks like the parser can't handle too much newlines/quotes

and values in one declaration. Notice that the array still contains 208 bytes.

 

 

I think the problem is still in the parser. I'm fighting from yesterday to try to solve some problems, and now i discovered that if i define a rom string like:

 

rom char *tst = "\18\01\16\01\00\00\00\08\216\04\02\00\00\00\01\02\00\01";

 

the compiler gives a table that is:

 

0050  0112     	 DW 0x0112
0052  1031     	 DW 0x1031
0054  3101     	 DW 0x3101
0056  3000     	 DW 0x3000
0058  3000     	 DW 0x3000
005A  3000     	 DW 0x3000
005C  3808     	 DW 0x3808
005E  04D8     	 DW 0x04D8
0060  0234     	 DW 0x0234
0062  0032     	 DW 0x0032
0064  0030     	 DW 0x0030
0066  0030     	 DW 0x0030
0068  0130     	 DW 0x0130
006A  0231     	 DW 0x0231
006C  0032     	 DW 0x0032
006E  0130     	 DW 0x0130
0070  0031     	 DW 0x0031

 

This is teken directly from the generated .lst file, and you can see that there are several EXTRA bytes inserted. When i try to read them and use them in my code i find a wrong data sequence. May be that this is the reason because your table that is lower of 256 bytes in your intention is in the reality bigger than this.

 

Dave, have you got an idea about that? My target is a 18F2455 and now i'm really stucked with my little project because of this issue. Is this a bug or one misunderstanding of mine? :(

 

Regards,

 

Walter

Link to post
Share on other sites

Wally,

 

For a start, the leading zeroes don't seem to be handled properly, please drop them for now,

eg

rom char *tst = "\18\1\16\1\0\0\0\8\216\4\2\0\0\0\1\2\0\1";

 

Regards

Dave

Link to post
Share on other sites

teunizz,

 

The other thing that is going wrong here is the spreading the string across multiple lines, separating each part with quotes. The quotes and line feed characters get added in as part of string.

 

The compiler should really generate an error here as its not valid C code to split strings up like this.

 

This is one for Pavel (the parser master).

 

Regards

Dave

Link to post
Share on other sites

Walter,

 

Mmm, it was so simple... i'm sorry but i was not able to find this by myself.
Don't be sorry! - I'm sorry tyou had to find the problem in the first place.

 

Regards

Dave

Link to post
Share on other sites
teunizz,

 

The other thing that is going wrong here is the spreading the string across multiple lines, separating each part with quotes. The quotes and line feed characters get added in as part of string.

 

The compiler should really generate an error here as its not valid C code to split strings up like this.

 

This is one for Pavel (the parser master).

 

Regards

Dave

Dave, Pavel,

 

Do you have any idea when the next version which will fix this issue will be available?

 

Grtz, Teuniz

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...