E HEWrn 96
E HEWrn 96
E HEWrn 96
Version 1.0
Release Note
HS6400EWIW1SE-RN990615
Rev. 1.0
June 15, 1999
Hitachi Company or Division
The time kept by a computer differs between computers. The time when a source file or an
output file is updated differs depending on a computer. It may happen that building a
project can be incorrect because of difference of times kept by computers if a source file or
a output file is shared via network. If such problem occurs, build a project using [Build->
Build All].
When you build a project on the network an error might occur depending on the conditioin
of the network. For example, a C/C++ compiler might output the following error message
When you add a file on a remote drive on the network via [Project-> Add Files…] or else,
the HEW might cause an application error depending on the condition of the network. In
this case, try to add the file to the project again. If application errors occur many times,
consider copying the file to a local drive then adding to the project.
With the syntax coloring capability of the HEW, comments and keywords in a source
program file are colored. But the syntax coloring of the HEW editor does not work
correctly depending on the way the source code is written. Disable the syntax coloring if
you are not satisfied with the syntax coloring. To disable it, select [Tools->Options…],
uncheck “Enable Syntax Coloring” on the “Editor” tab of the “Tools Options” dialog box,
and click the OK button.
Try to avoid using the * characters and the / characters placed adjacent to each other in a
C/C++ source file unless you specify a comment.
The HEW scans an include file of a C/C++ source file to show dependencies of source files
on the “Projects” tab of the “Workspace” window and to decide whether to build a file or
not. Even though the source code is syntactically correct, it may happen that a scan error
is detected; that an include file which is not actually included might be shown as a
dependent file; or that an include file which is included might not be shown as a dependent
file. In these cases, (a) build all files by selecting [Build->Build All] or (b) select the source
file in the “Projects” tab of the “Workspace” window and select [Build->Build File].
#define DEF 1
#ifdef DEF
void func(void)
{
}
#else
int func(int a)
{
}
cpp is a standard extension for the C++ source file group in the HEW while cpp, cp, and
cc are standard extensions for C++ source file in the C/C++ compiler of the Hitachi
toolchain. If you add cp or cc as a file extension to a file group, the file group must be the
C++ source file group. If cp or cc were added to the C source file group, a file with a file
extension of cp or cc would be compiled as a C++ source file instead of as a C source file. If
you specify the “–lang=c” option in the “User defined options” field of the “Other” tab of
an option dialog box of the C/C++ compiler, a file will be compiled as a C source file
regardless of its file extension.
If you add an extension other than cpp, cp, or cc to the C++ source file group, the HEW
regards a file with such an extension as C source file. For example, if cxx were added to the
C++ source file group, a file with the extension would be compiled as a C source file. If you
specify the “–lang=cpp” option in the “User defined options” field of the “Other” tab of an
option dialog box of a C/C++ compiler, a file will be compiled as a C++ source file
regardless of its file extension.
1.11 Note on the Format tab of the Tools Options dialog box
This is a note on the “Define Keywords” dialog box, which is launched when the “Add…”
button or the “Keywords…” button is clicked on the “Format” tab of the “Tools Options”
dialog box launched via [Tools->Options…]. On the “Keyword” field of the “Add
Keyword” dialog box launched by clicking the “Add…” button on the “Define Keywords”
1.12 Supplement to the Build tab of the Tools Options dialog box
This is a note on the “Stop build if no. of errors exceed” controls on the “Build” tab of the
“Tools Options” dialog box launched via [Tools-> Options…]. Note the following
descriptions when you check the check box and specify a number to the controls.
(1) “Stop build if no. of errors exceed” is not applied to a custom phase defined by a user.
This is applied only to system phases such as the C/C++ Compiler, the Assembler, the
IM OptLinker and the Stype Converter supplied from Hitachi.
(2) “no. of errors” in the statement means the number of errors output from an execution
of a tool. The total number of errors in more than one execution of a tool is irrelevant
to “Stop build if no. of errors exceed”. For example, the build stops when one execution
of the C/C++ Compiler outputs more than the number specified. If the number of
errors output from each compilation is no more than the specified number, the build
does not stop even though the total number of errors in more than one compilation
exceeds the specified number.
(3) The build stops after the whole phase is done. For example, suppose you compile more
than one file in a build. Even though the number of errors in the first compilation
exceeds the specified number, the HEW continues compilation of the other files and
stops the build after finishing the whole compiler phase.
(4) When the number of errors in one execution of a tool exceeds the specified number, the
number of error messages displayed on the “Output” window is the specified number
plus one. A message saying that the number of error has exceeded the specified
number is NOT displayed on the “Output” window.
The same things as “Stop build if no. of errors exceed” shown above hold also in “Stop
build if no. of warnings exceed”. There is no correlation between “Stop build if no. of
errors exceed” and “Stop build if no. of warnings exceed”. They are independent.
Table 1.16.1 shows the errata of the Hitachi Embedded Workshop User’s Manual.
Table 1.16.2 shows the errata of the Hitachi Embedded Workshop Project Generator
User’s Manual.
Table 1.16.2 Errata of Hitachi Embedded Workshop Project Generator User’s Manual
Table 2.2.1 SuperH™ RISC engine C/C++ Compiler Option Dialog Box
(2) The list file will always be output into the configuration directory.
(3) In the “User defined options” edit box, you can specify options in the command line
format. Begin each option with a minus character like “-euc”. Specify one option per
line. In the “User defined options” edit box, specify only options which is not supported
on the option dialog box. Otherwise, do not use this box.
(4) The following options are not supported on the option window.
–sjis
–euc
–outcode=euc|sjis
–lang=c|cpp
–show=width=<number>,length=<number>
–help
–subcommand
(5) If you need to specify any of –euc, -sjis, or outcode=euc|sjis, specify it in the “User
defined options” edit box on the “Other” tab. (e.g. –euc)
(6) The compiler will choose one from C and C++ by looking at the file extension of an
input file. So the –lang=c|cpp option will not be output by the HEW.
(2) The list file will always be output into the configuration directory.
(3) In the “User defined options” edit box, you can specify options in the command line
format. Begin each option with a minus character like “-euc”. Specify one option per
line. In the “User defined options” edit box, specify only options which is not supported
on the option dialog box. Otherwise, do not use this box.
(4) The following options are not supported on the option window.
–lines
–columns
–sjis
–euc
–outcode=euc|sjis
–abort=warning|error
–subcommand
(5) If you need to specify any of –lines, -columns, –euc, -sjis or outcode=euc|sjis,
specify it in the “User defined options” edit box on the “Other” tab. (e.g. –euc)
(2) A map file (*.map). a linkage symbol file (external symbol file) (*.fsy) or an
optimized linkage list file (*.lop) will always be output into the configuration directory.
(3) In the “User defined options” edit box, you can specify options in the subcommand
file format. In the “User defined options” edit box, specify only options which is not
supported on the option dialog box. Otherwise, do not use this box.
(4) The following options are not supported on the option window.
directory
udf | noudf
exchange
rename
delete
exit
echo | noecho
(2) The list file will always be output into the configuration directory.
(3) In the “User defined options” edit box, you can specify options in the command line
format. Begin each option with a minus character like “-euc”. Specify one option per
line. In the “User defined options” edit box, specify only options which is not supported
on the option dialog box. Otherwise, do not use this box.
(4) The following options are not supported on the option window.
–sjis
–euc
–outcode=euc|sjis
–lang=c|cpp
–show=width=<number>,length=<number>
–chgincpath
–subcommand
(5) If you need to specify any of –euc, -sjis, -latin1 or outcode=euc|sjis, specify it in the
“User defined options” edit box on the “Other” tab. (e.g. –euc)
(6) The compiler will choose one from C and C++ by looking at the file extension of an
input file. So the –lang=c|cpp option will not be output by the HEW.
(2) The list file will always be output into the configuration directory.
(3) In the “User defined options” edit box, you can specify options in the command line
format. Begin each option with a minus character like “-euc”. Specify one option per
line. In the “User defined options” edit box, specify only options which is not supported
on the option dialog box. Otherwise, do not use this box.
(4) The following options are not supported on the option window.
–lines
–columns
–sjis
–euc
–latin1
–outcode=euc|sjis
–abort
–subcommand
(5) If you need to specify any of –lines, -columns, –euc, -sjis, -latin1 or
outcode=euc|sjis, specify it in the “User defined options” edit box on the “Other” tab.
(e.g. –euc)
A map file (*.map). a linkage symbol file (external symbol file) (*.fsy) or an optimized
linkage list file (*.lop) will always be output into the configuration directory.
In the “User defined options” edit box, you can specify options in the subcommand file
format. In the “User defined options” edit box, specify only options which is not
supported on the option dialog box. Otherwise, do not use this box.
add, replace, delete, extract and rename command are available in Hitachi H Series
Librarian Interface.
(1) Open the “Start” menu of Windows®, select “Program”, select “Hitachi Embedded
Workshop” and select “HIM to HEW Project Converter”.
(2) Double click HimToHew.exe which is installed in the same directory as HEW.EXE.
This section will describe how to convert a single HIM project into a HEW workspace and
a HEW project using the “Single” tab (figure 3.2.1.1)
(1) In the “HIM Project filename” field, specify a path of a HIM project database file,
whose file extension is “*.him”. You have two ways to specify the path. One is to type
the path manually into the “HIM Project filename” field. The other is to use the
“Browse…” button. When you click the “Browse…” button, the “Select project
filename” dialog box (figure 3.2.1.2) will be displayed. Open the directory in which a
HIM project database file exists, and double click the project database file or select the
file and click the “Select” button.
(2) In the “HEW workspace name” field on the “Single” tab, specify a workspace name.
Use only alphanumerics or an underscore (‘_’) in a workspace name.
(3) Click the “Convert” button, then conversion will start. The “Total complete” meter
shows the progress of the conversion. When the conversion finishes, “Project converted
successfully” will be shown in the “Results” field (figure 3.2.1.3).
HimToHew.exe will create a HEW workspace file whose directory path is the same as the
file specified in the “HEW Project filename” field, whose file name is the name specified in
the “HEW workspace name” field, and whose file extension is “*.hws”. Also
HimToHew.exe creates a HEW project database file which has the same file path as the
HIM project database file except that the extension is changed from “*.him” to “*.hws”.
This section will describe how to use the “Multiple” tab (figure 3.2.2.1). Using the
“Multiple” tab, you can convert multiple HIM projects in a directory and in its
subdirectories into HEW projects at a time and register them into a HEW workspace.
(1) In the “Workspace directory” field, specify a directory path under which one or more
HIM project database files (“*.him”) exist. When you choose the directory, note that all
the HIM project database files in this directory and its subdirectories will be converted
at a time and will be registered to a HEW workspace.
You have two ways to specify the directory path. One is to type the directory path
manually into the “Workspace directory” field. The other is to use the “Browse…”
button. When you click the “Browse…” button, the “Select workspace directory” dialog
(2) In the “HEW workspace name” field on the “Multiple” tab, specify a workspace name.
Use only alphanumerics or an underscore (‘_’) in a workspace name.
(3) In the “CPU family” field, select a CPU family of the projects to be converted. Select
one of “SuperH RISC engine” or “H8S,H8/300” from the drop-down list.
(4) Click the “Convert” button, then the conversion will start. The “Current project” meter
shows the progress of conversion of a current project database file. “Total complete”
meter shows the overall progress of the conversion. The “Status” field shows a
temporary status of the conversion. The “Results” field shows a HIM project database
file being converted. When the conversion finishes, “XX project(s) converted
successfully” will be displayed in the “Results” field (figure 3.2.2.3).
HimToHew.exe will create a HEW workspace file whose directory path is the directory
path file specified in the “Workspace directory” field, whose file name is the name in the
“HEW workspace name” field, and whose file extension is “*.hws”. Also HimToHew.exe
creates a HEW project database file which has the same file path as each HIM project
database file except that the extension is changed from “*.him” to “*.hws”.
(1) External tools shown on the HIM toolbar will not be converted into the HEW.
(2) A build phase which is not shown on the “Build Order” tab of the “Phase Order” dialog
box of the HIM project builder will not be converted into the HEW. To launch the
“Phase Order” dialog box, select [Options->Build Phases…] on the HIM project builder
and click the “Phase Order…” button on the “Build Phases” dialog box.
(3) The output filename is unchangeable in the HEW. The filename here means a filename
excluding a directory path and a file extension. In the HIM, you can change a filename.
In HEW, however, you cannot change a filename. In table 3.4.1, output file groups
whose filenames are unchangeable by a user are shown.
(4) Furthermore, the output directory of some files will be fixed to $(CONFIGDIR) after
conversion into the HEW. In table 3.4.2, output file groups whose output directories are
unchangeable by a user are shown.
(5) You have a restriction regarding the “-speed=inline” option of H8S,H8/300 C Compiler
Version 2.x in the HIM. In this version of the compiler, you can not specify a number to
the “inline” sub-option. In version 3.0 or greater, however, you can do so. When options
of version 2.x of H8S,H8/300 C Compiler of the HIM are converted to those of version
3.0A of H8S,H8/300 C/C++ Compiler of the HEW, the “speed=inline” options will be
converted as shown in table 3.4.3.
Table 3.4.3 Conversion of –speed=inline option from ver. 2.x of H8S,H8/300 C Compiler
HIM HEW
H8S,H8/300 C Compiler option window H8S,H8/300 C/C++ Compiler option window
Optimize tab Optimize tab
Speed Sub-options group Speed sub-options group
Inline Expansion check box Maximum nodes of inline function
checked 105
unchecked 0 (same as without –speed=inline)
(6) You will have a restriction regarding the “-optimize” option of the H8S,H8/300 Inter-
Module Optimizer. On the “Optimize” tab of SH IM OptLinker in the HEW, selecting
“All” from the “Optimize” drop-down list has the same result as selecting “Customize”
from the drop-down list and checking all the sub-options. But graphical representations
of the selections are different. In H8S,H8/300 IM Optimizer Ver. 1.x in the HIM, the
“Optimize” tab does not have a drop-down list as the HEW does, and sub-options are
specified only though check boxes. If all the sub-options are checked in H8S,H8/300 IM
Optimizer Ver. 1.x, they will be converted into “All” in HEW. The same conversion
method holds in the “Safe” and “Speed” options.
After you convert the HIM project into the HEW, the output file from the custom phase
will not be input to SH IM OptLinker or H8S,H8/300 IM OptLinker automatically. To
solve this problem, add a file mapping to a HEW project in the way shown below.
File group:
“Object file” (if OBJ is an extension of an output file of the custom phase.)
“Relocatable file” (if REL is an extension of an output file of the custom phase.)
“Library file” (if LIB is an extension of an output file of the custom phase.)
Source phase:
The name of the custom phase
Destination phase:
SH IM OptLinker or H8S,H8/300 IM OptLinker
For example, suppose you have added a file group, “aaa source file”, to a HIM project
and have defined a multiple phase “aaa phase”, which takes the “aaa source file” file
group as input, as a custom phase in the project. Also suppose that you have specified a
file path, whose file extension is OBJ, on the “Output Files” tab of the “aaa phase
Options” dialog box via [Options->aaa phase]. After you convert this HIM project into
the HEW, define a file mapping as shown in figure 3.4.1 on the “Define File Mapping”
dialog box. Thus an OBJ file generated from the “aaa phase” will be input to SH IM
OptLinker or H8S,H8/300 IM OptLinker automatically in build.
(8) A HIM project cannot be converted into the HEW if a user has added to the project an
extension which is the same as an extension already defined in the HEW and the file
group the extension belongs to differs from the file group of the extension in the HEW.
In this case, open the project with the HIM, remove that extension from the HIM
project, and then convert the project into the HEW again.
For example, assume that, to a HIM project, a user has added an extension, “INC”, in
a “ASM header file” file group, which is defined by a user. In the HEW, the extension,
“INC”, is defined as an extension in the “Assembly include file” file group instead of the
“ASM header file” file group. When you convert the HIM project into the HEW with
HimToHew.exe, an error message shown in figure 3.4.2 will be displayed. In this case,
open the HIM project with the HIM and remove the extension, “INC”, from the project.
Then convert it into the HEW again.
For another example, assume that, to a HIM project, a user has added an extension,
“INC”, in the “Assembly source file” file group, which is already defined by the HEW.
But in the HEW, the extension, “INC”, is defined as an extension in the “Assembly
include file” file group instead of the “Assembly include file” file group. When you
convert the HIM project into the HEW with HimToHew.exe, an error message shown
in figure 3.4.3 will be displayed. In this case, open the HIM project with the HIM and
remove the extension, “INC”, from the project. Then convert it into the HEW again.
(9) If you have added a custom phase whose input file group is the “Preprocessed C Source
file” or “Preprocessed C++ Source file” file group of the HIM to a HIM project, you
need to modify the project after conversion into the HEW. You need to remove that
custom phase from the HEW project. Then add the phase again as a custom phase
whose input file group is “Preprocessed C source file” or “Preprocessed C++ source
file” if necessary.
(10) If you have added a file group whose name is the same as one of file groups shown
in table 2.2.1, “Standard File Extensions of the Hitachi Toolchains” EXCEPT for the
cases of the letters, you need to modify the project converted into the HEW. You need to
remove all the file extensions of that file group from the converted HEW project. (To do
so, you might need to remove a custom phase whose input file group is that file group
and a project file in that file group.) Then reconstruct your settings if necessary.
HS6400EWIW1SE-TU990601
Rev. 1.0
June 01, 1999
Hitachi Company or Division
Cautions
1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s
patent, copyright, trademark, or other intellectual property rights for information contained in
this document. Hitachi bears no responsibility for problems that may arise with third party’s
rights, including intellectual property rights, in connection with use of the information
contained in this document.
2. Products and product specifications may be subject to change without notice. Confirm that
you have received the latest product standards or specifications before final design, purchase
or use.
3. Hitachi makes every attempt to ensure that its products are of high quality and reliability.
However, contact Hitachi’s sales office before using the product in an application that
demands especially high quality and reliability or where its failure or malfunction may
directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics,
nuclear power, combustion control, transportation, traffic, safety equipment or medical
equipment for life support.
4. Design your application so that the product is used within the ranges guaranteed by Hitachi
particularly for maximum rating, operating supply voltage range, heat radiation
characteristics, installation conditions and other characteristics. Hitachi bears no
responsibility for failure or damage when used beyond the guaranteed ranges. Even within
the guaranteed ranges, consider normally foreseeable failure rates or failure modes in
semiconductor devices and employ systemic measures such as fail-safes, so that the
equipment incorporating Hitachi product does not cause bodily injury, fire or other
consequential damage due to operation of the Hitachi product.
5. This product is not designed to be radiation resistant.
6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this
document without written approval from Hitachi.
7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi
semiconductor products.
Preface
This tutorial will introduce you to the basic usage of the Hitachi Embedded Workshop
(hereafter referred to as HEW). The tutorial describes a series of usage such as how to
invoke the HEW, how to create and modify a project, how to build a program, and how to
invoke Hitachi Debugging Interface (hereafter referred to as HDI) from the HEW. For the
details of the HEW, the HEW project generator, a C/C++ compiler, an assembler, an inter-
module optimizer, the librarian, and the object converter, refer to the following manuals.
For details on the SuperH™ RISC engine CPU or the H8S, H8/300 CPU, refer to a
programming manual or a hardware manual of the corresponding CPU.
For the description in this manual, the Microsoft® Windows NT® 4.0 operating system
was used.
Microsoft®, Windows®, Windows® 95, Windows® 98, and Windows NT® are registered
trademarks of Microsoft Corporation in the United States and/or in other countries.
All other brand or product names used in this manual are trademarks or registered
trademarks of their respective companies or organizations.
If “->” is written inside [ and ], the left hand side of “->” means the menu title and the right
hand side of “->” means a menu option of the menu. For example, in figure 1, the menu
option “Exit” in the “File” menu is described as [File->Exit].
Figure 3.8 File Extension Dialog Box (After Adding an File Extension) 16
Figure 5.3 The Editor Windows of the HEW Opened by the HDI 26
Figure 6.1 Confirmation Dialog Box for Saving Workspace on Exiting from the HEW 27
If you use the HEW for the first time or if you want to work on a new project, select the
[Create a new project workspace] radio button and click [OK]. If you want to work on an
existing project, select the [Open a recent project workspace] or [Browse to another project
workspace] radio button and click [OK].
In this tutorial, select the [Create a new project workspace] radio button and click [OK].
Enter “tutorial”, for example, in the [Name] field, then the [Directory] field will show
“c:\tutorial”. If you want to change the directory used for the new workspace, click the
[Browse…] button and specify a directory, or enter a directory path manually in the
[Directory] field.
When you create a project of [H8S,H8/300], select “H8S,H8/300” in the [CPU family] field
and select “Hitachi H8S,H8/300 Standard” in the [Tool chain] field. Then you will have a
chance to select a project type other than the project types shown in the [Project type] field
of figure 2.1. For details, refer to the Hitachi Embedded Workshop Project Generator
User’s Manual.
For the details of the project generator, refer to the Hitachi Embedded Workshop Project
Generator User’s Manual.
Then the HEW will open a project generated by the project generator.
the “Workspace” window (on the left hand side of the HEW), which shows the contents of
the project, the “Output” window (on the lower side of the HEW), which shows outputs
from a build or a string search, and the editor window (on the right hand side of the
window), which is used to edit text files. Refer to the Hitachi Embedded Workshop User’s
Manual for how to change the state of the HEW and how to use each window such as the
editor window.
Those minimum options are set by default for each tool. When you add a new file to the
project, the minimum options will automatically be added to the file. You do not have to
specify options from scratch. For details of the options specified by the project generator,
refer to the Hitachi Embedded Workshop Project Generator User’s Manual.
If you want to open an existing text file with the editor of the HEW, select [File->Open]. If
you want to edit a new text file with the editor, select [File->New]. In this tutorial, select
[File->New], input the three lines shown below, select [File->Save As…] and save the file as
“newprog.c”.
void NewProgram(void);
{
}
You have another way to delete a file from a project. Select the file in the [Projects] tab of
the “Workspace” window and push the [Delete] key. Then the file will be deleted from the
project. In this way, you cannot cancel the deletion although you can cancel it on the
[Remove Project Files] dialog box.
If you want to exclude a file from a build temporarily instead of removing the file from the
project, refer to section 4.4, “Excluding a Project File”.
The HEW identifies a group to which a file belongs by checking the file extension. Select
[Project->File Extensions…], then the “File Extensions” dialog box (figure 3.6) will be
displayed. File extensions used in the project are shown on this dialog box. Every file
extension belongs to a file group. A file group can be associated to a tool in a build process.
If you want to use your own file extension in the project, define a new file extension by
clicking the [Add…] button.
The icon displayed in the [Extension] column of the “File Extensions” dialog box can show
a tool which opens the file. If the icon of a file extension is the same as the icon shown below,
a file with that file extension can be opened by the editor of the HEW.
In this tutorial, enter “asm” in the [File extension] field, select “Assembly source file” from
the drop-down list and click [OK]. Then a file with the extension, “*.asm”, will be treated
as a file in the “Assembly source file” group (figure 3.8).
If you want to compile or assemble a single source program file, select the file on the
[Projects] tab of the “Workspace” window and select [Build->Build File].
CAUTION ON BUILD
1. Depending of the setting of the editor window, a file being edited might be
saved on executing a build. So close a file which you do NOT want to be saved
beforehand. For details of customizing the editor, refer to the Hitachi
Embedded Workshop User’s Manual.
2. Do not save a file used in a project during the build because doing so might
disturb the build process.
When the project generator generates a project, the minimum options required for a build
are already specified. If you want to modify the options, however, select [Options-> <Tool
name>] and set options on the option dialog box of each tool.
If you select “Default Options” in a file group folder, you can specify initial options for the
file group. The HEW automatically adds the options specified to the “Default Options” to a
file of the corresponding file group of the corresponding file extension of the file. For
example, if you add a file with an extension “C” (“*.C”) to the project, the settings of the
“Default Options” of the “C source file” group will be added to the file automatically.
For the details of the options refer to the manual of the corresponding tool.
The project generator creates two configurations, [Debug] and [Release]. Difference
between them is only the setting of the debug option. To switch the current configuration to
another, launch the “Build Configurations” dialog box (figure 4.2) by selecting [Options-
>Build Configurations…], select a configuration from the “Current configuration” drop-
down list, and click [OK]. You can also change the current configuration by selecting one
from the drop-down list on the toolbar.
On the “Build Configurations” dialog box, you can create a new configuration or delete a
configuration. For details, refer to chapter 2, “Build Basics”, of the Hitachi Embedded
Workshop User’s Manual.
Select a file on the “Projects” tab of the “Workspace” window, click the right mouse button,
and select [Exclude Build <file>] on the pop-up menu. Then a red cross will be added to the
icon of this file as shown in figure 4.3. This file will be excluded from a build.
To include an excluded file into build, select the file on the “Projects” tab of the
“Workspace” window, click the right mouse button, and select [Include Build <file>] on the
pop-up menu.
Figure 4.4 shows an example in which a compiler detected a syntax error in a source
program file. When you build a project, messages, including error messages, from a tool in
a build will be displayed on the “Output” window. If you double click the line of the error
message the [Build] tab of the “Output” window, the file which caused the error will be
opened and the cursor will be placed on the line which caused the error. (The cursor might
not be placed on the line which caused the error if you have already edited the file.)
Thus clicking the button will launch the HDI and it will load the session file.
If you specify the path of the load module file on the [Download module] field, the HDI will
be focused immediately after the load module file is updated by the HEW.
If you double click a line on the source window (figure 5.2) of the HDI, the corresponding
file will be opened by the HEW and the cursor will be placed on the same line as you have
double clicked.
Figure 5.3 shows the HEW after the 17th line of “tutorial.c” is double clicked on the source
window of the HDI.
The HDI and the other tools launched from the HEW will not be closed when the HEW is
closed. Close the tools by yourself.
Figure 6.1 Confirmation Dialog Box for Saving Workspace on Exiting from the HEW
HS6400EWIW1SE-PG990601
Rev. 1.0
June 01, 1999
Hitachi Company or Division
Cautions
1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s
patent, copyright, trademark, or other intellectual property rights for information contained in
this document. Hitachi bears no responsibility for problems that may arise with third party’s
rights, including intellectual property rights, in connection with use of the information
contained in this document.
2. Products and product specifications may be subject to change without notice. Confirm that
you have received the latest product standards or specifications before final design, purchase
or use.
3. Hitachi makes every attempt to ensure that its products are of high quality and reliability.
However, contact Hitachi’s sales office before using the product in an application that
demands especially high quality and reliability or where its failure or malfunction may
directly threaten human life or cause risk of bodily injury, such as aerospace, aeronautics,
nuclear power, combustion control, transportation, traffic, safety equipment or medical
equipment for life support.
4. Design your application so that the product is used within the ranges guaranteed by Hitachi
particularly for maximum rating, operating supply voltage range, heat radiation
characteristics, installation conditions and other characteristics. Hitachi bears no
responsibility for failure or damage when used beyond the guaranteed ranges. Even within
the guaranteed ranges, consider normally foreseeable failure rates or failure modes in
semiconductor devices and employ systemic measures such as fail-safes, so that the
equipment incorporating Hitachi product does not cause bodily injury, fire or other
consequential damage due to operation of the Hitachi product.
5. This product is not designed to be radiation resistant.
6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this
document without written approval from Hitachi.
7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi
semiconductor products.
Preface
The project generator generates a project for the Hitachi Embedded Workshop (hereafter
referred to as HEW). The project generator will help you in generating the initial routine
files of an application program and in setting options for every tool of the project.
CPUs supported by the project generator differ depending on the CPU family that your
software package supports. Check beforehand whether the CPU family of your package is
the SuperH™ RISC engine or the H8S, H8/300 series.
This manual provides an overview of the project generator and its usage. Read this
manual before using the project generator. For details about the HEW, C/C++ compiler,
assembler, inter-module optimizer, librarian, and object converter, refer to the following
manuals.
For details on the SuperH™ RISC engine CPU or the H8S, H8/300 CPU, refer to a
programming manual or a hardware manual for the corresponding CPU.
For the description in this manual, the Microsoft® Windows® 95 operating system is used.
Microsoft®, Windows®, Windows® 95, Windows® 98, and Windows NT® are registered
trademarks of Microsoft Corporation in the United States and/or in other countries.
All other brand or product names used in this manual are trademarks or registered
trademarks of their respective companies or organizations.
Section 1 Overview............................................................................................1
1.1 Overview .......................................................................................................................... 1
1.2 Environment ..................................................................................................................... 4
Section 2 Tutorial...............................................................................................5
2.1 Project Types .................................................................................................................... 5
2.2 Operation .......................................................................................................................... 6
2.2.1 How to Create a New Project in a New Workspace ............................................ 6
2.2.2 How to Insert a New Project into an Existing Workspace................................... 8
2.2.3 Selecting the Target CPU .................................................................................... 9
2.2.4 Option Setting (for the SuperH™ RISC engine) ................................................. 11
2.2.5 Option Setting (for the H8S, H8/300 Series) ....................................................... 13
2.2.6 Setting the Contents of Files to be Generated...................................................... 15
2.2.7 Setting the Stack Area ......................................................................................... 20
2.2.8 Setting the Vector................................................................................................ 23
2.2.9 Changing the File Names to be Created .............................................................. 25
2.2.10 Confirming Settings (Summary Dialog Box) ...................................................... 27
2.3 Automatic Project Generation .......................................................................................... 29
Figure 2.5 New Project Wizard Dialog Box (Step-2 Screen) for the SuperH™ 11
Figure 2.6 New Project Wizard Dialog Box (Step-2 Screen) for the H8S,H8/300 Series 13
Figure 2.8 [Number of I/O Streams:] Message Box against Empty Input 16
Figure 2.9 [Heap Size:] Message Box against Illegal Value Input 16
Figure 2.12 [Stack Pointer Address:] Message Box against Empty Input 21
Figure 2.13 [Stack Pointer Address:] Message Box against Illegal Value Input 21
Figure 2.14 [Stack Pointer Address:] Message Box against Odd Value Input 21
Figure 2.15 Message Box against [Stack Size:] > [Stack Pointer Address:] 22
Figure 2.18 Message Box when 129 or More Characters are Input as Handler Name 24
Figure 2.22 Message Box when 252 or More Characters are Input as File Name 26
Figure 2.23 Message Box when Illegal Characters are Input as File Name 26
Table 2.6 Files Created by Step-3 Settings (H8S, H8/300 Assembly Application) 19
Table 3.6 Default Options (Super HTM RISC engine C/C++ Compiler) 46
Table 3.7 User Options (Super HTM RISC engine C/C++ Compiler) 47
1.1 Overview
When a program is developed using the HEW, the development process unit can be
considered a project. A project manages the information necessary for configuring a
program (hereafter referred to as a build) listed below.
The project manages the files by registering the files necessary for the build (hereafter
referred to as the project files). When the project files are registered, the build operation is
automatically applied to all the files.
The tools needed for the build must also be registered. The necessary tools and the order of
the tool execution during the build operation differ depending on the kind of program to be
developed. Each stage of the build in which a tool is executed is called a build phase or a
phase.
Each tool can determine the input files from the project files. (Note that a project file
refers to a file registered to a project.) However, it cannot determine the input files from
the intermediate files output by other tools. Therefore, a project must manage the
information of directing an intermediate file from one phase to another. This information
is called file mapping. The option for executing each tool is also required. The project
always manages the options set by the user.
Those pieces of information are necessary in building a project. Figure 1.4 shows the
relation between the tools and the project files at build.
• Creating the initial routine file for the SuperHTM RISC engine or the H8S, H8/300 series
• Creating the vector table definition and the sample files defined by the I/O registers for
the SuperHTM RISC engine or the H8S, H8/300 series
• Registering the project files
• Setting the phase order
• File mapping settings
• Option settings
NOTE
For the contents of the vector table definition and I/O register definitions created
by the project generator, refer to the appropriate CPU hardware manual and
confirm the correctness of the program of the generated files.
1.2 Environment
The project generator operates in the following environment.
Host computer: IBM PC compatible machine which can run Windows® 95, Windows® 98
or Windows NT® 4.0.
The operation of the project generator differs slightly depending on the project type
selected. Hereafter, however, an application project of the SuperH™ RISC engine will be
mainly discussed as an example.
When [File->New Workspace...] is selected or the [OK] button is clicked after selecting
[Create a new project workspace] in the “Welcome!” dialog box, the following dialog box
will be launched.
• Enter “tutorial” in the [Name:] field. The [Directory:] field will be automatically
updated.
• Select “SuperH™ RISC engine” in the [CPU family:] field, and select “Hitachi
SuperH Standard” in the [Tool chain:] field. The available project types will then be
displayed in the [Project type:] list.
• Click the [OK] button. The project generator will then launch a wizard dialog box.
This dialog box will be detailed in section 2.2.3, “Selecting the Target CPU”.
If you want to develop a program for the H8S, or the H8/300, select “H8S, H8/300” in the
[CPU family:] field and “Hitachi H8S,H8/300 Standard” in the [Tool chain:] field.
Items displayed in the [Project type:] list depend on the selection in both the [CPU family:]
and [Tool chain:] fields. Select an appropriate item from the [Project type:] list. Refer to
the description of project types in section 2.1, “Project Types”.
When [Project->Insert Project…] is selected, the dialog box shown in figure 2.2 will be
launched. Select the [New project] radio button and click the [OK] button.
Then the dialog box shown in figure 2.3 will then be launched.
• Enter “tutorial2” in the [Name:] field. The [Directory:] field will be updated
automatically.
Rev. 1.0, 06/99, page 8 of 59
• Select “Application” from the [Project type:] list.
• Click the [OK] button. The project generator will then launch a wizard dialog box.
This dialog box will be detailed in section 2.2.3, “Selecting the Target CPU”.
Items displayed in the [Project type:] list depend on the selection in both the [CPU family:]
and [Tool chain:] fields when the workspace is newly created. Refer to section 2.2.1, “How
to Create a New Project in a New Workspace” for details. Select an appropriate item from
the [Project type:] list.
If you click [OK] in the “New Project Workspace” dialog box or the “Insert New Project”
dialog box, the project generator launches the wizard dialog box shown in figure 2.4.
Select the target CPU in this dialog box. Specify, for example, the following settings.
• Select “SH-3” in the [CPU Series:] list. The [CPU Type:] list will then be updated.
• Click [Next >]. The Step-2 screen (in section 2.2.4, “Option Setting (for the SuperH™
RISC engine)”), will then be launched.
The [CPU Type:] list box shows the products included in the CPU series selected in the
[CPU Series:] list box. The CPU product selected in the [CPU Type:] list is called the CPU
type hereafter. The [CPU Series:] selection sets the CPU option of the SuperHTM RISC
engine C/C++ Compiler and the SuperHTM RISC engine Assembler. The selected items in
the [CPU Series:] list box and the [CPU Type:] list box specify the files to be generated.
Select the CPU type of the program to be developed. If the CPU type which you want to
select is not displayed in the [CPU Type:] list, select a CPU type with similar hardware
specifications or select “Other”.
Clicking [Next>] moves to the next display. Clicking [<Back] moves to the previous display
or the previous dialog box. Clicking [Finish] opens the “Summary” dialog box. Clicking
[Cancel] returns the display to the “New Project Workspace” dialog box or the “Insert
New Project” dialog box. [<Back], [Next>], [Finish], and [Cancel] are common buttons of
all the wizard dialog boxes.
For the H8S, H8/300 series, the CPU series and the CPU types in the H8S, H8/300 series
are displayed. For the selections in Step-2, refer to section 2.2.5, “Option Setting (for the
H8S, H8/300 Series)”. In Step-2, the more detailed CPU specification for the H8S, H8/300
Series C/C++ Compiler and the H8S, H8/300 Series Assembler can be selected.
Clicking the [Next>] button on the Step-1 screen opens the dialog box shown in figure 2.5.
This screen differs between that of the SuperH™ RISC engine and that of the H8S, H8/300
series. The screen for H8S, H8/300 series is described in section 2.2.5, “Option Setting (for
the H8S, H8/300 Series)”.
Figure 2.5 New Project Wizard Dialog Box (Step-2 Screen) for the SuperH™
On this screen, you can specify options common to all project files.
Click the [Next>] button without changing the setting. The Step-3 screen will be displayed.
Refer to section 2.2.6, “Setting the Created File”.
On the Step-2 screen, you can specify the options listed below.
• Endian
• FPU
• Rounding direction
Rev. 1.0, 06/99, page 11 of 59
• Denormalized number
• Position independent program section
• Double-type single precision
• Endian
• Rounding direction
• De-normalized number
The library file shown below [Required C Runtime Library:] will be specified in the
SuperH™ RISC engine Inter-Module Optimizer phase for linkage. The library file is
automatically selected according to the settings in the [CPU Series:] list of the Step-1 screen
and the settings in the Step-2 screen. Confirm the name of the library file below [Required
C Runtime Library:]. A library file name will not be displayed there if the project type is
“Library”.
A control of an option, which is not supported by the CPU series selected in the Step-1
screen, is grayed. In figure 2.5, since “SH-3” has been selected in the Step-1 screen, [FPU:],
[Round:], and [Denormalized number allowed as a result:] are grayed, meaning these
options are not available for SH-3.
If the project type is “Library”, do not click the [Next>] button. Click the [Finish] button.
When the project type is “Demonstration”, clicking the [Next>] button displays a Step-3
screen, whose contents are the same as the Step-6 screen shown in section 2.2.9, “Changing
the File Names to be Created”.
Click the [Next>] button on the Step-1 screen. The screen shown in figure 2.6 will be
displayed.
Figure 2.6 New Project Wizard Dialog Box (Step-2 Screen) for the H8S,H8/300 Series
[Operating Mode:] cannot be specified if the CPU series specified in the Step-1 screen has
no operating modes. Figure 2.6 shows a screen in which 2600 has been selected in [CPU
Series:] in the Step-1 screen.
If the project type is “Application” or “Assembly Application”, click the [Next>] button.
Then the Step-3 screen will be displayed. Refer to section 2.2.6, “Setting the File Contents”.
If the project type is “Library”, the [Next>] button cannot be clicked. Click the [Finish]
button.
When the project type is “Demonstration”, clicking the [Next>] button displays a Step-3
screen, whose contents are the same as the Step-6 screen shown in section 2.2.9, “Changing
the File Names to be Created”.
Click the [Next>] button on the Step-2 screen to display the screen shown in figure 2.7.
In this tutorial, click the [Next>] button without changing the setting. The Step-4 screen
will be displayed. Refer to section 2.2.7, “Setting the Stack Area”.
If [Use I/O Library] is checked, the standard I/O library can be used. Then the setting of
[Number of I/O Streams:] will be enabled and the number of I/O streams simultaneously
used can be specified. However, when the project type is “Application” for the SuperH™
RISC engine or “Assembly Application” for the H8S, H8/300 series, the inputs are disabled.
NOTE
If you use a function of the standard I/O library, check the stack size consumed by
the function by referring to the supplementary information of the C/C++ compiler.
If [I/O Register Definition Files] is checked, an I/O register definition file, which is written
in C language, can be created. Then the setting of [Generate Hardware Setup Function] is
enabled. However, when the project type is “Assembly Application” for the H8S, H8/300
series, the setting of [I/O Register Definition Files] is disabled.
If nothing is entered at [Number of I/O Streams:] or [Heap Size:], clicking the [Next>] or
[Finish] button displays the message shown in figure 2.8. In the figure, “Heap Size” instead
of “Number of I/O Streams” will be displayed if nothing is entered in [Heap Size]. Thus
the Step-4 screen or the “Summary” dialog box will not be displayed.
Figure 2.8 [Number of I/O Streams:] Message Box against Empty Input
If an illegal value is entered in [Heap Size:], clicking the [Next>] or [Finish] button displays
the message shown in figure 2.9. Thus the Step-4 screen or the “Summary” dialog box will
not be displayed.
Figure 2.9 [Heap Size:] Message Box against Illegal Value Input
Files to be created differ depending on the project type and the settings on the Step-3
screen. Tables 2.4, 2.5, and 2.6 show the files to be created. For details, refer to section 3.1,
“Created Files”.
NOTE
If you want to use an existing main (or _main) function, uncheck [Generate main()
function], add the file of the function after generating the project. If the name of the
function differs from main (or _main), change the caller of the function in
resetprg.src (or resetprg.c in “Application” of H8S,H8/300). Also, change the entry
point option of the inter-module optimizer.
When the project type is “Application” for the SuperH™ RISC engine, the setting of
[Number of I/O Streams:] cannot be changed.
The [Number of I/O Streams:], [Use Runtime Library], [Heap Size], [I/O Register
Definition Files], and [Generate Hardware Setup Function] cannot be changed for
“Assembly Application” of the H8S, H8/300 series.
The screen shown in figure 2.11 is displayed when the [Next>] button is clicked in the Step-
3 screen.
In this tutorial, click the [Next>] button without changing the settings. Then the Step-5
screen will be displayed. Refer to section 2.2.8, “Setting the Vector”.
[Stack Pointer Address:] and [Stack Size:] can be entered in hexadecimal or decimal values
as shown below:
Figure 2.12 [Stack Pointer Address:] Message Box against Empty Input
If an illegal value is entered in [Stack Pointer Address:] or [Stack Size:], clicking the
[Next>] or [Finish] button displays the message shown in figure 2.13. In the figure, “Stack
Size” instead of “Stack Pointer Address” will be displayed if an illegal value is entered in
[Stack Size]. Thus the Step-5 screen or the “Summary” dialog box will not be displayed.
Figure 2.13 [Stack Pointer Address:] Message Box against Illegal Value Input
If an odd number is entered in [Stack Pointer Address:] or [Stack Size:], clicking the
[Next>] or [Finish] button displays the message shown in figure 2.14. In the figure, “Stack
Size” instead of “Stack Pointer Address” will be displayed if an odd number is entered in
[Stack Size]. Thus the Step-5 screen or the “Summary” dialog box will not be displayed.
Figure 2.14 [Stack Pointer Address:] Message Box against Odd Value Input
Rev. 1.0, 06/99, page 21 of 59
If the [Stack Size:] value is larger than the [Stack Pointer Address:] value, clicking the
[Next>] or [Finish] button displays the message shown in figure 2.15. Thus the Step-5
screen or the “Summary” dialog box will not be displayed.
Figure 2.15 Message Box against [Stack Size:] > [Stack Pointer Address:]
The initial value of the stack area differs depending on [CPU Type:] selected in the Step-1
screen. In this tutorial, since SH7708 has been selected for [CPU Type:] in the Step-1
screen, [Stack Pointer Address:] is set to H’7FFFFFF0 and [Stack Size:] is set to H’400.
The setting of [Stack Size:] is written into stacksct.src for the SuperH™ RISC engine or
into stacksct.h for the H8S, H8/300 series. The stack section address is determined by the
start option of the inter-module optimizer for the SuperH™ RISC engine or the H8S,
H8/300 series. The start address of the stack section is calculated using the formula shown
below:
Stack Section Address = Value of [Stack Pointer Address:] – Value of [Stack Size:]
Clicking the [Next>] button in the Step-4 screen displays the screen shown in figure 2.16.
In this tutorial, click the [Next>] button without changing the settings. Then the Step-6
screen will be displayed. Refer to section 2.2.9, “Changing the File Names to be Created”.
If [Vector Table Definition Files] is checked, the HEW creates a vector table definition file.
The name of the reset vector can be changed by [Vector Handlers:].
The [Handler] column of [Vector Handlers:] displays the handler program name, and the
[Vector] column displays the vector description. To change the handler program, click the
name of the handler program to be changed, and enter a new name.
If nothing is entered in [Handler], the message shown in figure 2.17 will be displayed. Click
[OK] to return to the previous display.
If a character string which has 129 or more characters is entered as the handler name in
[Handler], the message shown in figure 2.18 will be displayed. Click [OK] to return to the
previous display.
Figure 2.18 Message Box when 129 or More Characters are Input as Handler Name
If an illegal character string is entered in [Handler], the message shown in figure 2.19 will
be displayed. Click [OK] to return to the previous display.
If [Vector Table Definition File] is checked, the HEW creates the following files:
• vecttbl.src
• intprg.src
• vect.inc
• resetprg.src (restprg.c for “Application” of the H8S, H8/300 series)
When the [Next>] button is clicked in the Step-5 screen, the screen shown in figure 2.20 is
displayed.
The screen shown in figure 2.20 is the final step of the “New Project” wizard. The screen
displays a list of files created according to the previous settings. The [File Name] column in
the list shows a file name, [Extension] shows an extension, and [Description] shows the
description of a file. The file name can be changed. To change a file name, select it by
clicking it and change it to a new file name.
In this tutorial, click the [Finish] button without changing the settings. When the button is
clicked, the “Summary” dialog box will be displayed. Refer to section 2.2.10, “Confirming
Settings (Summary Dialog Box)”.
If nothing is entered in [File Name], the message shown in figure 2.21 will be displayed.
Clicking [OK] returns to the previous display.
If a character string which has 252 or more characters is entered in [File Name], the
message shown in figure 2.22 will be displayed. Clicking [OK] returns to the previous
display.
Figure 2.22 Message Box when 252 or More Characters are Input as File Name
If an illegal character is entered in [File Name], the message shown in figure 2.23 will be
displayed. Clicking [OK] returns to the previous display.
Figure 2.23 Message Box when Illegal Characters are Input as File Name
Rev. 1.0, 06/99, page 26 of 59
2.2.10 Confirming Settings (Summary Dialog Box)
When the [Finish] button is clicked on the Step-6 screen, the dialog box shown in figure
2.24 will be displayed.
[Project Summary:] has the following contents. Confirm the contents and click the [OK]
button. To change the setting, click the [Cancel] button.
• Project name
• Project directory
• CPU series
• CPU type
• Toolchain name
• Toolchain version
The following items are included in the project. For details, refer to section 3, “Functions of
the Project Generator”.
• Project files
• Phase order
• File mapping
• Options for each tool
NOTE
Confirm the correctness of the definition of the vector table and the definition of the
I/O registers in the generated files reading the hardware manual of the CPU of your
choice.
This file initializes the RAM area. The section B area is cleared by the numerical value 0,
and the contents of the section D area is copied to the section R area.
Coding example:
(2) dbsct.src
This file sets the area information for sections B, D, and R to be used for initialization in (1).
Coding example:
.SECTION D,DATA,ALIGN=4
.SECTION R,DATA,ALIGN=4
.SECTION B,DATA,ALIGN=4
.SECTION C,DATA,ALIGN=4
__D_ROM .DATA.L (STARTOF D) ;Start Address of Section D
__D_BGN .DATA.L (STARTOF R) ;Start Address of Section R
__D_END .DATA.L (STARTOF R) + (SIZEOF R);End Address of Section R
__B_BGN .DATA.L (STARTOF B) ;Start Address of Section B
__B_END .DATA.L (STARTOF B) + (SIZEOF B);End Address of Section B
.EXPORT __D_ROM
.EXPORT __D_BGN
.EXPORT __D_END
.EXPORT __B_BGN
.EXPORT __B_END
.END
This file includes modules, which handle input/output of one character, used by the
simulated I/O in the simulator/debugger. For details on the standard input/output, refer to
the user’s manual of the simulator/debugger of the corresponding CPU family. For details
on creating the low-level interface routine, refer to the C/C++ compiler user’s manual.
When using the simulated I/O in the demonstration program or the like, open the “System
Configuration” dialog box from the [Setup->Configure Platform...] menu of the
simulator/debugger. In the dialog box, set H’0 (set H’4 if SH-4 is selected in [CPU Series])
to [System Call Address], and check [Enable].
(4) lowsrc.c
This file includes interface modules related to standard input/output. For details, refer to
the section describing the low-level interface routine in the C/C++ compiler user’s manual
of the corresponding CPU family.
This file defines a value (3 in the example) for [Number of I/O Streams:]. To modify the
number of standard I/O streams, change this value.
Coding example:
(6) sbrk.c
This file includes a low level interface routine used to allocate space of requested size in the
heap area. In H8S,H8/300, you can specify the minimum reservation unit size (_sbrk_size)
allocated in the heap area. Since the definition of _sbrk_size is commented by default,
activate the definition and specify the minimum block size including a management area of
the block. The size of the management area (6 or 12 bytes) depends on the CPU option. For
details, refer to section 8.4, “Setting the Execution Environment at Library Function
Usage”, in the H8S,H8S/300 C/C++ Compiler User’s Manual.
(7) sbrk.h
Defines a value (H’400 in the example) for [Use Runtime Library]. To change the heap
area size, change this value.
Coding example:
This file defines the main program of the application to be developed. This is the start of
the program description. In the “Demonstration” project (only a C source program), the
sample program is written.
Coding example:
void main(void);
void main(void)
{
(9) iodefine.h
The I/O registers of the CPU is defined in C language. The typical instance of definitions
for the selected CPU series is used. Check the contents using the hardware manual.
(10) hwsetup.c
This file initializes the CPU and the peripheral hardwares. The coding example using the
I/O definition of iodefine.h is written as a comment to be used if you want.
Coding example:
#include "iodefine.h"
extern void HardwareSetup();
void HardwareSetup()
{
/* SCI.SCSMR.BYTE = 0;
SCI.SCSMR.BIT.CA = 1;
SCI.SCSMR.BIT.CHR = 1;
.
.
. */
This file defines a dummy program of the interrupt function. To install the interrupt
program, extract the function name and perform coding. To change the name of an
interrupt function, this file, (12), and (13) must be changed.
Coding example:
.include "vect.inc"
.section IntPRG, code
;H’040 TLB miss/invalid (load)
_INT_TLBMiss_Load
;H’060 TLB miss/invalid (store)
_INT_TLBMiss_Store
;H’080 Initial page write
_INT_TLBInitial_Page
.
.
.
;H’5A0 REF ROVI
_INT_REF_ROVI
sleep
nop
.end
Coding example:
.include "vect.inc"
.section VECTTBL,data
.export _RESET_Vectors
_RESET_Vectors:
;<<VECTOR DATA START (POWER ON RESET)>>
;H’000 Power On Reset
.data.l _PowerON_Reset
;<<VECTOR DATA END (POWER ON RESET)>>
;<<VECTOR DATA START (MANUAL RESET)>>
;H’020 Manual Reset
.data.l _Manual_Reset
;<<VECTOR DATA END (MANUAL RESET)>>
.section INTTBL,data
.export _INT_Vectors
_INT_Vectors:
;H’040 TLB miss/invalid (load)
.data.l _INT_TLBMiss_Load
;H’060 TLB miss/invalid (store)
.data.l _INT_TLBMiss_Store
.
.
.
Coding example:
Coding example:
Coding example:
.include "env.inc"
.include "vect.inc"
.import _RESET_Vectors
.import _INT_Vectors
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; reset ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.section RSTHandler,code
_ResetHandler:
mov.l #EXPEVT,r0
mov.l @r0,r0
shlr2 r0
shlr r0
mov.l #_RESET_Vectors,r1
add r1,r0
mov.l @r0,r0
jmp @r0
nop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; exceptional interrupt ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.section INTHandler,code
.export INTHandlerPRG
INTHandlerPRG:
_ExpHandler:
mov.l #EXPEVT,r0
mov.l @r0,r0
add.l #-64,r0
shlr2 r0
shlr r0
mov.l #_INT_Vectors,r1
add r1,r0
mov.l @r0,r0
jmp @r0
Rev. 1.0, 06/99, page 38 of 59
nop
.
.
.
(16) resetprg.src
This file defines the initial routine after the reset and calls the main program.
.include "vect.inc"
.import _PowerON_Reset_SP
.import INTHandlerPRG
.import __INITSCT
.import _main
.AIFDEF USES_SIMIO
.import __INIT_IOLIB
.import __CLOSEALL
.AENDI
.AIFDEF OTHERLIB
.import __INIT_OTHERLIB
.AENDI
.AIFDEF HWSETUP
.import _HardwareSetup
.AENDI
.section ResetPRG,code
_PowerON_Reset:
_Manual_Reset:
mov.l #_PowerON_Reset_SP, R15 ; Initialize SP
mov.l #INTHandlerPRG,r0
mov.l #H’100,r1
sub.l r1,r0
ldc r0,vbr ; VBR addr set
.AIFDEF USES_SIMIO
mov.l #__INIT_IOLIB,r1
jsr @r1
nop
.AENDI
.AIFDEF OTHERLIB
mov.l #__INIT_OTHERLIB,r1
jsr @r1
nop
.AENDI
.AIFDEF HWSETUP
mov.l #_HardwareSetup,r1
jsr @r1
nop
.AENDI
mov.l #SR_Init,r0
ldc r0,sr ; SR set (User AP mode)
mov.l #_main,r1
jsr @r1
nop
.AIFDEF USES_SIMIO1
mov.l #__CLOSEALL,r1
jsr @r1
nop
.AENDI
sleep
nop
.pool
.end
#include <machine.h>
#include "stacksct.h"
#ifdef USES_SIMIO
extern void _INIT_IOLIB(void);
extern void _CLOSEALL(void);
#endif
#ifdef OTHERLIB
extern void _INIT_OTHERLIB(void);
#endif
#ifdef HWSETUP
extern void HardwareSetup(void);
#endif
void PowerON_Reset(void);
void PowerON_Reset(void)
{
set_imask_ccr(1);
_INITSCT();
#ifdef USES_SIMIO
_INIT_IOLIB();
#endif
#ifdef OTHERLIB
_INIT_OTHERLIB();
#endif
#ifdef HWSETUP
main();
#ifdef USES_SIMIO
_CLOSEALL();
#endif
sleep();
}
(17) stacksct.src
In this file, the stack area (H’400 in size in the example) is set. To change the stack size,
change the value of the [StackEND] (when SH7708 is used).
.section Stack,STACK
.export _PowerON_Reset_SP
.export _Manual_Reset_SP
File mapping set by the project generator is listed in tables 3.4 and 3.5. The file mapping
differs depending on the purchased package and the project type.
3.4 Options
The project generator sets the options for the C/C++ compiler, assembler, and inter-
module optimizer. (A set of options for all the tools is called the configuration.) When the
project type is “Demonstration”, only the “Debug” configuration is created. For other
project types, both the “Debug” configuration and “Release” configuration are created.
Tables 3.6 to 3.17 list the options set for each tool (called the default options hereafter), and
the options that can be set by users through the project generator wizard dialog box (called
the user options hereafter).
For details on option items, refer to the user’s manual of each tool.
Options set by the project generator can be changed in the [Options] menu of the HEW.
For details, see section 4.2, “Changing Options”, or the Hitachi Embedded Workshop
User’s Manual.
NOTE
Options such as section names and start addresses specified by the project
Rev. 1.0, 06/99, page 45 of 59
generator are set to show examples of usage. You might observe a warning message
(e.g. “1210 CANNOT FIND SECTION (C)” of the inter-module optimizer) when
you build the project right after it is generated. Tailor the options for your CPU
setting (e.g. mode and memory map).
Table 3.6 Default Options (Super HTM RISC engine C/C++ Compiler)
Dialog Box
Item Option Item Contents
Target CPU CPU type [SH-1]: Creates SH-1 object
setting screen <SH1 to SH4> [SH-2]: Creates SH-2 object
[CPU Series:] [SH-DSP]: Creates SH-2 object
[SH-2E]: Creates SH-2E object
[SH-3]: Creates SH-3 object
[SH3-DSP]: Creates SH-3 object
[SH-3E]: Creates SH-3E object
[SH-4]: Creates SH-4 object
Option setting Endian type [Big]: Big endian
screen <SH-3 to SH-4> [Little]: Little endian
[Endian:]
Option setting FPU <SH-4> [Mix]: Float type is calculated as single-precision floating
screen [FPU:] point. Double type is calculated as double-precision
floating point
[Single]: All floating point operations are calculated as a
single-precision floating point
[Double]: All floating point operations are calculated as a
double-precision floating point
Option setting Rounding direction [Zero]: Rounded to zero
screen <SH-4> [Nearest]: Rounded to the nearest value
[Round:]
Option setting Handling of [Not checked]: Assumes the denormalized number is 0.
screen denormalized [Checked]: Assumes the denormalized number is valid.
[Denormalized number <SH-4>
number
allowed as a
result]
Option setting Position [Not checked]: Does not generate program section as
screen independent position independent code
[Position program section [Checked]: Generates program section as position
independent <SH-2 to SH-4> independent code
code (PIC)]
Option setting double type [Checked]: Compiles the source code treating double
screen [Treat calculated as (double-precision floating point) type as the float (single-
double as single-precision precision floating point) type
float] <SH-1 to SH-3E>
Dialog Box
Item Option Item Contents
Target CPU CPU type [SH-1]: Creates SH-1 object
setting screen <SH1 to SH4> [SH-2]: Creates SH-2 object
[CPU Series:] [SH-DSP]: Creates SH-2 object
[SH-2E]: Creates SH-2E object
[SH-3]: Creates SH-3 object
[SH3-DSP]: Creates SH-3 object
[SH-3E]: Creates SH-3E object
[SH-4]: Creates SH-4 object
Option setting Endian type [Big]: Big endian
screen <SH-3 to SH-4> [Little]: Little endian
[Endian]
Option setting Rounding direction [Zero]: Rounded to zero
screen <SH-4> [Nearest]: Rounded to the nearest value
[Round:]
Option setting Handling of [Not checked]: Assumes the denormalized number as 0.
screen denormalized [Checked]: Accepts the denormalized number as it is
[Denormalized number <SH-4>
number
allowed as a
result]
Created file Definition of [Checked]: Replacement symbol USES_SIMIO is
setting screen replacement defined as character string “1”
[Use I/O character string
Library] (resetprg.src only)
Created file Definition of [Checked]: Replacement symbol OTHERLIB is defined
setting screen replacement as character string “1”
[Use Runtime character string
Library] (resetprg.src only)
Created file Definition of [Assembly source file]: Replacement symbol HWSETUP
setting screen replacement is defined as character string “1”
[Generate character string [C source file]: Replacement symbol HWSETUP is
Hardware (resetprg.src only) defined as character string “1”
Setup
Function]
Dialog Box
Item Option Item Contents
Target CPU Library file Specifies the standard library of the SuperHTM RISC
setting screen specification engine C/C++ compiler
[CPU Series:]
Option setting
display (all
controls)
Stack area Section start address Specifies the linkage order of the section shown
setting screen and linkage order below and its start address
[Stack Pointer specification <address> <section>
Address:] (Address A) Stack
[Stack Size:] Address A = [Stack Pointer Address:] − [Stack Size:]
Vector setting Section start address Specifies the linkage order of sections shown below
screen [Vector and linkage order and their start addresses
Table Definition specification <address> <section>
Files] H’00000000 RSTHandler
H’00000800 INTHandler
VECTTBL
INTTBL
IntPRG
H’00001000 ResetPRG
[300]: H8/300
[300L]: H8/300L
Option setting screen Parameter storage [Checked]: (E)R0 and (E)R1 are used
[Change number of register [Not checked]: (E)R0, (E)R1, and (E)R2 are
parameter registers from used
2 (default) to 3]
Created file setting Definition of character [Checked]: Defines a macro name
screen string replacement USES_SIMIO
[Use I/O Library] (resetprg.c only)
Created file setting Definition of character [Checked]: Defines a macro name
screen string replacement OTHERLIB
[Use Runtime Library] (resetprg.c only)
Created file setting Definition of character [Assembly source file]: Defines a macro
screen [Generate string replacement name HWSETUP
Hardware Setup (resetprg.c only) [C source file]: Defines a macro name
Function] HWSETUP
[300]: H8/300
[300L]: H8/300L
Dialog Box
Item Option Item Contents
Target CPU Library file Specifies the standard library of the H8S, H8/300
setting screen specification series C/C++ compiler
[CPU Series:]
Option setting
display (all
contols)
Stack area Section start Specifies the linkage order of the section shwon below
setting screen address and linkage and its start addresses
[Stack Pointer order specification <address> <section>
Address:] (Address A) S
[Stack Size:] Address A = [Stack Pointer Address:] − [Stack Size:]
Vector setting Section start Specifies the linkage order of the sections shown below
screen [Vector address and linkage and their start addresses
Table Definition order specification <address> <section>
Files] H’00000000 VECTTBL
INTTBL
H’00000400 PRsetPRG
IntPRG
When the [Project->Add Files…] menu is selected, or the [Insert] key is pressed in the
workspace window, the dialog box shown in figure 4.1 will be displayed. Select the file to be
added and click the [Add] button.
The common options in the project such as [CPU] will be automatically set to the added file.
To set an additional option, refer to section 4.2, “Changing Options”.
When the [Project->Remove Files...] menu is clicked, the dialog box shown in figure 4.2 will
be displayed. Select the file to be deleted, click the [Remove] button, and click the [OK]
button. A file can also be deleted by selecting the file in the workspace window and pressing
the [Delete] key as shown in figure 4.3.