Epson S5U1C17001C Manual
Epson S5U1C17001C Manual

Epson S5U1C17001C Manual

Cmos 16-bit single chip microcontroller (c compiler package for s1c17 family) (ver. 3.1)
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

Quick Links

CMOS 16-BIT SINGLE CHIP MICROCONTROLLER
(C Compiler Package for S1C17 Family) (Ver. 3.1)
S5U1C17001C
Manual
Rev.1.0

Advertisement

Table of Contents
loading

Summary of Contents for Epson S5U1C17001C

  • Page 1 CMOS 16-BIT SINGLE CHIP MICROCONTROLLER (C Compiler Package for S1C17 Family) (Ver. 3.1) S5U1C17001C Manual Rev.1.0...
  • Page 2 2. This evaluation board/kit or development tool is intended for use by an electronics engineer and is not a consumer product. The user should use it properly and in a safe manner. Seiko Epson dose not assume any responsibility or liability of any kind of damage and/or fire coursed by the use of it. The user should cease to use it when any abnormal issue occurs even during proper and safe use.
  • Page 3 S5U1C17001C Manual Revision History Code No. Page Chapter/Section Description of revision 411086412 Entire manual Version No. changed from 3.0 to 3.1 ― Entire manual Description revised ― "ICDmini3" changed to "ICDmini" How to Read the Manual Description revised "Explains the functions and handling methods of the ICDmini (S5U1C17001H)."...
  • Page 4 Code No. Page Chapter/Section Description of revision 411086412 3-15 3.5.2 Executing a Build Process Description revised Build process description revised 3-17 3.6 Debugging the Program Description revised "Starting the Debugger" changed to "Debugging the Program" Entire description revised 3-18 3.6.2 Setting Standard Output Description revised "Example"...
  • Page 5 Code No. Page Chapter/Section Description of revision 411086412 8-10 8.5.1 List of Commands Description added The following added to "Other" in the list of commands: c17 cpu 8-56 8.5.13 Other Commands Description added The following added: c17 cpu (set CPU type) 8-59 8.5.13 Other Commands Description revised...
  • Page 6 Configuration of product number ● Devices 17xxx 00E1 ■ Packing specifications 00 : Besides tape & reel 0A : TCP BL 2 directions 0B : Tape & reel BACK 0C : TCP BR 2 directions 0D : TCP BT 2 directions 0E : TCP BD 2 directions 0F : Tape &...
  • Page 8 General Source Files GNU17 IDE C Compiler Library Assembler Linker Debugger Creating Data to Be Submitted 10 Other Tools Quick Reference...
  • Page 9 This document describes the development procedure from compiling C source files to debugging and creating the PA file (Data to be submitted) 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.
  • Page 10 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 ICDmini (S5U1C17001H). Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 11: Table Of Contents

    3.6.1 GDB Command File ......................3-17 3.6.2 Setting Standard Output ..................... 3-18 3.6.3 Using the Debugger ......................3-19 3.6.4 Setting the Debug Configuration ..................3-20 Files Generated in a Project by the IDE....................3-21 S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 12 Functions .............................. 6-1 Input/Output Files ..........................6-1 6.2.1 Input File ..........................6-2 6.2.2 Output File ..........................6-2 Starting Method ............................ 6-3 6.3.1 Startup Format ........................6-3 6.3.2 Command-line Options ......................6-3 Scope ..............................6-4 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 13 8.3.2 Startup Options ........................8-4 8.3.3 Executing Command Files ....................8-5 8.3.4 Quitting the Debugger ......................8-6 Method of Executing Commands ......................8-7 8.4.1 Entering Commands From the Keyboard ................8-7 8.4.2 Parameter Input Format ......................8-8 S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 14 8.5.11 File Loading Commands ..................... 8-44 file (load debugging information) [ICD Mini / SIM] ............8-44 load (load program) [ICD Mini / SIM] ................8-45 8.5.12 Trace Command ......................... 8-46 c17 tm (set trace mode) [SIM]..................8-46 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 15 10.1.4 Error Message ........................10-2 10.1.5 Precautions ......................... 10-2 10.2 objcopy.exe ............................10-3 10.2.1 Function ..........................10-3 10.2.2 Input/Output Files........................ 10-3 10.2.3 Method for Using objcopy ....................10-4 10.2.4 Creating SA Files (ROM Data) .................... 10-5 S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 16 10.8.3 Starting and Closing LCDUtil17 ..................10-17 10.8.4 Window ..........................10-17 10.8.5 Menus and Toolbar ......................10-18 10.8.6 Producing an LCD file ....................... 10-21 10.8.7 Shortcut Key list ........................ 10-28 10.8.8 Warning Messages and Error Messages ................10-29 viii Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 17: General

    S5U1C17001C Manual 1 General...
  • Page 19: Features

     Integrated development environment for Windows  Designed to run under Microsoft Windows, the GNU17 IDE is a seamless integrated development environment suitable for a wide range of development tasks, from source creation to debugging. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 20: Outline Of Software Tools

    "readmeVxxx.txt" (xxx 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. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 21: Source Files

    S5U1C17001C Manual 2 Source Files...
  • Page 23: File Format And File Name

    The recommended tab stop is every 4 characters. This is the default tab setting when the IDE displays sources.  EOF  Make sure that each statement starts on a new line and that EOF is entered after line feed (so that EOF will stand independent at the file end). S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 24: Grammar Of C Source

    → warning:integer constant is too large for “long” type Ll_val = 0x1234567812345678LL; → OK Type wchar_t is the data type needed to handle wide characters. This data type is defined in stdlib.h/stddef.h as the type unsigned short. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 25: Library Functions And Header Files

    For details about the functions included in the libraries, refer to Chapter 5, "Library". When using a library function, be sure to specify the library file that contains the function used when linking. The linker extracts only the necessary object modules from the specified library file as it links them. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 26: In-Line Assemble

    Interrupt handler functions should be declared in the following format: <type><function name> __attribute__ ((interrupt_handler)); Example: void foo(void) __attribute__ ((interrupt_handler)); int int_num; void foo() int_num = 5; Assembler code foo: ld.a -[%sp],%r2 ld %r2,5 xld [int_num],%r2 ld.a %r2,[%sp]+ reti Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 27: Grammar Of Assembly Source

    (details below). Comments can be described using other characters than ASCII characters. When using non-ASCII characters (such as Chinese characters) for comments, use /* · · · */ as the comment symbol. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 28 Mnemonics can be written in uppercase (A–Z) characters, lowercase (a–z) characters, or both. For example, "ld", "LD", and "Ld" are all accepted as "ld" instructions. For purposes of discrimination from symbols, this manual uses lowercase characters. More will be said about operands later. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 29 An actual address value will be determined in the linking process.  Restrictions  Only the following characters can be used: A–Z a~z _ 0–9 A label cannot begin with a numeral. Uppercase and lowercase are discriminated. Example: ;Error FOO: 1label: _Abcd: 0_ABC: S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 30 This assembler also allows a blank line containing only a return/line feed code. It need not be made into a comment line, for example, when used as a break in a series of routines. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 31: Notations Of Operands

    "0b" cannot be followed by characters other than 0 or 1.  Specified ranges of values  The size (specified range) of immediate data varies with each instruction. The specifiable ranges of different immediate data are given below. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 32 %rd,LABEL ← LABEL = sign7 ld.a The as assembler also accepts the referencing of an address with a specified displacement as shown below. LABEL + imm24 LABEL + sign24 Example: xcall LABEL+0x10 2-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 33: Extended Instructions

    ; R0 ← symbol + 0x10 xjpa LABEL + 5 ; Jumps to address LABEL + 5. For details about the extended instructions that include operands, refer to Section 6.6, "Extended Instructions". S5U1C17001C Manual Seiko Epson Corporation 2-11 (Rev. 1.0)
  • Page 34: Preprocessor Directives

    Note: The sources that contain preprocessor directives need to be processed by the preprocessor (use the xgcc options -c and -xassembler-with-cpp), and cannot be entered directly into the as assembler. (Direct entry into the assembler will result an error.) 2-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 35: Precautions For Creation Of Sources

    → A function name can be used to assign the pointer to the short type local variable s_local_val. 4) long l_local_val = (long)boot; → A function name can be used to assign the pointer to the long type local variable l_local_val. S5U1C17001C Manual Seiko Epson Corporation 2-13...
  • Page 36 4) short s_Global_Val; void sub() s_Global_Val = (short)fp_Pt; → A function pointer can be assigned to the short type global variable s_Global_Val except when it is declared. 2-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 37 *p2 = (short *)&p1 ; Because p2 and &p1 are incompatible pointers, a warning message will appear. In that case, variable p1 may not be referenced by means of pointer p2 or assignment may not be performed correctly. S5U1C17001C Manual Seiko Epson Corporation 2-15...
  • Page 39: Gnu17 Ide

    S5U1C17001C Manual 3 GNU17 IDE...
  • Page 41: Overview

    The GNU17 IDE (hereafter simply the IDE) provides an integrated development environment that makes it user to develop software using the S1C17 Family C Compiler Package (S5U1C17001C). This IDE combines the Eclipse IDE for C/C++ Developers package with the functions required for S1C17 program development (simply “GNU17-specific plug-ins”...
  • Page 42: Starting And Quitting The Ide

    The method for starting the IDE is described below. Double-click the eclipse.exe icon in the C:\EPSON\GNU17V3\eclipse directory to start the IDE. You can also start the IDE by selecting [EPSON MCU] > [GNU17V3] > [GNU17V3 IDE] from the Windows Start menu, or from the command line without parameters.
  • Page 43: Projects

    Creating a new project creates a directory with the same name as the project in the current workspace or the directory specified in (3). If a directory with this project name already exists, the IDE uses it as the project directory. S5U1C17001C Manual Seiko Epson Corporation...
  • Page 44: Creating And Adding A Source File

    (6) You can also select and import folders. Importing folders also imports the directory configuration within the folder. (Only files within the selected folder are imported.) (7) Click [Finish]. (8) The imported file will appear in [Project Explorer] view. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 45: Interrupt Vector And Boot Processing Descriptions

    _vector08_handler(void) __attribute__((alias("sampleInterrupt"))); This description defines the _vector08_handler with the alias sampleInterrupt. The sampleInterrupt function is an interrupt handler function and must have a prototype declaration as shown below: void sampleInterrupt(void) __attribute__((interrupt_handler)); S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 46: Importing An Existing Project

    However, if the project is configured with exclusive include search paths and library paths in the build options, you may have to modify these paths after importing the project. Seiko Epson Corporation S5U1C17001C Manual...
  • Page 47: Importing A Gnu17 Version 2 Project

    If gdbsim.ini includes the c17 ttbr command, edit this so that it points to the interrupt vector table. For example, if the interrupt vector table is the vector array, write this as c17 ttbr &vector. (7) Build the project. Build the project and check the build results in the [Console] view. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 48: Setting Project Properties

    Data reading is prohibited. However, the CPU can execute commands. Read protect : OFF Data reading is allowed. Write protect : ON Data writing is prohibited. Write protect : OFF Data writing is allowed. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 49: Setting Environment Variables

    A value dependent on GNU17_MODEL is set when the GNU17 Setting property is changed. Normally, you should leave this unchanged. GNU17_MODEL_RS A value dependent on GNU17_MODEL is set when the GNU17 Setting property is changed. Normally, you should leave this unchanged. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 50 When using flash protection, set the character string ("_ptd") to be added to the file name of the ROM data (PSA file) protected. Cygwin setting CYGWIN Set "nodosfilewarning" to hide the file path format warning output by Cygwin. 3-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 51: Setting Compiler Path

    The optimization options available will differ for each C compiler. Refer to Section 4.3.2, “Command-line Options” for more information on optimization.  Miscellaneous  Select other compiler options from this page. [Other flags] (default: -c –mpointer${GCC17_POINTER} –B${GCC17_LOC}) A compiler flag can be added. S5U1C17001C Manual Seiko Epson Corporation 3-11 (Rev. 1.0)
  • Page 52: Setting Linker Options

    To specify your own linker script, specify the linker script file using the -T option. If this is not set, linking will use the default linker script. Example: To specify the linker script file elf32c17.x on the project folder -T ../elf32c17.x 3-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 53: Setting Assembler Options

    -xassembler-with-cpp option specification) to process using the C preprocessor.  General  [Assembler flags] (default: -B${GCC17_LOC} –c –mpointer${GCC17_POINTER} –x assembler-with-cpp –Wa,--gstabs) Assembler flags can be added. [Include paths] (default: ../inc) Set the search path for the include file. S5U1C17001C Manual Seiko Epson Corporation 3-13 (Rev. 1.0)
  • Page 54: Building A Program

    Specify a linker script using the -T option. If no linker script is specified, linking will use the default linker script. Example: To specify the linker script file elf32c17.x in the project folder -T ../elf32c17.x 3-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 55: Executing A Build Process

    You also can also execute “clean” as described below: (1) Select the project you want to execute “clean” in the [Project Explorer] view. (2) Select [Clean Project] from the context menu in the [Project Explorer] view. S5U1C17001C Manual Seiko Epson Corporation 3-15...
  • Page 56 Except when you intend to rebuild a project, you will need to execute a build process after altering certain source files or header files. You must perform a rebuild in the following cases: • When project properties have been changed • When the included header file has been changed 3-16 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 57: Debugging The Program

    If using the ICDmini3 for debugging, edit the gdbmini3.ini GDB command file in the project and specify the target model. With the c17 model_path command, specify the MCU model information folder. If GNU17 is installed in c:\EPSON\GNU17V3, specify as follows: c17 model_path c:/EPSON/GNU17V3/mcu_model With the c17 model command, specify the target model.
  • Page 58: Setting Standard Output

    To enable, remove the “#” characters for the lines in red text within the GDB command file. Example: GDB command file[gdbmini3.ini] # Please uncomment following commented out lines to enable STDOUT while debugging. hbreak WRITE_FLASH commands printf "%s",WRITE_BUF continue Note: Enabling this function occupies one hardware breakpoint. 3-18 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 59: Using The Debugger

    Allows the CPU register values to be checked and modified. Variables Allows the variables to be checked and modified. Local variables are displayed automatically, depending on program execution status. Global variables are displayed if they are registered. S5U1C17001C Manual Seiko Epson Corporation 3-19 (Rev. 1.0)
  • Page 60: Setting The Debug Configuration

    Specify the search path for the source file used for symbolic debugging. The project folder is the default location of the source file, and the GNU17 library source code is set by default. 3-20 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 61: Files Generated In A Project By The Ide

    \Debug\gpdata.bin Gang Programmer user setting/program data file × × \Debug Object file × × \<project name>.o The files in the “File management required” column must be managed using a source management application. S5U1C17001C Manual Seiko Epson Corporation 3-21 (Rev. 1.0)
  • Page 63: Compiler

    S5U1C17001C Manual 4 C Compiler...
  • Page 65: Functions

     Assembly source file  File format: Text file File name: <filename>.s Description: An assembly source file to be input to the as assembler. This file is generated when the -S option is specified. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 66: Starting Method

    File search is performed in order of priorities, i.e., current directory, -B option, and PATH in that order. Default: The xgcc C compiler searches sub-programs in the current directory and the PATH directory. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 67 Code is compiled unchanged, generating unnecessary code as well, including code that assigns values to local variables that are never referenced. While the values of the variables loaded in registers will not be reused, local variables that are declared as registered will be optimized and deleted, as needed. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 68 This option allows the user program to reduce the RAM size for storing static variable pointers. However, the stack size cannot be reduced by this option. Default: The C compiler generates the object that allows data to be located in the 24-bit (16MB) space. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 69 Outputs a warning if a format is not specified when a variable or function is declared. "-Wimplicit-function-declaration" Outputs a warning when a function is used before declaration. "-Wimplicit" Same as "-Wimplicit-int" and "-Wimplicit-function-declaration" in enabled state. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 70 Same as all "-Wunused-xxxx" above in the enabled state. "-Wuninitialized" Outputs a warning when a local variable is used without initialization. This warning is not output when -O0 is selected. Default: The above warning options are disabled. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 71 When the -c option is specified, the -mpointer16 option will also be passed to the assembler. Example of assembling: xgcc -B$(TOOL_DIR)/ -c -xassembler-with-cpp -Wa,--gstabs -Wa,-mpointer16 boot.s After boot.s is processed in the preprocessor, it will be assembled with the -mpointer16 option specified. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 72: Compiler Output

    Example: int i; .global .section .bss .align .type i,@object .size .zero For all symbols including function names and labels, symbol information by the .stab assembler directive is inserted (when the -gstabs option is specified). Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 73: Data Representation

    When 4-byte boundary type is not contained: 2-byte boundary When the number of elements is 1: Store position for data type Array When 4-byte boundary type is contained: 4-byte boundary When the number of elements is 2 or more: 4-byte boundary S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 74 With gcc4, bit fields are accessed using the size corresponding to the type defined. Program struct IFtag { volatile union { volatile struct { unsigned short DATA : 1; /* 1bit */ unsigned short Dummy : 15; } bCTL; unsigned short usCTL; } rOUT; 4-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 75 = (struct g_GAtag *)0x8300; pg_GAtag->g_IF.rOUT.bCTL.DATA = 1; (*) return; Code compiled from the source line (*) with gcc3 pg_GAtag->g_IF.rOUT.bCTL.DATA = 1; ld.b %r3,[%r2] ; Byte access %r3,0x1 ; Byte access ld.b [%r2],%r3 S5U1C17001C Manual Seiko Epson Corporation 4-11 (Rev. 1.0)
  • Page 76: Method Of Using Registers

    • First argument: long, second argument: short, third argument: short foo( long lData, short sData1, short sData2 ); %r0 ← lData (low-order 16 bits) %r1 ← lData (high-order 16 bits) %r2 ← sData1 (16 bits) %r3 ← sData2 (16 bits) 4-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 77: Function Call

    If the registers for passing argument (%r0 to %r3) cannot be used, the values of the structure members are passed through the stack. When an argument is a structure larger than 64 bits, the values of the structure members are passed through the stack. S5U1C17001C Manual Seiko Epson Corporation 4-13...
  • Page 78: Stack Frame

    If there are any local variables defined in the called function that cannot be stored in registers, an area is allocated in the stack frame. This area is not allocated if there is no local variable that needs to be saved in the stack. 4-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 79: Grammar Of C Source

    C language specifications permit implementation-defined adjustment of the method of configuring member variables of a structure or union. The C compiler in this package is adjusted to yield even-number bytes for the size of a structure or union as an implementation definition feature. S5U1C17001C Manual Seiko Epson Corporation 4-15 (Rev. 1.0)
  • Page 80: Filter Function For Shift Jis Code

    • When the -mno-sjis-filt option is not specified in versions 1.5.0 or later with gcc3 int i_Val = L'空'; → i_Val is replaced by 0x8bf3 if the prefix "L" is specified. If the prefix "L" is not specified, i_Val is replaced by 0xfff3. 4-16 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 81: Functions Of Xgcc And Usage Precautions

    For detailed information on known issues and limitations concerning the C compiler, refer to: readmeVxxx.txt in this package or the release history (GNU17v3_release_history_e.pdf). • For information on the C99 standard supported by the C compiler, visit the site below. http://gcc.gnu.org/c99status.html S5U1C17001C Manual Seiko Epson Corporation 4-17 (Rev. 1.0)
  • Page 83: Library

    S5U1C17001C Manual 5 Library...
  • Page 85: Library Overview

    24-bit memory model libraries for models with COPRO2 16-bit memory model libraries for models with COPRO2 \lib\MD2\16bit Link the 16-bit libraries with the application program when the -mpointer16 option is specified in the C compiler and assembler. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 86: Precautions To Be Taken When Adding A Library

    ANSI libraries lib3.a calls lib1.a and lib2.a in addition to the emulation and ANSI libraries ld.exe -T withmylib.x -o withmylib.elf boot.o lib3.a lib2.a lib1.a libc.a libgcc.a libc.a Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 87: Startup Processing Library

    Set the stack pointer initial value to a value appropriate for the target model of the program. The linker script definition will be used if this is not set. The default linker script definition will be used if no linker script is specified. S5U1C17001C Manual Seiko Epson Corporation...
  • Page 88: Startup Processing

    Permit interrupts using ei instruction. int main (void) (None) void _stop_device (void) Prevent interrupts using di instruction. void _exit (int) The argument is the value returned by the main function. Continue as an infinite loop. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 89: Emulation Library

    The registers %r0 to %r7 are used. The registers %r4 to %r7 are protected by saving to the stack before execution of a function and by restoring from the stack after completion of the function. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 90: Floating-Point Calculation Functions

    The comparison function changes the C, V, Z or N flag of the PSR depending on the result of op1 - op2 (a-b), as shown below. Other flags are not changed. Comparison result op1 > op2 op1 = op2 op1 < op2 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 91 Values 0x7f800001 to 0x7fffffff and 0xff800001 to 0xffffffff are not recognized as numeric values. Note: The floating-point numbers in the xgcc C compiler differ from the IEEE-based FPU in precision and functionality, including the manner in which infinity is handled. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 92: Floating-Point Number Processing Implementation Definition

    If the original value is -NaN → The significand of the single-precision floating-point number is shifted two bits to the right, and the logical sum of that value and 0xfff80000 00000000 is used. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 93: Integral Calculation Functions

    ← a << b bits long __cmpsi2 Comparison ( x ← 2 | 1 | 0 ∗ 1 Integer comparison unsigned long Comparison ( x ← 2 | 1 | 0 ∗ 1 __ucmpsi2 S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 94: Long Long Type Calculation Functions

    *1 The integer comparison function and the long long comparison function return the following values based on the result of op1 – op2. op1 > op2 → 2 op1 = op2 → 1 op1 < op2 → 0 5-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 95: Compatibility With Coprocessor Instructions

    Unsigned 16-bit division ✓ ✓ __umodhi3 Unsigned 16-bit remainder calculation ✓ ✓ __divsi3 Signed 32-bit division ✓ __modsi3 Signed 32-bit remainder calculation ✓ __udivsi3 Unsigned 32-bit division ✓ __umodsi3 Unsigned 32-bit remainder calculation ✓ S5U1C17001C Manual Seiko Epson Corporation 5-11 (Rev. 1.0)
  • Page 96: Ansi Library

    _iob , and call write function. count, FILE *stream); stdout. int fgetc(FILE *stream); Conditional Refer to global variables stdin and Input one character from _iob , and call read function. stdin. 5-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 97 Note: The file system is disabled; stdin and stdout are enabled. When using stdin and stdout, the read() and write() functions are needed, respectively. Refer to Section 5.4.4 for more information. S5U1C17001C Manual Seiko Epson Corporation 5-13 (Rev. 1.0)
  • Page 98 The table below lists the non-local branch functions included in libc.a. Table 5.4.2.3 Non-local branch functions Header file: setjmp.h Function Functionality Reentrant Notes int setjmp(jmp_buf env); Non-local branch Reentrant: void longjmp(jmp_buf env, int status); Non-local branch Reentrant: 5-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 99 Nonreentrant Change global variable errno . Calculate hyperbolic sine. double cosh(double x); Nonreentrant Change global variable errno . Calculate hyperbolic cosine. double tanh(double x); Calculate hyperbolic Nonreentrant tangent. S5U1C17001C Manual Seiko Epson Corporation 5-15 (Rev. 1.0)
  • Page 100 *strstr(const char *s1, const char Return position where the Reentrant *s2); specified character string appeared first. char *strtok(char *s1, const char *s2); Divide the character string into Nonreentrant Change static variable. tokens. 5-16 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 101 Header file: stdarg.h Macro Functionality void va_start(va_list ap, type lastarg); Initialize the variable argument group. type va_arg(va_list ap, type); Return the actual argument. void va_end(va_list ap); Return normally from the variable argument function. S5U1C17001C Manual Seiko Epson Corporation 5-17 (Rev. 1.0)
  • Page 102: Declaring And Initializing Global Variables

    Address pointer to indicate the beginning of the next new area mapped unsigned char *ansi_ucTblPtr; Address pointer to indicate the beginning of the next management area mapped unsigned long ansi_ulRow; Line pointer to indicate the next management area mapped 5-18 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 103: Lower-Level Functions

    Library function that calls the write function: Direct call: fwrite, putc, _doprint (_doprint is printf-series internal function) Indirect call: fputc, fputs, putchar, puts (calls putcc) printf, fprintf, sprintf, vprintf, vfprintf (calls _doprint) perror (calls fprintf) S5U1C17001C Manual Seiko Epson Corporation 5-19 (Rev. 1.0)
  • Page 104 5 Library  _exit function  Contents of _exit function void _exit(void); Format: Functionality: Performs program terminating processing. Argument: None Library function that calls the _exit function: Direct call: abort, exit 5-20 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 105: Assembler

    S5U1C17001C Manual 6 Assembler...
  • Page 107: Functions

    Assembly sources sources including preprocessor instructions file.s file.s Specify the –c and –xassembler-with-cpp Assembler C compiler options xgcc Preprocessor Object files file.o Assembler ld linker Object files file.o ld linker Figure 6.2.1 Flowchart S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 108: Input File

    Binary file in elf format File name: <filename>.o (The <filename> is the same as that of the input file.) Description: File in which symbol information and debugging information are added to the program code (machine language). Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 109: Starting Method

    The assembler generates object files for the 24-bit pointer mode (16MB memory model). When entering options in the command line, you need to place one or more spaces before and after the option. Example: as -otest.o -adhl test.s S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 110: Scope

    The as assembler regards the symbols SYMBOL and VAR1 in the file2 as those of undefined addresses in the assembling, and includes that information in the object file it delivers. Those addresses are finally determined by the processing of the ld linker. Seiko Epson Corporation S5U1C17001C Manual...
  • Page 111: Assembler Directives

     Instruction format  .text  Description  Declares the start of a .text section. Statements following this instruction are assembled as those to be mapped in the .text section, until another section is declared. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 112: Data Section Defining Directives(.Rodata, .Data

    Example: .section .data Defines a .data section.  Note  The data space allocated by the data-define directive is as follows: 1 byte: .byte 2 bytes: .short, .hword, .word, .int 4 bytes: .long Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 113: Bss Section Defining Directive (.Bss

    .align VAR2: Defines the 4-byte global variable VAR2. .skip • Areas in .bss sections can be secured using the .skip directive. The .space directive cannot be used because it has an initial data. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 114: Data Defining Directives (.Long, .Short, .Byte, .Ascii, .Space

    If <1-byte data> is omitted, the area is filled with 0x0. To fill the area with 0x0, the .zero directive (see the next page) can also be used. Example: .space 4,0xff Sets 0xff to the 4-byte area beginning from the current address. .zero (= .space 4,0x0) Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 115: Area Securing Directive (.Zero

    This directive secures a <length> bytes of blank area in the current .bss section. The area begins from the current address unless it is immediately preceded by the .align directive. Example: .section .bss .global VAR1 .align VAR1: Secures an space for the 4-byte global variable VAR1. .zero S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 116: Alignment Directive (.Align

    The .align directive is valid for only the immediately following data definition or area securing directive. Therefore, when defining data that requires alignment, you need to use the .align directive for each data definition directive. 6-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 117: Global Declaring Directive (.Global

    Makes global declaration of a symbol. The declaration made in a file with a symbol defined converts that symbol to a global symbol which can be referred to from other modules. Example:.global SUB1  Note  The symbols are always defined as a local symbol unless it is declared using this directive. S5U1C17001C Manual Seiko Epson Corporation 6-11 (Rev. 1.0)
  • Page 118: Symbol Defining Directive(.Set

    Defines the symbol DATA1 that represents absolute address 0x80000.  Note  The symbol is defined as a local symbol. To use it as a global symbol, global declaration using the .global directive is necessary. 6-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 119: Extended Instructions

    Expanded into the adc instruction sadd.a, xadd.a Expanded into the add.a instruction ssub, xsub Expanded into the sub instruction ssbc, xsbc Expanded into the sbc instruction ssub.a, xsub.a Expanded into the sub.a instruction S5U1C17001C Manual Seiko Epson Corporation 6-13 (Rev. 1.0)
  • Page 120 (3) xOP.a %rd,imm24 / xOP.a %sp,imm24 (OP = add, sub) Example: xadd.a %rd,imm24 imm24 0x7f < imm24 0xfffff < imm24 0x7f 0xfffff ≤ ≤ add.a %rd,imm24(6:0) imm24(19:7) imm24(23:20) add.a %rd,imm24(6:0) imm24(19:7) add.a %rd,imm24(6:0) 6-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 121: Comparison Instructions

    ≤ 0x7f 0x7f < imm20 cmp.a %rd,imm20(6:0) imm20(19:7) cmp.a %rd,imm20(6:0) (3) xcmp.a %rd,imm24 imm24 ≤ 0x7f 0x7f < imm24 ≤ 0xfffff imm24 > 0xfffff cmp.a %rd,imm24(6:0) imm24(19:7) imm24(23:20) cmp.a %rd,imm24(6:0) imm24(19:7) cmp.a %rd,imm24(6:0) S5U1C17001C Manual Seiko Epson Corporation 6-15 (Rev. 1.0)
  • Page 122: Logic Operation Instructions

    Expanded into the not instruction  Expansion formats  (1) sOP %rd,imm16 / xOP %rd,imm16 (OP = and, oor, xor, not) Example: xand %rd,imm16 imm 16 ≤ 0x7f 0x7f< imm16 and %rd,imm16(6:0) ext imm16(15:7) and %rd,imm16(6:0) 6-16 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 123: Data Transfer Instructions (Between Stack And Register)

    (OP = ld.b, ld.ub, ld, ld.a) xOP [%sp+imm24],%rs (OP = ld.b, ld, ld.a) Example: xld.a %rd,[%sp+imm24] imm24 ≤ 0x7f 0x7f < imm24 ≤ 0xfffff 0xfffff < imm24 ld.a %rd,[%sp+imm24(6:0)] imm24(19:7) imm24(23:20) ld.a %rd,[%sp+imm24(6:0)] imm24(19:7) ld.a %rd,[%sp+imm24(6:0)] S5U1C17001C Manual Seiko Epson Corporation 6-17 (Rev. 1.0)
  • Page 124: Data Transfer Instructions (Between Memory And Register)

    (OP = ld.b, ld.ub, ld, ld.a) xOP [imm24],%rs (OP = ld.b, ld, ld.a) Example: xld.a %rd,[imm24] imm24 ≤ 0x7f 0x7f < imm24 ≤ 0xfffff 0xfffff < imm24 ld.a %rd,[imm24(6:0)] imm24(19:7) imm24(23:20) ld.a %rd,[imm24(6:0)] imm24(19:7) ld.a %rd,[imm24(6:0)] 6-18 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 125: Immediate Data Load Instructions

    %rd,imm20(6:0) (3) xld.a %rd,imm24 / xld.a %sp,imm24 Example: xld.a %rd,imm24 imm24 ≤ 0x7f 0x7f < imm24 ≤ 0xfffff 0xfffff < imm24 ld.a %rd,imm24(6:0) imm24(19:7) imm24(23:20) ld.a %rd,imm24(6:0) imm24(19:7) ld.a %rd,imm24(6:0) S5U1C17001C Manual Seiko Epson Corporation 6-19 (Rev. 1.0)
  • Page 126 (5) sld.a %rd,symbol±imm20 / sld.a %sp,symbol±imm20 Example: sld.a %rd,symbol±imm20 Unconditional (symbol ± imm20)(19:7) ld.a %rd,(symbol ± imm20)(6:0) (6) xld.a %rd,symbol±imm24 / xld.a %sp,symbol±imm24 Example: xld.a %rd,symbol±imm24 Unconditional (symbol ± imm24)(23:20) (symbol ± imm24)(19:7) ld.a %rd,(symbol ± imm24)(6:0) 6-20 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 127: Branch Instructions

    PC relative subroutine call (10) xjpr sign24 PC relative unconditional jump (10) xjreq sign24 PC relative conditional jump (11) xjrne sign24 PC relative conditional jump (11) xjrgt sign24 PC relative conditional jump (11) S5U1C17001C Manual Seiko Epson Corporation 6-21 (Rev. 1.0)
  • Page 128 (OP = jr*, jr*.d) Example: sjreq label±imm20 Unconditional (label ± imm20)(19:8) jreq (label ± imm20)(7:1) (3) sOP label±imm20 (OP = calla, calla.d, jpa, jpa.d) Example: scalla label±imm20 Unconditional (label ± imm20)(19:7) calla (label ± imm20)(6:0) 6-22 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 129 (label ± imm24)(6:0) (10) xOP sign24 (OP = call, call.d, jpr, jpr.d) Example: xcall sign24 -1024 ≤ sign24 ≤ 1023 sign24 < -1024 1023 < sign24 call sign24(11:1) sign24(23:12) call sign24(11:1) S5U1C17001C Manual Seiko Epson Corporation 6-23 (Rev. 1.0)
  • Page 130 (12) xOP imm24 (OP = calla, calla.d, jpa, jpa.d) Example: xcalla imm24 imm24 ≤ 0x7f 0x7f < imm24 ≤ 0xfffff 0xfffff < imm24 calla imm24(6:0) imm24(19:7) imm24(23:20) calla imm24(6:0) imm24(19:7) calla imm24(6:0) 6-24 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 131: Coprocessor Instructions

    0xfffff < imm24 ld.ca %rd,imm24(6:0) imm24(19:7) imm24(23:20) ld.ca %rd,imm24(6:0) imm24(19:7) ld.ca %rd,imm24(6:0) (4) xOP %rd,symbol±imm24 (OP = ld.cw, ld.ca, ld.cf) Example: xld.ca %rd,symbol±imm24 Unconditional (symbol ± imm24)(23:20) (symbol ± imm24)(19:7) ld.ca %rd,(symbol ± imm24)(6:0) S5U1C17001C Manual Seiko Epson Corporation 6-25 (Rev. 1.0)
  • Page 132: Xext Instructions

    (OP = ld.b, ld.ub, ld, ld.a)  Basic instructions after expansion  Expanded into the ext instruction Xext  Expansion formats  (1) Xext imm24 imm24 ≤ 0x1fff 0x1fff < imm24 ≤ 0xffffff ext imm24(12:0) imm24(23:13) imm24(12:0) 6-26 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 133: Error/Warning Messages

    (e.g. .byte 0x100000012 → .byte 0xff ) Warning: operand out of range The value specified in the operand is out of the effective ( XXXXXX : XXX not between AAA and BBB ) range. S5U1C17001C Manual Seiko Epson Corporation 6-27 (Rev. 1.0)
  • Page 134: Precautions

    To prevent errors during linkage, be sure to write the .section directive with the .align directive to clearly define the section boundary. Example: .section .rodata .align 2 ; ←Essential .long data1 .long data2 6-28 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 135: Linker

    S5U1C17001C Manual 7 Linker...
  • Page 137: Functions

    Linker script Linker symbol file file ANSI library libc.a User Object Emulation library file.a file.o Library files libgcc.a file.x ldsyms.ini Library files Linker Executable file.elf object file gdb debugger Figure 7.2.1 Flowchart S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 138: Input Files

    Text file File name: <filename>.map Description: Mapping information file showing from which address of a section each input file was mapped. The file is delivered when the -M or -Map option is specified. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 139: Starting Method

    The linker does not delete the ext 0 instruction. When inputting options in the command line, one or more spaces are necessary before and after the option. Example: ld -o sample.elf -T sample.lds -N boot.o sample.o ..\lib\24bit\libc.a S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 140: Linkage

    *(.data) *(.data.*) PROVIDE (__END_data = .) ; } > iram AT > irom .rodata : PROVIDE (__START_rodata = .) ; *(EXCLUDE_FILE (*crt0.o ) .rodata) *(.rodata.*) PROVIDE (__END_rodata = .) ; } > irom Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 141 0x8000. Figure 7.4.1.1 shows the memory map after linkage. .data (initial values) .rodata VMA=LMA .text VMA=LMA 0x8080 .vector VMA=LMA 0x8000 Unused .data .bss 0x0000 VMA=LMA Figure 7.4.1.1 Memory map configured by default script S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 142: Examples Of Linkage

    .text_foo1 { *foo1.o(.text.*) *foo1.o(.text) } .text_foo2 { *foo2.o(.text.*) *foo2.o(.text) } .text_foo3 { *foo3.o(.text.*) *foo3.o(.text) } } > iram AT > irom .rodata : PROVIDE (__START_rodata = .) ; *(EXCLUDE_FILE (*crt0.o ) .rodata) *(.rodata.*) Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 143 A program cache for high-speed program execution is realized in this method. The .text sections in other files than these three files are located in the .text section that follows the .vector section and are executed at the stored address in the ROM. S5U1C17001C Manual Seiko Epson Corporation...
  • Page 144: Link Maps

    _vector12_handler 0x0000808e _vector17_handler 0x0000808e _vector19_handler 0x0000808e _vector13_handler 0x0000808e _vector25_handler 0x0000808e _vector01_handler 0x0000808e _vector11_handler 0x0000808e _vector14_handler 0x0000808e _vector05_handler 0x0000808e _vector29_handler 0x0000808e _vector04_handler 0x0000808e _vector02_handler 0x0000808e _vector07_handler 0x0000808e _vector30_handler 0x0000808e _vector15_handler 0x0000808e _vector09_handler 0x0000808e _vector23_handler Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 145 0x0000069c 0x24c C:\EPSON\GNU17V3\gcc4\lib\\24bit\libg.a(debuglib.o) 0x258 (size before relaxing) .comment 0x00000000 0x11 .comment 0x00000000 0x11 crt0.o 0x12 (size before relaxing) .comment 0x00000000 0x12 src\sample_gcc4.o .comment 0x00000000 0x12 C:\EPSON\GNU17V3\gcc4\lib\\24bit\libg.a(debuglib.o) .stabstr 0x00000000 0x8d5 .stabstr 0x00000000 0x8d5 crt0.o S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 146 The .stab and .stabstr sections are used to embed debugging information used by the debugger into the program. The contents of these sections are not loaded to the target. 7-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 147: Error/Warning Messages

    Object files created in 16-bit pointer mode and object files Cannot link 16bit object <objectfile16> [included from created in 24-bit pointer mode cannot be linked. <archivefile16> ] with 24bit object <objectfile24> [included from <archivefile24> ] S5U1C17001C Manual Seiko Epson Corporation 7-11 (Rev. 1.0)
  • Page 148: Precautions

    24-bit limit (0xffffff) or lower than 0x0, the address bits that exceed 24 bits are masked with 0 and no error occurs. Example: xadd.a %r0,symbol-5 If the symbol is located at address 0, the specified absolute address is 0 - 5 = 0xfffffb (-5). Therefore, this code will be assembled as "xadd.a %r0,0xfffffb". 7-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 149: Debugger

    S5U1C17001C Manual 8 Debugger...
  • Page 151: Features

    This object file does not contain debug information created from an object file (.elf). Source level debugging is not performed for ROM data, since debugging information is not included. It is used with the load command to load programs and data to target memory. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 152: Output File

     File format: Text file File name: gdb.txt Description: The commands executed and execution results are output to this file. Output by executing the set logging on command within the startup command file. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 153: Starting The Debugger

    Simulator (SIM) mode In simulator mode, target program execution is simulated in the internal memory of a personal computer. No other tools are required. Note that ICDmini-dependent functions cannot be used in this mode. S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 154: Startup Options

    Explanation: This option can be used to specify debugger operations corresponding to MCU models. To load a program to the Flash ROM inside the MCU, either specify this option or execute the c17 model command. Loading to the Flash ROM is not possible unless you specify the MCU model. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 155: Executing Command Files

     Example of a command file  Only one command can be written per line. Example: c17 model_path c:/EPSON/GNU17V3/mcu_model Specifies the model-specific information file directory. Specifies the model name. (Voltage level 3.3 V) 17 model 17W23@NOVCCIN target icd icdmini3 Connects the target.
  • Page 156: Quitting The Debugger

    Note: When using an ICD to debug a program, always be sure to close the debugger before turning off power to the ICD. Should you turn off power to the ICD while running the debugger, you will be unable to reconnect it. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 157: Method Of Executing Commands

    If you have entered an incorrect command by mistake, use the arrow (←, →), [Backspace], or [Delete] keys to correct it. When you have finished entering a command, press the [Enter] key to execute the command. Example: (gdb) continue (entry of command only) (gdb) target icd icdmini3 (entry of command and parameters) S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 158: Parameter Input Format

    Only characters 'a' to 'z,' 'A' to 'Z,' 0 to 9, /, and _ can be used. Drive names must be specified in /<drive name>/format, with / instead of \ used for delimiting the path. Example: (gdb) file /c/EPSON/gnu17v3/sample/txt/sample.elf Seiko Epson Corporation S5U1C17001C Manual (Rev.
  • Page 159: Command Reference

    ○ ○ commands Set command to execute at break ○ ○ Symbol information info locals Display local symbol ○ ○ info var Display global symbol ○ ○ print Alter symbol value ○ ○ S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 160: Detailed Description Of Commands

    Notes Describes limitations on use of the command or precautions to be taken when using the command. Some commands have additional items other than those described above when needed for explanatory purposes. 8-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 161: Command Details

    (gdb) x /4w 0x0 0x0: 0x00000001 0x00000001 0x00000001 0x00000001 The entire memory area from address 0x0 to address 0xf is rewritten with 32-bit data 0x00000001. (This applies to when using little endian.) S5U1C17001C Manual Seiko Epson Corporation 8-11 (Rev. 1.0)
  • Page 162 For example, when data 0x100 is specified in c17 fb, it is processed as 0x00.  If the end address is smaller than the start address, an error is assumed. 8-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 163: Memory Dump) [Icd Mini / Sim]

    When Size is specified but Length omitted, one unit of data equal to the specified data size is displayed. The letter i is a symbol defined at address 0x0. If any address other than the address at the beginning of a variable, etc. is specified, <symbol+offset> is displayed as the symbol. S5U1C17001C Manual Seiko Epson Corporation 8-13...
  • Page 164  If the specified address exceeds the 24-bit range, an error is assumed.  An error does not occur even if a value of 2147483648 or greater is specified for Length. The value for Length is set to 2147483647. 8-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 165  Data parameters are only effective for the 8 low-order bits for set {char}, 16 low-order bits for set {short} and set {int}, and 32 low-order bits for set {long}, with excessive bits being ignored. For example, when data 0x100 is specified in set {char}, it is processed as 0x00. S5U1C17001C Manual Seiko Epson Corporation 8-15...
  • Page 166: C17 Mvb (Copy Area, In Bytes)

    Therefore, data is always copied even when the specified destination address exists within the source area.  If the end address at the destination exceeds 0xffffff, data is only copied only up to 0xffffff. 8-16 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 167: C17 Df (Save Memory Contents) [Icd Mini / Sim]

    In Motorola S3 format, data is output 32 bytes per line. If one line is less than 32 bytes, the number of bytes for the address range specified will be written. (Contents of dump.mot) S3250008000094D4BA020FCA086120800961881C6F0AA4D4BA020FCA086120800961881C6F0AA8 S3250008002008D3730A00000000000000000000000008D3730A09CA026139A505610CD309613F S30800080100A4D5BABB S70500000000FA S5U1C17001C Manual Seiko Epson Corporation 8-17 (Rev. 1.0)
  • Page 168 If no Append parameters exist or the parameter 'f' is specified, a footer record is output to a Motorola S3 format file. Notes  If the specified address exceeds the 24-bit range, an error is assumed.  If the end address is smaller than the start address, an error is assumed. 8-18 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 169: Register Manipulation Commands

    1184810 0xaaaaaa 1184810 0x7f8 2040 0xc00030 12582960 Notes Be sure to specify register names in lowercase letters. Using uppercase letters for register names or specifying nonexistent register names results in an error. S5U1C17001C Manual Seiko Epson Corporation 8-19 (Rev. 1.0)
  • Page 170  The contents of the set values are not checked internally. No errors are assumed even when values other than 16-bit or 32-bit boundary addresses are specified for PC or SP, respectively. However, when the registers are actually modified, values are forcibly adjusted to boundary addresses by truncating the lower bits. 8-20 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 171: Program Execution Commands

     If break conditions other than the one that stopped the target program must be ignored a specified number of times, specify break conditions and the number of times that a break hit is to be ignored in the ignore command. Then execute the continue command without any parameters. S5U1C17001C Manual Seiko Epson Corporation 8-21...
  • Page 172: Until (Execute Continuously With Temporary Break) [Icd Mini / Sim]

    A symbol can also be used, as shown below. (gdb) until *main main () at main.c:7 Note that adding an asterisk (*) causes even the function name to be regarded as an address. 8-22 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 173  If temporary breakpoints are specified by an address value that exceeds the 24-bit range, an error is assumed.  When specifying temporary breakpoints by address value and the address is specified with an odd value, the specified address is adjusted to the 16-bit boundary by assuming LSB = 0. S5U1C17001C Manual Seiko Epson Corporation 8-23...
  • Page 174: Step (Single-Step, Every Line)

    Similarly, the halt and slp instructions are executed while single-stepping the program, causing the CPU to enter standby status. The CPU exits standby status when an external interrupt is generated. Clicking the [Suspend] button also releases the CPU from standby mode. 8-24 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 175: Next (Single-Step With Skip, Every Line)

    Similarly, the halt and slp instructions are executed while single-stepping the program, causing the CPU to enter standby mode. The CPU exits standby mode when an external interrupt is generated. Clicking the [Suspend] button also releases the CPU from standby mode. S5U1C17001C Manual Seiko Epson Corporation 8-25...
  • Page 176: Finish (Finish Function) [Icd Mini / Sim]

    Notes When the finish command is executed at the highest level (e.g., boot routine), the program does not stop. If no breaks are set, use the [Suspend] button to halt the program. 8-26 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 177: Cpu Reset Commands

    Notes  The contents of memory and debugging status of break and trace are not reset.  When using gdb in ICD Mini mode, the bus status and I/O status are retained. S5U1C17001C Manual Seiko Epson Corporation 8-27 (Rev. 1.0)
  • Page 178: C17 Rstt (Reset Target) [Icd Mini]

    TARGET resetting ....failure Notes  The c17 rstt command can only be used in ICD Mini mode.  To execute this command, a reset input pin is required on the target board. 8-28 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 179: Interrupt Commands

     Make sure the interrupt number is specified from 0 to 31. If this range is exceeded, an error is assumed.  Make sure the interrupt priority level is specified from 0 to 7. If this range is exceeded, an error is assumed.  TTBR is effective even in simulator mode. S5U1C17001C Manual Seiko Epson Corporation 8-29...
  • Page 180: C17 Intclear (Clear Interrupt) [Sim]

     The c17 intclear command can only be used in simulator mode.  Make sure the interrupt number is specified from 0 to 31. If this range is exceeded, an error is assumed. 8-30 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 181: Break Setup Commands

    10 with actual code, the program breaks at the beginning of the first instruction encountered with actual code thereafter. Because the breakpoint is set by tbreak, it is cleared after a break. S5U1C17001C Manual Seiko Epson Corporation 8-31 (Rev.
  • Page 182 If brk instructions cannot be embedded, hardware PC breaks are set in the same way as for the hbreak/thbreak command. Use the hbreak/thbreak command from the start if you know that brk instructions cannot be embedded. 8-32 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 183 When a hardware break is set at ①, the process stops at ②. After ③ is processed by "next," the process stops at ②. S5U1C17001C Manual Seiko Epson Corporation 8-33 (Rev.
  • Page 184: Hbreak (Set Hardware Pc Break)

    If no instructions exist on line 10 with actual code, the program breaks at the beginning of the first instruction encountered with actual code thereafter. Because the breakpoint is set by thbreak, it is cleared after a break. 8-34 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 185  When specifying hardware PC breakpoints by address value and the address is specified with an odd value, the specified address is adjusted to the 16-bit boundary by assuming LSB = 0. An error will occur if an address is specified exceeding 24 bits. S5U1C17001C Manual Seiko Epson Corporation 8-35...
  • Page 186: Delete (Clear Break By Break Number) [Icd Mini / Sim]

     The delete command clears all break settings. To disable a breakpoint temporarily, use the disable or ignore command.  Note that specifying a break number not set displays the "No breakpoint number N." message, with no breakpoints being deleted. 8-36 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 187: Clear (Clear Break By Break Position) [Icd Mini / Sim]

     The clear command completely clears break settings. To disable a breakpoint temporarily, use the disable or ignore command.  If you specify a function name, line number, or address for which no breakpoints are set, an error is assumed. S5U1C17001C Manual Seiko Epson Corporation 8-37...
  • Page 188: Enable (Enable Breakpoint)

     The number of breakpoints that can be set is limited. Use the delete command to delete unnecessary breakpoints.  Note that specifying a break number not set displays the "No breakpoint number N." message, with no breakpoints being disabled or enabled. 8-38 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 189: Ignore (Disable Breakpoint With Ignore Counts) [Icd Mini / Sim]

     The ignore command cannot be used to collectively disable multiple breakpoints.  Note that specifying a break number not set displays the "No breakpoint number N." message, with program execution being aborted. S5U1C17001C Manual Seiko Epson Corporation 8-39 (Rev. 1.0)
  • Page 190: Info Breakpoints (Display Breakpoint List) [Icd Mini / Sim]

    Moreover, the number of times a breakpoint has thus been hit is displayed in "breakpoint already hit N times" format. When breakpoints are not set at any location, the list is displayed as shown below. (gdb) info breakpoints No breakpoints or watchpoints. 8-40 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 191: Commands (Setting A Command To Execute After Break) [Icd Mini / Sim]

    • The command line is not executed when a break occurs using a temporary breakpoint (tbreak, thbreak). • The commands command cannot be nested. If a commands command occurs in the command line, the command line specified by the commands command cannot be entered during a break. S5U1C17001C Manual Seiko Epson Corporation 8-41...
  • Page 192: Symbol Information Display Commands

    If the current position indicated by the PC address is outside the function (stack frame) (e.g., in boot routine of an assembly source), local symbols are not displayed. (gdb) info locals No frame selected. 8-42 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 193: Print (Alter Symbol Value) [Icd Mini / Sim]

     Even if the value you have specified exceeds the range of values for the type of variable you wish to alter, no errors are assumed. Only a finite number of low-order bits equivalent to the size of the variable are effective, with excessive bits being ignored. For example, specifying 0x10000 for variable int is processed as 0x0000. S5U1C17001C Manual Seiko Epson Corporation 8-43...
  • Page 194: File Loading Commands

     Once the file command is executed, operation cannot be aborted until the debugger finishes loading the file.  An error will occur if an unsupported elf file (with no C17 flag) is specified. 8-44 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 195: Load (Load Program) [Icd Mini / Sim]

    (resets the CPU.)  The load command loads only several areas of an object file containing the code and data. All other areas are left intact in the previous state before load command execution. S5U1C17001C Manual Seiko Epson Corporation 8-45...
  • Page 196: Trace Command

    ■Example 2 (gdb) c17 tm off Trace mode is turned off. From this time on, no trace information is sampled even when running the program. 8-46 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 197 003ef4 0 0 0010 jreq 003ef8 0 0 0010 (main.c) 00027 } 003ef8 0 0 0000 %r4,0x1 (main.c) 00014 for( j = 0; j < 6; ++j ) 003ef8 0 0 1001 %r4,0x5 S5U1C17001C Manual Seiko Epson Corporation 8-47 (Rev. 1.0)
  • Page 198  This command cannot be used in ICD Mini mode.  To change trace mode (with contents of trace information displayed), temporarily turn off trace mode (by executing c17 tm off), then set a new trace mode. 8-48 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 199: Other Commands

    $1 = -21846 (gdb)set output-radix 16 (gdb)print i $2 = 0xaaaa (gdb)set output-radix 8 (gdb)print i $3 = 0125252 Notes  The debugger will not display correctly if binary is set (set output-radix 2). S5U1C17001C Manual Seiko Epson Corporation 8-49 (Rev. 1.0)
  • Page 200: Set Logging (Log Output Setting) [Icd Mini / Sim]

    (disables log output) Usage example ■Example 1 (gdb) set logging on Outputs a debugger command log. The log is saved as the file gdb.txt. ■Example 2 (gdb) set logging off Disables log output. 8-50 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 201: Source (Execute Command File) [Icd Mini / Sim]

    # reset c17 rst From # to the end of the line is interpreted as a comment. (gdb) source src.cmd (gdb) (gdb) file c:/EPSON/gnu17v3/sample/tst/sample.elf (gdb) (gdb) target sim boot () at boot.s:9 Connected to the simulator. Current language: auto; currently asm (gdb) (gdb) load c:/EPSON/gnu17v3/sample/tst/sample.elf...
  • Page 202: Target (Connect Target) [Icd Mini / Sim]

    The following shows the basic sequence of command execution: (gdb) target sim (this command) (gdb) c17 ttbr 0x20000 (TTBR setting) (gdb) load sample.elf (loads the program.) (gdb) c17 rst (resets the CPU.) 8-52 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 203: Detach (Disconnect Target) [Icd Mini / Sim]

    This command can be used to turn the ICDmini off to switch between simulator mode and other modes, or perform operations on the target board. You need not execute this command to terminate debugging. S5U1C17001C Manual Seiko Epson Corporation 8-53...
  • Page 204: Pwd (Display Current Directory)

    Directory: Character string used to specify a directory Usage example (gdb) pwd Working directory c:/EPSON/gnu17/sample/tst. (gdb) cd c:/EPSON/gnu17/sample/ansilib Working directory c:/EPSON/gnu17/sample/ansilib. After the current directory is confirmed, it is changed to "c:\EPSON\gnu17\sample\ansilib". 8-54 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 205: C17 Ttbr (Set Ttbr) [Sim]

    Usage example (gdb) c17 ttbr 0x8000 Sets address 0x8000 to TTBR. Notes  This command can be used only in simulator mode.  This command must be executed before the target command. S5U1C17001C Manual Seiko Epson Corporation 8-55 (Rev. 1.0)
  • Page 206: C17 Cpu (Set Cpu Type) [Sim]

     The debugger sets the CPU type using either this command or the model information acquired via the c17 model command. If both this command and the c17 model command are executed, the setting for the last command executed takes priority. 8-56 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 207: C17 Chgclkmd (Dclk Change Mode) [Icd Mini]

    1. Overwriting clock control and clock source registers during break 2. Breaking while switching the clock within the target program 3. Step running the clock switching section within the target program In the cases described above, set Mode = 1. S5U1C17001C Manual Seiko Epson Corporation 8-57 (Rev. 1.0)
  • Page 208: C17 Pwul (Unlock Flash Security Password) [Icd Mini]

     An error occurs if an undefined version is specified. The password will not be unlocked.  An error occurs if invalid characters (non-alphanumeric characters) are specified for the password. The password is not unlocked. 8-58 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 209: C17 Help (Help) [Icd Mini / Sim]

    Number of steps to execute (decimal or hexadecimal) One step is assumed if ommitted. Conditions: 1-0x7fffffff example: (gdb)step (gdb)step 10 When you specify a command, a detailed description of that command is displayed. S5U1C17001C Manual Seiko Epson Corporation 8-59 (Rev. 1.0)
  • Page 210 The command can be used in simulator mode (when debugging with the PC alone) If "[ICD]" is displayed, it indicates that the command cannot be executed in modes other than ICD Mini mode. 8-60 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 211 Debugger gdb.exe is normally located in c:\EPSON\GNU17V3, so the setting in this usage example will be the same as when this command is not executed.  Settings made by this command are referenced when the c17 model command is executed. If this command is to be executed, be sure to execute before executing the c17 model command.
  • Page 212: C17 Model (Mcu Model Name Setting) [Icd Mini / Sim]

    ■Example 4: When the debug I/F voltage is 3.3 V and FLS is also specified (gdb) c17 model 17W23@FLS=FLS17W23.saf,NOVCCIN (gdb) target icd icdmini3 Specifications included in Detail must be separated by commas. Notes  This command must be executed before the target command. 8-62 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 213: Quit (Quit Debugger) [Icd Mini / Sim]

    (quit debugger) [ICD Mini / SIM] Operation Terminates the debugger. Any ports or files used by the debugger that remain open are closed. Format quit q (abbreviated form) Usage example (gdb) q S5U1C17001C Manual Seiko Epson Corporation 8-63 (Rev. 1.0)
  • Page 214: Status And Error Messages

    The number of software PC breakpoints set exceeds the limit (up to 200). Cannot write file Cannot write to the file. command result error! An error occurred on executing an undefined command. icdmini3 dll open failure. Failed to connect to ICD mini Ver3. 8-64 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 215: Peripheral Circuit Simulator (Es-Sim17)

    The ES-Sim17 can simulate operations with the OSC1 clock in real time. For operations with the OSC3 clock, refer to "simulator_readme.txt". Note: The ES-Sim17 is a simulator that runs on a PC, therefore, it has some restrictions. Refer to Section 8.7.8, "Restrictions", and "simulator_readme.txt". S5U1C17001C Manual Seiko Epson Corporation 8-65 (Rev. 1.0)
  • Page 216: Input/Output Files

    LCD file path LCD panel setting file File format: Binary file File name: <filename>.lcd Description: This is an LCD panel setting file for ES-Sim17 created by LcdUtil17. ES-Sim17 can simulate dot-matrix and segment LCDs. 8-66 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 217  LCD screen-capture bitmap file File format: Bitmap file File name: <filename>.bmp Description: This is a bitmap file that contains an LCD screen image simulated and can be generated by the ES-Sim17. S5U1C17001C Manual Seiko Epson Corporation 8-67 (Rev. 1.0)
  • Page 218: Starting And Terminating Es-Sim17

    The [ES-Sim] window cannot be opened twice. If you attempt to open the window when it is already opened, the [ES-Sim] window moves to the foreground but a new window does not appear. 8-68 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 219: Menus

    Open an LCD file (.lcd) created in LCDUtil17. For information on LCDUtil17 and LCD files, see Section 10.8, "LCDUtil17 (LCD Panel Customizing Tool)." [Help] menu [About EssWnd] Shows ES-Sim Window version information. S5U1C17001C Manual Seiko Epson Corporation 8-69 (Rev. 1.0)
  • Page 220: Simulating I/O Ports

    The port data buttons and simultaneous input ports select check boxes for the ports that do not exist in the target model are not displayed.  Setting the port input status  Select either High or Low port data button. This determines the current port input level. P00 input = High P01 input = Low 8-70 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 221 To evaluate this function, use the same way as the simultaneous multiple key inputs described above.  Port input interrupts  Changing the input status by an operation in the port data control window can generate a port input interrupt. S5U1C17001C Manual Seiko Epson Corporation 8-71 (Rev. 1.0)
  • Page 222: Simulating Svd

    SVD detection result register.  SVD interrupt  If the target model supports the SVD interrupt, setting a voltage level lower than the SVD compare voltage in this window can generate an interrupt. 8-72 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 223: Simulating An Lcd Panel

    The ES-Sim17 generates a Windows standard bitmap file (.bmp).  Restrictions  • The dot size, contrast, and background color are different from those of the actual LCD panels. • The LCD display refresh times differ from actual LCD panels. S5U1C17001C Manual Seiko Epson Corporation 8-73 (Rev. 1.0)
  • Page 224: Es-Sim17 Error Massages

    • Some peripheral circuits, such as the oscillator and SVD circuits, need time until their operations stabilize. In the simulation by the ES-Sim17, they can operate with stability immediately after they start. * For the restrictions in the latest version of ES-Sim17 and model dependent restrictions, refer to "simulator_readme.txt". 8-74 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 225: Creating Data To Be Submitted

    S5U1C17001C Manual 9 Creating Data to Be Submitted...
  • Page 227: Outline Of Tools For Creating Data To Be Submitted

    9 Creating Data to Be Submitted If using the service to load user programs to the internal ROM or Flash of the CPU at the Seiko Epson factory, a PA file (Data to be submitted) must be created and submitted to Seiko Epson.
  • Page 228: Procedure For Creating Data To Be Submitted

    Enter the filename and path in the text box in the dialog box displayed, or click the [Ref] button to load S1C17xxx.ini for the target CPU. The S1C17xxx.ini corresponding to the specific model can be found in the folder below. User_folder\EPSON\GNU17V3\mcu_model If no corresponding S1C17xxx.ini exists for the target CPU, contact the Seiko Epson sales operations. Seiko Epson Corporation S5U1C17001C Manual...
  • Page 229 Click the [Generate] button in winfog17 or select [Generate] from the [Tool] menu. Once the file has been correctly generated, the message "Making file(s) is completed" is displayed in the message area. The FDC files are generated in the folder below. User_folder\EPSON\GNU17V3\dev S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 230 Enter the user's company name. The name can be up to 40 characters long, and any more than this will be ignored. The name may contain alphanumeric characters, symbols, and spaces. The details entered here are recorded in the "USER'S NAME" field of the FDC file. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 231: Creating Psa Files (Rom Data)

    In either case, winmdc17 creates a PA file in accordance with the target CPU settings when a project is built on the IDE. If using the service to load user programs to the internal ROM or Flash of the CPU at the Seiko Epson factory, the PA files generated should be submitted to Seiko Epson.
  • Page 232: Pa File (Data To Be Submitted) Separation Procedure

    ROM data Figure 9.2.4.1 Flowchart for PA file unpacking (1) Launch winmdc17.exe Double-click winmdc17.exe in User_folder\EPSON\GNU17V3\dev\Bin. If the model-specific information file (S1C17xxx.ini) was read in for the previous execution, the same file will be loaded automatically when winmdc17 is launched.
  • Page 233 CPU. The S1C17xxx.ini corresponding to the specific model can be found in the folder below. User_folder\EPSON\GNU17V3\mcu_model If no corresponding S1C17xxx.ini exists for the target CPU, contact the Seiko Epson sales operations. Figure 9.2.4.3 Load window for model-specific information definition file (3) Select input file Click the [Unpack] button in winmdc17.exe or select [Unpack] from the [Tool] menu.
  • Page 234 [Unpack message] area once unpacking has successfully been completed. With the default settings, the UFD and USA files will be generated in the following folder. User_folder\EPSON\GNU17V3\dev Click the [Cancel] button to close the dialog box. Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 235: Error Messages For Submitted Data Creation Tools

    Cannot write in file (xxxx) when executing Generate. Message Making file(s) is not completed Table 9.3.1.2 Warning messages Message Description Display Are you file update? Overwrite confirmation message Dialog xxxx is already exist (Specified file already exists.) S5U1C17001C Manual Seiko Epson Corporation (Rev. 1.0)
  • Page 236: Winmdc17 Error Messages

    Option data error : Mask data is not ROM data is insufficient. Message enough. Option data error : Illegal start mark. Start mark is incorrect. Message Option data error : Illegal end mark. End mark is incorrect. Message 9-10 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 237: Sample Output For Submitted Data Creation Tools

    * S1C17xxx_xxKB FUNCTION OPTION DOCUMENT Vx.xx Version ← * FILE NAME zzzzzzzz.FDC File name (specified in [Setup]) ← * USER'S NAME SEIKO EPSON CORPORATION User name (specified in [Setup]) ← * INPUT DATE yyyy/mm/dd Creation date (specified in [Setup]) ←...
  • Page 238 ← * S1C17xxx FUNCTION OPTION DOCUMENT V x.xx Model name/version ← * FILE NAME zzzzzzzz.FDC * USER'S NAME SEIKO EPSON CORPORATION * INPUT DATE yyyy/mm/dd * COMMENT SAMPLE DATA * "xxxxxxxx.fdc" * *** OPTION NO.1 *** * --- OSC1 SYSTEM CLOCK --- * Crystal(32.768KHz) ---- Selected...
  • Page 239: Other Tools

    S5U1C17001C Manual 10 Other Tools...
  • Page 241: Objdump.exe

    Explanation: Displays the relations between sources and addresses based on the debugging information. The data types of the global symbols are also displayed. Function: Display global symbol information Explanation: Displays a list of the global symbols including the local labels. S5U1C17001C Manual Seiko Epson Corporation 10-1 (Rev. 1.0)
  • Page 242: Error Message

    Explanation: Displays all the executable sections after disassembling the object code. The source code is also displayed with the corresponding disassembled code if possible. When entering an option, you need to place one or more spaces before and after the option. Example: c:\EPSON\GNU17V3\GCC4\objdump -S test.elf 10.1.4 Error Message The following shows the error message generated by objdump: Table 10.1.4.1 Error message...
  • Page 243: Objcopy.exe

    A file for writing to the ROM. When the system uses two or more ROMs, create a data file for each ROM by extracting the section data to write to the ROM from the elf object file. S5U1C17001C Manual Seiko Epson Corporation 10-3 (Rev.
  • Page 244: Method For Using Objcopy

    -V(or --version) Display version number Function: Explanation: Displays the version number of objcopy, and then terminates the process. --help Function: Usage display Explanation: Displays the usage of objcopy, and then terminates the process 10-4 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 245: Creating Sa Files (Rom Data)

    10.2.4 Creating SA Files (ROM Data) Open the command prompt window and execute objcopy at the command line as shown below. C:\EPSON\GNU17V3\gcc4\objcopy -I elf32-little -O srec -R SectionName --srec-forceS3 InputFile OutputFile Running the above command converts sections other than those specified with the -R option into S3 records and generates an output file.
  • Page 246: Ar.exe

    The ar can add files in this format into an archive or extract an object from an archive to generate a file in this format.  Archive file (library file)  File format: Archive file in binary format File name: <filename>.a Description: A library file that can be input to the linker ld. 10-6 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 247: Method For Using Ar

    Use this modifier with key 'r' to replace only the updated objects in the <objects> that are newer than those included in the archive. v Specifies verbose mode to display the executed processes. Do not enter a space between the keys and modifiers. S5U1C17001C Manual Seiko Epson Corporation 10-7 (Rev. 1.0)
  • Page 248 The archive is not modified. Removing an object ar ds mylib.a func5.o (mylib.a: func1.o + func2.o + func3.o + func4.o) func5.0 is removed from mylib.a. 10-8 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 249: Moto2Ff.exe

    The ROM area data generated by moto2ff should be processed with sconv32 and winmdc17 to generate the PA file (Data to be submitted) to be ultimately submitted to Seiko Epson. For more information on the PA file generation procedure, refer to Section 9.2, "Procedure for Creating Data to Be Submitted".
  • Page 250: Error/Warning Messages

    Finally, pack the verified PSA file and the FDC file (Function option document) generated by winfog17 into a single PA file using winmdc17 and submit this to Seiko Epson. 10-10...
  • Page 251: Sconv32.Exe

    The file should be processed with winmdc17 to generate the PA file (Data to be submitted) to be ultimately submitted to Seiko Epson after verifying program operation on the actual target board using the PSA file (ROM data). For more information on the PA file generation procedure, refer to Section 9.2, "Procedure for Creating Data to Be Submitted".
  • Page 252: Error Messages

    The input file has an unsupported record type. ADDRESS LENGTH RANGE OVER. The address range of the input file exceeds the address range for the S format to be converted. OTHER ERROR. Another error has occurred. 10-12 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 253: Gpdata.exe

    Select whether buzzer sounds when program ends Set model name (required) User program location address (required) Set serial number initial value Set serial number write start address Flash memory security password Specify parameter input file S5U1C17001C Manual Seiko Epson Corporation 10-13 (Rev. 1.0)
  • Page 254: Ptd.exe

    Explanation: Specifies the data to be written to the address in 16-bit units. If multiple data is specified, data is written to subsequent addresses. An error will occur if the address specified does not exist in the input file. 10-14 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 255: Error Messages

    Run ptd as follows at the command prompt. Example: C:\EPSON\GNU17V3\>ptd s1c17554.psa –e 0x27ffc=0xff80,0xffff This command rewrites the value at address 0x27ffc to 0xff80 and the value at address 0x27ffe to 0xffff inside s1c17554.psa and outputs to s1c17554_ptd.psa. The addresses for Flash Protection Bits in S1C17754 are 0x27ffc (write-protect) and 0x27ffe (data-read-protect).
  • Page 256: Lcdutil17 (Lcd Panel Customizing Tool)

     CPU configuration file (essim17.ini)  This file contains recorded information on the simulator model. Be sure to use the setting file provided by Seiko Epson. Modifying the contents of this file may prevent the LcdUtil17 and ES-Sim17 operating properly.
  • Page 257: Starting And Closing Lcdutil17

    Opening a bitmap file (.bmp) or LCD file (.lcd) will display the file in this window. This window is used to design an LCD panel layout and assign COM/SEG. Two or more windows can be opened at the same time, and icons and dot matrices can be dragged and dropped between two windows. S5U1C17001C Manual Seiko Epson Corporation 10-17 (Rev. 1.0)
  • Page 258: Menus And Toolbar

    Opens the dialog box used for selecting the paper size or printer to use. File list Displays up to eight previously opened files and enables access to those files. [Exit] Ends LcdUtil17. 10-18 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 259 Minimizes all open panel editing windows to icons at the bottom of the window. Window list Displays a list of names of all currently open panel editing windows. Select a panel editing window in the list to activate the selected panel editing window. S5U1C17001C Manual Seiko Epson Corporation 10-19 (Rev. 1.0)
  • Page 260 Commands that can be undone include Move, Cut, and Paste for icon/dot matrix, Change of SEG/COM, Group Icon, Release Group [Redo] button Reperforms the command most recently undone with Undo. [Print] button Prints the bitmap image in the active panel editing window. [About] button Displays LcdUtil17 version information. 10-20 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 261: Producing An Lcd File

    Enter the LCD panel size, then click the [OK] button. The default LCD size of a new panel editing window is 640 x 480 dots. Calculate the dot matrix size and set the LCD panel size. S5U1C17001C Manual Seiko Epson Corporation 10-21...
  • Page 262 IDE, an LCD driver is already set and this dialog box does not appear. Note: Once set, an LCD driver cannot be changed. Be extremely careful when setting the LCD driver. The [Dot matrix] dialog box appears. 10-22 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 263 Click the [Preview] button after making the settings above. A dot matrix will be displayed in the panel editing window for confirmation. Click the [OK] button to produce a dot matrix based on the settings entered. S5U1C17001C Manual Seiko Epson Corporation 10-23 (Rev.
  • Page 264 Double-click a dot matrix to display the [Dot matrix] dialog to change settings. Note: A dot matrix that is copied and pasted retains position and size information but discards port allocation information. Dot matrices without allocation information are indicated in black. 10-24 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 265 Drag with the mouse to move an icon. You can also move an icon from one panel editing window to another by dragging and dropping. Cut, Copy Select the command from the [Edit] menu or click the toolbar button. S5U1C17001C Manual Seiko Epson Corporation 10-25 (Rev. 1.0)
  • Page 266 [Start LcdUtility] button of the IDE is clicked while a project is selected by the IDE, an LCD driver is already set and this dialog box does not appear. Note: Once set, an LCD driver cannot be changed. Be extremely careful when setting the LCD driver. 10-26 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 267 A list appears and shows the icons in the currently active panel editing window. Click an icon in the list to display the corresponding icon in the panel editing window in blue. In this window, you can also change COM/SEG information for icons. S5U1C17001C Manual Seiko Epson Corporation 10-27...
  • Page 268: Shortcut Key List

    Icon List Ctrl + M Dot Matrix Ctrl + N Ctrl + O Open Save Ctrl + S Ctrl + P Print Ctrl + Z Undo Alt + BS Ctrl + Y Redo 10-28 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 269: Warning Messages And Error Messages

    This file was not saved. Cause: The icon or dot matrix extending from the LCD panel was not removed. Corrective action: Data cannot be saved if an icon or dot matrix extends from the LCD panel. S5U1C17001C Manual Seiko Epson Corporation 10-29 (Rev. 1.0)
  • Page 270 The vertical or horizontal size of the bitmap file is too large. Corrective action: Use a bitmap file with a horizontal size of no more than 1280 and a vertical size of no more than 1024. 10-30 Seiko Epson Corporation S5U1C17001C Manual (Rev. 1.0)
  • Page 271 S1C17 Family C Compiler Package Quick Reference...
  • Page 273 Memory Map and Trap Table (S1C17 Core) S1C17 Core Memory Map Trap Table Vector 0xff ffff address Reserved Core I/O area 0 (0x00) Reset TTBR + 0x00 1K bytes 0xff fc00 1 (0x01) Address misaligned interrupt TTBR + 0x04 0xff fbff CMOS 16-bit Single Chip Microcomputer 2 (0x02) TTBR + 0x08...
  • Page 274 5-3) Pack the PSA and FDC files into a single PA file using PSA file Board (ROM data) File.psa File.fdc winmdc17. 5-4) Submit the created PA file to Seiko Epson. Data checker winmdc17 PA file File.PA (Data to be submitted) SEIKO EPSON...
  • Page 275 C Compiler xgcc Development Tools Outline Start-up Command xgcc <options> <filename> 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 <filename>...
  • Page 276 Assembler as (1) Development Tools Outline Start-up Command as <options> <filename> 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. The as.exe allows the user <filename>...
  • Page 277 Assembler as (2) Development Tools Error/Warning messages Error messages Error: Unrecognized opcode: 'XXXXX' The operation code XXXXX is undefined. Error: junk at end of line: 'XXXXX' A format error of the operand. Error: XXXXXX: invalid register name The specified register cannot be used. Warning messages Warning: Unrecognized .section attribute: want a, w, x The section attribute is not a, w or x.
  • Page 278 Linker ld (1) Development Tools Outline Start-up Command ld <options> <filename> 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 <filename>...
  • Page 279 Linker ld (2) Development Tools Default linker script file generated by the IDE .text : OUTPUT_FORMAT("elf32-c17") OUTPUT_ARCH(c17) PROVIDE (__START_text = .) ; ENTRY(_start) *(.text.*) SEARCH_DIR(.); *(.text) MEMORY PROVIDE (__END_text = .) ; } > irom iram : ORIGIN = 0, LENGTH = 32K .data : irom...
  • Page 280 Specify the command file using start-up options when executing from within the IDE. Example: gdb –x gdbmini3.ini Flowchart Command file from Linker Example: c17 model_path c:/EPSON/GNU17V3/mcu_model Specifies the model information file directory. c17 model 17W23@NOVCCIN Specifies the model name. source file Executable (Voltage level 3.3 V)
  • Page 281 Debugger gdb (2) Development Tools Debug Commands Memory operation Interrupt c17 fb addr1 addr2 data Fill memory area (8 bits) ICD Mini/SIM c17 int [intNo. level] Generate interrupt c17 fh addr1 addr2 data Fill memory area (16 bits) ICD Mini/SIM c17 intclear [intNo.] Clear interrupt c17 fw addr1 addr2 data...
  • Page 282 Debugger gdb (3) Development Tools Debug Commands Status and Error Messages Others Status messages set output-rad x Change variable display format ICD Mini/SIM Breakpoint #, function at file:line Made to break at a set breakpoint set logging on/off Log output setting ICD Mini/SIM Illegal instruction.
  • Page 283 Emulation Library libgcc.a (libgccM.a/libgccMD.a/libgccMD2.a) (1) Library Floating-point Calculation Functions Floating-point Data Format Double-type operation Double-type data format 52 51 adddf3 x ← a + b Addition Exponent part Fixed-point part subdf3 x ← a - b Subtraction muldf3 x ← a * b Multiplication Double-type effective range divdf3...
  • Page 284 Emulation Library libgcc.a (libgccM.a/libgccMD.a/libgccMD2.a) (2) Library Integral Calculation Functions long long Type Calculation Functions Integral calculation long long type calculation divsi3 x ← a / b muldi3 x ← a * b Signed 32-bit integral division Signed 64-bit multiplication modsi3 x ←...
  • Page 285 ANSI Library libc.a (1) Library Input/Output Functions Utility Functions (header file: stdio.h) (header file: stdlib.h) fread( ) size_t fread(void *ptr, size_t size, size_t count, FILE *stream); *1, *2 malloc( ) void *malloc(size_t size); fwrite( ) size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream); *1, *2 calloc( ) void *calloc(size_t elt_count, size_t elt_size);...
  • Page 286 ANSI Library libc.a (2) Library Mathematical Functions Character Functions (header file: math.h, errno.h, float.h, limits.h) (header file: string.h) fabs( ) double fabs(double x); memchr( ) void *memchr(const void *s, int c, size_t n); ceil( ) double ceil(double x); memcmp( ) int memcmp(const void *s1, const void *s2, size_t n);...
  • Page 287 Instruction List (1) Assembly Programming Symbols in the Instruction List Registers/Register Data Bit Field %rd, rd: A general-purpose register (R0–R7) used as the destination register or its contents (X): Bit X of data. %rs, rs: A general-purpose register (R0–R7) used as the source register or its contents (X:Y): A bit field from bit X to bit Y.
  • Page 288 Instruction List (2) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE Signed 8-bit data ld.b %rd, %rs rd(7:0)←rs(7:0), rd(15:8)←rs(7), rd(23:16)←0 – – – – – – ◯ transfer %rd, [%rb] rd(7:0)←B[rb], rd(15:8)←B[rb](7), rd(23:16)←0 – – – – – –...
  • Page 289 Instruction List (3) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE 16-bit data transfer %rd, %rs rd(15:0)←rs(15:0), rd(23:16)←0 – – – – – – ◯ %rd, sign7 rd(6:0)←sign7(6:0), rd(15:7)←sign7(6), rd(23:16)←0 – – – – – – ◯ %rd, [%rb] rd(15:0)←W[rb], rd(23:16)←0 –...
  • Page 290 Instruction List (4) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE ld.a [%rb], %rs A[rb](23:0)←rs(23:0), A[rb](31:24)←0 – – – – – – 32-bit data transfer ○ [%rb]+, %rs A[rb](23:0)←rs(23:0), A[rb](31:24)←0, rb(23:0)←rb(23:0)+4 – – – – – – ○ [%rb]-, %rs A[rb](23:0)←rs(23:0), A[rb](31:24)←0, rb(23:0)←rb(23:0)-4 –...
  • Page 291 Instruction List (5) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE ↔ ↔ ↔ ↔ Arithmetic operation %rd, %rs rd(15:0)←rd(15:0)+rs(15:0), rd(23:16)←0 – – ○ ↔ ↔ ↔ add/c %rd, %rs rd(15:0)←rd(15:0)+rs(15:0), rd(23:16)←0 if C = 1 (nop if C = 0) –...
  • Page 292 Instruction List (6) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE Arithmetic operation ssub.a %rd, imm20 rd(23:0)←rd(23:0)-imm20 (with zero extension) – – – – – – – %sp, imm20 sp(23:0)←sp(23:0)-imm20 (with zero extension) – – – – – –...
  • Page 293 Instruction List (7) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE ↔ ↔ Logic operation %rd, %rs d(15:0)←rd(15:0) | rs(15:0), rd(23:16)←0 – – – ○ ↔ ↔ or/c %rd, %rs rd(15:0)←rd(15:0) | rs(15:0), rd(23:16)←0 if C = 1 (nop if C = 0) –...
  • Page 294 Instruction List (8) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE Branch jrge / jrge.d sign7 pc←pc+2+sign8 if !(N^V) is true; sign8={sign7,0} – – – – – – – sjrge / sjrge.d label±imm20 pc←label±imm20 if !(N^V) is true –...
  • Page 295 Instruction List (9) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE jreq / jreq.d sign7 Branch pc←pc+2+sign8 if Z is true; sign8={sign7,0} – – – – – – – sjreq / sjreq.d label±imm20 pc←label±imm20 if Z is true –...
  • Page 296 Instruction List (10) Assembly Programming Mnemonic Flags Classification Function Opcode Operand IL IE Conversion cv.ab %rd, %rs rd(23:8)←rs(7), rd(7:0)←rs(7:0) – – – – – – ○ cv.as %rd, %rs rd(23:16)←rs(15), rd(15:0)←rs(15:0) – – – – – – ○ cv.al %rd, %rs rd(23:16)←rs(7:0), rd(15:0)←rd(15:0) –...
  • Page 297 Expansion Format of Extended Instructions (1) Assembly Programming Expansion format Extended instruction Opcode Operand Condition 1 Condition 2 Condition 3 sld.b %rd, [%sp+imm20] imm20≤0x7f 0x7f<imm20 — sld.ub ld.b %rd, [%sp+imm20(6:0)] imm20(19:7) ld.b %rd, [%sp+imm20(6:0)] sld.a Example) sld.b %rd, [%sp+imm20] %rd, [imm20] imm20≤0x7f 0x7f<imm20 —...
  • Page 298 Expansion Format of Extended Instructions (2) Assembly Programming Extended instruction Expansion format Opcode Operand Condition 1 Condition 2 Condition 3 — — sld.a %rd, symbol±imm20 Unconditional (symbol+imm20)(19:7) ld.a %rd, (symbol+imm20)(6:0) Example) sld.a %rd, symbol+imm20 %sp, symbol±imm20 Unconditional — — (symbol-imm20)(19:7) ld.a %sp, (symbol-imm20)(6:0) Example) sld.a %sp, symbol-imm20...
  • Page 299 Expansion Format of Extended Instructions (3) Assembly Programming Extended instruction Expansion format Opcode Operand Condition 1 Condition 2 Condition 3 xld.a %rd, imm24 imm24≤0x7f 0x7f<imm24≤0xfffff 0xfffff<imm24 ld.a %rd, imm24(6:0) imm24(19:7) imm24(23:20) ld.a %rd, imm24(6:0) imm24(19:7) Example) xld.a %rd, imm24 ld.a %rd, imm24(6:0) %sp, imm24 imm24≤0x7f...
  • Page 300 Expansion Format of Extended Instructions (4) Assembly Programming Extended instruction Expansion format Opcode Operand Condition 1 Condition 2 Condition 3 xadd.a %rd, imm24 imm24≤0x7f 0x7f<imm24≤0xfffff 0xfffff<imm24 xsub.a sub.a %rd, imm24(6:0) imm24(19:7) imm24(23:20) sub.a %rd, imm24(6:0) imm24(19:7) Example) xsub.a %rd, imm24 sub.a %rd, imm24(6:0) %sp, imm24 imm24≤0x7f...
  • Page 301 Expansion Format of Extended Instructions (5) Assembly Programming Extended instruction Expansion format Opcode Operand Condition 1 Condition 2 Condition 3 scall label±imm20 Unconditional — — scall.d (label+imm20)(19:12) sjpr call (label+imm20)(11:1) sjpr.d Example) scall label+imm20 sign20 -1024≤sign20≤1023 sign20<-1024 or 1023<sign20 — sign20(11:1) sign20(19:12) sign20(11:1)
  • Page 302 Expansion Format of Extended Instructions (6) Assembly Programming Extended instruction Expansion format Opcode Operand Condition 1 Condition 2 Condition 3 xjr*1 label±imm24 Unconditional — — xjr*1.d (label+imm24)(23:21) (label+imm24)(20:8) Example) xjreq label+imm24 jreq (label+imm24)(7:1) sign24 -128≤sign24≤127 -1048576≤sign24<-128 or 127<sign24≤1048575 sign24<-1048576 or 1048575<sign24 jrne sign24(7:1) sign24(20:8)
  • Page 303 EPSON HONG KONG LTD. Unit 715-723, 7/F Trade Square, 681 Cheung Sha Wan Road, Kowloon, Hong Kong. Phone: +852-2585-4600 FAX: +852-2827-4346 EPSON TAIWAN TECHNOLOGY & TRADING LTD. 14F, No. 7, Song Ren Road, Taipei 110, TAIWAN Phone: +886-2-8786-6688 FAX: +886-2-8786-6660 EPSON SINGAPORE PTE., LTD.

Table of Contents