FAQ

Assembler

Compiler (GCC)

Integrated development environment (GNU17 IDE)

Linker

Debugger (GDB)

Sample program

Other tools

Multi Programmer

Gang Programmer


Assembler

  • as-01Set the interrupt level at software interrupts
Target Version Ver.3.x.x
Question Is there a way to set the interrupt level when using software interrupts (int instruction)?
Answer Use C17 assembly instruction 'intl' (interrupt with level).
intl imm5, imm3 Specify vector number as imm5, and interrupt level as imm3.
ex) intl 0x3, 0x2
This will invoke maskable software interrupt 0x3 and set IL to 0x2.
For more information, please refer to S1C17 Family Core Manual "7. Details of Instructions".
  • as-02Handling of comment in assembler source code
Target Version Ver3.x.x
Question The error occurs when "/*" is used on a comment line (with ";") in assembler source code.
Answer In assembler source code, "/*" is higher priority comment than ";".
"*/" is required with "/*" as a set.
  • as-03Interrupt setting by using assembler language
Target Version Ver3.x.x
Question I want to make a code of interrupt setting by using assembler language.
Answer Please refer S1C17Family startup Manual (Assembler version) on Epson web site, and sample program (C:\EPSON\GNU17V3\sample) in GNU17v3.

Compiler (GCC)

  • gcc-01Reduce the code size
Target Version Ver.3.x.x
Question How can I reduce the code size as much as possible?
Answer Use single arrays as much as possible instead of multi dimensional arrays, because accessing multi dimensional arrays decreases code efficiency.

In addition, it is better to use pointers in case of passing structures to functions, or returning structures from functions,
In case no to use pointer, the process to copy the whole structure is needed and the code size increases.

  • gcc-02Access way to PSR
Target Version Ver.3.x.x
Question How can PSR is read to know the current interrupt state?
Can PSR is modified directly?
Answer S1C17 does not have PSR accessing instructions.

To refer and modify PSR value,
PSR value is referred and modified after it is stored to stack memory by using int instruction, and then it is returned by using reti instruction.

Some models have implemented PSR accessing instructions.
Please refer to each technical manuals.

Example: PSR example PDF

  • gcc-03Error by using "-S" at compiler startup option
Target Version Ver.3.x.x
Question syntax error occurs when command-line option "-S" is used for compiler.
Answer

Even though syntax error occurs, assembly source file ".o" is output.
When this "-S" option is used, the object file cannot be generated due to GNU17 specification. Then, compile is failed at linker path.
In GNU17, it is general method to refer assembly result by objdump command with ".elf" file, instead of using command-line option "-S".

  • gcc-04How to support Shift-JIS
Target Version Ver.3.x.x
Question How do I use Shift-JIS on GNU17 ?
Answer

Basic character code on GCC is UTF-8. Please follow this process to support Shift-JIS.

Add -finput-charset=CP932 on the target project [Properties] dialog > C/C++ Build>Settings > [Tool Settings] > [Cross GCC Compiler] > [Dialect] > [Other dialect flags]
“-finput-charset” is an option to specify character code, Shift-JIS is CP932.

  • gcc-05How to locate constant data on ROM area
Target Version Ver.3.x.x
Question I would like to locate constant data to specific address on C source code.
Answer

As example, data 0x00-0x0F will be located to the address 0xB000-0xB00F by writing source code and linker script as follows.

[Source code]
const unsigned char __attribute__ ((section (".updatable"))) checkerLineBit[16] = {
0x00, 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F
};

[Linker Script]
.updatable (0xB000) :
{
*(.updatable);
. = ALIGN(0x800);
} > irom = 0xffff

  • gcc-06Changing C compiler optimization options
Target Version Ver.3.x.x
Question How do I change C compiler optimization options ?
Answer

Please refer to the following document.
PDF

  • gcc-07How to check program size
Target Version Ver.3.x.x
Question I want to know program size.
Answer

Please refer to the following document.
PDF

  • gcc-08How to check the size of stack
Target Version Ver.3.x.x
Question How many stack size is used ?
Answer

Please refer to the following document.
PDF

  • gcc-09Location address of program, data and variables
