SPRU514Z July 2001 – October 2023 SM320F28335-EP
This section applies to applications that use the COFF ABI only.
Initialization of variables at load time enhances performance by reducing boot time and by saving the memory used by the initialization tables. To use this method, invoke the linker with the --ram_model option.
When you use the --ram_model link option, the linker sets the STYP_COPY bit in the .cinit section's header. This tells the loader not to load the .cinit section into memory. (The .cinit section occupies no space in the memory map.) The linker also sets the cinit symbol to -1 (normally, cinit points to the beginning of the initialization tables). This indicates to the boot routine that the initialization tables are not present in memory; accordingly, no run-time initialization is performed at boot time.
A loader (which is not part of the compiler package) must be able to perform the following tasks to use initialization at load time:
Figure 7-5 illustrates the initialization of variables at load time.
Regardless of the use of the --rom_model or --ram_model options, the .pinit or .init_array section is always loaded and processed at run time.