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
Refer to the following knowledgebase article:
http://www.keil.com/support/docs/1615.htm
and make sure that the g_UnitDesignation array and the Log_GetLogText function are located in the same bank.
Second, return outputString from your Log_GetLogText function is a BAD idea. The outputString is not in scope outside that function.
If you have some control over the hardware design, using xbanking (http://www.keil.com/support/man/docs/c51/c51_ap_xbanking.htm) may work better for you.
Jon
Then consider a change of processor.
You are fighting a fundamental limitation of the 8051 architecture - is that a battle worth fighting?
Could your time be better spent in switching to an architecture which does not have this fundamental limitation?