Tool/software: TI C/C++ Compiler
Hello,
I would like to verify something regarding section initialization (using TI tools, cortex M4 , TDA2xx)
If i have a linker file with the following:
GROUP (G1)
{
.sec1 : {}
.sec2 :
{
*(.sec2) {}
.=0x8;
}
.sec3 :
{
*(.sec3) {}
.=0x8;
}
} load = (0)
if nothing is actually assigned to either sec2 or sec3 while the other section is assigned when some data , i can see in the map file that the section that was not referred to in the code is UNINITIALIZED and that there is a hole (--HOLE--), while the section that was referred to does contain the assigned input section and on the remaining space (when i.e. only 4 bytes where assigned to it) there is also a hole but this time it says --HOLE-- [fill = 0] .
When running this application and after reaching main i can see that the above makes sense in the way that the memory area of the section that was marked as HOLE only is never initialized (not set to zero) and the memory stays intact (meaning whatever was there before stays as it was), while the initialized section the area marked as HOLE [fill=0] is indeed cleared to zero.
What i want to verify is if this indeed the expected behavior and that i can rely on this if i would like to create holes in memory and also be sure that they will NOT get written at all (no zero initialization ,...).
(as a note: in this specific case i CANNOT use the NOLOAD type on the linker file which will for sure achieve the above so i would like to know if what i am seeing is something i can actually trust and use)
B.T.W
when looking at the ELF segments all of these sections are marked as allocated but for the segment that includes the "unassigned" section the fileSize < memSize which means that the memory area will indeed wont be loaded but it (according to ELF general rules) mean that the area that is not loaded (from fileSize to memSize) is supposed to be initialized to zero, so i am not sure how am i suppose to understand this behavior and according to what, on TI tools, holes are getting initialized to zero.
Thanks
Guy