Epson S5U1C17001C Manual page 100

Cmos 16-bit single chip microcomputer, c compiler package for s1c17 family
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

3 SOfTWarE DEVElOPMEnT PrOCEDUrES
The example source files shown above include the following sections.
.rodata and .text sections
file1
.data and .rodata sections
file2
.text, .bss, .data, and .rodata sections
file3
These sections are relocated according to the SECTIONS command specified in a linker script file. The contents of
the example linker script file are described below.
(1) Set the location counter to 0x0. This location is assumed to be address 0x0. The location counter will be incre-
mented by specifying an address or locating sections. '.' is used to reference the current location counter value
in a linker script.
(2) Define the .bss output section to be output to an executable format object file. The .bss section begins
with address 0x000000 as the definition specifies the address.
(3) The linker script created by the IDE contains symbols defined to indicate a section start address. In this ex-
ample, the .bss output section start address is defined as the symbol name __START_bss. '.' represents the
location counter value, so the symbol is defined with the value 0x000000. Other sections have a start address
definition similar to this. These symbols can be referenced from program source files as global symbols.
(4) Specify the object files with their basic section attribute to be located in this section. In this example, the
.bss sections in the specified files will be located in order of file1.o, file2.o, and file3.o in the
.bss output section. The file2.o does not contain a .bss section, so no memory area will be allocated
but no error will occur even if it is specified like this.
Furthermore, library files must be written if the application uses library functions. In this example, libgcc.
a cannot reference symbols in the preceding libc.a, therefore libc.a is specified twice to resolve refer-
ences to unknown symbols (some functions in libgcc.a call a function in libc.a). This specification
does not locate the actual code twice.
(5) The symbol __END_bss is defined to indicate the .bss output section end address similar to (3) above. The
location counter value specified by '.' is __START_bss + (total size of all .bss sections located).
(6) Define the .data output section. With __END_bss specified as the start address, this section (VMA) is
located immediately after the .bss section. All .data sections in the input files are placed into this output
section.
The defined section is located at the VMA (memory address accessed when actually executing code or when
reading/writing data). The VMA is normally the same as the LMA (load memory address in which data is
stored). However, the .data section requires that initial values be written to ROM and that the initial values
be copied to RAM before use. For this reason, the LMA (ROM address) must be specified separately. The AT
statement specifies that the actual code in the .data section must be located from __END_rodata (imme-
diately following the .rodata section).
(7) Define the .vector output section beginning with address 0x008000. In this example, the vector table is
written in the .rodata section defined in file1.o, so only file1.o(.rodata) is specified as the file
(section attribute) to be located in this section.
(8) Define the .text output section immediately following the .vector section. All .text sections in the
input files are placed into this output section.
(9) Define the .rodata output section immediately following the .text section. All .rodata sections in the
input files are placed into this output section. The file1.o is not specified here, as its .rodata section has
been located in the .vector section.
(10) The __START_data_lma and __END_data_lma are defined for the start (LOADADDR(.data)) and
the end addresses (LMA) of the .data section in which the actual data is stored. These symbols are used to
copy data from the LMA to the VMA in the program source.
3-70
EPSOn
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
S5U1C17001C ManUal

Advertisement

Table of Contents
loading

Table of Contents