This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

String size limit lower than 64kB ?

Hello,

I use keil compiler V7.50 with DS80C400 µC in LARGE memory model.

I declare several string constants like this :

const char far image[] = "\x25\x50\x44\x46\x2D\x31\x2E\x34\xD\xA\x25[...]
\x30\x34\x38\xD\xA\x25\x25\x45\x4F\x46\xD\xA";
And there is "#pragma STRING (far)" at the beginning of the file


I noticed 2 problems :

1st : String size limit cannot exceed about 16kB
If one of the string exceed about 16kB, I get this kind of error :
SRC\UTILE.C(255): error C281: illegal hex constant
SRC\UTILE.C(255): error C103: '<string>': unclosed string
SRC\UTILE.C(256): error C141: syntax error near '42'
SRC\UTILE.C(258): error C103: '<string>': unclosed string
Note that I am aware of the 64kB limit for array declaration ( http://www.keil.com/support/docs/3128.htm ). My strings doesn't exceed this limit. And yes my strings are enclosed.

Is there such limitation in string size ? How to declare strings larger than 16kB ?

2sd : Declaring several strings in such way that the total size exceed 64kB stops the compilation
If I place several string declaration in the same file, in such way that none of the string size exceeds 16kB, but the total size of the strings in the file exceed 64kB, I get this error :
SRC\IMAGE.C(360): error C249: '!': SEGMENT TOO LARGE

As a workaround I found that placing the strings in different files solves the problem. However is this normal ? (strings are placed in HCONST memory class which is large enough to contain more than 64kB)

Thanks for your answers.

P.S. note that even though it is not obvious in my example, I need to use strings because most of the declarations use human readable characters !

0