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

C51:Code banking string problem

Hi Everybody!

I'm working on a project with a AT8C51RE2 and reached the maximum code size of 65K.

So i set up the code banking mechanism and split my programm to three banks.

Everythings works fine, only string handover between banks often give some chaotic results.

For example ive got an constant char code table in bank #1 like this one:

static const char code g_UnitDesignation[UnitDesignationId_LENGTH][MaxChar_UnitDesignation]=
{
        {""},
        {"s"},
        {"min"},
        {"days"},
        {"mg/l"}
}


if try to access over an function in common bank:

char* Log_GetLogText(UINT8 UnitDesignationId, float LogValue)
{
        char outputString[Protocol_MaxOutputChars];

        sprintf(outputString, "Log %s=%5.3f", Unit_getUnitDesignation(UnitDesignationId), LogValue);

        return outputString;
}

the generated output is often mutilated badly. (".000Logä")

Does anybody have an idea how to handle this cross access over banks or have a hint whats going wrong?

Thanks a lot,

David

Parents
  • string handover between banks often give some chaotic results.

    And on what basis did you even begin to believe that that could, much less should, work? That's code banking you're looking at, not constant data banking. String literals outside the common bank are, pretty much by definition, not accessible at all to code in any other bank than their own.

    I rather strongly suspect the only possibly strategy here is "Don't do that, then!"

Reply
  • string handover between banks often give some chaotic results.

    And on what basis did you even begin to believe that that could, much less should, work? That's code banking you're looking at, not constant data banking. String literals outside the common bank are, pretty much by definition, not accessible at all to code in any other bank than their own.

    I rather strongly suspect the only possibly strategy here is "Don't do that, then!"

Children