Target Version Ver.3.x.x
Question How do I get the location address of program data and variables ?
Answer

Please refer to the following document.
PDF

  • gcc-10The purpose of generated file by build
Target Version Ver.3.x.x
Question Which files are generated by build ? What is the purpose for each files ?
Answer

Please refer to the following document.
PDF

  • gcc-11How to define the interrupt vector
Target Version Ver.3.x.x
Question I don't know how to define interrupt routines and interrupt vectors.
Answer

The "crt0.c" file that is included in GNU17 Ver.3.x.x defines the vector table,and the basic sample software provides the following macros, so you can easily use them.
You can redefine the vector table. The "crt0.c" file is made into an object file by default, but the source code is stored in "\EPSON\GNU17V3\utility\lib_src\crt0".

1)Vector definition(crt0.c)
void _vector25_handler(void) __attribute__((weak, alias("_crt0_vector_handler")));
* From "_vector01_handler" to "_vector3x_handler", they are defined as well.

2)Macro definition(crt0.h)
#define C17_INTERRUPT_HANDLER(vh, ih)
void ih(void) __attribute__ ((interrupt_handler));
void vh(void) __attribute__ ((unused,alias(#ih)))

3)Macro usage example (user description content)
C17_INTERRUPT_HANDLER(_vector25_handler, c17intAd12);
(Refer to the S5U1C17001C manual page 3-5, 5-3)

  • gcc-12Startup routine
Target Version Ver.3.x.x
Question How to replace the startup routine.
Answer

Please refer to the following documents.
PDF

  • gcc-13Exclusion of unused functions
Target Version Ver.3.x.x
Question How to build by excluding unused functions.
Answer

Please refer to the following documents.
PDF

  • gcc-14How to specify the address directly
Target Version Ver.3.x.x
Question I want to specify the address directly from C language and read or write the data.
Answer

By describing as follows, it is possible to read the value from the specified address to "value" or write the value of "value" to the specified address.
1) When the address is peripheral circuit register 0x4000 (2 byte)
unsigned int value;
value = *(volatile unsigned int *)(0x4000); // read from the address 0x4000
*(volatile unsigned int *)(0x4000) = value; // write to the address 0x4000

2) When the address is RAM 0x0200 (1 byte)
unsigned char value;
value = *(volatile unsigned char *)(0x0200); // read from the address 0x0200
*(volatile unsigned char *)(0x0200) = value; // write to the address 0x0200

Integrated development environment (GNU17 IDE)

  • ide-01Source file which should be controlled in project on IDE
Target Version Ver.3.x.x
Ver.2.x.x
Question I would like to control the project which is made by IDE in a source file version management software.Which file should be control?
Answer The files which need to be controlled are;
  • source file
  • header file
  • "File management required" files generated in a project by the IDE. Please refer the attached table.
    For GNU17v3: PDF
    For GNU17v2: PDF
  • ide-02The meaning of "S1C17" in target CPU of GNU17 General
Target Version Ver.3.x.x
Question In Project Properties - GNU17 General - Target CPU Device, there is a "S1C17" in the CPU name selection.
What purpose is this?
Answer S1C17 is prepared to simulate CPU core in the generic settings independent of the model of target CPU.
The memory maps are not configured.
The default boot address is set to 0x8000, which can be modified.
  • ide-03Eclipse Plug-in install
Target Version Ver.3.x.x
Question Eclipse plug-in is not listed up when I try to install it.
Answer When plug-in is installed by Help>Install New Software on GNU17, it takes 3 to 4 minutes till plug-in is listed after requirement is filled. It is also announced on Eclipse official size.
  • ide-04Unexpected Build error
Target Version Ver.3.x.x
Question The following error occurs at Build.
"Couldn't reserve space for cygwin's heap, Win32 error 0."
Answer It is an issue of library (msys-1.0.dll) in order to use GCC of GNU17 on Windows application.
It may be solved by OS reboot depending on user environment.
Or it will be solved by rebase in general. GNU17v3 prepares rebased msys-1.0.dll on "C:\EPSON\GNU17V3\utility\msys".
Please overwrite with this file at GNU17v3 folder (For GCC4, "C:\EPSON\GNU17V3\gcc4")
When the issue is not solved yet, please try followings.
- Reboot OS, and run GNU17v3 first (as much as possible)
- In case that msys-1.0.dll is already installed by another tool, overwrite with this file at GNU17v3 folder.
  • ide-05Using "dot" into project name
