8.5.2 Creating ROMized load module file

This section explains how to create the ROMized load module.

 

The -rom option is used for ROMization. The code is as follows.

-rom=name of the initial-value section=name of the destination section[,name of the initial-value section=name of the destination section]...

The -start option must also be used to specify the addresses of the initial-value section and destination section.

-start=[(]section-name[{:|,}section-name]...[)][{:|,}section-name]...[/destination-address][,[(]section-name[{:|,}section-name]...[)][{:|,}section-name]...[/destination-address]]... 

Assume that the program contains seven sections: .text, .data, .zdata, .zbss, .bss, .sdata, and .sbss. If .text, r0 relative sections, and r4 relative sections are to be allocated to addresses 0x0, 0xFE000000, and 0xFE001000 respectively before execution of the user program, the code will be as follows.

-start=.text,.data,.zdata,.sdata/0
-start=.data.R,.zdata.R,.zbss,.bss/fe000000
-start=.sdata.R,.sbss/fe001000
-rom=.data=.data.R,.zdata=.zdata.R,.sdata=.sdata.R

.data and .zdata are allocated to the range following the .text section at address 0x0.

When the user program is executed, .data.R, .zdata.R, .zbss, and .bss at address 0xFE000000 and .sdata.R and .bss at address 0xFE001000 are initialized before they are used.

 

An image of this operation is shown below.

Figure 8.4

Image of Processing Before and After Copy Function Call