Tool/software: TI C/C++ Compiler
Hello,
I use the TI CGT C2000 18.12.0 toolchain and parse the map files with a script to get the size of the generated code.
Now I noticed that the size of the memory area at the beginning of the map file is sometimes smaller than the size of the actual executable. I looked at several map files in different application, and the delta was often between 1 and 6 words. However, when I checked the more detailed section description in the map file, the size was correct and consistent with the generated executable.
Here an example for one of the affected memory areas:
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
EXER_TEXT 00318010 00007ff0 000045f5 000039fb R X
When I calculate the end address from this info, I get 0x00318010 + 0x000045f5 - 1 = 0x31C604
Now when I look at the last section in EXER_TEXT, I find the following in the map file:
.switch 0 0031c4da 0000012e
0031c4da 000000c8 Exer.obj (.switch:_Exer_xx_Parser)
0031c5a2 00000032 Exer.obj (.switch:_Exer_yy_Parser)
0031c5d4 0000001c MemoryAccess.obj (.switch:_MemoryAccess_Parser)
0031c5f0 00000018 Exer.obj (.switch:_Exer_Parser)
When I calculate the end address from this info, I get 0x0031c5f0 + 0x00000018 - 1 = 0x31c607 (which is also the end address in memory when I checked it with the debugger)
After some try and error I think I found a workaround for it. Previously, the sections in the linker command file were just listed in a SECTION. Now when I enclose all section in EXER_TEXT in a GROUP block to allocate them contiguously in memory, the size in the map file is correct.
My questions are:
- are these inconsistent sizes a known bug of the linker?
- when I use a GROUP in the linker command file, does this really guarantee that the memory size in the map file is correct, or did it just accidentally work in the given project and may occur again in the future?
Regards,
Thomas