Target Version Ver.3.x.x
Question Build error occurs when project is named like "String1.String2" (using "." into project name)
Answer Only single-byte alphanumeric characters and underscores may be used for project name.
  • ide-06Mixed .c and .C in project
Target Version Ver.3.x.x
Question Is it possible to have both .c and .C in project ?
Answer No, it is impossible due to Eclipse CDT specification. Please use either .c or .C.
  • ide-07Shortcut key
Target Version Ver.3.x.x
Question What are the convenient shortcut key ?
Answer
Function Shortcut key
Uncomment Ctrl+/
Find and Replace in a file Ctrl+F
Find and Replace in other files Ctrl+H
Jump to a line Ctrl+L
Set break point Ctrl+Shift+B
Format Ctrl+Shift+F
Step Into F5(debugger)
Step Over F6(debugger)
Step Return F7(debugger)
Resume F8(debugger)

Note)These are just for your reference.

  • ide-08About error display
Target Version Ver.3.x.x
Question As a result of building the project file, the generated object code does not fit in the memory size of the target MCU, but it is not displayed as an error in the Problem window.
Answer Please refer to the following documents.
PDF
  • ide-09About download plugins
Target Version Ver.3.x.x
Question I want to change the notation to something other than English, but I don't know the URL of the latest plug-in.
Answer The URL of the latest plug-in as of August 2020 is as follows.
URL: https://archive.eclipse.org/technology/babel/babel_language_packs/R0.18.0/2020-06/2020-06.php
For example, in the case of Japanese, it will be the following file.
BabelLanguagePack-eclipse-ja_4.16.0.v20200711020001.zip
BabelLanguagePack-tools.cdt-ja_4.16.0.v20200711020001.zip
  • ide-10Abnormalities in the debugger startup screen
Target Version Ver.3.x.x
Question The debugger no longer starts. Also, the screen when starting the debugger has been changed.
Answer Please refer to the following documents.
PDF

Linker (LNK)

  • lnk-01Description of stack pointer in map file
Target Version Ver.3.x.x
Question The stack pointer start ("__START_stack") 0x7c0 in map file is different with actual setting.
Answer

The default of stack pointer is set to 0x7c0 in linker script. In map file, it is always set to 0x7c0 without specifying linker script file.
Even if it has a different value, there is no impact to actual operation.

  • lnk-02How to put the program in RAM
Target Version Ver.3.x.x
Question I want to put the object data of the program in the RAM area of the target MCU and execute it.
Answer

Please refer to the following documents.
PDF

  • lnk-03Variable addressing
Target Version Ver.3.x.x
Question I want to place a variable at a specific address.
Answer

Please refer to the following documents.
PDF


Debugger (GDB)

  • gdb-01Can not start the functions when step is executed.
Target Version Ver.3.x.x
Question When "step" is executed in the source window, functions sometimes does not start.
Answer It is because of the optimization of code by compiler.
The program location changes as the program language changes from C to assembler due to optimization of code by compiler. Then, it looks like that the program is not existing.

In this case, it can be avoided by setting the optimization off.
Refer the S5U1C17001C manual "C compiler" about setting of optimization.

  • gdb-02How to monitor the registers of peripheral circuit
Target Version Ver.3.x.x
Question How do I monitor the register values of peripheral circuit ?
Answer It is possible to use Expressions view.
As example of "MSCPROT" as register name, it may be described {MSCPROT_REG}0x4000 on expressions view.
  • gdb-03[resume] button is not available
Target Version Ver.3.x.x
Question There is no error and warning at Build. However, [resume] button is not available on debugger by selecting [run] > [Debug Configurations].
Answer There is a "Stop on startup" item on [run] > [Debug configuration] > [Debugger] tab in pull-down menu.
The check box may not be selected, or it may not be "main".
  • gdb-04Debugger cannot be controlled
