Is it possible to identify the storage of String Literals from the mapfile? I asume they will be in the ?CO? segment for the module? eg,
void func( void ) { code unsigned int NumConst = 1; printf( "NumConst = %u", NumConst ); }
The Storage of string literal will be placed in just one ?CO? segment inside your MAP file, ( ?CO?your_source_filename Ex.:
MEMORY MAP OF MODULE: C:\EMBEDDED\EMUL251\MAPTEST (MAPTEST2) START STOP LENGTH ALIGN RELOC MEMORY CLASS SEGMENT NAME ========================================================================= 000000H 000007H 000008H --- AT.. DATA "REG BANK 0" 000008H 00001BH 000014H BYTE UNIT DATA _DATA_GROUP_ 000020H.0 000021H.0 000001H.1 BIT UNIT BIT _BIT_GROUP_ 000022H 000121H 000100H BYTE UNIT EDATA ?STACK FF0000H FF0002H 000003H --- OFFS.. CODE ?CO?START251?3 FF0003H FF0018H 000016H BYTE INBLOCK CODE ?PR?MAIN?MAPTEST2 FF0019H FF0029H 000011H BYTE UNIT CODE ?CO?MAPTEST2 FF002AH FF00E5H 0000BCH BYTE UNIT CODE ?C_C51STARTUP FF00E6H FF043DH 000358H BYTE UNIT CODE ?PR?PRINTF?PRINTF FF043EH FF043EH 000001H BYTE UNIT CODE ?C_INITSEG FF043FH FF0474H 000036H BYTE UNIT CODE ?C?LIB_CODE FF0475H FF049BH 000027H BYTE UNIT CODE ?PR?PUTCHAR?PUTCHAR
SYMBOL TABLE OF MODULE: C:\EMBEDDED\EMUL251\MAPTEST (MAPTEST2) VALUE REP CLASS TYPE SYMBOL NAME ==================================================== --- MODULE --- --- MAPTEST2 00FF0003H PUBLIC CODE --- MAIN 00FF0003H BLOCK CODE --- LVL=0 00FF0028H SYMBOL CODE WORD NumConst 00FF0003H LINE CODE --- #3 00FF0003H LINE CODE --- #4 00FF0003H LINE CODE --- #7 00FF0018H LINE CODE --- #9 --- BLOCKEND --- --- LVL=0 --- MODULE --- --- ?C_START 00FF0000H PUBLIC CODE --- ?C_STARTUP 00FF0000H BLOCK CODE NEAR LAB LVL=0 --- BLOCKEND --- --- LVL=0 00FF002AH BLOCK CODE NEAR LAB LVL=0 --- BLOCKEND --- --- LVL=0 --- MODULE --- --- PRINTF 00000008H PUBLIC DATA --- ?PRINTF?BYTE 00000008H PUBLIC DATA --- ?SPRINTF?BYTE 00000008H PUBLIC DATA --- ?_PRINTF?BYTE 00000008H PUBLIC DATA --- ?_SPRINTF?BYTE 00FF0151H PUBLIC CODE --- PRINTF 00FF0148H PUBLIC CODE --- SPRINTF 00FF014EH PUBLIC CODE --- _PRINTF 00FF0145H PUBLIC CODE --- _SPRINTF
Actually, both the variable NumConst and the String Literal "NumConst = %u" seem to be placed into the same segment: The map for my original example shows the size of the ?CO? segment as 0x10 (16 bytes); that's 14 bytes for the string (including NUL terminator) plus 2 bytes for the int (not sure why yours comes to 0x11?). What I actually want to know is, how much room are all my string literals taking? It looks like I'd need to subtract the sizes of all the SYMBOLs in the segment - but where can I find that in the map?
The segment is the same, code segment ( ?CO? ) but, the variable NumCast is only in the symbol table. If you analyze the ?CO? segment, you will see everything that is declared in the code segment toguether with the literal strings. The ?CO?your_source_file_name is the Room size of all your string literal. ( strings used by printf, puts and so on )
The ?CO?your_source_file_name is the Room size of all your string literal. Not quite sure what you mean by, "Room size?" I think you are using L251, which might give more details, but with BL51 I can't see any way to tell from the mapfile how much of the ?CO?your_source_file_name segment is occupied by String Literals, and how much by "real" constants. Basically I need to cut down my code size, and I think that String Literals are a prime target; therefore, I need some easy way to confirm just how much code is being used by String Literals (rather than "real" constants, which must be retained).
Hummmm... unfortunately the ?CO?your_file_source_name is showing your literals and other "real" constants, I could not find a way to see only the literals. When I add another code variable to the source file, the length of ?CO?xxx increase. Yes, I was using L251 ( FF0000h ).