5 gnU17 iDE
Example linker script settings
Shown below are example linker script settings for several section configurations using sample screens. For
more information on making these settings, refer to the discussion on the preceding pages.
Example 1: Minimum section configuration
Example 2: Changing the basic layout
Example 3: Sharing the RAM area with multiple variables
Example 4: Executing a program in RAM
It is assumed that the vector table in the assembler source (boot.o) is written in the .rodata section and
that the table is set in the new project wizard to be located in the .vector section.
Example 1: Minimum section configuration
Described here is a system with the simplest possible configuration using RAM and ROM.
The program and data will be located in the ROM beginning with address 0x8000 as shown in Figure 5.7.6.2.
The program is assumed to run directly from its stored ROM address (LMA), and static data is also assumed
to be read out for use directly from the ROM. The variable without initial values will be located from address
0x0 in the RAM. Subsequent areas are used for variables with initial values. The initial values of variables are
stored in the ROM and copied from the ROM into the RAM by the application program.
0x008000
0x000fbf
0x000000
Using default linker script files is the simplest method for using memory in this way.
This section location can be realized without adding to or correcting settings in the [GNU17 Linker Script Set-
tings] dialog box.
Example of a source file configuration
(vector table and stack initialization, etc.)
boot.s
(main and other functions)
main.c
The program is assumed to be comprised of these two sources.
Except when the location addresses of the respective sections are specified individually, the sections when
linked are located in alphabetical order of file names. In the example here, the sections are located in order of
boot.s and main.c. The vector table at the beginning of boot.s (i.e., the .rodata section) is placed at
the beginning of the ROM (0x8000 and beyond).
5-140
ROM
Unused area
Variables
.data section (LMA)
with initial values
Constants
.rodata section (LMA=VMA)
and other static data
Program
.text section (LMA=VMA)
Vector table
.vector section (LMA=VMA)
RAM
Stack area
Variables
.data section (VMA)
with initial values
Variables without initial
.bss section (VMA)
values and work area
Figure 5.7.6.2 Example of a memory configuration 1
EPSOn
Data
copied
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
S5U1C17001C ManUal
Need help?
Do you have a question about the S5U1C17001C and is the answer not in the manual?