Target Version Ver.3.x.x
Question Debugger is malfunctioned by run / single-stepping. Then it is uncontrollable.
Answer Please check following points.
・Is the stack pointer setting correctly ?
・Don't you set debug pins as GPIO ?
・Last 64byte on RAM is used by debugger. Is this area used ?
・Is there an interrupt by watchdog timer during program is running ?
Is the register bit (DBRUN) set to "1" which supplies clock to watchdog timer.
・If you use own startup routine, is there any issue on it ?
・Is there any possibility to access S1C17 core reserved I/O area (0xfffc00 - 0xffffff)
  • gdb-05Debugger Startup Options
Target Version Ver.3.x.x
Question Please explain the meaning of command option of gdbmini*/ini as debugger startup options.
Answer Please refer to the following document.
PDF
  • gdb-06Debugger quick reference guide
Target Version Ver.3.x.x
Question Do you have quick reference guide for debugger ?
Answer Please refer to the following document.
PDF
  • gdb-07How to show a view which is undisplayed
Target Version Ver.3.x.x
Question How do I show a view which is undisplayed ?
Answer Please refer to the following document.
PDF
  • gdb-08Useful function for showing register values (How to use EmbSys registers)
Target Version Ver.3.x.x
Question Is there any way to refer registers of peripherals as symbolic ?
Answer Please refer to the following document.
PDF
  • gdb-09Measurement of program execution time
Target Version Ver.3.x.x
Question How do I know the program execution time ?
Answer Please refer to the following document.
PDF
  • gdb-10Notes of showing memory or register value
Target Version Ver.3.x.x
Question Are there any notes of showing memory or register value ?
Answer Please refer to the following document.
PDF
  • gdb-11Debugger suddenly stopped operation
Target Version Ver.3.x.x
Question Debugger suddenly stopped operation.
Answer Please refer to the following document.
PDF
  • gdb-12Note of console view
Target Version Ver.3.x.x
Question It looks console view shows unexpected information.
Answer Please refer to the following document.
PDF
  • gdb-13I want to start only the debugger
Target Version Ver.3.x.x
Question When starting the debugger, I don't want to rewrite the program / data to the flash memory of the target MCU.
Answer This can be achieved by rewriting the following "gdbmini3.ini" file in the project file.
See gdb-05. For example, if you do not supply power from the outside and do not execute initial read, write, or erase, describe as follows.
c17 model 17***@NOVCCIN,NOREAD,NOWRITE,NOERASE
  • gdb-14Reduced debugger startup time
Target Version Ver.3.x.x
Question Debugger startup time is slow.
Answer The download time can be shortened by rewriting the following "gdbmini3.ini" file in the project file. See gdb-05. If you write "NOREAD", it will not be read in advance, so you can write at high speed.
  • gdb-15An error occurs when starting the debugger
Target Version Ver.3.x.x
Question After setting 4 breakpoints, quit the debugger and then restart the debugger. An error occurs when starting.
Answer

The debug circuit built into the S1C17Family can set up to 4 hard breakpoints. However, in this debugger, the point that should be stopped immediately after startup (the beginning of the main function) is also set as a hard breakpoint, so the number of hard breakpoints that can be set in advance at the time of initial startup is 3 points or less.

  • gdb-16Variable watch
Target Version Ver.3.x.x
Question I want to refer to variable values while running software.
Answer It doesn't have the ability to reference variables in real time, By following the steps below, you can refer to the variable value while running the user software.
< Procedure>
1) Add the following to the end of the GDB command file "gdbmini3.ini" that is executed when the debugger is started.
c17 stdout 1 WRITE_FLASH WRITE_BUF
c17 stdin 1 READ_FLASH READ_BUF

2) Output the variable you want to monitor on the source code
For example, use functions such as "puts ()" and "putchar ()" to display variable values on the screen. There is sample software below, so it will be easier to understand

C:\EPSON\GNU17V3\sample\sample_gcc6

  • gdb-17Error occurred when rewriting non-volatile memory
Target Version Ver.3.x.x
Question When writing the flash memory built into the MCU using ICDmini, a write error occurs when the boost mode in which the write power supply is generated internal the MCU is used.
Alternatively, the software of the MCU tries to rewrite the EEPROM built in this MCU. Then, a rewrite error occurs.
Answer

