31.12.2013 Views

Linkage Kit Manual V6-00 - Fujitsu

Linkage Kit Manual V6-00 - Fujitsu

Linkage Kit Manual V6-00 - Fujitsu

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 5 SPECIFICATIONS OF A LINKER<br />

5.9 Sections to be Transferred from ROM to RAM<br />

When developing a program using a C/C++ compiler, a variable with an initial value is<br />

created and you must often rewrite the variable and perform other processing.<br />

Such a variable, being rewritten at the time of execution, must be in RAM when the<br />

application is executed. Therefore, in a program to be imported, the initial value data<br />

must be placed in ROM and transferred to RAM before the application is executed.<br />

The section to be transferred from ROM to RAM is a function that enables such a usage.<br />

■ Sections to be Transferred from ROM to RAM<br />

When developing a program using a C/C++ compiler, a variable with an initial value is created and you<br />

must often rewrite the variable and perform other processing.<br />

In a program to be imported, the variable data with initial values are placed in ROM. However, since it is<br />

being rewritten at the time of execution, it must be in RAM when the application is executed.<br />

Therefore, the initial value data is transferred to RAM before the application is executed.<br />

To facilitate such a usage, this linker, as long as the sections to be transferred from ROM to RAM are<br />

specified, supports the system of solving the reference addresses of a program on RAM and placing the<br />

data with initial values on ROM.<br />

■ Using the Sections to be Transferred from ROM to RAM<br />

Specify the sections to be transferred from ROM to RAM in the -sc option as follows:<br />

The sections containing variables with initial values shall be INIT.<br />

DATA shall be the sections containing variables without initial values, start shall be a program used to<br />

transfer the data of variables with initial values on ROM to RAM, and CODE shall be the application<br />

program to be executed.<br />

-sc DATA+INIT=0x1<strong>00</strong>0,start+CODE+@INIT=0xC<strong>00</strong>0<br />

As shown in the figure, specify to locate INIT on RAM (0x1<strong>00</strong>0), and also to locate INIT on ROM<br />

(0xC<strong>00</strong>0) using a section name starting with an at sign, @.<br />

If the section is thus located, INIT is processed as a section to be transferred from ROM to RAM, and the<br />

location is as shown in Figure 5.9-1. Then, the addresses are solved on RAM and the initial value data is<br />

located on ROM.<br />

82 PART II LINKER

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!