Hi when my code reaches a certain size, the sprintf function doesn't work correct anymore. The .h86 file has now a size of 164KB, guess code is around 64KB (last code block in map file). The module has 1MB SRAM and 1MB Flash, so there should be no problem. Memory model is HLarge, segmented. sprintf just removes all '%' from the formatting string but does no replacements. Does anyone know this symptoms? I guess it's a segmentation problem. Any solutions or hints? Thanks
Have you tried the new XLarge memory model which overcomes the segmentation barrier? This memory model was introduced with a version 5. Do you see the same problem using XLarge memory model? Here is a description what is new in C166 version 5: http://www.keil.com/update/whatsnew.asp?p=C166&v=5.00 Franc
I do not think that it has to do with the memory model. Maybe you have just an issue with defining the format string for printf. How is the format string defined and passed to the printf function? Reinhard
The total number of bytes that may be passed to sprintf is limited due to the memory restrictions imposed by the 8051. A maximum of 15 bytes may be passed in small model or compact model. A maximum of 40 bytes may be passed in large model.
"The total number of bytes that may be passed to sprintf is limited due to the memory restrictions imposed by the 8051." True, but the toolset is stated as C166 - not C51! Does C166 have the same limitation?
Does C166 have the same limitation? No, it doesn't. The first few arguments are passed to the function in registers, the rest - on the user stack. User stack can be as large as 16KB, or even 64KB - I'm not sure. - mike