Unfortunately, I need to use sprintf() in my application. My memory model is LARGE. When I include sprintf() the map file changes to include 5 bytes of internal memory starting at location 0008H and a single bit at 0020H.1. My application uses that memory space! Is there a way to get the sprintf() library function to use ONLY external memory or maybe some other internal memory? Thank you! -Paul
Believe it or not, we are enhancing the OLD BASIC-52. BASIC-52 uses almost all of the internal memory. Only register bank 3 is free and maybe a few bits/bytes in internal memory. I thought about saving the areas used by sprintf() and then restoring them after the call but I was hoping I was just missing something with the libraries. Thank you! -Paul
At a minimum, you'd have to recompile sprintf(). The executable code will contain instructions to reference internal data and bit memory. You could get the linker to move the addresses around, but the only way to generate completely different instructions to access a different memory space would be to recompile. The different memory spaces on the 8051 have fundamental architectural differences, reflected in the instruction set, not just performance differences. And as long as you've got source for sprintf(), you could change its internal variable locations to whereever you liked. Source code for the GCC C library is easy to find, if your application can tolerate being linked with GPL code.