Please refer to the following document.
PDF

  • gdb-18Display local variables
Target Version Ver.3.x.x
Question Local variables do not appear in the Variables view.
Answer

The optimization option is -O1 by default, so the local variables you want to display may be optimized. It can be displayed by adding a volatile declaration to the variable to prevent optimization.

Sample program(sp)

  • spl-01About clearing the interrupt factor flag
Target Version -
Question When a specific interrupt flag is cleared by bit operation, another interrupt flag in the same register is also cleared.
Answer

When manipulating bits in C language, it is actually OR operation. That is, the target register information is read in byte units, specific bits are changed, and the target register information is written back in byte units. At this time, if another interrupt flag in a specific bit is 1, 1 is written back, and as a result, the flag is cleared. In such a case, it can be solved by performing a byte operation and specifying the value.

Other tools(oth)

  • oth-01ICDminiV1/2 Flash writer mode on GNU17Ver3
Target Version Ver.3.x.x
Question I want to use S5U1C17001H1/2 (ICDminiV1/2) Flash write mode on GNU17Ver3.
Answer

S5U1C17001H1/2(ICDminiV1/2) Flash writer mode is not supported on GNU17Ver3.
Please contact an Epson sales representative how to correspond it.

  • oth-02Disassemble psa file
Target Version Ver.3.x.x
Question Is there any way to convert assembler instruction by disassemble psa(motorola S-format) file ?
Answer

It is possible by using objdump command on GNU17.
Please start with following command.

 objdump -D -m c17 --stop-address=end-address XXXX.psa > XXXX.s

Note) Please be careful that this also converts the data which is defined with const, interrupt vector to instruction code.

  • oth-03Manage data written to flash memory using checksum
Target Version Ver.3.x.x
Question Write data to the flash memory built into the target MCU by in-house. I want to manage using a checksum to prevent data mistakes.
Answer

Please refer to the following document.
PDF

  • oth-04About the computer protection function by the OS
Target Version Ver.3.x.x
Question

In Windows10, the following screen is displayed when downloading the package from the MCU user site.
PC

Answer

There is no problem running it.

Multi Programmer(mpg)

  • mpg-01Verify error
Target Version Ver.4.0.0
Question Verify error occurs at production with Multi Programmer.
Answer

Please check the length of wiring between ICDmini and target system. The writing data may be affected by noise with longer wiring.

  • mpg-02How to use MultiProgrammer.dll
Target Version Ver.4.0.0
Question It is difficult to understand the usage of MultiProgrammer.dll..
Answer

Sample software to use MultiProgrammer.dll is prepared. Please contact an Epson sales representative in your region.

  • mpg-03Used with power supplies other than 3.3V
Target Version Ver.4.0.0
Question It is necessary to switch the corresponding voltage of ICDmini according to the power supply voltage of the target connected to ICDmini.In the case of ICDminiVer.2, 3.3V / 1.8V and external power supply could be selected with the DIP switch, but in ICDminiVer.3, there is no DIP switch for switching the voltage. How should I set it?
Answer

When using ICDmini Ver.3, first use the external power supply supplied to the TARGET_VCC_IN terminal. Try to connect to the target, and if this connection fails, switch to the internal power supply (3.3V) and try to reconnect. So you don't have to worry about it. Multi-programmers also use model-specific information files. Please check our website to make sure that this file is always up to date.

  • mpg-04LCD display on the main screen
Target Version Ver.4.0.0
Question If the ICDmini is disconnected from the target board before the execution result is displayed (before the execution is completed), the LCD display on the main screen will advance and no error will occur.
Answer

For models with a small target Flash memory, execution is complete before disconnecting the ICDmini from the target board.

The timing may be different from what you think because it is visually displayed on the main screen for users to see.

Gang Programmer(gpg)

  • gpg-01The meaning of contents in log file (gplog.txt)
Target Version Ver.2
Question What is the meaning of contents in log file (gplog.txt) ?
Answer

Please refer the gang programmer User Manual.
When you contact an Epson sales representative, please share following information in order to solve issues.
・The photo of LCD panel (display) at the timing of problem.
・gplog.txt file