We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello everybody, I've a question concerning the internal RAM of derivatives such p89c66x and passing parameters. As far I've understood, the internal RAM has 256 bytes in 89c66x. the 128 first bytes are for stack, registers, bit registers and the functions parameters, the remaining 128 bytes are general purpose RAM. When passing parameters in a function, the parameters space is allocated in the first 128 bytes. Each parameter of a coded function has its space allocated here. When the application has many functions, the available space decrease dangerously ! Currently, I've only 30 bytes remaining in this segment and I've just coded the low-level and general purpose functions. This means I've still to code the application. I'll surely have a lack of space in this segment.... Is there a way to put the space allocation of these parameters in XDATA or to tell the linker to allocate memory only when the function is called ? Note that reducing the number of functions isn't a solution for me. My application needs really many functions in order to be well coded. Thanks Best regards Stephane
Well, let's take an example. Here is a function and the associated LST file specially coded for the sample :
#include "reg51f.h" #include "tdef.h" void GLCD_DisplayValue (U32 u32Value, U8 u8NumberOfIntegerDigits, U8 u8NumberOfDecimalDigits) { xdata U8 u8Size=0; /* Size of the table */ xdata U8 au8ValueToDisplay[10]; /* String where is converted the value */ xdata S8 s8CharNumber=0; /* Character number in the string */ u32Value=0; u8NumberOfIntegerDigits=0; u8NumberOfDecimalDigits=0; u8Size=0; au8ValueToDisplay[0]=0; s8CharNumber=0; } MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 28 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = 12 ---- PDATA SIZE = ---- ---- DATA SIZE = ---- 6 IDATA SIZE = ---- ---- BIT SIZE = ---- ----
TYPE BASE LENGTH RELOCATION SEGMENT NAME ----------------------------------------------------- * * * * * * * D A T A M E M O R Y * * * * * * * ... DATA 0037H 0006H UNIT ?DT?_GLCD_DISPLAYVALUE?GLCD ... * * * * * * * X D A T A M E M O R Y * * * * * * * XDATA 02B8H 000CH UNIT ?XD?GLCD