Hi Maarten,

thanks for your reply.
I tried as you suggested but it failed again. More or less the same error message.
But as I was reading the manual chapter 3.4.1.8 Pointers to MCS51/DS390 speciļ¬c memory spaces 
and after I thought I understand I was trying the following and it worked all of a sudden:

...
static CODE Tbyte *ucHelpSystem[] = {
//  |..................|
"** Help on System **",
"The System menu has ",
"options to set the  ",
"editable settings   ",
"of the device.      ",
""
};

CODE Tbyte ** EXTERNAL_RAM startHelpString=NULL;
...

Is that the right thing to do?

My task in the moment is to port the project from KEIL to SDCC, since the integration in Netbeans IDE is excellent.
But the code won't compile with the KEIL compiler anymore ... well for the moment beeing I have to put quite a few #define statments
regarding compiler change.
But therefore I cannot test on the target system since sdcc is not giving me an output file due to many more problems (to many variables in
internal RAM, code size overflow, ....)

Hope I get through all this probs.

Thank you,
Andreas 
 
Am 03.05.2008 um 12:07 schrieb Maarten Brock:

Hello Andreas,

At first this looked like a bug to me too, but...
You were actually saved from harder to detect runtime
problems. The problem is that generic pointers are 3
bytes and code pointers are only 2. Your array is filled
with code pointers and resides in data memory. The ptr-
ptr startHelpString is a generic pointer to generic
pointers. If you would only dereference the pointers
things might work out ok, but any arithmetic on them
will go wrong. Incrementing the ptr-ptr will go 3 bytes
further (sizeof generic pointer) but the next ptr in the
array is only 2 bytes (sizeof code pointer) away.

To solve this you can fill the array with generic
pointers or tell the ptr-ptr it points to code pointers.
The latter being more optimal.

So either remove CODE from ucHelpSystem or use:
Tbyte * CODE * startHelpString = NULL;

And finally for best optimization you might want to
explicitly put everything in code memory:

static Tbyte code * code ucHelpSystem[] = ...
Tbyte code * code * startHelpString = ...

Greets,
Maarten

Hi All,

I have a small pointer problem.
I have several String Arrays in CODE segment and want to load the  
start address into a pointer variable according to a user selction.
But when I compile I get the following Error:

help.c:247: error 47: indirections to different types assignment
from type 'const-unsigned-char code*  [41] '
to type 'unsigned-char generic*  generic* '

Here part of the Code:

....
static CODE Tbyte *ucHelpSystem[] = {
//  |..................|
"** Help on System **",
"The System menu has ",
"options to set the  ",
"editable settings   ",
"of the device.      ",
""
};

Tbyte **startHelpString=NULL;
...
void HlSystemHelp(void)
{
LcCls();
startHelpString = ucHelpSystem;      !!!! Here I get the Error !!!!
HlProcessHelpRequest();
LcCls();
}

Thanks a lot,
Andreas




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user