This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

__scatterload function in ARM c library.

Hi,

According to ARM document pasted below, __main always calls __scatterload. But I got a .elf file whose dissambly code doesn't contain the __scatterload function.  Any idea in what situation the __scatterload will not be compiled and used ?

I use armclang 6 to compile the source files into the .elf.

Thanks and best regards,

Xinwei

3             Entry point to the C library

The function __main is the entry point to the C library. Unless you change it, __main is the default entry point to the ELF image that the ARM linker (armlink) uses when creating the image. Figure 1 shows the functions called by__main during the C library startup.

Figure 1 Overview of the functions called during the C library startup

__rt_entry and the functions called by __rt_entry are described in Functions called by __rt_entry.

3.1      __scatterload

Application code and data can be in a root region or a non-root region. Root regions have the same load-time and execution-time addresses. Non-root regions have different load-time and execution-time addresses. The root region contains a region table output by the ARM linker.

The region table contains the addresses of the non-root code and data regions that require initialization. The region table also contains a function pointer that indicates what initialization is needed for the region, for example a copying, zeroing, or decompressing function.

__scatterload goes through the region table and initializes the various execution-time regions. The function:

  • Initializes the Zero Initialized (ZI) regions to zero
  • Copies or decompresses the non-root code and data region from their load-time locations to the execute-time regions.

__main always calls this function during startup before calling __rt_entry.

Parents
  • I got the answer.

    As the document says,  __scatterload is to initialize the ZI region and map the load regions to the execution regions. So, if there are no uninitialized array in the code , and no non-root region specified in the scatter file, then the __scatterload function wont be used so it won't be linked to the .elf.

Reply
  • I got the answer.

    As the document says,  __scatterload is to initialize the ZI region and map the load regions to the execution regions. So, if there are no uninitialized array in the code , and no non-root region specified in the scatter file, then the __scatterload function wont be used so it won't be linked to the .elf.

Children