8.4.1 Outline

When a variable is declared globally or static within a program, the variable is allocated to the data-attribute section in RAM if the variable has a initial value, or to the bss-attribute section if it does not have a initial value. When the variable has a initial value, that initial value is also stored in RAM. In addition, program code may be stored in the internal RAM area for self-programming.

In the case of an embedded system, if a debug tool such as an in-circuit emulator is used, executable road module files can be downloaded and executed just as they are in the allocation image. However, if the program is actually written to the target system's ROM area before being executed, the initial value information that has been allocated to the data-attribute section and the program code that has been allocated to a RAM area must be deployed in RAM prior to execution. In other words, data that is residing in RAM must be deployed in ROM, and this means that data must be copied from ROM to RAM before the corresponding application is executed.

"ROMization" refers to the packing of the initial values of variables in data-attribute sections and program code to be allocated to the RAM into a single section of ROM. Allocating this section to ROM and copying it to RAM during startup makes it easy to deploy the initial values and program code to RAM. For details on copying, see "8.2.6 Initialization of RAM area section".

The following figure shows an outline of the operation flow in creating objects for ROMization.

Figure 8.1

Creation of Object for ROMization

 

When ROMization object files are created as shown in "Figure 8.1 Creation of Object for ROMization", data to be allocated to RAM is copied from the packed ROM during startup.

 

If the object files resolved for relocation include symbol information and debug information, the CC-RL creates a ROMization object module file without deleting them. Therefore, the debugger can debug the source even with a ROMization object module file.