I may be asking for the moon here, but I'd like to place all printf strings in a specific code bank. Right now, I'm not using banking at all but we're starting to get close to 64K. The project has about 10K of printf strings scattered throughout the code and the text would fit nicely in one of the 16K banks that are avaialble. I'm thinking that I could create a wrapper function around printf that would switch in the bank of string data before calling printf and then switch it back out. Moving all the strings to one source file is not an option because it would too hard to maintain.
Thanks for any help you can give.
BTW, it is interesting to look at the code generated when calling printf():
printf("uint16=%u,int16=%d,uint32=%lu,uint16=%u\n", pMyStruct->Uint16, pMyStruct->Int16, MyUint32, MyUint16); 023C 900000 R MOV DPTR,#pMyStruct 023F 120000 E LCALL ?C?PLDXDATA 0242 900004 MOV DPTR,#04H 0245 120000 E LCALL ?C?ILDOPTR 0248 85F000 E MOV ?_printf?BYTE+03H,B 024B F500 E MOV ?_printf?BYTE+04H,A 024D 90000B MOV DPTR,#0BH 0250 120000 E LCALL ?C?ILDOPTR 0253 85F000 E MOV ?_printf?BYTE+05H,B 0256 F500 E MOV ?_printf?BYTE+06H,A 0258 900000 R MOV DPTR,#MyUint32 025B 120000 E LCALL ?C?LLDXDATA 025E 8F00 E MOV ?_printf?BYTE+0AH,R7 0260 8E00 E MOV ?_printf?BYTE+09H,R6 0262 8D00 E MOV ?_printf?BYTE+08H,R5 0264 8C00 E MOV ?_printf?BYTE+07H,R4 0266 900000 E MOV DPTR,#MyUint16 0269 E0 MOVX A,@DPTR 026A FE MOV R6,A 026B A3 INC DPTR 026C E0 MOVX A,@DPTR 026D 8E00 E MOV ?_printf?BYTE+0BH,R6 026F F500 E MOV ?_printf?BYTE+0CH,A 0271 7BFF MOV R3,#0FFH 0273 7A00 R MOV R2,#HIGH ?SC_624 0275 7900 R MOV R1,#LOW ?SC_624 0277 120000 E LCALL _printf
The thing you're looking for is either the STRING or the XCROM option to Cx51. See both in the documentation.