3-70
EPSOn
S5U1C17001C ManUal
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
3 SOfTWarE DEVElOPMEnT PrOCEDUrES
The example source files shown above include the following sections.
file1
.rodata
and
.text
sections
file2
.data
and
.rodata
sections
file3
.text
,
.bss
,
.data
, and
.rodata
sections
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.
Summary of Contents for S5U1C17001C
Page 6: ......
Page 17: ...1 General S5U1C17001C Manual 1 General ...
Page 18: ......
Page 21: ...1 2 Install S5U1C17001C Manual 2 Installation ...
Page 22: ......
Page 29: ...3 SoftDev S5U1C17001C Manual 3 Software Development Procedures ...
Page 30: ......
Page 103: ...4 SrcFiles S5U1C17001C Manual 4 Source files ...
Page 104: ......
Page 121: ...5 IDE S5U1C17001C Manual 5 gnU17 iDE ...
Page 122: ......
Page 365: ...6 Compiler S5U1C17001C Manual 6 C Compiler ...
Page 366: ......
Page 385: ...7 Library S5U1C17001C Manual 7 library ...
Page 386: ......
Page 405: ...8 Assemblr S5U1C17001C Manual 8 assembler ...
Page 406: ......
Page 439: ...9 Linker S5U1C17001C Manual 9 linker ...
Page 440: ......
Page 449: ...10 Debugger S5U1C17001C Manual 10 Debugger ...
Page 450: ......
Page 626: ...11 Tools S5U1C17001C Manual 11 Other Tools ...
Page 627: ......
Page 696: ...S1C17 Family C Compiler Package Quick Reference Reference ...