(C Compiler Package for S1C17 Family)
(Ver. 1.5.0)
Manual
Page 2
NOTICE
No part of this material may be reproduced or duplicated in any form or by any means without the written permission
of Seiko Epson. Seiko Epson reserves the right to make changes to this material without notice. Seiko Epson does not
assume any liability of any kind arising out of any inaccuracies contained in this material or due to its application or
use in any product or circuit and, further, there is no representation that this material is applicable to products requiring high level reliability, such as medical products. Moreover, no license to any intellectual property rights is granted by
implication or otherwise, and there is no representation or warranty that anything made in accordance with this material will be free from any patent or copyright infringement of a third party. This material or portions thereof may contain
technology or the subject relating to strategic products under the control of the Foreign Exchange and Foreign Trade
Law of Japan and may require an export license from the Ministry of Economy, Trade and Industry or other approval
from another government agency.
Windows 2000, Windows XP, and Windows Vista are registered trademarks of Microsoft Corporation, U.S.A.
PC/AT and IBM are registered trademarks of International Business Machines Corporation, U.S.A.
All other product names mentioned herein are trademarks and/or registered trademarks of their respective owners.
• If execution of a build fails after importing a
project using Windows Vista
Explanation modified
Dummy functions were deleted from the table.
Explanation modified
Table (functions with prototype declarations only)
was added.
Technical term changed
“ANSI standard library” → “ANSI library”
Explanation added
Certain ANSI library functions ... include the
pertinent header file rather than declaring a
prototype before implementing the function.
Explanation modified
-O3 was added.
Explanation added
(10) Due to C language specifications, ...
substitution will not proceed correctly.
Section deleted
• If execution of a build fails after importing a
project using Windows Vista
[Use Japanese Kanji filter]... (When the
checkbox is unselected, the -mno-sjis-filt
option is specified during compilation.)
-O3: Optimizes code execution speed.
Example of generated makefile
• If execution of a build fails after importing a
project using Windows Vista
Of bugs detected during the evaluation, ... are
described in ...
-O3 was added.
-mno-sjis-filt
• First argument: long; second argument: pointer;
third argument: pointer
Section added
6.4.7 Compiler Implementation Definition
Section added
6.5 Filter Function for Shift JIS Code
Page 4
Code No.PageChapter/SectionDescription of revision
411086605
6-16 to
6.7 Known IssuesSection added
6-18
7-67.2.3 Floating-point Number
Processing Implementation
Definition
6.7 Known Issues
Section added
7.2.3 Floating-point Number Processing
Implementation Definition
7-97.3.1 OverviewExplanation modified
Certain ANSI library functions ... See the table
in Section 4.2.2, “Library Functions and Header
Files” for
a discussion of ANSI libra
with prototype declarations only.
7-9 to
7-12
7.3.2 ANSI Library Function ListExplanation modified
Explanation of dummy functions and descriptions
pertaining to dummy functions have been
deleted.
7-157.3.3 Declaring and Initializing
Global Variables
Explanation modified
Descriptions pertaining to dummy functions have
been deleted.
10-2610.4.5 [Memory] WindowExplan
ation modified
emory Preferences dialog box
M
10-2610.4.5 [Memory] WindowExplanation added
Default Start Dump Address
10-6310.7.1 List of Commands“Table 10.7.1.1 List of commands” revised
ry functions
10-11210.7.8 Break Setup CommandsSection added
commands (setting a command to execute after
a break)
11-311.1.4 MakefilesExplanation modified
Example of generated makefile
11-5511.11.5.1 MenusExplanation modified
About
LcdUtil message box
1
1-6411.11.8 Warning Messages and
“Table 11.11.8.1 List of warning messages” revised
Error Messages
QR-13Quick ReferenceExplanation modified
-O3 was added.
QR-13Quick ReferenceExplanation added
-mno-sjis-filt
QR-22Quick ReferenceExplanation added
commands
QR-27Quick ReferenceExplanation modified
Explanation of dummy functions and descriptions
pertaining to dummy functions have been
deleted.
Page 5
1 General
2 Installation
3 Software Development Procedures
4 Source Files
5 GNU17 IDE
6 C Compiler
7 Library
8 Assembler
9 Linker
10 Debugger
11 Other Tools
Quick Reference
General
Install
SoftDev
SrcFiles
IDE
Compiler
Library
Assemblr
Linker
Debugger
Tools
Reference
S5U1C17001C Manual
Page 6
Page 7
INTRODUCTION
Introduction
This document describes the development procedure from compiling C source files to debugging and creating
the mask data which is finally submitted to Seiko Epson. It also explains how to use each development tool of the
S1C17 Family C Compiler Package common to all the models of the S1C17 Family.
How To Read the Manual
This manual was edited particularly for those who are engaged in program development. Therefore, it assumes that
the reader already possesses the following fundamental knowledge:
• Knowledge about C language (based on ANSI C) and C source creation methods
• Knowledge about the gnu C, binutils, gnu make and the linker script for the gnu linker (ld)
• Basic knowledge about assembler language
• Basic knowledge about the general concept of program development by a C compiler and an assembler
• Basic operating methods for Windows 2000 or Windows XP.
Please refer to manuals or general documents which describe ANSI C, gnu tools and Windows‚ for the above contents.
Before installation
See Chapter 1. Chapter 1 describes the composition of this package, and provides a general outline of each tool.
Installation
Install the tools following the installation procedure described in Chapter 2.
To understand the flow of program development and the operating procedure
See the Tutorial described in Chapter 3. This will give you an overview of program development using the C
compiler to the debugger and how to make the mask data.
For coding
See the necessary parts in Chapter 4. Chapter 4 describes notes on creating source files and the grammar for the
assembler language. Also refer to the following manuals when coding:
S1C17xxx Technical Manual
Covers device specifications, and the operation and control method of the peripheral circuits.
S1C17 Core Manual
Has the instructions and details the functions and operation of the Core CPU.
For debugging
Chapter 10 explains details of the debugger. Sections 10.1 to 10.6 give an overview of the functions of the de-
bugger. See Section 10.7 for details of the debug commands. Also refer to the following manuals to understand
operations of the debugging tools:
S1C17 Family In-Circuit Debugger Manual
Explains the functions and handling methods of the ICD Mini (S5U1C17001H).
For details of each tool
Refer to Chapters 5 to 11 and gnu tool manuals for details.
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
EPSON
i
Page 8
INTRODUCTION
Manual Notations
This manual was prepared by following the notation rules detailed below:
Samples
The sample screens provided in the manual are all examples of displays under Windows 2000/XP. These dis-
plays may vary according to the system or fonts used.
Names of each part
The names or designations of the windows, menus and menu commands, buttons, dialog boxes, and keys are
annotated in brackets [ ]. Examples: [Command] window, [File] menu, [Stop] button, [q] key, etc.
Names of instructions and commands
The CPU instructions and the debugger commands that can be written in either uppercase or lowercase charac-
ters are annotated in lowercase characters in this manual, except for user-specified symbols. A fixed-width
font is used to describe these words.
Notation of numeric values
Numeric values are described as follows:
Decimal numbers: Not accompanied by any prefix or suffix (e.g., 123, 1000).
Hexadecimal numbers: Accompanied by the prefix "0x" (e.g., 0x0110, 0xffff).
Binary numbers: Accompanied by the prefix "0b" (e.g., 0b0001, 0b10).
However, please note that some sample displays may indicate hexadecimal or binary numbers not accompanied
by any symbol.
Mouse operations
To click: The operation of pressing the left mouse button once, with the cursor (pointer) placed in the
intended location, is expressed as "to click". The clicking operation of the right mouse button
is expressed as "to right-click".
To double-click: Operations of pressing the left mouse button twice in a row, with the cursor (pointer) placed
in the intended location, are all expressed as "to double-click".
To drag: The operation of clicking on a file (icon) with the left mouse button and holding it down
while moving the icon to another location on the screen is expressed as "to drag".
To select: The operation of selecting a menu command by clicking is expressed as "to select".
Key operations
The operation of pressing a specific key is expressed as "to enter a key" or "to press a key".
A combination of keys using "+", such as [Ctrl]+[C] keys, denotes the operation of pressing the [C] key while
the [Ctrl] key is held down. Sample entries through the keyboard are not indicated in [ ].
In this manual, all the operations that can be executed with the mouse are described only as mouse operations.
For operating procedures executed through the keyboard, refer to the Windows manual or help screens.
General forms of commands, startup options, and messages
Items given in [ ] are those to be selected by the user, and they will work without any key entry involved.
An annotation enclosed in < > indicates that a specific name should be placed here. For example, <filename>
needs to be replaced with an actual file name.
Development tool name
ICD: Indicates the ICD Mini (S5U1C17001H) or the ICD board.
ii
EPSON
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
S5U1C17001C MANUAL
Page 9
CONTENTS
– Contents –
1 General ..........................................................................................................................1-1
1.1 Features ...........................................................................................................................1-1
1.2 Outline of Software Tools .................................................................................................1-2
11.12.2 Procedures for Stand-Alone Flash Write......................................................11-66
x
EPSON
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
S5U1C17001C MANUAL
Page 17
S5U1C17001C Manual
1 General
1
General
Page 18
Page 19
1 GENERAL
1 General
1.1 Features
The S1C17 Family C Compiler Package contains software development tools for compiling C source files,
assembling assembly source files, linking object files, debugging executable files, making mask data and other
utilities. The tools are common to all the models of the S1C17 Family.
Its principal features are as follows:
Powerful optimizing function
The C Compiler is designed
The high-optimize ability does not lose most of the debugging information, and it enables C source level
debugging.
Useful extended instructions are provided
The extended instructions allow the programmer to describe assembly source simply without the need of
knowing the data size. The immediate data extension using
that need multiple basic instructions are described with an extended instruction.
C and assembly source level debugger with a simulator function
The debugger supports C source level debugging and assembly source level debugging. By using an ICD, the
program can be debugged even when the target board is operating. It also provides a simulator function
a
llows debugging on a personal computer without using hardware tools.
uit to the S1C17 architecture, it makes it possible to deliver minimized codes.
to s
he "ext" instruction and some useful functions
t
that
1
General
Integrated development environment for Windows
Designed to run under Microsoft Windows 2000 Professional, Windows XP, and Windows Vista, the GNU17
IDE is a seamless integrated development environment suitable for a wide range of development tasks, from
source creation to debugging.
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
EPSON
1-1
Page 20
1 GENERAL
1.2 Outline of Software Tools
The following shows the outlines of the principle tools included in the package.
(1) C Compiler (xgcc.exe)
This tool is made based on GNU C Compiler and is compatible with ANSI C. This tool invokes cpp.exe and
cc1.exe sequentially to compile C source files to the assembly source files for the S1C17 Family. It has a
powerful optimizing ability that can generate minimized assembly c
as.exe assembler to generate object files.
(2) Assembler (as.exe)
This tool assembles assembly source files output by the C compiler and converts the mnemonics of the
source files into object codes (machine language) of the S1C17 Core. The as.exe allows the user to invoke the
assembler through xgcc.exe, this makes it possible to include preprocessor directives into assembly source fi
he results are output in an object file that can be linked or added to a library.
T
(3) Linker (ld.exe)
The linker defines the memory locations of object codes created by the C compiler and assembler, and creates
executable object codes. This tool puts together multiple objects and library files into one file.
(4) Debugger (gdb.exe)
This debugger serves to perform source-level debugging by cont
function that allows debugging on a personal computer.
The gdb.exe supports Windows GUI. Commands that are used frequently, such as break and step, are registered
on the tool bar, minimizing the necessary keyboard operations. Moreover, various data can be displayed in
multi windows, with a resultant increased efficiency in the debugging tasks.
odes.
rolling a
The xgcc.exe can also invoke the
les.
n ICD. It also comes with a simulator
(5) Libraria
n (ar.
exe)
This tool is used to edit libraries. The ar.exe can register object modules created by the C compiler and
assembler to libraries, delete object modules in libraries and restore library modules to the original object files.
(6) Make (make.exe)
This tool automatically executes from compile to link according to the command lines described in the make
file. The basic make file can be created by t
7) GNU17 IDE (eclipse.exe)
(
he IDE.
The development workbench provides an integrated development environment for a wide range of development
tasks, from source creation to debugging.
This package contains other gnu tools, sample programs and several utility programs. For details on those
programs, please refer to "readmeVxx.txt" (xx indicates version) on the disk.
Note: Only the command options for each tool described in the respective section are guaranteed to
work. If other options are required, they should only be used at the user's own risk.
1-2
EPSON
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
S5U1C17001C MANUAL
Page 21
S5U1C17001C Manual
2 Installation
1
2
Install
Page 22
Page 23
2 INSTALLATION
2 Installation
This chapter describes the required working environments for the tools supplied in the S1C17 Family C
Compiler Pa
2.1 Working Environment
To use the S1C17 Family C Compiler Package, the following conditions are necessary:
Pe
rsonal computer
A
GHz, and 512MB or more of memory is recommended.
To
Display
A
Note: Selecting an ultra-large font and high contrast in the Windows "Display Properties" may prevent
Hard
T
ckage and their installation methods.
n IBM PC/AT or a compatible machine which is equipped with a CPU equal to or better than a Pentium4 1.50
use an optional ICD, a USB port is required.
display unit capable of displaying 1,024 × 768 dots or more is recommended.
proper display of the IDE screen. Furthermore, "Color quality" should be set to 16 bits or higher.
drive
he hard drive must have at least 500MB of empty space to install the S1C17 Family C Compiler Package.
2
Install
Mouse
A
mouse is necessary to operate the tools.
Debu
gging tool
To
debug the program and the target system, an optional ICD is needed in addition to this software package.
System software
T
he tools support Microsoft Windows 2000 Professional, Windows XP, or Windows Vista (English or Japanese
ve
rsion).
User account
R
un the S1C17 Family C Complier Package with Administrator privileges.
Other
• P
lease go through the precautions and restrictions given in "readmeVxx.txt" (English, Japanese) (xx indicates
ve
rsion) on the disk.
unning the tools in this package presumes the presence of cygwin1.dll. Although cygwin1.dll is stored in
• R
the \
gnu17 directory, if cygwin1.dll is already installed on your system, the duplication may cause problems.
If s
o, remove the copy of cygwin1.dll installed in your system or exclude it from the environment variable
PATH
settings to ensure that the file referenced is always the copy of cygwin1.dll located in the \gnu17
directory.
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
EPSON
2-1
Page 24
2-2
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
2 INSTALLATION
2.2 Installation Method
Installing the tools
To install the tools, run the installer found on the CD-ROM provided.
(1) Start Windows 2000/XP/Vista.
If Windows is already running, close all other programs that are currently open.
(2) Download the compressed S5U1C17001C file from the EPSON user site and expand it in the desired
folder..
(3) Double-click Setup.exe to launch the installer.
You will see the install wizard start screen.
(4) Click the [Next >] button to go to the next step.
Read the end user software license agreement displayed
on the following screen.
(5) If you agree to the terms of the license, select "I
accept the terms of the license agreement" and click
the [Next >] button. If you do not agree, click the
[Cancel] button to close the installer.
The screen displayed allows you to select the directory
into which the gnu17 tools are to be installed.
(6) Check the destination directory in which the tool
will be installed.
To switch to a different directory, use the [Browse...]
button to bring up a directory selection dialog box.
From the list in this dialog box, select the directory
in which you want to install the tools, or enter a path
to the desired directory in the [Path] text box. Click
the [OK] button.
(7) Click the [Next >] button.
Page 25
S5U1C17001C MANUAL
EPSON
2-3
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
2 INSTALLATION
2
Install
This is the install start screen.
(8) Click the [Install] button to begin installing.
When
installation is completed, a complete screen is
displayed.
(9) C
lick the [Finish] button to quit the installer.
This completes installation of the tools.
Assuming
Wi
ndows startup menu.
installation finished successfully, an [EPSON MCU] > [GNU17vx.x] menu will be added to the
Page 26
2-4
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
2 INSTALLATION
Installed files
The following lists the configuration of directories and files after copying.
\EPSON (default)
\gnu17 (root DIR of gnu17 tool)
readmeVxx.txt : Description of the tool (English and Japanese)
Copying.GNU : GNU general public license
xgcc.exe : Gnu C compiler (cpp.exe and cc1.exe are used)
xgcc_filt.exe : Kanji filter (same as xgcc.exe)
cpp.exe : Preprocessor
cc1.exe : Compiler
as.exe : Assembler
ld.exe : Linker
objdump.exe : Object file dump tool
objcopy.exe : Converts obj files to the specified format (e.g., S-record format).
gdb.exe : Debugger
gdbtk.ini : gdb initialization file
gnuProf.exe : Profiler executable file
gnuCvrg.exe : Coverage executable file
cygitcl30.dll : dll for gdb
cygitk30.dll : dll for gdb
cygtcl80.dll : dll for gdb
cygtk80.dll : dll for gdb
tix4180.dll : dll for gdb
cygwin1.dll : dll for compiler, binutils, etc.
cygiconv-2.dll : dll for cygwin1.dll
cygintl-3.dll : dll for cygwin1.dll
cygintl-8.dll : dll for cygwin1.dll
reset.gdb : Command file executable by Reset button
userdefine.gdb : Command file executable by User button
savebreak.gdb : Command file for commands related to saving breakpoints
loadbreak.gdb : Command file for commands related to resetting breakpoints
make.exe : Make execution
ar.exe : Library file creation/update
cp.exe : File copying
rm.exe : File deletion
sed.exe : Stream editor
sh.exe : Bourne shell
ccap.exe : Console capture
moto2ff.exe : Tool for filling gaps in Motorola-format file with FFs
sconv32.exe : Tool for converting Motorola-format file to S2 record file
DIFF.EXE : File comparison utility
vecChecker.exe : Vector checker for coprocessor
\include : Header file to ANSI C library
\lib
\16bit : Library for 16-bit address space
libc.a : ANSI C library
libgcc.a : Emulation library
libgccM.a : Emulation library (coprocessor multiplication instructions supported)
instructions supported)
libstdio.a : Library for simulation IO
\24bit : Library for 24-bit address space (file structure is the same as that of \16bit)
\eclipse
eclipse.exe : GNU17 IDE executable file
eclipse.ini : Eclipse settings file
.eclipseproduct : Eclipse version information
epl-v10.html : EPL license
notice.html : Software agreement
gnu17_32_trans.ico : gnu17 icon file
Page 27
S5U1C17001C MANUAL
EPSON
2-5
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
2 INSTALLATION
2
Install
artifacts.xml : Eclipse update manager file
\configuration : Startup configuration file and other files
\dropins : plug-in folder (empty folder)
\features : Features
\jre : Java virtual machine
\p2 : Eclipse update manager folder
\plugins : Plug-in
\readme : Release note
\essim17 : Embedded system simulator
\utility : Utility
\tool : Middleware and other tools
\dev : ROM data production tool
\sample : Sample file
\mcu_model : Model-specific information tool
\doc : Manual and other documents
Refer to the "readmeVxx.txt" for the contents of the "sample" and "utility" directories.
Precaution when installing over existing version
If the gnu17 tools have been installed over the old version, changes in the GNU17 IDE may not be reflected in
the new version just installed. If this happens, temporarily close GNU17 IDE, then start from the command line
prompt, as described below.
C:\EPSON\gnu17\eclipse>eclipse.exe -clean
Precautions on setting the OS
• Select to "regular" font size in "Display Properties".
hen using a drive on the network as the tool and/or work drive, be sure to assign a drive name to it. The
• W
netwo
rk name cannot be used.
o not use the USB port for the ICD in other drivers and applications. Furthermore, make sure that the port has
• D
been enabled when using a note PC as some can disable USB port.
• I
f the gdb debugger or GNU17 IDE have a problem on the GUI that causes an abnormal display, decrease
the
function level of the graphics or use a low-level standard display driver which has been supplied in the
Wi
ndows package.
Uninstalling the tools
To uninstall the tools, select [UnInstall] from [EPSON MCU] > [GNU17] in Windows startup menu, then click
the [OK] bu
You also can use Add/Remove Programs in the Control Panel to uninstall the tools.
Note: If you set the \EPSON\gnu17\eclipse\workspace directory in the workspace, make a backup of
tton in the subsequent dialog box.
→
the workspace directory before removing the tools. (Projects are saved to this directory.)
Page 28
2 INSTALLATION
About the license
GNU
The C compiler tools in this package is made based on the GNU C Compiler designed by Free Software
Foundation, Inc. Please read the "Copying.GNU" text file for the license before using.
EPL
GNU17 IDE complies with the Open Source Initiative EPL (Eclipse Public License) 1.0. For more information
on the EPL, refer to epl-v10.html in the \gnu17\eclipse directory.
2-6
EPSON
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
S5U1C17001C MANUAL
Page 29
S5U1C17001C Manual
3 Software Development
Procedures
3
SoftDev
Page 30
Page 31
3 SOFTWARE DEVELOPMENT PROCEDURES
GNU17 IDE
C compiler
xgcc
cpp
cc1
Assembler
as
Linker
ld
Debugger
gdb
ICD
Simulator
Object data translator
objcopy
file.c∗1
file.o
file.elf
file.mak
file.par
file.sa
Librarian
ar
file.a
libstdio.a
libc.a
file.s∗2
file.map
ANSI library
Emulation library
Simulated I/O library
SEIKO EPSON
C source
files
Assembly
source files
file.s
Assembly
source files
Library
files
Make
file
Parameter
file
file.cmd
Command
file
Target Board
Executable
object file
Map
file
2nd pass
ROM data
HEX file
Data dump utility
objdump
file.dump
Dump file
ROM area data utility
moto2ff
file.saf
ROM area
data file
Motorola S converter
sconv32
file.psa
Motorola S2
ROM data file
file.ini
Device information
definition file
Function option
generator winfog17
file.fdc
Function option
document file
Mask data checker
winmdc17
file.PA
Mask
data file
(Windows version)
Object
files
file.lds
Linker
script
file
∗1 file.c
file.h
∗2 file.s
file.S
Make
libgcc.a (libgccM.a/libgccMD.a)
3 Software Development Procedures
3
SoftDev
3.1 Software Development Flow
Figure 3.1.1 shows typical software development flow.
Figure 3.1.1 Software development flow
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
EPSON
3-1
Page 32
3-2
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
As shown above, the tools included with this package handle all software processing required after creating a
source program. All basic operations except debugging are performed in the GNU17 IDE (hereafter the IDE).
The development flow is outlined below.
(1) Creating a project
Use the IDE to create a new project. The system will set up the project file needed to collectively manage the
software resources of th
pplication to be developed and a workspace directory in which those resources are
e a
stored.
(2) Creating a source program
Use the IDE editor or a general-purpose editor to create a source file and add it to the project.
(3) Building a program
Start by using the IDE to set startup options for the tools from the C compiler to the linker and linker scripts.
Then execute a build process from the IDE. The sys
ill execute make.exe using the makefile (generated
tem w
according to the set content), generating object files in debuggable ‘elf’ format and ROM data files (psa files),
which are created by converting object files into S-record format.
The necessary processing is automatically executed sequentially in the following operations according to the
makefile.
• Compile (for C sources)
The source files are compi
y the xgcc C compiler, generating the object files (.o) are to be input to the ld
led b
linker.
• Assemble (assembler sources)
The assembler source files are assembled by the as assembler to generate the object files (.o) to be input to
the ld linker.
If the source files include preprocessor instructions, use xgcc to perform preprocessing and assembly. When
the necessary options are specified, xgcc will execute
Link
•
the cpp preprocessor and the as assembler.
The compilation and assembly operations described above will prepare one or multiple object files required
for subsequent processing. The ld linker then generates an executable object file capable of being loaded and
executed in the target ROM, namely ‘elf’ format object files that include information required for debugging,
etc.
• S-record conversion
L
aunches o
bjcopy/moto2ff/sconv32 and outputs S-record-format ROM data files (psa files) from ‘elf’ format
object files.
Use the objcopy object file format conversion utility to create HEX files for writing programs to external
ROM or internal ROM from ‘elf’ format object files generated by the ld linker.
Then convert the HEX file for the internal ROM into a Motorola S2 file in which the unused area is filled
wit
by moto2ff and sconv32.
h 0xff
Using the ROM data file created above, perform final verification of program operation on the actual target
board.
(4) Debugging
Use ‘elf’ format object files generated by the ld linker and S-record format ROM data file (psa file) to perform
verification and debugging with the gdb debugger. Although an ICD can be used to debug hardware as well as
software operation, the gdb has simulator mod
hat allows the PC to emulate device operations as the S1C17
e t
Core and memory models.
Debugger setting and startup can be performed from the IDE.
Page 33
S5U1C17001C MANUAL
EPSON
3-3
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
(5) Creating ROM data and mask data
Use the object file format conversion utility objcopy to create HEX files for writing the program into external and
internal ROMs from the ‘elf’ format object files generated by the ld linker. Then, convert the HEX file for the internal
ROM into a Motorola S2 file in which the unused area is filled with 0xff using moto2ff and sconv32. After creating
the ROM data file according to
the above procedure, be sure to perform the final verification of program operation on
the actual target board using that file. Finally, pack the verified ROM data file (psa file) and the mask option data file
generated by winf
og17 into a mask data file using winmdc17 and present it to Seiko Epson.
Note that winfog17 and winmdc17 can be started by the IDE.
In addition to the tools described above, the C compiler package comes w
ith t
he ar librarian. This tool organizes
modules for general-purpose processing (e.g., object files output by the as assembler) as a library, facilitating future
applications development involving the S1C17 Family.
Page 34
3-4
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Creating a
new project
When generating makefiles, etc. automatically by the IDE
•Ordinary program development
•Building and debugging requires the creation of source files
When using the makefiles, etc. prepared by the user
•Reuse/revision, etc. of programs not created with the IDE
•Increased user freedom of build and debugger startup
• makefile and IDE configurations requires modification
Reference
(1) Creating a new project 1
3.3 Tutorial 1 (Basic Operations, from Project Creation
to ROM mask Data)
Importing an
existing
project
•Project migration from another environment
•Program revision, etc.
Reference
(3) Importing an existing IDE project
3.5 Tutorial 3 (Importing an IDE Project)
Reference
(2) Creating a new project 2
3.4 Tutorial 2 (Using the User Makefiles)
3.2 Software Development Using the IDE
This section describes software development procedures using the IDE separately in several different cases. The
actual operations are detailed in other tutorial sections in this manual.
First, before starting software development with the IDE, create a folder labeled "project" for each application. Use
this folder to manage necessary resources.
If no projects are c
applies when creating an entirely new application or when using one of programs created with an earlier version of
the S1C17 tools.
If a project has already been created in the IDE, it is possible to migrate projects from another environment or to
upgrade program versions by importing that project folder.
n the IDE, software development with the IDE will start with project creation. The same
reated i
Figure 3.2.1 Software development with the IDE
Page 35
S5U1C17001C MANUAL
EPSON
3-5
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Create a new project
Edit source files
Specify build options
Set a linker script (link map)
Build (compile link)
Set debugger startup
Start the debugger
Close the debugger
Debug
Error?
OK?
Create and edit source files using the IDE.
You can also import source files created in other editors.
IDE
Debugger
Select C compiler, assembler, and linker options.
From
second
time
yes
yes
no
no
From
second
time
Set section information and location.
Linker script files are generated automatically by the IDE.
Run make.exe to execute the makefile generated
automatically by the IDE.
You can jump from an error message to the editor line
containing the error.
Set parameter file map information and connect
mode, etc.
Completed
Start the gdb debugger. The gdb debugger executes
the command file generated automatically by the IDE.
Start the IDE
(1) Creating a new project 1
This is the conventional procedure for developing software with the IDE. The user creates source files, after
which the IDE automatically generates all other files required for build processing and debugger startup.
The basic procedural flow is given below.
Figure 3.2.2 Procedural flow (makefiles, etc. generated automatically by the IDE)
For detailed information on basic operations, from starting the IDE to debugging the program, refer to Section
3.3, "Tutorial 1 (Basic Operations, from Project Creation to ROM mask Data)".
Page 36
3-6
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Create a new project
Import files
Edit source files
Edit user's build/debug files
Alter IDE settings
Specify build options
Set a linker script (link map)
Build (compile link)
Set debugger startup
Start the debugger
Close the debugger
Debug
Error?
OK?
Create and edit source files in the IDE.
IDE
Debugger
Not required when using the user's makefiles.
Correct the makefiles, linker script files, parameter
files, and debugger command files.
In addition to source files, existing or user-created
makefiles, linker script files, parameter files, and
debugger command files may be imported for use
in this operation.
From
second
time
yes
yes
no
no
From
second
time
Not required when using the user's linker script files.
This setting is required to use the user's build/debug
files.
Run make.exe to execute a build process.
You can jump from an error message to the editor line
containing the error.
Not required when using the user's parameter and
debug command files.
Completed
Start the gdb debugger.
The user's debug command file can be specified.
Start the IDE
(2) Creating a new project 2
When developing new software, a user makefile or a debug command file may be used instead of generating
files automatically with the IDE.
The basic procedural flow is given below.
For detailed information on building a program with the IDE, refer to Section 3.4, "Tutorial 2 (Using the User
Makefiles)", which describes the procedure for building a sample program using a user makefile.
To use user makefiles, you must correct the makefile itself and alter the settings made in the IDE. Unless doing
so would result in
Figure 3.2.3 Procedural flow (using the user's makefiles, etc.)
problems, we recommend using the fi
les automatically generated by the IDE.
Page 37
S5U1C17001C MANUAL
EPSON
3-7
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Import a project
Edit source files
Specify build options
Set a linker script (link map)
Build (compile link)
Set debugger startup
Start the debugger
Close the debugger
Debug
Error?
OK?
Create and edit source files in the IDE.
IDE
Debugger
Only when changes are needed.
Only when changes are needed.
Only when changes are needed.
Select and import a project file.
From
second
time
yes
yes
no
no
From
second
time
Run make.exe to execute a build process.
You can jump from an error message to the
editor line containing the error.
Completed
Start the gdb debugger.
Start the IDE
(3) Importing an existing IDE project
If you have an existing project, you can simply import the project to continue working on your development or
revisions. The project properties are inherited, so that re-configuration or other such operations are not required
unless you intend to change them. However, project management files must remain intact in the project folder
to be able to import projec
The basic procedural flow is given below.
ts.
Figure 3.2.4 Procedural flow (importing an IDE project)
For detailed information on how to import a project, refer to Section 3.5, "Tutorial 3 (Importing an IDE Proj-
ect)", which describes the procedure for importing a sample program created with the IDE.
Page 38
3-8
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.3 Tutorial 1 (Basic Operations, from Project Creation to ROM
mask Data)
This section provides a tutorial based on a sequence of basic operations from IDE startup to debugging to creation
of the ROM data file. For detailed information on each tool, refer to the sections in which the respective tools are
described.
Files used
This discussion assumes that the sample source files listed below are prese
sample\S1C17common\simulator\tst directory.
boot.s Assembler source file
main.cC source file
Described below is range of operations for creating a project, building a program, and verifying program operation
using the above two source files. Note that this discussion assumes that you are using the IDE for the first time after installing the tools. If you have taken any actions in the IDE, the example screens may not match the ones you
see on y
our PC.
3.3.1 Starting the IDE
Step 1: Double-click the eclipse.exe icon in the c:\EPSON\gnu17\eclipse directory to start the
IDE. You also can start the IDE by selecting [EPSON MCU] > [GNU17] > [GNU17 IDE] from
the Windows Start menu.
in the c:\EPSON\gnu17\
nt
After an Eclipse splash screen, the [Workspace Launcher] dialog box shown below will appear. Specify the workspace (directory) in which you want to save the project resources and output files.
This tutorial uses the default workspace directory. You can select any directory or create a new directory and set it
as the workspace.
* Do not specify the project directory (directory containing .project file) as a workspace directory. Doing so may
result in failures with project imports (when [Copy projects into workspace] is selected).
Step 2: Click the [OK] button.
The IDE window shown below will be displayed.
Page 39
S5U1C17001C MANUAL
EPSON
3-9
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Editor area
View
To quit before completing the tutorial, select [Exit] from the [File] menu of the IDE. Or use the window's
(close) button. When the following dialog box appears, click the [OK] button to quit or the [Cancel] button to
cancel quitting.
Page 40
3-10
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.3.2 Creating a Project
In applications development, a single executable program file is created from multiple source files. To manage these
files in one location, you must create a project. The IDE generates programs on a per-project basis. In a sense, the
project is the application program you want to develop, but the project actually created is a directory with a specified project name, wherein
ect) are generated.
To create a new project
The [New GNU17 Project] wizard will start.
files containing project information (.cproject, .gnu17project, and .proj-
Step 3: Select [New GNU17 Project] from the [New] pulldown menu in the toolbar.
You can also select [New GNU17 Project] from the [File] menu or from [New] on the
context menu (displayed by right-clicking) in the [C/C++ Projects/Navigator] view.
Page 41
S5U1C17001C MANUAL
EPSON
3-11
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Specifying a project name
Step 4: Enter the project name "sample" in the [Project name:] text box.
Leave the [Use default location] check box selected. A project folder named "sample" will be generated in the
workspace directory you specified when the IDE started.
The executable object file (.elf) generated when building a project is assigned the name you specify here.
Step 5: Click the [Next>] button.
The system will go to the next screen, where you select a targ
et CPU, memory model and vector table file.
Page 42
3-12
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Specifying a target CPU
Step 6: From the [Target CPU Device] combo box, select the target processor. Here, se-
lect "S1C17".
Selecting a memory model
Step 7: Select the memory model supported by the processor from the [Memory Model]
combo box. Here, select "REGULAR".
REGULAR: 24-bit address space (16MB)
MIDDLE: 20-bit address space (1MB)
SMALL: 16-bit address space (64KB)
Selecting a coprocessor library
Depending on the selected target CPU, you can specify whether to link a coprocessor library and its type.
Step 8: Select or unselect the [Use Co-processor Library] checkbox.
ON: Adds the setting to link the coprocessor library libgccMD.a (for multiplication and division)
or libgccM.a (for multiplication) when creating a project. If you select this option, select the
library type from the [Select
just one selection option.)
OFF: Adds the setting to link the ordinary emulation library libgcc.a when creating a project.
The IDE requires the definition of a vector table section labeled .vector in a linker script to ensure that the
trap vectors located in memory always begin with the trap table base address. In the [Use '.vector' section as a
vector table container] field of this screen, specify whether to locate a specific object in the .vector section
by selecting or unselecting the check box and
set an object file name in the combo box. Here, we'll proceed as-
suming that boot.o is located in the .vector section.
Step 9: Select boot.o from the pulldown list.
For detailed information on the .vector section, refer to Section 5.7.8, "Editing a Linker Script".
Specifying a boot vector address
In the [Specify boot vector address] field, specify a boot vector address. The default boot vector address is
"008000". The value set here will be used as the parameter for the TTBR setting command that will be written
in the debugger startup command file created by the IDE
section that will be written in the linker script file. It is not necessary to alter the default value.
ell as it will be used as the VMA of the .vector
as w
Page 43
S5U1C17001C MANUAL
EPSON
3-13
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 10: Click the [Finish] button.
The [New GNU17 Project] wizard will be closed, creating a project with the specified name.
Note that the target CPU cannot be changed later. The memory model, coprocessor library, and vector table file
can be revised later.
Page 44
3-14
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.3.3 Creating, Adding, and Editing a Source File
The IDE supports C and assembler to allow generation of an object from source files created in those languages.
All source files required to generate an object must be added to the project created earlier.
Creating a source file
Use the IDE editor or a general-purpose editor to create a source file. You can also use an existing source file in
the application you created for the S1C17 Fa
In this tutorial, we will use the source files prepared as examples.
For detailed information on creating a new source file with the IDE, refer to Section 5.5, "The Editor and Edit-
ing Source Files".
Adding a source file
Load the source files prepared as samples into the project.
Step 11: Select [Import...] from the [File] menu.
The [Import] wizard will start.
mily.
Step 12: From the list displayed, select [General] > [File System] and click the [Next>] button.
Page 45
S5U1C17001C MANUAL
EPSON
3-15
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 13: Click the [Browse...] button for [From directory:]. The [Import from directory] dialog box will be dis-
played, so select the \EPSON\gnu17\sample\S1C17common\simulator\tst directory from
the drive (C) in which you installed the IDE and click [OK].
Page 46
3-16
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
The directory you selected is displayed in the left-side list box, while the files contained in the directory are
listed in the right-side list box.
Step 14: Select "boot.s" and "main.c" from the file list. Click to select the check box shown before the
file name (flagged by a check mark when selected).
Step 15: Click the [Browse...] button for the [Into folder:]. This displays the [Import into Folder] dialog box.
Select the "sample" folder and click [OK].
Page 47
S5U1C17001C MANUAL
EPSON
3-17
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 16: After confirming that the dialog box is filled out as shown above, click the [Finish] button.
This procedure adds "boot.s" and "main.c" to the project.
Step 17: Double-click "sample" in the [C/C++ Projects] view, or click [+] shown before "sample".
The added source files are displayed in the "sample" folder in the [C/C++ Projects] view.
Step 18: Click [+] for "main.c" in the [C/C++ Projects] view.
The global variables and functions defined in the file are displayed for C sources.
Page 48
3-18
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Displaying and editing source files
Use the IDE editor to display and edit source files added to the project.
Step 19: Double-click "main.c" in the [C/C++ Projects] view.
The contents of main.c are displayed in the editor. Here, you can correct the source as with a general-purpose
editor. Furthermore, you can set up the editor so that selected files will be opened in a general-purpose editor
you normally use.
For detailed information, refer to Section 5.5, "The Editor and Editing Source Files".
If C sources are displayed, reserved words, comments, and C strings are hig
hlighted in color.
Page 49
S5U1C17001C MANUAL
EPSON
3-19
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 20: Click "main" in the [Outline] view.
Marker bar
The editor will jump to the line where main() exists and highlight it. Furthermore, a bar indicating the range
of the main() function will be displayed in the marker bar on the left side of the editor window. This way the
editor allows you to inspect functions, etc. easily.
Step 21: Double-click "boot.s" in the [C/C++ Projects] view.
Multiple sources can be opened at the same time. Click the tab at the top of the editor window (where a file
name is displayed) and select the source you want to display or edit.
When assembler sources are displayed, the labels, directives, and registers are highlighted.
Step 22: Click the
(close) button on the editor tab of each open source to close the editor.
Page 50
3-20
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.3.4 Editing the Build Options and the Linker Script
To build a project (to generate an executable object file), make.exe is used to start the compiler, assembler, and
linker. Although the makefiles required for make are generated automatically by the IDE, the build options to be
written in those files (i.e., compiler, assembler, and linker startup options) must first be set before they can be used.
Furth
ermore, the contents of the linker script files required for link operation must also be set before a project can
be built.
The method for making these settings is outlined below.
Setting build options
Step 23: Select [Properties] from the [Project] menu. You also can select [Properties] from the context menu that
pops up when you right-click on the project name "sample" in the [C/C++ Projects] view.
The [Properties] dialog box will be displayed.
S
tep 24: From the properties list on the left side of the dialog box, select [GNU17 Build Options] by clicking
on it to display the [Build Options] tab page.
You can set command line options here for the compiler, assembler, linker, and vector checker.
Click to select one of the tool names shown in tree form (Compiler, Assembler, Linker, or Vector Checker for
Copro) and display the currently selected options in the [All Options] column. Select the kind of option from
those shown in tree form by clicking on it, and the options of the selected kind will
be enabled, allowing you to
set.
Currently displayed here are the options that have been set by default when you created a new project.
For the contents of options, refer to the respective chapters in this manual in which each tool is described. For
detailed information on option select screen, refer to Section 5.7, "Building a Program".
In this tutorial, although no particular changes are needed
ere, we'll take a look at the method on how to add a
h
user include path and a library file.
Page 51
S5U1C17001C MANUAL
EPSON
3-21
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Adding an include path
Steps 25 to 28 below are shown for reference only. No operation is required.
Step 25: Select [Compiler] > [Directories] from the [Build Options] tree.
The page in which you set the C compiler's -I option (to specify an include path) will be displayed.
If user header files are prepared in another directory, they should be added to this list following the procedure
described below.
Step 26: Click the [Add] button. A directory select dialog box will be displayed, so enter a path or se-
lect one from the folder select dialog box that appears when you click the [Browse...] button.
When the directory select dialog box is closed, the path entered or selected is added to the list as show
n below.
Page 52
3-22
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
The features of other buttons are summarized below.
[Delete]Deletes the path selected in the list.
[Edit]Edits the path selected in the list. A dialog box is displayed in which you can modify the
path.
[Move Up]Moves the path selected in the list one place up in the list. Include files are searched sequen-
tially, beginning with the path uppermost in the list.
[Move Down] Moves the selected path down in the list.
Step 27: Press the [Apply] button to confirm the changes made here.
If you click the [Apply] or [OK] button after settings in a [GNU17 Build Options] page have been
changed, a dialog box appears for selecting whether the files created with the previous settings will
be deleted (and rebuild) or not. Click the [Cancel] button.
The directory setti
ng specifi
ed here provides the includes file paths for the C compiler to search from.
Macro and environment variable to specify a path
The [Include Paths (-I)] column lists "$(TOOL_DIR)/include" that is set by default.
$(environment variable) is a macro defined in the makefile that is generated when you build a project.
TOOL_DIR is the environment variable in which the path to the gnu17 tool directory is defined. The defined
contents can be
rified in the [Environments] tab page.
ve
Example: If the gnu17 tools have been installed in the c:\EPSON\gnu17 directory
TOOL_DIR = c:/EPSON/gnu17
Since the macro is replaced with the contents of the environment variable described in () during execution of
make.exe, -I$(TOOL_DIR)/include will be resolved to -Ic:/EPSON/gnu17/include.
The [Environments] tab page allows the user to define environment variables similar to TOOL_DIR.
Page 53
S5U1C17001C MANUAL
EPSON
3-23
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
The definition procedure is described below.
Step 28: Click the [New] button to display the [New Environment Setting] dialog box.
Enter an environment variable name in the [Name:] text box.
Type in using the keyboard or select using the [Browse...] button to enter a path in the [Path:] text
box.
Then click the [OK] button to close the dialog box.
The environment variables defined here may be used for specifying include file and library file paths in the
build options. The environment variable should be used as a $(environment variable) macro format when
specifying a path option.
Adding a library file
Steps 29 to 31 below are shown for reference only. No operation is required.
Step 29: Select [Linker] > [Libraries] from the [Build Options] tree.
Displays the page in which a library fi
le can be set.
The [Libraries] column lists the ANSI library and emulation library included in this package.
Page 54
3-24
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
If user library files are available, add them to this list following the procedure described below.
Step 30: Click the [Add] button. In the file select dialog box displayed, enter a file name or select one from
the [Open] dialog box displayed by clicking the [Browse...] button.
Paths can be specified using the environment variables that have been defined in the [Environments] tab page.
Close the file select dialog box to add the fi
le entered or selected to the list as shown below.
The features of other buttons are the same as for the include path described before.
Step 31: Press the [Apply] button to confirm the changes made here.
If you click the [Apply] or [OK] button after settings in a [GNU17 Build Options] page have been
changed, a dialog box appears for selecting whether the files created with the previous settings will
be deleted (and rebuild) or not. Click the [Canc
el] bu
tton.
The library settings specified here will be used in the linking operation.
Setting a linker script
A build process requires a linker script file. This file also can be created with the IDE.
A linker script file is used to indicate the section location and configuration to the linker. For example, one
object file generated by the assembler consists of sets of codes classified by data attri
code part, static data part, and a variable part. A set of codes like these comprises a single section. To the linker,
these represent an input section. The linker combines multiple input sections of the same kind into one (by re-
configuring them into an output section) to generate an executable object file. Furthermore, these sets of codes,
even of the same attributes, mu
st b
e separated by location address and device so that the program code part
for the object generated from sources 1 and 2 is located at address A of the external ROM, and the program
code part for the object generated from source 3 is located at address B of the internal ROM before they can be
linked.
Therefore, a linker script file specifies which input sections should be combined to configure o
tion, from which address a section should be stored in memory, and at which address a section should be executed. For more information, refer to Section 3.8, "Sections and Linkage".
Step 32: If you closed the [Properties] dialog box, select [Properties] from the [Project] menu to reopen it.
Step 33: Click to select [GNU17 Linker Script Settings] from the properties list.
tes, such as a program
bu
ne o
utput sec-
Page 55
S5U1C17001C MANUAL
EPSON
3-25
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
You'll see that the five basic sections (output sections)—i.e., .bss, .data, .vector, .text, and .ro-
data—are preset in the Section name column.
.bss Section in which variables without initial values are placed. (Normally located in
RAM.)
.dataSection in which variables with initial values are placed. (The initial values are lo-
cated in ROM. They are copied into RAM when needed.)
.vectorSection in which vector tables are placed. (T
he actual data is located in ROM.)
.textSection in which program codes are placed. (The actual data is located in ROM and
executed there or from high-speed RAM after copying.)
.rodataConstant variables. (The actual data is located in ROM.)
The VMA (Virtual Memory Address) is the position (start address) at which a section is placed during runtime.
If a section does not have its start address indicated in th
e V
MA column, it means that the section is to be lo-
cated following the immediately preceding section.
The LMA (Load Memory Address) is the position (start address) in ROM at which the actual data is placed.
If this column is marked with "-", it means that this address is the same as the VMA (i.e., the section will be
executed or accessed at the position at which the actual data is placed). If thi
olumn is marked with "after
s c
(.rodata)", it means that the actual data is to be located following the section indicated in parentheses (in
this case, the .rodata section).
The Labels column shows the labels indicating the start and end addresses of an area in which the section will
be located. If the LMA is not specified, two labels <beginning of VMA> and <end of VMA> are shown here. If
the LMA is specified, four labels are shown in order of
ginning of VMA>, <end of VMA>, <beginning of
<beLMA>, and <end of LMA>. These labels may be used to specify addresses in a source file when, for example,
copying sections from ROM to RAM.
During actual program development, user defined sections can be added using the [Add] button.
Page 56
3-26
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
The section information is displayed in blue except for the .vector section displayed in black. Blue is used to
display the standard sections defined by default and black is used to display other user defined sections. To edit
the section name, standard section attribute, address to locate, and objects to be located, a user section should
be created. The standard section allows the user to specify the
location address only, and objects are automati-
cally located except those are located in the user sections with the same attribute.
Each of the above sections is predefined to contain object files that exist within a project.
Let's take a look at an example of the .vector section.
Step 34: Select ".vector" from the section list and click the [Edit] button.
The [Edit Section] dialog box will be displayed.
The upper part of the dialog box is used to set the sections listed in the preceding screen.
The list box on the lower right side shows the objects to be located in the .vector section. You can see
"boot.o" is set in the .vector section as you have previously specified in the New Project Wizard.
The list box on the left side lists the remaining other object files and library files within the project.
If any objec
t i
n the left-side list needs to be located in this section, select that file from the list and click the [>]
button. The selected file will be moved to the right-side list box and added to the list of files that comprise this
section.
If there are multiple files displayed in the right-side list, they will be located in order as shown. The placement
order can be changed with the [Up] or [Down] but
ton.
Although there are no object files generated at this point of time yet, the files in this dialog box are displayed on
the assumption that object files (boot.o, main.o) will be generated from the source files added to a project
in the same name as those of the source files.
Page 57
S5U1C17001C MANUAL
EPSON
3-27
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
To take a look at [File Attributes] here, we see that the indicated attribute is ".rodata". This means that only
the .rodata sections in boot.o will be located in the .vector section. Since the other sections in boot.o will be located in respective sections with the same attribute, looking at the other section information we find
that all sections except the .rodata section with the same attribute will have boot.o located in each.
In
i
ts initial settings, the IDE assumes that a vector table is written in the .rodata section (in the C sources,
the constants declared by const, in the assembler sources, the constants in the scope of the .rodata section).
If the vector table is written in another section with a different attribute (e.g. .text section), select the attribute
from [File Attributes] so that the section will be located in the .vector section.
F
urthermore, [Virtual map address] contains the boot vector address specified when the project is newly created.
If the processor has a different boot vector address, rewrite [Virtual map address] with the correct value.
Step 35: Click the [Cancel] button to close the dialog box.
Step 36: Click the [OK] button in the [Properties] dialog box to finish editing a linker script.
Editing objects to be l
ocated and section attribute of a user section (displayed in black) automatically updates
the object configuration of the standard section with the same attribute.
By the above, you are finished with preparations for building a program.
Page 58
3-28
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.3.5 Building a Program
When you are finished with the work described in the preceding sections, you are ready to build (compile, assemble, and link) a program.
To execute a build process
Step 37: Select the project name "sample" from the [C/C++ Projects] view.
Step 38: Select [Build Project] from the [Project] menu. You also can select [Build Project] from the context
menu that appears when you right-click
When the build command is selected this way, makefiles are generated with the current settings and then make.
exe is executed to generate an executable format object file sample.elf.
on the project name "sample" in the [C/C++ Projects] view.
The commands executed during a build process and tool messages are displayed in the [Console] view.
Page 59
S5U1C17001C MANUAL
EPSON
3-29
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.3.6 Debugging a Program
Before debugging a program, create a parameter file for the debugger. This is a file in which the memory map information of the target system is written, which is loaded into the debugger to set a memory map. A parameter file
should be created to be suitable for the memory configuration of the target system and must always be loaded into
the debugger.
Furthermore, the deb
Setting parameters
Step 39: Select the "sample" project in the [Navigator] or the [C/C++ Projects] view and then [Properties]
Step 40: Select [GNU17 Parameter Settings] from the properties list by clicking on it.
ugger's startup options must also be set before debu
from the [Project] menu.
gging a program.
Two items of area information that have been set by default will be displayed.
The information for RAM defines that 0x0 to 0xffffff (16M bytes) be used as a RAM area. Note that "00
word" here means this device is accessed in 32-bit size for read with no wait states (0 cycles) and for write
with no wait states (0 cycles). (The access conditions set here are effective in only simulator mode.)
Other area
information for the stack area in RAM is also defi
ned.
Shown here is the basic configuration of the S1C17 microcomputer that incorporates the S1C17 Core.
If other memory or external devices must be used, click the [Add] button and set the area to be added.
Since the sample program does not specifically require a memory configuration other than the default, a param-
eter file may be created directl
y a
s shown here without incurring any problem. Steps 41 to 47 below are shown
for reference only. No operation is required.
As for an example, we'll add a ROM area (0x8000–0x17fff). Note, however, that areas cannot overlap with an-
other area except for the STACK setting. Therefore, first the RAM area must be changed to 0x0–0x7fff.
Step 41: Click on the RAM line in the list box to get it displayed i
rse video and click the [Edit] button.
n inve
The [Edit Parameter] dialog box will be displayed.
Page 60
3-30
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 42: Change the address in [End Address:] to 7fff.
Step 43: Click the [OK] button.
The displayed address range of the RAM area has been changed to "000000-007FFF".
Step 44: Click the [Add] button.
The [Add Parameter] dialog box will be displayed.
Step 45: Enter 8000 in the [Start Address:] text box and 17fff in the
Select "halfword" (16 bits) from [Access Size:].
Step 46: Click the [OK] button.
[End Address:] text box.
Page 61
S5U1C17001C MANUAL
EPSON
3-31
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
The ROM area have been added.
Step 47: Click the [Apply] button.
When above settings are made, a file named "sample_gnu17IDE.par" is generated and passed to the de-
bugger via a command file when the debugger starts.
Setting the debugger's startup options
Step 48: Select [GNU17 GDB Commands] from the properties list by clicking on it.
This page displays the contents of the debugger startup command file that will be generated by the IDE.
The debugger must be set to the appropriate mode that suits the ICD used, etc. before it can be operated. For
detailed information, refer to Section 3.7, "Debugging Environment".
Page 62
3-32
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Here, we'll set the debugger to simulator mode that does not require external equipment before we start debug-
ging.
The contents of the command file displayed by default are provided for debugging using an ICD.
It may be changed for simulator mode by the following procedure.
Step 49: Click the [Create commands from template] button to display the [Create a simple startup command]
dialog box.
Step
50: S
elect "Simulator" from the [Debugger:] combo box.
Step 51: Click the [Overwrite] button, then click the [OK] button in the [Overwrite commands] dialog box
displayed next.
The displayed contents are altered for simulator mode. The commands may be added and edited directly in this
page as necessary.
Step 52: Click the [OK] button.
When above settings are made, a command file named "sample_gnu17IDE.cmd" is generated and it will
be passed to the debugger.
Page 63
S5U1C17001C MANUAL
EPSON
3-33
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Starting the debugger
Step 53: Select [External Tools] > [External Tools Configurations...] from the [Run] menu.
The [External Tools Configurations] dialog box will be displayed.
Step 54: Select [GDB17 Launch for sample] from the list in the dialog box.
This dialog box may be used to edit the command line of the gdb debugger. No particular changes are required
for executing the sample, so start the debugger directly with this setting.
Step 55: Click the [Run] button.
The gdb debugger will start.
Page 64
3-34
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
When the debugger has started, the window shown below appears, executing the command file that was set in
the [GNU17 GDB Commands] dialog box.
The object file is loaded into the debugger by the command file and the debugger is reset. The PC (program counter)
is set to the program execution start position, letting the debugger ready to start debugging.
To run a program
Step 56: Click the [Continue] button in the toolbar.
The sample program here endlessly increments the int variable counter 'i' (addresses 0x0–0x3).
Use a forcible break to stop such an endless loop.
To forcibly break a program
Step 57: Click the [Stop] button in the toolbar.
Page 65
S5U1C17001C MANUAL
EPSON
3-35
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Notice that the for statement in the [Source] window is highlighted in green. This is because the current ad-
dress of the PC (program counter) exists there, at which the program has stopped. Furthermore, notice that the
'pc' column of the [Registers] window indicates the address 0x8094. It means that the program has stopped immediately before executing the instruction at this address.
Although boot.s w
as d
isplayed in the [Source] window when the program has started, the source of main.c
is displayed in it because the program has stopped and remains idle in main.c now.
The [Source] window can display a program in other than the source mode.
To change the display mode of the [Source] window
There is the pulldown list box that shows SOURCE in the toolbar. Use it to specify the display mode of the
[Source] window.
S
tep 58: Select "SOURCE", "ASSEMBLY", "MIXED", or "SRC + ASM" in the pulldown list
to change display modes.
Page 66
3-36
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
SOURCE
In SOURCE or the default display mode, the content of a source file is displayed beginning with the top of the
file, with line numbers added. You can see the entire source file in one window.
ASSEMBLY
In ASSEMBLY mode, the loaded object code is displayed in disassembled form. Even when the source files
corresponding to the loaded object file cannot be found, the object code is displayed in this mode. The C sources are displayed in function units. Only the currently halted function can be displayed at a time, and no other
functions can be displayed in the same window.
Page 67
S5U1C17001C MANUAL
EPSON
3-37
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
MIXED
In MIXED mode, the displayed source lines have the corresponding assembler display inserted in each. This
MIXED mode, therefore, allows you to know not only the source line at which the program has stopped, but
also the address and the instruction code at that address, all in the [Source] window. In this case too, the C
sources are displayed in function units.
SRC+ASM
In SRC + ASM mode, the window is split into the upper and lower parts for simultaneous display in SOURCE
and ASSEMBLY modes.
Step 59: Select SOURCE to reverse the display mode.
Let's take a look at other windows of the debugger here.
Page 68
3-38
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
About the debugger windows
This is the [Console] window. Enter a debug command at the "(gdb)" prompt to execute it.
Although we used a button to run a program in Step 56, the same effect can be achieved by entering cont here
and pressing the [Enter] key.
This is the [Registers] window. It shows the contents of the S1C17 Core registers. The register data can be re-
written here.
This is the [Memory] window. It shows the contents of the target memory. The memory data here can be rewrit-
ten.
When run in the above step, the sample program increments the int variable 'i' (addresses 0x0–0x3). Examine
value of the variable 'i' in the [Memory] window.
Step 60: Enter '&i' or '0' in the [Address] text box of the [Memory] window and press the [Enter] key.
Page 69
S5U1C17001C MANUAL
EPSON
3-39
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
The memory contents are displayed, beginning with the variable 'i' (address 0x0). As shown here, 'i' has been
counted up to 0x6eeb (= 28395).
These three windows are displayed by default when the debugger starts, along with the [Source] window.
In addition, the following three windows are available.
Step 61: Click the [Breakpoints] button.
This is the [Breakpoints] window. This window is used to manage software PC breakpoints that halt the pro-
gram at specified positions.
Step 62: Click the [Watch Expressions] button.
This is the [Watch Expressions] window. This window is used to monitor the values of global variables. This
window may be used to monitor the variable 'i' (i = global variable) earlier verified in the [Memory] window.
The procedure is described below.
Step 63: Enter 'i' in the text box located at the bottom of the window and click the [Add Watch] button.
Page 70
3-40
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
The letter 'i' will appear in the list box of the window, the contents of which are displayed as decimal values
(default display mode).
Step 64: Click the [Local Variables] button.
This is the [Local Variables] window. It shows the local variables defined in the current function. Since the cur-
rent PC address exists in the main() function, the symbol and the value of the variable 'j' defined in this function are displayed.
We have thus far seen the windows for the gdb debugger. Each window has other facilities, not just the ones
that display information. These are detailed in Sec
tion 10.4, "Wi
ndows".
We'll now return to program execution.
In the preceding steps, we ran a program, stopping it using forced breaks.
This time we'll run a program after specifying in advance a position at which to stop it.
To specify a breakpoint
Step 65: The source line numbers are displayed in the [Source] window. Move the mouse cursor to a position
preceding numeral 16. Click when the cursor changes to a
You will see that source line 16 is marked with n (red) at the beginning of it. This means that this line has been
set to be a software PC breakpoint. If a n mark is attached anywhere other than source line 16, click there to
reverse, then repeat.
Step 66: Click the [Continue] button.
In contrast to Step 56, the program this time should have stopped at the line set to be a breakpoint. Try pressing
the [Continue] button a number of times. You will see that the program stops at the same place each time.
l (white circle).
Page 71
S5U1C17001C MANUAL
EPSON
3-41
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
If the [Local Variables] window is still open, you can verify that the variable 'j' increments each time the pro-
gram breaks. Similarly, you can verify that the variable 'i' displayed in the [Watch Expressions] window increments every other time the program is run, indicating that the program operates exactly as expected.
Step 67: Click the [Breakpoints] button.
Examine the [Breakpoints] window. The information on the breakpoint we set above is displayed in it, although
no information was displayed there earlier. The check mark shown at the beginning of the information means
that the breakpoint is currently active. When the check box is unselected, the breakpoint is temporarily disabled: The next time the program is run, it will no longer halt at the po
sition at which it halted earlier. Selecting
the check box reenables the breakpoint.
Step 68: Click on the n mark that is displayed in the [Source] window to turn it off.
This clears the breakpoint.
When the n mark disappears, the line is marked with "-" back again. This "-" mark means that the line can be
set to be a breakpoint. The lines lacking this mark are source lines not converted to actual
cutable instruc-
exe
tions when the source was compiled and assembled. No breakpoints can be set in these lines.
In addition, other break facilities are available, including a temporary break effective only once the program is
run. Discussions of these break facilities are omitted here. For detailed information on break facilities, refer to
Section 10.6.6, "Break Functions".
If any problem in progra
m behav
ior is detected, the program operation should be verified with greater care.
As the last step of the tutorial, we will proceed through the program by executing one source line at a time.
To proceed through the program step-by-step
Step 69: Click the [Step] button in the toolbar.
The source line highlighted in green in the [Source] window (the line at which the current PC address exists) is
executed, and the highlighting moves to the next source line to be executed.
By repeating Step 69, we can execute the program one step or one source line at a time. If the program has no
problems, you will see that the displayed register values, etc. change correctly at each step.
The [Step] button executes the program one source line at a time. To execute the program one instruction (mne-
monic) at
Repeat Step 70 to verify differences between this and the [Step] button in the [Source] window.
When the program is run with the [Next] button, you will see that although the function sub() was skipped,
the value of the variable 'i' is updated, indicating that the instructions in the function have all been executed.
The [Next] button operates in b
functions and subroutines (i.e., executes a function or subroutine as one step, without stopping at every instruction). If you do not need to debug the subroutines instruction by instruction, use the [Next] button instead.
a time, use the [Step A
[Step Asm Inst] button
sm Inst] button.
Step 70: Click the [Next] button in the toolbar.
asically the same way as the [Step] button, except that the [Next] button skips
Page 72
3-42
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
We have thus far seen the basic use of the debugger. More advanced debugging can be performed by entering a
command in the [Console] window from the keyboard. For detailed information, refer to Chapter 10, "Debugger".
Follow the procedure described below to quit the debugger.
To quit the debugger
Step 71: Select [Exit] from the debugger's [File] menu.
All of the debugger windows will be closed, and the IDE window
is displayed once again.
In addition to the simulator mode described above, a program can be debugged in another mode after connect-
ing an ICD to the target board. For detailed information on how to debug in this mode, refer to Section 3.7,
"Debugging Environment".
Finally, we'll quit the IDE.
To quit the IDE
Step 72: Select [Exit] from the IDE's [File] menu.
Page 73
S5U1C17001C MANUAL
EPSON
3-43
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.3.7 Creating ROM Data
The ROM data HEX file for incorporation into the target board is generated, based on the executable file used in
debugging.
(This HEX file is generated based on the ‘elf’ format object file at the build time (a .psa file).)
When [Build Mask file (.psa)] is selected in [Build goal switch] in the [Properties] dialog box from the [Project]
menu
The mask data to be presented is
generated based on this ROM data HEX file.
After a program for a model with built-in ROM is completed, you will be requested to present the masked data for
the internal ROM to Seiko Epson.
Creating a ROM data HEX file
When a build process is executed, a Motorola-S2-format ROM data HEX file with the same name as the ‘elf’
format object file and the “.psa” extension will be created as follows:
1. Motorola-S3-format HEX fi
le is created by objcopy.exe.
o b j c o py -I elf32-lit t l e -O sr e c --sr e c - f o rceS3 In p u tFile(.el f )
OutputFile(.sa)
2. Empty addresses in the HEX file are filled with 0xff data by moto2ff.exe.
moto2ff StartAddress BlockSize InputFile(.sa)
(output file name: <input file name + .saf>)
3. File is converted to the Motorola S2 format by sconv32.exe.
sconv32 S2 InputFile(.saf) OutputFile(.psa)
Use the ROM data HEX file created by the above procedure to perform final verification of program operations
on th
e actual targ
et board.
Creating mask data for presentation
If the model is set with a mask option, select the option using winfog17.exe.
Information on the selected option is output to a function option document file by winfog17.
Step 73: Select a project in the IDE and click the toolbar [Start Winfog17] button.
If the model lacks mask options, the [INI file does not include FOG information] dialog
ou click the [Start Winfog17] button.
y
box will appear when
In this case, there is no need to create a function options file. Close the dialog box and exit Winfog17.
Page 74
3-44
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 74: Select a mask option on the Winfog17 window.
Step 75: Select [Generate] from the [Tools] menu to create a function option document file (sample.FDC file)
in the project directory.
Step 76: The Winfog17 window will close.
For detailed information on winfog17.exe, refer to the section describing other tools.
Lastly, pack the verified Motorola-S2 ROM data HEX file and the function option document file created by
winfog17 into a single mask data
le (packed file) using winmdc17.exe.
fi
Step 77: Select a project and click the toolbar [Pack with WinMdc17] button.
The [Pack successfully completed!!] dialog box appears, and a packed file (sample.pa file) is
created in the project directory.
For detailed information on winmdc17.exe, refer to the section describing other tools.
Present the mask data file generated by the above operations to Seiko Epson.
Page 75
S5U1C17001C MANUAL
EPSON
3-45
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.4 Tutorial 2 (Using the User Makefiles)
In this section, as an example for using a user makefile, a user linker script file and a user command file, we'll take
a look at a series of procedures, from building a project in the IDE to starting the debugger. For basic information
on using the IDE, etc., refer to Tutorial 1.
Files used
Tutorial 2 uses the sample files listed below that exist in the c:\EPSON\gnu17\sample\S1C17common\
Step 2: Select [New] > [New GNU17 Project] from the [File] menu to start the [New GNU17 Project] wizard.
Step 3: Enter the project name "mymake_sample" in the [Project name:] field.
ectory.
In this tutorial, we create a project folder in the workspace (default). Leave the [Use default location] check box selected.
Page 76
3-46
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 4: Click the [Next>] button.
This tutorial does not use the makefiles and linker script files generated by the IDE, so there is no need to select the
target CPU, memory model and .vector section.
Step 5: Deselect the check box [Allocate a specific file to '.vector' section].
Step 6: Click the [Finish] button to create a project.
Page 77
S5U1C17001C MANUAL
EPSON
3-47
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.4.2 Importing Source Files
Import the source files after creating a project. Here, for the sake of convenience, we'll also import the makefiles
stored in the same directory.
Step 7: Select "mymake_sample" in [Navigator] view, and [Import...] from the [File] menu.
This launches the [Import] wizard.
Step 8: Select [General] > [File System] from the list displayed and click the [Next>] button.
Step 9: Using the [Browse...] button in [From directory:], select the C:\EPSON\gnu17\sample\
S1C17common\simulator\simulatedIO directory that contains the files to be imported.
Page 78
3-48
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
The selected directory and the files in it will be displayed in the list boxes on the left and the right sides of the window, respectively.
Step 10: Select the check boxes for the following files shown in the right-side list box.
You can inspect the files that have been added to the project from the [Navigator] view.
Page 79
S5U1C17001C MANUAL
EPSON
3-49
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.4.3 Disabling the GNU17 File Builder
The IDE is initialized to automatically generate makefiles, linker script files, parameter files, and debugger command files and to use these files when building a project or starting the debugger. In this tutorial, since we use separately prepared files, we need to change the default IDE settings to keep from using these files.
The following describes how to di
Step 12: After selecting the "mymake_sample" project from the [Navigator] or the [C/C++ Projects] view, se-
lect [Properties] from the [Project] menu or context menu to display the [Properties] dialog box.
Step 13: Select [Builders] from the properties list and deselect the [GNU17 File Builder] check box. A dialog box
below appears for confirmation. Click [OK].
sable the file builder to prevent automatic generation of these files.
Step 14: Click the [OK] button.
You can use your own makefiles, linker script files, parameter files, and debugger command files even without taking this step, but unnecessary files will be generated each time you build a project. Additionally, the automatically
generated files will overwrite any current files with the same names.
Do not disable the file builder if any of the above files must be au
tomatically generated by the IDE.
Page 80
3-50
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.4.4 Setting and Correcting the Makefile
To specify a user makefile
Now we'll set up the IDE to build the project using the separately prepared makefile. Here, we use mymak-
efile.mak, which we imported into the project.
Step 15: After selecting the "mymake_sample" project from the [Navigator] or [C/C++ Projects] view, se-
lect [Properties] from the [Project] menu or context menu to display the [Properties] dialog box.
Step 16: S
elect [C/C++ Make Project] from the properties list to display the page for the [Make Builder] tab.
Step 17: Change the makefile name "mymake_sample_gnu17IDE.mak" set in [Build command:] to
"mymakefile.mak".
No change is required if the makefile is mymakefile.mak. However, unless the target name in the user-
created makefile is all (build) or clean (clean), the following settings must also be changed.
[Build (Incremental Build)]
Specify the target in the makefile to be called when executing a build process.
[Clean]
Specify the target in the makefile to be called when executing a clean process (to clear the generated files
[
Build on resource save (Auto Build)] is not used in the IDE.
).
Step 18: Click the [OK] button.
Page 81
S5U1C17001C MANUAL
EPSON
3-51
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Correcting the makefile contents
To use a makefile not created with the IDE, you may need to change the path written in it. If it contains a rela-
tive path, change it to a cygwin format path to allow file referencing from the project directory as well. You can
use the IDE editor to make changes in the file.
Example: Before change: SRCDIR= ..After change:
After setting the makefile, you can execute a build process as you would normally do. There is no need to set build
options or to edit the linker script file.
Step 19: Select the project "mymake_sample" name from the [Navigator] or the [C/C++ Projects] view.
Step 20: Select [Build Project] from the [Project] menu.
When the build command is selected this way, make.exe is executed with a specified makefile to generate the executable format object file "
stdio.elf". (Since we are using a makefile that is not automatically generated, the
object file is not named after the project name.)
3.4.6 Starting the Debugger
As the last step in Tutorial 2, described below is the method for making the necessary settings to execute the prepared command file at debugger startup.
Step 21: Select [External Tools] > [External Tools Configurations...] from the [Run] menu t
o display the [External
Tools Configurations] dialog box.
Step 22: Select [GDB17 Launch for mymake_sample] from the list in the dialog box and display the page for the
[Main] tab.
Page 82
3-52
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 23: In the [Arguments:] column, modify the -x option that specifies a command file as shown below.Before change: -x ${project_name}_gnu17IDE.cmdAfter change: -x mycmdfile.cmd
Step 24: Click the [Apply] button to confirm what you've altered here.
Starting the debugger will now execute mycmdfile.cmd.
Step 25: Click the [Close] button if you want to finish here.
To actually start the debugger, click the [Run] button.
See Tutorial 1 for basic debugger operations.
Page 83
S5U1C17001C MANUAL
EPSON
3-53
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.5 Tutorial 3 (Importing an IDE Project)
If you've already developed an application for the S1C17 Family with the IDE, you can continue with development
or make revisions by importing that project into the IDE on another PC. Or you can develop another application,
based on that project. The procedure for importing a project is explained here. For other procedures, refer to Tutorials 1 and 2.
We'll assume that the project to be imported is copied to the HDD of your PC.
This launches the [Import] wizard.
roject directory
used
Step 1: Launch the IDE.
Step 2: Select [Import...] from the [File] menu.
Step 3: Select [Existing Projects into Workspace] from the displayed list and click the [Next>] button.
Page 84
3-54
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 4: Using the [Browse...] button in [Select root directory:], select the project directory C:\EPSON\
gnu17\sample\S1C17common\simulator\simulatedIO to be imported.
Step 5: Select the [Copy projects into workspace] check box.
This will make a copy of the project into the workspace directory and the original project files will
not be modified.
* Do not specify the project directory (directory containing .project file) as a workspace directory.
Doing so may result in failures with project imports (when [Copy projects into workspace] is
selected).
The current wo
directory can be checked by selecting [File] > [Switch workspace...] >
rkspace
[Others...] and opening the [Workspace Launcher] dialog box.
Page 85
S5U1C17001C MANUAL
EPSON
3-55
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 6: Click the [Finish] button.
This imports the selected directory into the IDE as a project.
Automatic updates of the project file
When you import a project created in an older version of the IDE, the project file (.project/.cproject/.gnu17project/)
is automatically updated to one compatible with the current version.
Note that .cdtproject files used by projects of an older version will be replac
y .cproject files. A .cproject file
ed b
is generated during project import, and the contents of the .cdtproject file will be transferred automatically to
the newly generated .cproject file.
About the directory structure and resource position
If all resources are stored together in a project directory, the project can be copied to any location without caus-
ing problems. The project can then be built at the copied destination with no further rev
Even if your project references certain external files or folders outside the project, you will not need to correct
them as long as those files and folders are managed in the same directory structure. However, if makefiles, etc.
are prepared externally and not the ones automatically generated by the IDE, as explained in Tutorial 2, the
paths spec
ifi
ed in these files may need to be corrected.
You will neither have a problem with the standard libraries and include directories as long as the tools are in-
stalled in the same directory where the original project was created in (e.g. C:\EPSON\gnu17). Otherwise,
corrections are required for the user library and include directory. Make these corrections in the [GNU17 Build
Options] of the [Properties] dialog
box for the project.
isions.
Page 86
3-56
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3.6 Tutorial 4 (How to Use ES-Sim17)
The S5U1C17001C Package contains the Embedded System Simulator (ES-Sim17) for simulating the hardware
functions of the target model, such as I/O ports and LCD display, during debugging on the PC. The debugger will
launch ES-Sim17 by setting some conditions with the IDE. This section describes operations on the IDE to use
ES-Sim17. For other operations, see Tutorials 1 to 3. For detail
tem Simulator (ES-Sim17)".
3.6.1 Settings Required for Launching ES-Sim17
To launch ES-Sim17 at the start of the debugger, the following two settings are required.
1. Specifying the target CPU (parameter file)
2. Starting the debugger in simulator mode (debugger command file)
This section explains the operations on the IDE to set the above conditions when a new project begins.
Specifying the target model
To simulate model specific hardware functions, the target CPU to be used must be specified in advance.
When a new project is created, specify the target CPU as in the procedure below.
Step 1: Select [New GNU17 Project] from the [New] pull-down menu on the tool bar to launch the [New
GNU17 Project] wizard. Then enter the project name in the [Project name:] box on the firs
page and click the [Next>] button.
s on ES-Sim17, see Section 10.11, "Embedded Sys-
izard
t w
Page 87
S5U1C17001C MANUAL
EPSON
3-57
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 2: Select "S1C17701" from the [Target CPU Device] combo box.
"S1C17" is provided for simulating the S1C17 Core only and selecting it will not launch ES-Sim17 at the start
of debugging.
Select "S1C17" when debugging the program in simulator mode without ES-Sim17. When debugging the pro-
gram using an ICD (in ICD Mini mode), ES-Sim17 will not start up regardless of how the target CPU has been
selected.
The models displayed in the list may be added/deleted by the configuration fi
hat will be modified when a
le t
new model is released or an existing model is discontinued.
Step 3: Configure the memory model and vector section as necessary, then terminate the wizard by clicking
the [Finish] button.
After that, edit source files and build them as usual.
The target CPU can also be specified on the [GNU17 General] page of the [Preferences] dialog box similar to
above.
Creating a debugger command file for simulator mode
The ES-Sim17 will be able to run only when the debugger is running in simulator mode. The following shows
the operations on the IDE to launch the debugger in simulator mode.
Step 4: Display the [Properties] dialog box by selecting [Properties] from the [Project] menu and open the
[GNU17 GDB Commands] page.
Page 88
3-58
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 5: Display the [Create a simple startup command] dialog box by clicking the [Create commands from
template] button and select "Simulator" from the [Debugger:] combo box.
Step 6: Click the [Overwrite] button.
Step 7: Click the [OK] button.
Following the above steps the settings for launching ES-Sim17 at the same time the debugger starts up are fin-
ished. Other operations are not necessary in the source edit and build stages to launch ES-Sim17.
Page 89
S5U1C17001C MANUAL
EPSON
3-59
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.6.2 How to Launch ES-Sim17 in the Existing Project
This section explains the procedure from importing the project, which has been made for the S1C17 Core as the
target, to launching the debugger and ES-Sim17 after changing the target model.
This tutorial assumes that the project to be imported is copied to the HDD of your PC.
Step 1: Launch the IDE.
Step 2: S
This launches the [Import] wizard.
elect [Import...] from the [File] menu.
Step 3: Select [Existing Projects into Workspace] from the displayed list and click the [Next>] button.
Page 90
3-60
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Step 4: Using the [Browse...] button in [Select root directory:], select the project directory C:\EPSON\
gnu17\sample\S1C17701\simulator\application to be imported.
Step 5: Select the [Copy projects into workspace] check box.
This will make a copy of the project into the workspace directory and the original project files will
not be modified.
* Do not specify the project directory (directory containing .project file) as a workspace directory.
Doing so may result in failures with project imports (when [Copy projects into workspace] is
selected).
The current wo
directory can be checked by selecting [File] > [Switch workspace...] >
rkspace
[Others...] and opening the [Workspace Launcher] dialog box.
Page 91
S5U1C17001C MANUAL
EPSON
3-61
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 6: Click the [Finish] button.
This imports the selected directory into the IDE as a project.
Checking the target CPU (parameter file)
Make sure “S1C17701” is selected as the target processor of the sample project to be simulated by ES-Sim17.
Step 7: Display the [Properties] dialog box by selecting [Properties] from the [Project] menu and open the
[GNU17 General] page.
Step 8: Make sure “S1C17701” is selected in the [Target CPU Device] combo box.
Step 9: Click the [OK] button.
The name of the target model used by the debugger to start ES-Sim17 is described below in the parameter file
to be passed on to the debugger:
ESSIM S1C17701(“S1C17701” is the name of the target processor.)
* When the user provides the original parameter file, add the above description to the file.
Page 92
3-62
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Edit the debugger command file to one for simulator mode
The ES-Sim17 starts up when the debugger enters simulator mode. The command file in the sample project is
made to set the debugger to ICD Mini mode, therefore, it must be changed to simulator mode.
Step 10: Display the [Properties] dialog box by selecting [Properties] from the [Project] menu and open the
[GNU17 GDB Commands] page.
Step 11: Display the [Create a simple startup command] dialog box by clicking the [Create commands from
template] button and select "Simulator" from the [Debugger:] combo box.
Step 12: Click the [Overwrite] button.
Page 93
S5U1C17001C MANUAL
EPSON
3-63
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Step 13: Click the [OK] button.
Following the above steps the command for setting the debugger to simulator mode (for launching ES-Sim17)
is written to the command file that will be passed to the debugger as shown below.
target sim
* When the user provides the original command file that contains the "target icd usb" command, rewrite
the command to "target sim".
Page 94
3-64
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Launching the debugger
Step 14: Select [External Tools] > [GDB17 Launch for application] from the [Run] menu.
The debugger starts up and enters simulator mode. At the same time the [ES-Sim] window opens.
Page 95
S5U1C17001C MANUAL
EPSON
3-65
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
Loading files for LCD simulation
You can simulate an LCD panel display with ES-Sim17 using LCD files created in LCDUtil17. Load an LCD
file (.lcd) compatible with the model selected in the project.
For instructions on creating LCD files, see Section 11.11, “LCDUtil17 (LCD Panel Customizing Tool).”
Step 15: Select [Load lcd file] from the [File] menu.
After the file selection dialog box is displaye
pen the LCD file for the S1C17701 (as created in LCDUtil17)
d, o
at C:\EPSON\gnu17\tool\LcdUtil17\sample\SVT17701.lcd.
For the functions and how to operate ES-Sim17, see Section 10.11, "Embedded System Simulator (ES-Sim17)".
Page 96
3-66
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
USB cable
(included with the ICD package)
4-pin to 4-pin
target system
connecting cable
(included with the ICD package)
USB
Target board
ICD
3.7 Debugging Environment
The debugger supports two connect modes, of which the mode used is set by the target command.
ICD Mini mode
In this mode, the ICD Mini (S5U1C17001H) or ICD board is used to perform debugging. The program is ex-
ecuted on the target board.
Figure 3.7.1 Example of debugging system using an ICD
Specification method
Command: (gdb) target icd usbSpecification in IDE:
Select "ICD Mini" from the [Debugger:] combo box in the [Create a simple startup command] dia-
log box to generate a startup command file.
To start in ICD Mini mode, make sure an ICD and target board are connected correctly, and that the power for
these units is turned on. For details on how to use the ICD, refer to the manual for the ICD used.
ote that the trace function is not available in ICD Mini mode.
N
Simulator (SIM) mode
In simulator mode, target program execution is simulated in internal memory of a personal computer, with no
other tools required. However, the ICD-dependent functions cannot be used in this mode.
Specification method
Command: (gdb) target simSpecification in IDE:
Select "Simulator" from the [Debugger:] combo box in the [Create a
log box to generate a startup command file.
The trace function is available in simulator mode. The flash writer function cannot be used.
imple startup command] dia-
s
Page 97
S5U1C17001C MANUAL
EPSON
3-67
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
3
SoftDev
3.8 Sections and Linkage
Here, the concept of section management that is required when you create and link source files is explained.
The source file contains data with various attributes, such as program code, constants, and variables. In an embedded system, data management must assume that data will be mapped to different memory devices such as ROM and
RAM. For this reason, logical areas called "sections" a
butes.
For example, if a program is created on the assumption that program code present in multiple source files will be
located in one section, program code can easily be combined from these source files when linked, and will consequently be located in the same ROM. And since addresses can be specified separately for each file,
located on separate devices, such as internal ROM and external ROM.
Four broad categories (attributes) of sections are set in the xgcc C compiler, and data is located in the appropriate
sections according to the contents of the source files.
(1).text section
Program code is located here. All code is eventually written to ROM.
(2).data section
Read/writable data with initial values are located here.
to RAM before use.
(3).rodata section
Variables defined with const are located here. They are eventually written to ROM.
(4).bss section
Variables without initial values are located here. Memory is allocated without a specific value.
(5).vector section
The IDE has another section with .rodata attribute, the .vector section, available for use for vector tables.For C sources,
create a ve
ctor table with a const declaration and locate its object in the .vector section.
For the assembler sources, a vector table may be written in .rodata or the .text section. However, if a vec-
tor table is located in the .text section, you must change the .vector section attribute to .text.
For more information, refer to Section 5.7.8, "Editing a Linker Script".
re provided to enable management of data with their attri-
t
hey can be
The d
ata is written to ROM, from which it is transferred
Page 98
3-68
EPSON
S5U1C17001C MANUAL
(C COMPILER PACKAGE FOR S1C17 FAMILY) (Ver. 1.5.0)
3 SOFTWARE DEVELOPMENT PROCEDURES
Discussed below is the relationship between sections and actual memory locations.
(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
m
ented by specifying an address or locating sections. '.' is used to reference the current location counter value
incre-
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 addr
ess. I
n 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 locate
this section. In this example, the
d in
.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
n the preceding libc.a, therefore libc.a is specified twice to resolve refer-
i
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 out
ection. With __END_bss specified as the start address, this section (VMA) is
put s
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).
owever, the .data section requires that initial values be written to ROM and that the initial values
H
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 (immediately following the .rodata section).
(7) Define the .vector output section beginning with address 0x008000. In this exam
he vector table is
ple, t
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 place
d into this output section. T
he 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.
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.