Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows...

128
H8 EMBEDDED W ORKBENCH Interface Guide

Transcript of Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows...

Page 1: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

H8 EMBEDDED WORKBENCH

Interface Guide

Page 2: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

ii

COPYRIGHT NOTICE© Copyright 1998 IAR Systems. All rights reserved.

No part of this document may be reproduced without the prior written consent of IAR Systems. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license.

DISCLAIMERThe information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions.

In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind.

TRADEMARKSC-SPY is a registered trademark of IAR Systems. IAR Embedded Workbench, IAR XLINK Linker and XLIB Librarian are trademarks of IAR Systems. Windows and MS-DOS are trademarks of Microsoft Corp.

All other product names are trademarks or registered trademarks of their respective owners.

First edition: October 1998

Part no: EWH8-1

Page 3: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

iii

WELCOME Welcome to the IAR Systems Embedded Workbench, a powerful integrated Windows environment for developing applications in C or assembler for the Hitachi H8/300H and H8S series microprocessors.

Before reading this guide refer to the QuickStart Card, or the chapter Installation and documentation route map, for information about installing the Embedded Workbench, and an overview of the Embedded Workbench documentation.

This guide explains how to configure and run the IAR Systems development tools from the Embedded Workbench interface. It also includes complete reference information about the Embedded Workbench commands and dialog boxes, and the Workbench editor.

Refer to the H8 C Compiler Programming Guide and H8 Assembler, Linker, and Librarian Programming Guide for detailed information about working with the individual development tools incorporated in the Embedded Workbench.

If your product includes the optional H8 C-SPY debugger refer to the H8 C-SPY User Guide, Windows Workbench Version, for information about debugging with C-SPY.

ABOUT THIS GUIDE This guide consists of the following chapters:

Installation and documentation route map explains how to install and run the Embedded Workbench or C-SPY, and gives an overview of the documentation supplied with the IAR Systems tools.

The Introduction provides a brief summary of the Workbench features, and describes how you would use it to develop a typical project.

The Overview explains how the Embedded Workbench organizes your work into a project, to help you keep track of the source files involved in a typical application. It explains how the configuration options relate to your project, and how you use the IAR Systems development tools to operate on the files within a project.

The Tutorial demonstrates how to use the most important features of the Embedded Workbench to develop and maintain a simple C project.

Setting options explains how to set options from the Embedded Workbench. It also describes how to specify paths for executable, object and list files.

PREFACE

Page 4: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

iv

C compiler options explains how to use the C compiler options from the Embedded Workbench, gives a summary of the options, and complete reference information about each C compiler option.

Assembler options explains how to use the assembler options from the Embedded Workbench. A summary of options is given and complete reference information about each assembler option is included.

XLINK Linker options explains how to use the XLINK options from the Embedded Workbench and includes a summary and complete reference for each option.

Reference provides complete reference information about the components of the Embedded Workbench window, and the commands on each of the Embedded Workbench menus.

THE OTHER GUIDES The other guides provided with the H8 Embedded Workbench are as follows:

H8 C Compiler Programming GuideThis guide provides programming information about the H8 C Compiler. It includes reference information about the C library functions and language extensions, and provides information about support for the target-specific options such as memory models.

You should refer to this guide when you are setting up the C compiler configuration options in the Embedded Workbench, and for information about the C language when writing and debugging C source programs.

This guide also describes the diagnostic functions and lists the H8-specific warning and error messages.

H8 Assembler, Linker, and Librarian Programming GuideThis guide provides reference information about the H8 Assembler, XLINK Linker, and XLIB Librarian for use with the Embedded Workbench.

The assembler programming sections include details of the assembler source format, and reference information about the assembler operators, directives, and mnemonics.

The XLINK Linker programming reference sections provide information about the XLINK Linker commands and output formats.

PREFACE

Page 5: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

v

The XLIB Librarian programming sections provide information about the XLIB Librarian commands.

Finally, the guide includes a list of diagnostic messages for each of these tools.

H8 C-SPY User GuideThis optional guide describes how to use the IAR C-SPY Debugger for the Hitachi H8 series of microprocessors, and provides reference information about the features of C-SPY.

Note: There are two versions of this guide, an Embedded Workbench version as well as a Command line version.

ASSUMPTIONS AND CONVENTIONS

ASSUMPTIONSThis guide assumes that you already have a working knowledge of the following:

◆ The C programming language.

◆ The Hitachi H8 series microprocessors.

◆ The procedures for using menus, windows, and dialog boxes in a windows environment.

Note that the illustrations in this guide show the Embedded Workbench running in a Windows 95-style environment, and their appearance will be slightly different if you are using another platform.

CONVENTIONSThis user guide uses the following typographical conventions:

Style Used for

computer Text that you type in, or that appears on the screen.

parameter A label representing the actual value you should type as part of a command.

[option] An optional part of a command.

bold Names of menus, menu commands, buttons, and dialog boxes that appear on the screen.

reference A cross-reference to another part of this guide, or to another guide.

PREFACE

Page 6: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

vi

PREFACE

Page 7: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

vii

CONTENTS

INSTALLATION AND DOCUMENTATION ROUTE MAP........ 1Embedded Workbench versions 1Documentation route map 3

INTRODUCTION......................................................................... 5Embedded Workbench 5C compiler 6Assembler 7XLINK Linker 8XLIB Librarian 9C-SPY debugger 10

OVERVIEW................................................................................ 11How projects are organized 11Setting options 12Building a project 13Testing the code 13Sample applications 14

TUTORIAL................................................................................. 17Getting started 17Compiling the project 22Linking the project 25Debugging the project 27Using Make 32What next? 34

SETTING OPTIONS................................................................... 35Setting options 35General options 37

C COMPILER OPTIONS ............................................................ 41Options summary 41Code generation 43Language 45Debug 52

Page 8: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

CONTENTS

EWH8-1

viii

#define 54List 55#undef 58Include 59

ASSEMBLER OPTIONS ............................................................ 61Options summary 61Code generation 62Debug 65#define 66List 67#undef 69Include 70

XLINK LINKER OPTIONS ........................................................ 71Summary of options 71Output 73#define 75Diagnostics 76List 77Include 78Input 79Processing 81

REFERENCE.............................................................................. 83The Embedded Workbench window 83File menu 95Edit menu 97View menu 100Project menu 101Tools menu 105Options menu 109Window menu 115Help menu 116

INDEX...................................................................................... 117

Page 9: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

1

INSTALLATION AND DOCUMENTATION ROUTE MAPThis chapter explains how to install and run the Embedded Workbench versions of the IAR products, and gives an overview of the user guides supplied with them.

EMBEDDED WORKBENCH VERSIONS

This section explains how to install and run the Embedded Workbench.

WHAT YOU NEED◆ Windows 95/98 or Windows NT 3.51 or later.

◆ Up to 15 Mbytes of free disk space for the Embedded Workbench.

◆ A minimum of 4 Mbytes of RAM for the IAR applications.

You should install the Workbench before C-SPY.

INSTALLING FROM WINDOWS 95/98 OR NT 4.01 Insert the first installation disk or the installation CD-ROM.

2 Click the Start button in the taskbar, then click Settings and Control Panel.

3 Double-click the Add/Remove Programs icon in the Control Panel folder.

4 Click Install, then follow the instructions on the screen.

RUNNING FROM WINDOWS 95/98 OR NT 4.01 Click the Start button in the taskbar, then click Programs and IAR

Embedded Workbench.

2 Click the IAR Embedded Workbench program icon.

Page 10: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EMBEDDED WORKBENCH VERSIONS INSTALLATION AND DOCUMENTATION ROUTE MAP

EWH8-1

2

INSTALLING FROM NT 3.511 Insert the first installation disk or the installation CD-ROM.

2 Double-click the File Manager icon in the Main program group.

3 Click the a disk icon in the File Manager toolbar.

4 Double-click the setup.exe icon, then follow the instructions on the screen.

RUNNING FROM NT 3.51◆ Go to the Program Manager and double-click the IAR Embedded

Workbench icon.

RUNNING C-SPY

Either:◆ Start C-SPY in the same way as you start the Embedded Workbench

(see above).

Or:◆ Choose Debugger from the Embedded Workbench Project menu.

Page 11: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INSTALLATION AND DOCUMENTATION ROUTE MAP DOCUMENTATION ROUTE MAP

EWH8-1

3

DOCUMENTATION ROUTE MAP

WINDOWS WORKBENCHVERSION

COMMAND LINEVERSION

QS

Command Line Interface GuideTo get started with using thecommand line, and forinformation about the environ-ment variables and utilities.

C Compiler Programming GuideTo learn about writing programs withthe IAR Systems C Compiler, and forreference information about thecompiler options and C language.

Assembler, Linker, andLibrarian Programming GuideTo learn about using the IARSystems assembler, linker, andlibrarian, and for referenceinformation about these tools.

C-SPY User Guide,Command Line VersionTo learn about debuggingwith the command lineversion of C-SPY, and forC-SPY reference.

C-SPY User Guide, WindowsWorkbench Version

To learn about debuggingwith C-SPY for Windows,and for C-SPY reference.

Windows WorkbenchInterface Guide

To get started with usingthe Embedded Workbench,

and for EmbeddedWorkbench reference.

QuickStart CardTo install the tools and run the

Embedded Workbench.

QuickStart CardTo install the tools and run the DOSor UNIX versions.

Page 12: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

DOCUMENTATION ROUTE MAP INSTALLATION AND DOCUMENTATION ROUTE MAP

EWH8-1

4

Page 13: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

5

INTRODUCTIONThe IAR Systems Embedded Workbench is a flexible integrated environment for developing applications for a variety of different target processors. It provides a convenient windows interface for rapid development and debugging.

Support for a number of different target processors can be added to the Embedded Workbench, and users developing projects for different target processors can specify the target on a project by project basis. For more information on supported target processors please contact your local IAR distributor.

The tools include a fast compiler, an efficient linker, a librarian, a syntax highlighting text editor, an automatic Make facility, and an optional C-SPY debugger.

EMBEDDED WORKBENCH

The IAR Systems Workbench provides the following features:

GENERAL◆ Runs under Windows 95/98 or Windows NT 3.51 or later.

◆ Hierarchical project representation.

◆ Intuitive user interface, taking advantage of Windows 95/98 features.

◆ The Make utility recompiles, reassembles, and links files only when necessary.

◆ Full integration between the Workbench tools and editor.

◆ Support of drag and drop features.

◆ Comprehensive hypertext help.

EMBEDDED WORKBENCH EDITOR◆ Syntax of C programs shown using text styles and colors.

◆ Powerful search and replace commands, including multi-file search.

◆ Direct jump to context from error listing.

Page 14: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER INTRODUCTION

EWH8-1

6

◆ Parenthesis matching.

◆ Automatic indentation.

◆ Multi-level undo and redo for each window.

C COMPILER AND ASSEMBLER◆ Projects build in the background under Windows 95/98 or

Windows NT, allowing simultaneous editing.

◆ Options can be set globally, on groups of source files, or on individual source files.

C COMPILER The IAR Systems C Compiler for the H8/300H and H8S series microprocessors offers the standard features of the C language, plus many extensions designed to take advantage of the H8-specific facilities. The compiler is supplied with the IAR Systems Assembler for the H8, with which it is integrated, and shares linker and librarian manager tools.

It provides the following features:

LANGUAGE FACILITIES◆ Conformance to the ANSI specification for free-standing C in

accordance to what the controller design allows.

◆ Standard library of functions applicable to embedded systems, with source available.

◆ IEEE-compatible floating-point arithmetic.

◆ Powerful extensions for H8-specific features, including efficient I/O.

◆ LINT-like checking of program source.

◆ Linkage of user code with assembly routines.

◆ Long identifiers – up to 255 significant characters.

◆ Up to 32000 external symbols.

◆ Maximum compatibility with other IAR Systems C compilers.

Page 15: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INTRODUCTION ASSEMBLER

EWH8-1

7

PERFORMANCE◆ Fast compilation.

◆ Memory-based design which avoids temporary files or overlays.

◆ Rigorous type checking at compile time.

◆ Rigorous module interface type checking at link time.

CODE GENERATION◆ Selectable optimization for code speed or size.

◆ Comprehensive output options, including relocatable binary, ASM, ASM+C, XREF, etc.

◆ Easy-to-understand error and warning messages.

◆ Compatibility with the C-SPY high-level debugger.

TARGET SUPPORT◆ Small and large memory models.

◆ Flexible variable allocation.

◆ Interrupt functions requiring no assembly language.

◆ A #pragma directive to maintain portability while using processor-specific extensions.

DOCUMENTATIONThe H8 C Compiler is documented in the H8 C Compiler Programming Guide.

ASSEMBLER The IAR Systems H8/300H and H8S Assembler is a powerful relocating macro assembler with a versatile set of directives.

The assembler incorporates a high degree of compatibility with the processor manufacturer’s own assemblers, to ensure that software originally developed using them can be transferred to the IAR Systems Assembler with little or no modification.

Page 16: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

XLINK LINKER INTRODUCTION

EWH8-1

8

It provides the following features:

GENERAL◆ One pass assembly, for faster execution.

◆ Integration with the XLINK Linker and XLIB Librarian.

◆ Integration with other IAR Systems software.

◆ Self-explanatory error messages.

ASSEMBLER FEATURES◆ Support for the H8 series microprocessors.

◆ Up to 256 relocatable segments per module.

◆ 32-bit arithmetic and IEEE floating-point constants.

◆ 255 significant characters in symbols.

◆ Powerful recursive macro facilities.

◆ Number of symbols and program size limited only by available memory.

◆ Support for complex expressions with external references.

◆ Forward references allowed to any depth.

◆ Support for C language pre-processor directives and sfr and sfrb keywords.

◆ Macros in Intel/Motorola style.

DOCUMENTATIONThe H8 Assembler is documented in the H8 Assembler, Linker, and Librarian Programming Guide.

XLINK LINKER The IAR Systems XLINK Linker converts one or more relocatable object files produced by the IAR Systems Assembler or C Compiler to machine code for a specified target processor. It supports a wide range of industry-standard loader formats, in addition to the IAR Systems debug format used by the C-SPY high level debugger.

Page 17: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INTRODUCTION XLIB LIBRARIAN

EWH8-1

9

XLINK supports user libraries, and will load only those modules that are actually needed by the program you are linking.

The final output produced by XLINK is an absolute, target-executable object file that can be programmed into an EPROM, downloaded to a hardware emulator, or run directly on the host using the IAR Systems C-SPY debugger.

XLINK offers the following important features:

FEATURES OF XLINK◆ Unlimited number of input files.

◆ Searches user-defined library files and loads only those modules needed by the application.

◆ Symbols may be up to 255 characters long with all characters being significant. Both upper and lower case may be used.

◆ Global symbols can be defined at link time.

◆ Flexible segment commands allow full control of the locations of relocatable code and data in memory.

◆ Support for over 30 output formats.

DOCUMENTATIONThe XLINK Linker is documented in the H8 Assembler, Linker, and Librarian Programming Guide.

XLIB LIBRARIAN The IAR Systems XLIB Librarian enables you to manipulate the relocatable object files produced by the IAR Systems Assembler and C Compiler.

XLIB provides the following features:

FEATURES OF XLIB◆ Support for modular programming.

◆ Modules can be listed, added, inserted, replaced, deleted, or renamed.

◆ Segments can be listed and renamed.

Page 18: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C-SPY DEBUGGER INTRODUCTION

EWH8-1

10

◆ Symbols can be listed and renamed.

◆ Modules can be changed between program and library type.

◆ Interactive or batch mode operation.

◆ A full set of library listing operations.

DOCUMENTATIONThe XLIB Librarian is documented in the H8 Assembler, Linker, and Librarian Programming Guide.

C-SPY DEBUGGER An optional C-SPY debugger can be added to the Embedded Workbench, to run and debug H8/300H and H8S object code programs, and if present will be accessible from the menus and toolbar.

DOCUMENTATIONThe C-SPY debugger is documented in the H8 C-SPY User Guide, Windows Workbench Version.

Page 19: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

11

OVERVIEWThe IAR Embedded Workbench provides a powerful environment for developing projects with a range of different target processors, and a selection of tools for each target processor.

This chapter gives a brief discussion of the project model used by the Embedded Workbench, and explains how you use it to develop typical applications.

HOW PROJECTS ARE ORGANIZED

The Embedded Workbench has been specially designed to fit in with the way that software development projects are typically organized. For example, you may need to develop related versions of an application for different versions of the target hardware, and you may also want to include debugging routines into the early versions, but not in the final code.

Versions of your applications for different target hardware will often have source files in common, and you want to be able to maintain a unique copy of these files, so that improvements are automatically carried through to each version of the application. There will also be source files that differ between different version of the application, such as those dealing with hardware-dependent aspects of the application, and so these will need to be maintained separately for each target version.

The Embedded Workbench addresses these requirements, and provides a powerful environment for maintaining the source files used to build all versions of an application. It allows you to organize projects in a hierarchical tree structure showing the dependency between files at a glance.

TARGETSAt the highest level of the structure you specify the different target versions of your application that you want to build. For a simple application you might need just two targets, called Debug and Release. A more complex project might include additional targets for each of the different processor variants that the application is to run on.

Page 20: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

SETTING OPTIONS OVERVIEW

EWH8-1

12

GROUPSEach target in turn contains one or more groups, which collect together related sets of source files. A group can be unique to a particular target, or it can be present in two or more targets. For example, you might create a group called Debugging routines which would be present only in the Debug target, and another group called Common sources which would be present in all targets.

SOURCE FILESEach group is used to group together one or more related source files. For maximum flexibility each group can be included in one or more targets.

When you are working with a project you always have a current target selected, and only the groups that are members of that target, along with their enclosed files, are visible in the Project window. Only these files will actually be built and linked into the output code.

SETTING OPTIONS For each target you set global assembler and compiler options at the target level, to specify how that target should be built. At this level you typically define the memory model you are using, and the processor variant.

You can also set local compiler and assembler options on individual groups and source files. These local options are specific to the context of a target and override override any corresponding global options set at the target level, and are specific to that target. A group can be included in two different targets and have different options set for it in each target. For example, you might set optimization high for a group containing source files that you have already debugged, but remove optimization from another group containing source files that you are still developing.

Page 21: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OVERVIEW BUILDING A PROJECT

EWH8-1

13

BUILDING A PROJECT The Compile command on the Embedded Workbench Project menu allows you to compile or assemble the files of a project individually. The Embedded Workbench automatically determines whether a source file should be compiled or assembled by its file name extension.

Alternatively, you can build the entire project, automatically compiling and assembling all the component files, using the Make command. This identifies when the files have changed, and only recompiles or assembles files as necessary before re-linking the project, based on whether they have changed, and their dependencies on other files.

A Build All option is also provided, which unconditionally regenerates all files.

When running the Embedded Workbench on Windows NT or Windows 95/98, the Compile, Make, Link, and Build commands all run in the background so that you can continue editing or working with the Embedded Workbench while your project is being built.

TESTING THE CODE The compiler and assembler are fully integrated with the development environment, so that if there are errors in your source code you can jump directly from the error listing to the correct position in the appropriate source file, to allow you to locate and correct the error.

After you have resolved any compile-time errors you can switch directly to the C-SPY debugger to test the resulting code at source level. The C-SPY debugger runs in a separate window, so that you can make changes to the original source files to correct problems as you identify them in C-SPY.

Page 22: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

SAMPLE APPLICATIONS OVERVIEW

EWH8-1

14

SAMPLE APPLICATIONS

The following examples describe two sample applications to illustrate how you would use the Embedded Workbench in typical development projects.

A SIMPLE APPLICATIONIn a simple application which you are developing for one version of the target hardware you would manage with the two default targets, Release and Debug, as shown in the following diagram:

Both targets share a common group containing the project’s core source files. Each target also contains a group containing the source files specific to that target: I/O routines, contains the source files for the input/output routines to be used in the final release code, and I/O stubs which contains input/output stubs to allow the I/O to be debugged with a debugger such as C-SPY.

The release and debug targets would typically have different compiler options set for them; for example, you could compile the Debug version with trace, assertions, etc, and the Release version without it.

Page 23: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OVERVIEW SAMPLE APPLICATIONS

EWH8-1

15

A MORE COMPLEX PROJECTIn the following more complex project an application is being developed for several different pieces of target hardware, containing different variants of the H8 processor, and different I/O ports and memory configurations. The project therefore includes a debug target, and a release target for each of the different sets of target hardware.

The source files that are common to all the targets are collected together, for convenience, into groups which are included in each of the targets. The names of these groups reflect the areas in the application that the source code deals with; for example Math, I/O etc.

Areas of the application that depend on the target hardware, such as the memory management, are included in a number of separate groups, one per target. Finally, as before, debugging routines are provided for the Debug target.

Project

Debug H8/300H Smallmemory model

Targets

I/O stubs Small memory management

Math routines

Sourcefiles

iodebug.c mcmem.c main.c fp.ccalc.c

H8/300H Largememory model

mpmem.c

Large memorymanagement

io.c

I/O routinesGeneral routines

Groups

Page 24: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

SAMPLE APPLICATIONS OVERVIEW

EWH8-1

16

When working with large projects such as this the Embedded Workbench minimizes your development time by helping you to keep track of the structure of your project, and optimizes the development cycle by assembling and compiling the minimum set of source files necessary to keep the object code completely up to date after changes.

Page 25: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

17

TUTORIALThis tutorial illustrates how you might use the Embedded Workbench to develop a simple C program, compile it, and run it using the C-SPY debugger.

Before reading this chapter you should:

◆ Have installed the Embedded Workbench software, as described in the QuickStart Card or the chapter Installation and documentation route map.

◆ Be familiar with the architecture and instruction set of the H8 family of microprocessors.

USING C-SPYThis tutorial assumes that you are using the C-SPY debugger with the Embedded Workbench, and describes how to use C-SPY to run the programs you are developing. If your installation does not include C-SPY, you can use the Embedded Workbench editor to examine the listing files.

GETTING STARTED The files you are working on in the Embedded Workbench are organized into projects.

We recommend that you create a directory where you keep the project files. In this tutorial we assume that there is a directory called projects on the c: drive.

Copy the files tutor.c, tutor.h, common.c, and common.h that are provided in the ewnn\h8\tutorial directory to c:\projects\.

The first step in using the Embedded Workbench is to create a new project, to specify which target processor you are working on, and to include a list of the files contained in the project.

Page 26: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

GETTING STARTED TUTORIAL

EWH8-1

18

RUNNING THE EMBEDDED WORKBENCH

Click the Start button in the taskbar, then click Programs and IAR Embedded Workbench.

Then click the IAR Embedded Workbench program icon, and the Embedded Workbench window will be displayed.

CREATING A NEW PROJECTCreate a project for the tutorial as follows.

Choose New… from the File menu to display the following dialog box:

Select Project and choose OK to display the New Project dialog box.

Page 27: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL GETTING STARTED

EWH8-1

19

Enter Demo in the Project Filename box, and set the Target CPU Family to H8:

Locate the directory where you want to store your project. In this example we choose c:\projects. Then choose OK to create the new project.

The Project window will be displayed. Make sure that Debug is selected from the Targets drop-down list box:

A directory structure is created in the project directory, with separate directories for executable files, list files, and object files:

Page 28: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

GETTING STARTED TUTORIAL

EWH8-1

20

Choose Files… from the Project menu to display the Project Files dialog box. Locate the files tutor.c and common.c in the file selection list in the upper half of the dialog box, and choose Add to add them to the new project:

Then click Done to close the Project Files dialog box.

Click the symbol to display the files in the Project window tree display:

Since we did not create any group in our project the Embedded Workbench created the default group Common Sources.

You can add files to a project at a later date, or remove files, using the Files… command on the Project menu.

Page 29: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL GETTING STARTED

EWH8-1

21

EDITING A FILETo edit one of the files in a project you simply double-click its name in the Project window. For example, double-click the file tutor.c. The file is displayed in an editor window:

Note that the Embedded Workbench editor provides a number of useful features to help you enter programs correctly, and to provide immediate syntax checking as you type.

For example, the following components of a program are identified:

You can configure these settings; for more information see Colors and Fonts, page 113.

We will use the editor to introduce an error into the program so that we can see the error handling features provided by the Embedded Workbench.

Item Highlight

Keyword Black bold

Text string Blue

Preprocessor directives Green

Numeric constants Red/magenta/blue

Comments Dark blue italics

Other program constructions

Black

Page 30: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

COMPILING THE PROJECT TUTORIAL

EWH8-1

22

Change the put_fib( fib ) on line 22 to put_fib( fibb ) and save the file by choosing Save from the File menu.

COMPILING THE PROJECT

SETTING COMPILER OPTIONSThe Embedded Workbench allows you to set options for the whole target, for a group of files, or for a single source file.

For this tutorial we will set options for the whole Debug target, as we do not need individual options for the groups or files in the target.

Select the Debug folder icon in the Project window, to specify which options are to be set, and choose Options… from the Project menu.

Alternatively, click the right mouse button on the Debug folder and choose Options… from the pop-up menu.

The Options dialog box is displayed. Then select General in the Category list and click the Target tab to display the target options for the Embedded Workbench tools:

Check that the Processor option is set to H8/300H and that Memory model is set to Small.

Page 31: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL COMPILING THE PROJECT

EWH8-1

23

Next select ICCH8 in the Category list to display the pages of C compiler options:

You can display any page by clicking the appropriate tab at the top of the page.

Page 32: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

COMPILING THE PROJECT TUTORIAL

EWH8-1

24

Click Debug to display the C compiler options and check that Generate debug information is selected, to create an output file for debugging with C-SPY:

Choose OK to save the options you have specified.

COMPILING A FILETo compile a source file you are editing choose Compile from the Project menu, or click the Compile button in the toolbar.

You can also compile a source file by selecting it in the Project window and choosing Compile.

Page 33: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL LINKING THE PROJECT

EWH8-1

25

The progress, and any error messages, will be displayed in the Messages window:

Here there is one error corresponding to the bug we inserted.

Double-click the error message in the Messages window. The cursor will be moved directly to the appropriate line in the program and you can simply correct the error.

For example, in this case change put_fib( fibb ) to the correct version put_fib( fib ).

Then recompile as described earlier. It should compile this time without an error, and you can then close the tutor.c source file by choosing Close from the File menu.

Compile the file common.c in the same way.

The object files are created in the project’s debug\obj subdirectory.

LINKING THE PROJECT Before linking the program you need to set up the linker options for the project.

SETTING THE LINKER OPTIONSSelect the Debug folder in the Project window. Then choose Options… from the Project menu, and select XLINK in the Category list to display the linker option pages.

Page 34: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LINKING THE PROJECT TUTORIAL

EWH8-1

26

View the options on the Output page. Check that the Format option is set to Debug info with terminal I/O, to generate a file for debugging with C-SPY.

Then choose OK to close the dialog box and save your settings.

LINKING THE FILESTo link the project choose Link from the Project menu. The files will then be linked, and the Messages window will show progress during linking:

Providing there were no errors, the output file demo.d37 will be generated for use with the C-SPY Simulator.

Page 35: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL DEBUGGING THE PROJECT

EWH8-1

27

The executable files will be created in the project’s debug\exe subdirectory.

DEBUGGING THE PROJECT

If you have the C-SPY debugger you can run the object code using C-SPY.

Choose Debugger from the Project menu, or click the C-SPY button in the project bar.

If necessary, the project will be relinked with debugging information for use by the simulator, and then C-SPY will be run automatically.

Choose Step from the Execute menu, or click the Step button in the debug bar, to start executing the source code.

The source will be displayed on the screen, with the first executable statement highlighted.

Page 36: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

DEBUGGING THE PROJECT TUTORIAL

EWH8-1

28

WATCHING VARIABLESTo keep track of a variable you can set a watchpoint on it.

For example, to watch the values of the variable call_count as you step through the program, first open the Watch window by choosing Watch from the Window menu.

Select the dotted rectangle, then click and briefly hold the left mouse button, and type call_countR to add the variable to the Watch window.

Choose Step from the Execute menu, or click the Step button in the debug bar.

Then choose Step Into from the Execute menu or click the Step Into button in the debug bar to step into the function init_fib() which will initialize the root array. We can view the initialization of the array called root by placing it in the Watch window.

Double-click the root variable in the beginning of the init_fib function. Drag and drop root in the Watch window. The root should now appear just under the call_count variable.

Page 37: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL DEBUGGING THE PROJECT

EWH8-1

29

Just to the left of the root name there is a symbol allowing us to view the contents of the array. (This can be done also for complex types such as struct and union).

Position the Source and Watch windows conveniently on the screen before proceeding.

Step to the for loop in the init_fib function. As you step through the for loop you can watch the root array being initialized. You will also notice that C-SPY will step through every statement inside the for loop.

Page 38: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

DEBUGGING THE PROJECT TUTORIAL

EWH8-1

30

We can also view the memory where root is located. Open the Memory window by choosing Memory from the Window menu. In the Memory window you can select the size of the data that you are watching. In this case the root is an array of integer. Click the 16 button to view the 16-bit size of the memory window.

Mark root again and drag and drop it in the Memory window. As you step through the for loop the memory location for root will be updated with the initialization values:

Step out of the init_fib funtion by choosing Go out from the Execute menu or by stepping through the init_fib funtion until it returns to the main function.

Close the Memory window by clicking its close box.

SETTING A BREAKPOINTYou can execute a program up to a specific statement by setting a breakpoint at that statement.

First open the Terminal I/O window, by choosing Terminal I/O from the Window menu, to display output from the program. Position the Source, Watch, and Terminal I/O windows conveniently on the screen.

Select the file common.c in the file box to the upper left in the Source window. Then select the function get_fib in the function box to the right of the file box.

Place the cursor at the if statement. In the Control menu choose Toggle Breakpoint to set a breakpoint on that statement.

Page 39: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL DEBUGGING THE PROJECT

EWH8-1

31

The statement will be highlighted in red to show the breakpoint:

Then choose Go from the Execute menu or click the Go button in the debug bar, to execute up to the breakpoint.

Choose Go three times to see the variable call_count change.

Page 40: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

USING MAKE TUTORIAL

EWH8-1

32

The output will be displayed in the Terminal I/O window:

Continue to step or choose Go from the Execute menu to step out of the program.

To exit from C-SPY and return to the Embedded Workbench, choose Exit from the File menu.

For more information on how to debug a program see the H8 C-SPY User Guide, Windows Workbench Version.

USING MAKE Instead of compiling and assembling the files in a project individually, and then linking them, you can automatically bring the project up-to-date using the Make command.

The Embedded Workbench maintains a list of all the files in the project, and the include files they depend on. When you run Make, the Embedded Workbench checks the dependency files, and recompiles or reassembles as necessary to keep the project up to date.

Note that you do not need to add the include files to the project. They are automatically added to the list of dependency files when you reference them in an #include statement.

Page 41: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TUTORIAL USING MAKE

EWH8-1

33

EDITING AN INCLUDE FILEThe following example illustrates how Make automatically detects that a dependent file has been changed.

The file tutor.c contains the following #include statement:

#include "tutor.h"

Once you have compiled a file the Project window shows any include files it references. Click the symbol next to the source file to expand the tree display and show include files:

Open the file tutor.h by double-clicking its name in the Project window:

Page 42: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

WHAT NEXT? TUTORIAL

EWH8-1

34

Add a comment, for example:

/* Include file for Demo*/

Save and close the file.

MAKING THE PROJECTTo bring the project up to date choose Make from the Project menu, or click the Make button in the toolbar.

The source file tutor.c will be recompiled, because the include file it references has been changed, and the whole project will then be linked.

The source file common.c will not be recompiled since it does not depend on the tutor.h header file.

WHAT NEXT? That completes this brief guided tour of the Embedded Workbench.

For more detailed information about using the Embedded Workbench and Embedded Workbench editor, refer to Reference later in this guide.

For more information about using the Embedded Workbench tools refer to the H8 C Compiler Programming Guide and the H8 Assembler, Linker, and Librarian Programming Guide.

Page 43: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

35

SETTING OPTIONSThis chapter explains how to set options from the Embedded Workbench.

SETTING OPTIONS To set options in the Embedded Workbench choose Options… from the Project menu and select the appropriate category from the Category list to display the options pages:

To restore all settings globally to the default factory settings, click on the Factory Settings button.

The Category list allows you to select which set of options you want to edit. The options available in the Category list will depend on the tools installed in your Embedded Workbench, and will typically include the following options:

Category Description

General General options.

ICCH8 H8 C Compiler options.

Page 44: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

SETTING OPTIONS SETTING OPTIONS

EWH8-1

36

Note that for all categories except General a Factory Settings button is available which resets all options for the selected category to the default settings for release and debug targets, respectively.

You can set options on the entire target, on a group of files, or on an individual file. The name bar at the top of the option dialog shows which file is affected. For example: Options For Target “Debug”.

Overriding inherited optionsThe available categories depend on which target, group or file you selected in the project:

If you select a source file, you must check the Override inherent settings check box to be able to change the settings inherited from the file group.

AH8 H8 Assembler options.

XLINK XLINK Linker options.

C-SPY (optional) C-SPY options.

Category Description

Page 45: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

SETTING OPTIONS GENERAL OPTIONS

EWH8-1

37

GENERAL OPTIONS TARGETThe Target options in the General category specify the processor and memory model for the assembler and C compiler.

ProcessorSelects the processor mode:

If no Processor option is specified, the C compiler and the assembler use H8/300H by default.

Note that changing the processor group causes different code to be generated. For information about the addressing supported by each processor group, see the H8 C Compiler Programming Guide or the H8 Assembler, Linker, and Librarian Programming Guide.

Processor

H8/300H (default)

H8S/2200

H8S/2600

Page 46: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

GENERAL OPTIONS SETTING OPTIONS

EWH8-1

38

Memory modelSelects the memory model for which the code is to be generated, as follows:

The memory model determines the maximum size of code and maximum size of data normally available.

Normally, the compiler generates code for the small memory model. If you want code for a different memory model, you use the Memory model option. See the options chapters in the H8 C Compiler Programming Guide and the H8 Assembler, Linker, and Librarian Programming Guide for details about the available memory models.

Double sizeNormally the double float is a 32-bit floating point number. Use the 64-bit IEEE option to set the double float to 64-bit floating point numbers.

OUTPUT DIRECTORIESThe General category provides an Output Directories page, to allow you to specify the paths for executable, object, and list files:

ExecutablesUse this option to override the default directory for executable files.

Option

Small (default)

Large

Page 47: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

SETTING OPTIONS GENERAL OPTIONS

EWH8-1

39

Enter the name of the directory where you want to save executable files for the project.

Object filesUse this option to override the default directory for object files.

Enter the name of the directory where you want to save object files for the project.

List filesUse this option to override the default directory for list files.

Enter the name of the directory where you want to save list files for the project.

OTHER OPTIONSFor more detailed information about setting options, see C compiler options, page 41, Assembler options, page 61 and XLINK Linker options, page 71. For information about the C-SPY options, see the H8 C-SPY User Guide, Windows Workbench Version.

Page 48: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

GENERAL OPTIONS SETTING OPTIONS

EWH8-1

40

Page 49: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

41

C COMPILER OPTIONSThis chapter explains how to use the C compiler options and gives full reference information about each option.

The options are divided into the following sections, corresponding to the pages in the ICCH8 options in the Embedded Workbench:

Code generation ListLanguage #undefDebug Include#define

Options affecting both the C compiler and the assembler are described in General options on page 37.

OPTIONS SUMMARY The following is a summary of the compiler options in the Embedded Workbench. Each option is described in the following sections. The command line options are described in the H8 C Compiler Programming Guide.

Option Section Corresponding command line option

Active lines only List -T

Add #include file text List -i

Assembly output file List -a filename

Code segment Code generation -Rname

Cross reference List -x[DFT2]

Define symbols #define -Dsymb[=value]

Disable warnings Language -w[s]

Enable language extensions Language -e

Explain C declarations List -X

Flag old-style functions Language -gA

Form-feed after function List -F

Generate debug information Debug -r[012][i][n][r][e]

Page 50: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OPTIONS SUMMARY C COMPILER OPTIONS

EWH8-1

42

Global strict type checking Language -g

H8 Specific extensions Code generation -u{arglist}

Include paths Include -Iprefix

Insert mnemonics List -q

Lines/page List -plines

Make a LIBRARY module Code generation -b

Memory model See Target, page 37 -m{sl}

Nested comments Language -C

No type info in object code Language -gO

Optimize for size Code generation -z[0-9]

Optimize for speed Code generation -s[0-9]

Preprocessor output file List -n filename

Processor See Target, page 37 -v{012}

64-bits IEEE See Target, page 37 -2

Tab spacing List -tn

Undef #undef -Usymb

Writable strings Language -y

‘//’ comments Language -K

‘char’ is ‘signed char’ Language -c

Option Section Corresponding command line option

Page 51: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS CODE GENERATION

EWH8-1

43

CODE GENERATION The Code Generation options determine the type and level of optimization for generation of object code.

MODULE HEADER NAMENormally, the internal name of the object module is the name of the source file, without directory name or extension. To set the object module name explicitly, you use the Module header name option.

This is particularly useful when several modules have the same filename, since normally the resulting duplicate module name would cause a linker error. An example is when the source file is a temporary file generated by a preprocessor.

CODE SEGMENTSets the name of the code segment.

Normally, the compiler places executable code in the segment named CODE which, by default, the linker places at a variable address. If you want to be able to specify an explicit address for the code, you use the Code segment option to specify a special code segment name which you can then assign to a fixed address in the linker command file.

Page 52: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

CODE GENERATION C COMPILER OPTIONS

EWH8-1

44

MAKE A LIBRARY MODULECauses the object file to be a library module rather than a program module.

The compiler normally produces a program module ready for linking with XLINK. Use this option to make a library module which will only be included if referenced in your program.

OPTIMIZATIONBy default, the compiler optimizes for maximum execution speed.

Use the optimization options to optimize for size or to change the optimization level.

Default optimization level for both speed and size is 3. You can change the level of optimization for maximum execution speed using the following modifiers.

Note that the Optimize for size and Optimize for speed options cannot be used at the same time.

H8-SPECIFIC EXTENSIONSEnables use of the H8-specific extensions. The following extensions are available:

Modifier Level

0 No optimization.

1–3 Fully debuggable.

4–6 Heavy optimization can make the program flow hard to follow during debug.

7–9 Full optimization.

Extension Description

Toggle run-time library function calls

Changes the type of run-time library function calls.

Max uninterruptable cycles Maximum number of uninterruptable cycles (EEPMOV).

Page 53: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS LANGUAGE

EWH8-1

45

LANGUAGE The Language options enable the use of target-dependent extensions to the C language.

ENABLE LANGUAGE EXTENSIONSEnables target-dependent extensions to the C language.

Normally, language extensions are disabled to preserve compatibility. If you are using language extensions in the source, you must enable them by including this option.

For details of language extensions, see the chapter Language extensions in the H8 C Compiler Programming Guide.

‘CHAR’ IS ‘SIGNED CHAR’Makes the char type equivalent to signed char.

Normally, the compiler interprets the char type as unsigned char. To make the compiler interpret the char type as signed char instead, for example for compatibility with a different compiler, use this option.

Note that the run-time library is compiled without the ‘char’ is ‘signed char’ option. If you use this option, you may get type mismatch warnings from the linker since the library uses unsigned chars.

Page 54: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LANGUAGE C COMPILER OPTIONS

EWH8-1

46

WRITABLE STRINGSCauses the compiler to compile string literals and other constants as initialized variables.

Normally, string literals and constants are compiled as read-only. If you want to be able to write to them, use the Writable strings option, causing them to be compiled as writable variables.

Note that arrays initialized with strings (ie char c[] = "string") are always compiled as initialized variables, and are not affected by the Writable strings option.

‘//’ COMMENTSEnables comments in C++ style, that is, comments introduced by // and extending to the end of the line.

Normally for compatibility the compiler does not accept C++ style comments. If your source includes C++ style comments, you must use the ‘//’ comments option for them to be accepted.

NESTED COMMENTSEnables nested comments.

Normally, the compiler treats nested comments as a fault and issues a warning when it encounters one, resulting for example from a failure to close a comment. If you want to use nested comments, for example to comment-out sections of code that include comments, use the Nested comments option to disable this warning.

DISABLE WARNINGSDisables compiler warning messages.

Normally, the compiler issues standard warning messages, and any additional warning messages enabled with the Global strict type checking option. To disable all warning messages, you use the Disable warnings option.

Page 55: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS LANGUAGE

EWH8-1

47

TYPE CHECKINGEnables checking of type information throughout the source.

There is a class of conditions in the source that indicate possible programming faults but which for compatibility the compiler and linker normally ignore. To cause the compiler and linker to issue a warning each time they encounter such a condition, use the Global strict type checking option.

Flag old-style functionsNormally, the Global strict type checking option does not warn of old-style K&R functions. To enable such warnings, use the Flag old-style functions option.

No type info in object codeNormally, the Global strict type checking option includes type information in the object module, increasing its size and link time, allowing the linker to issue type check warnings. To exclude this information, avoiding this increase in size and link time but inhibiting linker type check warnings, use the No type info in object code option.

When linking multiple modules, note that objects in a module compiled without type information, that is without Global strict type checking option or with Global strict type checking and Flag old-style functions options, are considered typeless. Hence there will never be any warning of a type mismatch from a declaration from a module compiled without type information, even if the module with a corresponding declaration has been compiled with type information.

The conditions checked by the Global strict type checking option are:

◆ Calls to undeclared functions.

◆ Undeclared K&R formal parameters.

◆ Missing return values in non-void functions.

◆ Unreferenced local or formal parameters.

◆ Unreferenced goto labels.

◆ Unreachable code.

◆ Unmatching or varying parameters to K&R functions.

◆ #undef on unknown symbols.

Page 56: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LANGUAGE C COMPILER OPTIONS

EWH8-1

48

◆ Valid but ambiguous initializers.

◆ Constant array indexing out of range.

ExamplesThe following examples illustrate each of these types of error.

Calls to undeclared functionsProgram:

void my_fun(void) { }

int main(void)

{

my_func();/* mis-spelt my_fun gives undeclared function warning */

return 0;

}

Error:

my_func();/* mis-spelt my_fun gives undeclared function warning */

--------^

"undecfn.c",5 Warning[23]: Undeclared function ’my_func’; assumed

"extern" "int"

Undeclared K&R formal parametersProgram:

int my_fun(parameter)/* type of parameter not declared */

{

return parameter+1;

}

Error:

int my_fun(parameter) /* type of parameter not declared */

---------------------^

"undecfp.c",1 Warning[9]: Undeclared function parameter ’parameter’;

assumed "int"

Missing return values in non-void functionsProgram:

int my_fun(void)

{

/* ... function body ... */

}

Page 57: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS LANGUAGE

EWH8-1

49

Error:

}

^

"noreturn.c",4 Warning[22]: Non-void function: explicit "return"

<expression>; expected

Unreferenced local or formal parametersProgram:

void my_fun(int parameter)/* unreferenced formal parameter */

{

int localvar;/* unreferenced local variable */

/* exit without reference to either variable */

}

Error:

}

^

"unrefpar.c",6 Warning[33]: Local or formal ’localvar’ was never

referenced

"unrefpar.c",6 Warning[33]: Local or formal ’parameter’ was never

referencedUnreferenced goto labels

Program:

int main(void)

{

/* ... function body ... */

exit: /* unreferenced label */

return 0;

}

Error:

}

^

"unreflab.c",7 Warning[13]: Unreferenced label ’exit’

Unreachable codeProgram:

#include <stdio.h>

int main(void)

{

goto exit;

Page 58: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LANGUAGE C COMPILER OPTIONS

EWH8-1

50

puts("This code is unreachable");

exit:

return 0;

}

Error:

puts("This code is unreachable");

------^

"unreach.c",7 Warning[20]: Unreachable statement(s)

Unmatching or varying parameters to K&R functionsProgram:

int my_fun(len,str)

int len;

char *str;

{

str[0]=’a’ ;

return len;

}

char buffer[99] ;

int main(void)

{

my_fun(buffer,99) ;/* wrong order of parameters */

my_fun(99) ;/* missing parameter */

return 0 ;

}

Error:

my_fun(buffer,99) ;/* wrong order of parameters */

--------------^

"varyparm.c",14 Warning[26]: Inconsistent use of K&R function - changing

type of parameter

my_fun(buffer,99) ;/* wrong order of parameters */

-----------------^

"varyparm.c",14 Warning[26]: Inconsistent use of K&R function - changing

type of parameter

my_fun(99) ;/* missing parameter */

----------^

"varyparm.c",15 Warning[25]: Inconsistent use of K&R function - varying

number of parameters

Page 59: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS LANGUAGE

EWH8-1

51

#undef on unknown symbolsProgram:

#define my_macro 99

/* Misspelt name gives a warning that the symbol is unknown */

#undef my_macor

int main(void)

{

return 0;

}

Error:

#undef my_macor

--------------^

"hundef.c",4 Warning[2]: Macro ’my_macor’ is already #undef

Valid but ambiguous initializersProgram:

typedef struct t1 {int f1; int f2;} type1;

typedef struct t2 {int f3; type1 f4; type1 f5;} type2;

typedef struct t3 {int f6; type2 f7; int f8;} type3;

type3 example = {99, {42,1,2}, 37};

Error:

type3 example = {99, {42,1,2}, 37} ;

-----------------------------------^

"ambigini.c",4 Warning[12]: Incompletely bracketed initializer

Constant array indexing out of rangeProgram:

char buffer[99] ;

int main(void)

{

buffer[500] = ’a’ ;/* Constant index out of range */

return 0;

}

Error:

buffer[500] = ’a’ ;/* Constant index out of range */

-----------^

"arrindex.c",5 Warning[28]: Constant [index] outside array bounds

Page 60: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

DEBUG C COMPILER OPTIONS

EWH8-1

52

DEBUG The Diagnostics options determine how diagnostics are classified and displayed.

GENERATE DEBUG INFORMATIONCauses the compiler to include additional information required by C-SPY and other symbolic debuggers in the object modules.

Normally the compiler does not include debugging information, for code efficiency. To make code debuggable with C-SPY, you simply include the option with no modifiers.

To make code debuggable with other debuggers, you select one or more options, as follows:

Option Description

File references (default) Generates an object file without source information.

Embedded source Includes the source in the object code.

Add #include file information Includes #include file in the object code.

Suppress source in object code Suppresses source in object code.

No register variables Suppresses the use of register variables in object code.

Page 61: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS DEBUG

EWH8-1

53

Normally the Generate debug information option does not include #include file debugging information, because this is usually of little interest, and most debuggers other than C-SPY do not support debugging inside #include files well. If you want to debug inside #include files, for example if the #include files contain function definitions rather than the more usual function declarations, you use the Add #include file information modifier. A side effect is that source line records contain the global (=total) line count which can affect source line displays in some debuggers other than C-SPY.

Using Embedded source option includes the full source file in the object code.

The Generate debug information option usually includes C source lines in the object file, so they can be displayed during debugging. If you want to suppress this to reduce the size of the object file, you use the Suppress source in object code modifier.

For most other debuggers that do not include specific information on how to use IAR Systems C Compilers, you should use the Suppress source in object code option.

Normally, the compiler tries to put locals as register variables. However, some debuggers cannot handle register variables; to suppress the use of register variables use the No register variables option.

The Code added statements options add one or two NOPs to the code generated for each statement. Only use one of these options if your debugging tool specifically requires you to do so.

Code added to statements Adds one or two NOP to the code generated for each statement.

Option Description

Page 62: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

#DEFINE C COMPILER OPTIONS

EWH8-1

54

#DEFINE The #define options allow you to define symbols and include paths for use by the C compiler.

#DEFINE Defines a symbol with the name symb and the value value. If no value is specified, 1 is used.

#define has the same effect as a #define statement at the top of the source file.

symb

is equivalent to:

#define symb

The #define option is useful for specifying a value or choice that would otherwise be specified in the source file.

For example, you could arrange your source to produce either the test or production version of your program depending on whether the symbol testver was defined. To do this you would use include sections such as:

#ifdef testver... ; additional code lines for test version only

#endif

Each value must be entered on a separate line.

Page 63: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS LIST

EWH8-1

55

LIST The List options determine whether a listing is produced, and the information included in the listing.

LIST FILEGenerates a list file with the same name and directory as the source, but with the extension .lst. The list file contents can be set using the following options:

Insert mnemonicsIncludes generated assembly lines in the listing.

Normally, the compiler does not include the generated assembly lines in the listing. If you want these to be included, for example to be able to check the efficiency of code generated by a particular statement, you use the Insert mnemonics option.

Add #include file textCauses the listing to include #include files.

Normally the listing does not include #include files, since they usually contain only header information that would waste space in the listing. To include #include files, for example because they include function definitions or preprocessed lines, you include the Add #include file text option.

Active lines onlyCauses the compiler to list only active source lines.

Page 64: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LIST C COMPILER OPTIONS

EWH8-1

56

Normally the compiler lists all source lines. To save listing space by eliminating inactive lines, such as those in false #if structures, you use the Active lines only option.

Form-feed after functionGenerates a form-feed after each listed function in the assembly listing.

Normally, the listing simply starts each function on the next line. To cause each function to appear at the top of a new page, you would include this option.

Form-feeds are never generated for functions that are not listed, for example, as in #include files.

Lines/pageCauses the listing to be formatted into pages, and specifies the number of lines per page in the range 10 to 150.

Normally, the listing is not formatted into pages. To format it into pages with a form feed at every page, you use the Lines/page option.

Tab spacingSet the number of character positions per tab stop to n, which must be in the range 2 to 9.

Normally, the listing is formatted with a tab spacing of 8 characters. If you want a different tab spacing, you set it with the Tab spacing option.

CROSS REFERENCEIncludes a cross reference list in the listing.

Normally, the compiler does not include global symbols in the listing. To include at the end of the listing a list of all variable objects, and all functions, #define statements, enum statements, and typedef statements that are referenced, you use the Include cross reference option.

When you select Cross reference the following options become available:

◆ Include unreferenced #defines.

◆ Include unreferenced enum and typedefs.

◆ Include unreferenced functions.

◆ Dual line spacing.

Page 65: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS LIST

EWH8-1

57

ASSEMBLY OUTPUT FILEGenerates assembler source to prefix source.s37.

By default the compiler does not generate an assembler source. To send assembler source to the file with the same name as the source leafname but with the extension .s37, use the Assembly output file option.

The assembler source may be assembled by the appropriate IAR assembler.

PREPROCESSOR OUTPUT FILEGenerates preprocessor output to prefix source.i.

By default the compiler does not generate preprocessor output. To send preprocessor output to the file with the same name as the source leafname but with the extension .i, use the Preprocessor output file option.

EXPLAIN C DECLARATIONSDisplays an English description of each C declaration in the file.

To obtain English descriptions of the C declarations, for example to aid the investigation of error messages, you use the Explain C declarations option.

For example, the declaration:

void (* signal(int __sig, void (* func) ())) (int);

gives the description:

Identifier: signalstorage class: extern prototyped near_func function returning near - near_func code pointer to prototyped near_func function returning near - void and having following parameter(s): storage class: auto near - int and having following parameter(s): storage class: auto near - int storage class: auto near - near_func code pointer to near_func function returning near - void

Page 66: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

#UNDEF C COMPILER OPTIONS

EWH8-1

58

#UNDEF The #undef option allows you to undefine predefined symbols.

#UNDEFRemoves the definition of the named symbol.

Normally, the compiler provides various predefined symbols. If you want to remove one of these, for example to avoid a conflict with a symbol of your own with the same name, you undefine a symbol by deselecting it in the Predefined symbols list.

For more information about the predefined symbols, see the chapter Predefined symbols reference in the H8 C Compiler Programming Guide.

Page 67: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

C COMPILER OPTIONS INCLUDE

EWH8-1

59

INCLUDE The Include option allows you to define the include path for the C compiler.

INCLUDE PATHS Adds a path to the list of #include file paths, for example:

/mylib1

Note that both / and \ can be used to specify paths.

This option may be used more than once on a single command line.

Following is the full description of the compiler’s #include file search procedure:

◆ If the #include file name is an absolute path, that file is opened.

◆ When the compiler encounters a #include file name in angle brackets such as:

#include <stdio.h>

it searches the directories specified with the Include paths option, in the order that they were specified.

◆ When the compiler encounters a #include file name in double quotes such as:

#include "vars.h"

it searches the directory of the source file, and then performs the sequence as for angle-bracketed filenames.

Page 68: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INCLUDE C COMPILER OPTIONS

EWH8-1

60

If there are nested #include files, the compiler starts searching in the directory of the file that was last included, iterating upwards for each included file, searching the source file directory last. Example:

src.c in directory dir#include “src.h”...

src.h in directory dir\h#include “io.h”...

When dir\exe is the current directory, use the following command for compilation:

..\dir\h

Then the following directories are searched for the io.h file, in the following order:

dir\h Current file.

dir File including current file.

dir\h As specified with the Include paths option.

Page 69: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

61

ASSEMBLER OPTIONSThis chapter explains how to set the assembler options.

The options are divided into the following sections, corresponding to the pages in the AH8 and General options in the Embedded Workbench:

Code generation #defineList #undefInclude

Options affecting both the C compiler and the assembler are described in the General options chapter on page 37.

OPTIONS SUMMARY The following is a summary of the assembler options. Each option is described in detail in the following sections. The command line options are described in the H8 Assembler, Linker, and Librarian Programming Guide.

Option Section Corresponding command line option

#included text List -i

Assembled lines only List -T

C style expression Code generation -C

Case sensitive user symbols Code generation -s{+|-}

Define symbol #define -Dsymb[=value]

Generate debug information Debug -r{en}

Include cross reference List -x{DI2}

Include paths Include -Iprefix

Lines/page List -plines

List to named file List -l filename

List to prefixed source name List -L[prefix]

Macro execution info List -B

Macro quote chars Code generation -Mab

Page 70: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

CODE GENERATION ASSEMBLER OPTIONS

EWH8-1

62

CODE GENERATION These options control the assembler’s code generation.

CASE SENSITIVE USER SYMBOLSSets whether the assembler is sensitive to the case of user symbols.

By default, case sensitivity is on. This means that, for example, LABEL and label refer to different symbols. You can deselect Case insensitive user symbols to turn case sensitivity off, in which case LABEL and label will refer to the same symbol.

MAKE A LIBRARY MODULECauses the object file to be a library module rather than a program module.

Make a LIBRARY module Code generation -b

Maximum number of errors Code generation -Enumber

Memory model See Target, page 37 -m{sl}

No header List -N

Processor configuration See Target, page 37 -v{012}

Tab spacing List -tn

Undefine symbol #undef -Usymb

Option Section Corresponding command line option

Page 71: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

ASSEMBLER OPTIONS CODE GENERATION

EWH8-1

63

By default, the assembler produces a program module ready to be linked with XLIB. You use the Make a library module option if you want it to make a library module for use with XLIB.

If the NAME directive is used in the source (to specify the name of the program module), the Make a library module option is ignored, that is the assembler produces a program module regardless of the Make a library module option.

C STYLE EXPRESSIONEnables C style expressions. By default the assembler supports the following operators:

By enabling the C style Expression option, the following operators are made available:

MAXIMUM NUMBER OF ERRORSSets the maximum number of errors the assembler reports.

By default, the maximum number is 100. The Maximum number of errors option allows you to decrease or increase this number, for example, to see more errors in a single assembly.

Operator Description Precedence

|| logical or 6

| logical or 5

&& logical and 5

Operator Description Precedence

~ binary not 1

|| logical or 6

| binary or 6

^ binary xor 6

== equal 7

&& logical and 5

& binary and 5

Page 72: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

CODE GENERATION ASSEMBLER OPTIONS

EWH8-1

64

WARNINGSBy default, the assembler displays a warning message when it finds an element of the source which is legal, but probably the result of a programming error (see Assembler diagnostics in the H8 Assembler, Linker, and Librarian Programming Guide for details).

The Enable warnings option enables all warnings. By setting a warning number in Just warning, only that warning will be enabled. By setting a range in Warnings from/to, a specific range of warnings will be enabled.

The Disable warnings option disables all warnings. By setting a warning number in Just warning, only that specific warning will be disabled. By setting a range in Warnings from/to, that range of warnings will be disabled.

MACRO QUOTE CHARSSets the characters used for the left and right quotes of each macro argument to a and b respectively.

By default, the characters are < and >. The Macro quote chars option allows you to change the quote characters to suit an alternative convention or simply to allow a macro argument to contain < or > themselves.

You can select one of four types of brackets from the drop-down list as the macro quote characters:

Page 73: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

ASSEMBLER OPTIONS DEBUG

EWH8-1

65

DEBUG These options control generation of debug information.

GENERATE DEBUG INFORMATIONEnables the inclusion of information that allows a debugger (such as C-SPY) to be used on the program.

By default, the assembler does not generate debug information, to reduce the size and link time of the object file. You must use the Generate debug information option if you want to use a debugger with the program.

Using the File references modifier will generate an object file without source information; symbol information will be available.

Using the Embedded source modifier includes the full source file into the object file.

Page 74: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

#define ASSEMBLER OPTIONS

EWH8-1

66

#define This option allows you to define symbols.

#DEFINEDefines a symbol with name and value. If no value is specified, 1 is used.

The #define option allows a value or choice that would otherwise have to be specified in the source file. For example, you could arrange your source to produce either the test or production version of your program dependent on whether the symbol testver was defined. To do this you would use include sections such as:

#ifdef testver... ; additional code lines for test version only#endif

Page 75: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

ASSEMBLER OPTIONS LIST

EWH8-1

67

LIST The List options are used to cause the assembler to generate a listing, to select the contents of the listing, and to generate other listing-type output.

LIST FILECauses the assembler to generate a listing and send it to the file sourcename.lst.

When List file is selected the following list options become available:

Selecting Include listing makes the following options available:

Option Description

Include header Includes a header in the listing.

Include listing Includes the body of the listing.

Option Description

#included text Includes #include files in the listing.

Macro expansions Includes macro expansions in the listing.

Assembled lines only Includes only assembled lines in the listing.

No structured assembler list Prints the assembler code without structure.

List individual cycle count Includes individual cycle counts in the listing.

Page 76: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LIST ASSEMBLER OPTIONS

EWH8-1

68

INCLUDE CROSS-REFERENCE Causes the assembler to generate a cross-reference list at the end of the listing. See the chapter Assembler file formats in the H8 Assembler, Linker, and Librarian Programming Guide for details.

The following options are available when generating a cross reference listing:

LINES/PAGESets the number of lines per page, which must be in the range 10 to 150.

TAB SPACING Sets the number of character positions per tab stop, which must be in the range 2 to 9.

By default, the assembler sets eight character positions per tab stop.

Macro definitions Includes macro definitions in the listing.

Macro execution info Prints macro execution information on every call of a macro.

Multiline code Lists the code generated by directives on several lines if necessary.

Assembled lines only Lists only assembled lines.

Option

#defines

Internal symbols

Dual line spacing

Option Description

Page 77: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

ASSEMBLER OPTIONS #undef

EWH8-1

69

#undef The #undef option allows you to undefine the predefined symbols.

#UNDEFUndefines a predefined symbol.

By default, the assembler provides certain predefined symbols; see the chapter Predefined symbols reference in the H8 Assembler, Linker, and Librarian Programming Guide. The #undef option allows you to undefine such a predefined symbol to make its name available for your own use through a subsequent #define option or source definition.

To undefine a symbol, deselect it in the Predefined symbols list.

Page 78: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INCLUDE ASSEMBLER OPTIONS

EWH8-1

70

INCLUDE The Include option allows you to define the include path for the assembler.

INCLUDE PATHS Adds the #include file search prefix prefix.

By default, the assembler searches for #include files only in the current working directory. The Include paths option allows you to give the assembler the names of directories which it will also search if it fails to find the file in the current working directory.

Page 79: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

71

XLINK LINKER OPTIONSXLINK options allow you to control the operation of XLINK from the command line or from the Embedded Workbench.

The options are divided into the following sections, corresponding to the pages in the XLINK options in the Embedded Workbench version:

Output Include#define InputDiagnostics ProcessingList

For information about the command line and segment controll options, see the chapter XLINK Linker in the H8 Assembler, Linker, and Librarian Programming Guide.

SUMMARY OF OPTIONS

The following is a summary of the XLINK options. Each option is described in detail in the following sections.

Option Section Corresponding command line option

Load as PROGRAM Input -A file,…

Always generate output Diagnostics -B

Load as LIBRARY Input -C file, …

Define symbol #define -Dsymbol=value

Inherent, no object code Input -E file,…

Output format Output -Fformat

XCL filename Include -f file

No global type checking Diagnostics -G

Fill unused code memory Processing -Hhexvalue

Include paths Include -Ipathname

Generate checksum Processing -Jsize,method[,comp]

Output file Output -o file

Page 80: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OUTPUT XLINK LINKER OPTIONS

EWH8-1

72

OUTPUT The output options are used to specify the output format and the level of debugging information.

OUTPUT FILEUse Output file to override the the default output file by specifying the name of the XLINK output file. If a name is not specified the linker will use the name aout.hex. If a name is supplied without a file type, the default file type for the selected output format in Output format option will be used.

If a format is selected that generates two output files, the user-specified file type will only affect the primary output file (first format).

Lines/page List -plines

Disable range check Diagnostics -R

Debug info Output -r

Debug info with terminal I/O Output -rt

Disable warnings Diagnostics -w[n|s|t]

Format variant Output -Y[char] -y[chars]

Segment overlap warnings Diagnostics -z

Option Section Corresponding command line option

Page 81: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

XLINK LINKER OPTIONS OUTPUT

EWH8-1

73

FORMAT

Debug infoUse Debug info to output a file in DEBUG (UBROF) format, with a .d37 extension, to be used with the C-SPY debugger. For emulators that support the IAR Systems DEBUG format, choose Other and debug(ubrof) format from the Output format list box.

Using the debug(ubrof) format will generate UBROF output matching the latest UBROF format version in the input. Using ubrof5(forced) or ubrof6(forced) will force output of the specified version of the format irrespective of the input.

Debug info with terminal I/OUse Debug info with terminal I/O to use the output file with the C-SPY debugger and emulate terminal I/O.

Output formatUse Output format to select the output format.

The parameter should be one of the supported XLINK output formats; for details of the formats see the chapter XLINK output formats in the H8 Assembler, Linker, and Librarian Programming Guide.

If not specified, the default Motorola format will be used.

Note that specifying the Output format option as DEBUG does not include C-SPY debug support. Use the Debug info option instead.

Format variantUse Format variant to select enhancements available for some output formats. For more information, see the chapter XLINK output formats in the H8 Assembler, Linker, and Librarian Programming Guide.

The Format variant options depend on the output format chosen.

Page 82: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

#define XLINK LINKER OPTIONS

EWH8-1

74

#define The #define option allows you to define symbols.

DEFINE SYMBOLUse Define symbol to define absolute symbols at link time. This is especially useful for configuration purposes. Any number of symbols can be defined using the XCL file mode of XLINK operation. The symbol(s) defined in this manner will belong to a special module generated by the linker called ?ABS_ENTRY_MOD.

XLINK will display an error message if you attempt to redefine an existing symbol.

Page 83: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

XLINK LINKER OPTIONS DIAGNOSTICS

EWH8-1

75

DIAGNOSTICS The Diagnostics options determine the error and warning messages generated by the XLINK Linker.

ALWAYS GENERATE OUTPUTUse Always generate output to generate an output file even if a non-fatal error was encountered during the linking process, such as a missing global entry or a duplicate declaration. Normally, XLINK will not generate an output file if an error is encountered. Note that XLINK always aborts on fatal errors, even with the Always generate output option.

The Always generate output option allows missing entries to be patched in later in the absolute output image.

DISABLE RANGE CHECKUse Disable range check to disable the address range check.

If an address is relocated out of the target CPU’s address range (code, external data, or internal data address) an error message is generated. This usually indicates an error in an assembly language module or in the segment placement.

SEGMENT OVERLAP WARNINGSUse Segment overlap warnings to reduce segment overlap errors to warnings, making it possible to produce cross-reference maps, etc.

Page 84: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

LIST XLINK LINKER OPTIONS

EWH8-1

76

NO GLOBAL TYPE CHECKINGUse No global type checking to disable type checking at link time. While a well-written program should not need this option, there may be occasions where it is helpful.

By default, XLINK performs link-time type checking between modules by comparing the external references to an entry with the PUBLIC entry (if the information exists in the object modules involved). A warning is printed if there are mismatches.

WARNINGSUse Disable to suppress specified warning messages.

The optional argument specifies which warning to disable; for example, to disable warnings 3 and 7:

3,7

Use Disable all warnings to suppress all warning messages.

LIST The List options determine the generation of an XLINK cross-reference listing.

GENERATE LINKER LISTINGCauses the linker to generate a listing and send it to the file project.lst.

Page 85: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

XLINK LINKER OPTIONS INCLUDE

EWH8-1

77

The following options are available:

LINES/PAGESets the number of lines per page for the XLINK listings, which must be in the range 10 to 150.

INCLUDE The Include option allows you to set the include path for linker command files, and specify the linker command file.

INCLUDE PATHSSpecifies a pathname to be searched for object files.

By default, XLINK searches for object files only in the current working directory. The Include paths option allows you to specify the names of the directories which it will also search if it fails to find the file in the current working directory.

Workbench option Description

Segment map A list of all the segments in dump order.

Symbol listing An abbreviated list of every entry (global symbol) in every module. This entry map is useful for quickly finding the address of a routine or data element.

Module map A list of all segments, local symbols, and entries (public symbols) for every module in the program.

Page 86: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INPUT XLINK LINKER OPTIONS

EWH8-1

78

This is equivalent to the XLINK_DFLTDIR command line option; see the H8 Command Line Interface Guide.

XCL FILENAMEA default XCL file is selected automatically for the General Target memory model and processor configuration selected. You can override this by selecting Override default, and then specifying an alternative file.

Note that you can include C-style /*...*/ or // comments in XCL files.

INPUT The Input options define the status of input modules.

INHERENTUse Inherent to link files normally, and generate output code.

INHERENT, NO OBJECT CODEUse Inherent, no object code to empty load specified input files; they will be processed normally in all regards by the linker but output code will not be generated for these files.

One potential use for this feature is in creating separate output files for programming multiple EPROMs. This is done by empty loading all input files except the ones you want to appear in the output file.

Page 87: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

XLINK LINKER OPTIONS PROCESSING

EWH8-1

79

LOAD AS PROGRAMUse Load as PROGRAM to temporarily force all of the modules within the specified input files to be loaded as if they were all program modules, even if some of the modules have the LIBRARY attribute.

This option is particularly suited for testing library modules before they are installed in a library file, since the Load as PROGRAM option will override an existing library module with the same entries. In other words, XLINK will load the module from the input file specified in the Load as PROGRAM argument instead of one with an entry with the same name in a library module.

LOAD AS LIBRARYUse Load as library to temporarily cause all of the modules within the specified input files to be treated as if they were all library modules, even if some of the modules have the PROGRAM attribute. This means that the modules in the input files will be loaded only if they contain an entry that is referenced by another loaded module.

PROCESSING The Processing options allow you to specify additional options determining how the code is generated.

FILL UNUSED CODE MEMORYUse Fill unused code memory to fill all gaps between segment parts introduced by the linker with the Filler byte value . The linker can introduce gaps either because of alignment restriction, or at the end of ranges given in segment placement options.

Page 88: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

PROCESSING XLINK LINKER OPTIONS

EWH8-1

80

The normal behavior, when no Fill unused code memory option is given, is that these gaps are not given a value in the output file.

GENERATE CHECKSUMUse Generate checksum to checksum all generated raw data bytes. This option can only be used if the Fill unused code memory option has been specified.

Size specifies the number of bytes in the checksum, and can be 1, 2, or 4.

Method specifies the algorithm used, and can be one of the following:

Complement can be set as is or to one’s or two’s complement.

In all cases it is the least significant 1,2, or 4 bytes of the result that will be output, in the natural byte order for the processor. The CRC checksum is calculated as if the following code was called for each bit in the input, starting with a CRC of 0:

unsigned longcrc(int bit, unsigned long oldcrc){ unsigned long newcrc = (oldcrc << 1) ^ bit; if (oldcrc & 0x80000000) newcrc ^= POLY; return newcrc;}

POLY is the generating polynomial. The checksum is the result of the final call to this routine. If complement is specified, the checksum is the one’s or two’s compliment of the result.

The linker will place the checksum byte(s) at the label __checksum in the segment CHECKSUM. This segment must be placed using the segment placement options like any other segment.

Method Description

Arithmetic sum Simple arithmetic sum.

Crc16 CRC16 (generating polynomial 0x11021).

Crc32 CRC32 (generating polynomial 0x104C11DB7).

Crc polynomial CRC with a generating polynomial of specified value.

Page 89: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EWH8-1

83

REFERENCEThis chapter provides complete reference information about the H8 Embedded Workbench.

It first gives information about the components of the Workbench window, and each of the different types of window it encloses.

It then gives details of the menus, and the commands on each menu.

THE EMBEDDED WORKBENCH WINDOW

The following illustration shows the different components of the Embedded Workbench window.

Messageswindow

Binarybrowsewindow

Project window

Editor window

Projectbar

Menu barEdit bar

Status bar

Page 90: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

THE EMBEDDED WORKBENCH WINDOW REFERENCE

EWH8-1

84

These components are explained in greater detail in the following sections.

MENU BARGives access to the Embedded Workbench menus.

The menus are described in greater detail on the following pages.

Menu Description

File The File menu provides commands for opening projects and source files, saving and printing, and exiting from the Embedded Workbench.

Edit The Edit menu provides commands for editing and searching in editor windows.

View The commands on the View menu allow you to change the information displayed in the Embedded Workbench window.

Project The Project menu provides commands for adding files to a project, creating groups, and running the IAR tools on the current project.

Tools The Tools menu is a user-configurable menu to which you can add tools for use with the Embedded Workbench.

Options The Options menu allows you to customize the Embedded Workbench to your requirements.

Window The commands on the Window menu allow you to manipulate the Embedded Workbench windows and change their arrangements on the screen.

Help The commands on the Help menu provides help about the Embedded Workbench.

Page 91: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE THE EMBEDDED WORKBENCH WINDOW

EWH8-1

85

TOOLBARSThe Embedded Workbench window contains two toolbars:

◆ The edit bar.

◆ The project bar.

The edit bar provides buttons for the most useful commands on the Embedded Workbench menus, and a text box for entering a string to do a toolbar search.

The project bar provides buttons for the build and debug options on the Project menu.

You can move either toolbar to a different position in the Embedded Workbench window, or convert it to a floating palette, by dragging it with the mouse.

You can display a description of any button by pointing to it with the mouse button. When a command is not available the corresponding toolbar button will be grayed out, and you will not be able to select it.

Edit barThe following illustration shows the menu commands corresponding to each of the edit bar buttons:

New Save Cut Paste

Toolbar search text Find GotoOpen Print Copy

Redo

Undo

Toolbar search

Replace

Page 92: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

THE EMBEDDED WORKBENCH WINDOW REFERENCE

EWH8-1

86

Toolbar searchTo search for text in the frontmost editor window enter the text in the Toolbar search text box, and press R or click the Toolbar search button.

Alternatively, you can select a string you have previously searched for from the drop-down list box.

You can choose whether or not the edit bar is displayed using the Edit Bar command on the View menu.

Project barThe following illustration shows the menu command corresponding to each of the project bar buttons:

You can choose whether or not the project bar is displayed using the Project Bar command on the View menu.

Make Debugger

Compile Stop building Split

Cascade

Tile

Tile Help

Page 93: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE THE EMBEDDED WORKBENCH WINDOW

EWH8-1

87

PROJECT WINDOWThe Project window shows the name of the current project and a tree representation of the groups and files included in the project.

Pressing the right mouse button in the Project window displays a pop-up menu which gives you convenient access to several useful commands. Save As Text... allows you to save a textual description of the project, including all options that you have specified.

Pin buttonThe Pin button, in the top right corner of the Project window, allows you to pin the window to the desktop so that it is not affected by the Tile or Cascade commands on the Window menu.

TargetsThe top node in the tree shows the current target. You can change the target by choosing a different target from the Targets drop-down list box at the top of the Project window. Each target corresponds to a different version of your project that you want to compile or assemble. For example, you might have a target called Debug, which includes debugging code, and one called Release, with the debugging code omitted.

You can expand the tree by double-clicking on the target icon, or by clicking on the symbol, to display the groups included in this target.

GroupsGroups are used to collect together related source files. Each group may be included in one or more targets, and a source file can be present in one or more groups.

Pin button

Page 94: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

THE EMBEDDED WORKBENCH WINDOW REFERENCE

EWH8-1

88

Source filesYou can expand each group by double-clicking on its icon, or by clicking on the symbol, to show the list of source files it contains.

Once a project has been successfully built any include files are displayed in the structure below the source file that included them. Note that the include files associated with a particular source file may depend on which target the source file appears in, since preprocessor or directory options may affect which include files are associated with a particular source file.

Editing a fileTo edit a source or include file, double-click its icon in the Project window tree display.

Moving a source file between groupsYou can move a source file between two groups by dragging its icon between the group icons in the Project window tree display.

Removing items from a projectTo remove an item from a project, click on it to select it, and then press d.

To remove a file from a project you can also use the Project Files dialog box, displayed by choosing Files… from the Project menu.

Page 95: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE THE EMBEDDED WORKBENCH WINDOW

EWH8-1

89

EDITOR WINDOWSource files are displayed in the editor window. The Embedded Workbench editor automatically recognizes the syntax of C programs, and displays the different components of the C program in different text styles.

The following table shows the default styles used for each component of a C program:

Item Style

Default Black plain

C Keyword Black bold

Strings Blue

Preprocessor Green

Integer (dec) Red

Integer (oct) Magenta

Integer (hex) Magenta

Real Blue

C++ Dark blue italic

Comment Dark blue italic

Page 96: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

THE EMBEDDED WORKBENCH WINDOW REFERENCE

EWH8-1

90

To change these styles choose Settings… from the Options menu, and then select the Colors and Fonts page in the Settings dialog box, see Colors and Fonts, page 113.

Note that the Embedded Workbench editor can also be used for editing plain text files, such as Read-Me files.

Auto indentThe editor automatically indents a line to the same indent as the previous line, making it easy to lay out programs in a structured way.

Matching bracketsWhen the cursor is next to a bracket you can automatically find the matching bracket by choosing Match Brackets from the Edit menu.

Read-only and modification indicatorsThe name of the open source file is displayed in the editor window title bar.

When a file has been modified after it was last saved, an asterisk appears after the the window title, for example Common *.

If a file is read-only, the text (Read Only) appears after the file name, for example Common (Read Only).

Editor optionsThe Embedded Workbench editor provides a number of special features, each of which can be enabled or disabled independently in the Editor page of the Settings dialog box. For more information see Editor, page 109.

Page 97: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE THE EMBEDDED WORKBENCH WINDOW

EWH8-1

91

Editor key summaryThe following tables summarize the editor’s keyboard commands:

Use the following keys and key combinations for moving the insertion point:

Use the following keys and key combinations for scrolling text:

Use the following key combinations for selecting text:

To move the insertion point Press

One character left <

>

c<

c>

^

V

H

n

cH

cn

One character right

One word left

One word right

One line up

One line down

To the start of the line

To the end of the line

To the first line in the file

To the last line in the file

To scroll Press

Up one line c^

cVDown one line

Up one page P

pDown one page

To select Press

The character to the left S<

S>The character to the right

One word to the left Sc<

Sc>One word to the right

Page 98: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

THE EMBEDDED WORKBENCH WINDOW REFERENCE

EWH8-1

92

Splitting the editor window into panesYou can split the editor window horizontally or vertically into multiple panes, to allow you to look at two different parts of the same source file at once, or cut and paste text between two different parts.

To split the window drag the appropriate splitter control to the middle of the window:

To revert to a single pane double-click the appropriate splitter control, or drag it back to the end of the scroll bar.

You can also split a window into panes using the Split command on the Window menu.

To the same position on the previous line S^

To the same position on the next line SV

To the start of the line SH

To the end of the line Sn

One screen up SP

One screen down Sp

To the beginning of the file ScH

To the end of the file Scn

To select Press

Splitter control

Page 99: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE THE EMBEDDED WORKBENCH WINDOW

EWH8-1

93

STATUS BARDisplays the status of the Embedded Workbench, and the state of the modifier keys.

As you are editing in the editor window the status bar shows the current line and column number containing the cursor, and the ç, N, and ß status:

You can choose whether or not the status bar is displayed using the Status Bar command on the View menu.

MESSAGES WINDOWThe Messages window shows the output from different Embedded Workbench commands. The window is divided into multiple pages and you select the appropriate page by clicking on the corresponding tab.

Pressing the right mouse button in the Messages window displays a pop-up menu which allows you to save the contents of the window as a text file.

Pin buttonThe Pin button, in the top right corner of the Messages window, allows you to pin the window to the desktop so that it is not affected by the Tile or Cascade commands on the Window menu.

Pin button

Page 100: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

THE EMBEDDED WORKBENCH WINDOW REFERENCE

EWH8-1

94

BuildBuild shows the messages generated when building a project. Double-clicking a message in the Build panel opens the appropriate file for editing, with the cursor at the correct position.

Find in FilesFind in Files displays the output from the Find in Files… command on the Edit menu. Double-clicking an entry in the panel opens the appropriate file with the cursor positioned at the correct location.

Tool OutputTool Output displays any messages output by user-defined tools in the Tools menu.

BINARY BROWSE WINDOWThe Binary Browse window displays the contents of a binary file as hexadecimal data, with its ASCII equivalent to the right of each line. To display binary data choose Browse Binary Data… from the Tools menu.

Page 101: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE FILE MENU

EWH8-1

95

FILE MENU The File menu provides commands for opening projects and source files, saving and printing, and exiting from the Embedded Workbench.

The menu also includes a numbered list of the most recently opened files to allow you to open one by selecting its name from the menu.

NEW…Displays the following dialog box to allow you to specify whether you want to create a new project, or a new text file:

Choosing Source/Text opens a new Editor window to allow you to enter a text file.

Choosing Project displays the following dialog box to allow you to specify a name for the project and the target CPU family:

The project will then be displayed in a new Project window.

By default new projects are created with two targets, Release and Debug.

OPEN…Displays a standard Open dialog box to allow you to select a text or project file to open. Opening a new project file automatically closes and saves any currently-open project.

Page 102: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

FILE MENU REFERENCE

EWH8-1

96

CLOSECloses the active window.

You will be warned if a text document has changed since it was last saved, and given the opportunity to save it before closing. Projects are saved automatically.

SAVESaves the current text or project document.

SAVE AS…Displays the standard Save As dialog box to allow you to save the active document with a different name

SAVE ALLSaves all open text documents.

PRINT…Displays the standard Print dialog box to allow you to print a text document.

PRINT SETUP…Displays the standard Print Setup dialog box to allow you to set up the printer before printing.

EXITExits from the Embedded Workbench. You will be asked whether to save any changes to text windows before closing them. Changes to the project are saved automatically.

Page 103: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE EDIT MENU

EWH8-1

97

EDIT MENU The Edit menu provides commands for editing and searching in editor windows.

UNDOUndoes the last edit made to the current editor window.

REDORedoes the last Undo in the current editor window.

You can undo and redo an unlimited number of edits independently in each editor window.

CUT, COPY, PASTEProvide the standard Windows functions for editing text within editor windows and dialog boxes.

FIND…Displays the following dialog box to allow you to search for text within the current editor window:

Enter the text to search for in the Find What text box.

Select Match Whole Word Only to find the specified text only if it occurs as a separate word. Otherwise int will also find print, sprintf etc.

Select Match Case to find only occurrences that exactly match the case of the specified text. Otherwise specifying int will also find INT and Int.

Select Up or Down to specify the direction of the search.

Choose Find Next to find the next occurrence of the text you have specified.

Page 104: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

EDIT MENU REFERENCE

EWH8-1

98

REPLACE…Allows you to search for a specified string and replace each occurrence with another string.

Enter the text to replace each found occurrence in the Replace With box. The other options are identical to those for Find….

Choose Find Next to find the next occurrence, and Replace to replace it with the specified text. Alternatively choose Replace All to replace all occurrences in the current editor window.

FIND IN FILES…Allows you to search for a specified string in multiple text files. The following dialog box allows you to specify the criteria for the search:

Page 105: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE EDIT MENU

EWH8-1

99

Specify the string you want to search for in the Search String text box, or select a string you have previously searched for from the drop-down list box.

Select Match Whole Word or Match Case to restrict the search to the occurrences that match as a whole word or match exactly in case, respectively.

Select each file you want to search in the File Name list, and choose Add to add it to the Selected Files list.

You can add all the files in the File Name list by choosing Add All, or you can select multiple files using the S and c keys and choose Add to add the files you have selected. Likewise you can remove files from the Selected Files list using the Remove and Remove All buttons.

When you have selected the files you want to search choose Find to proceed with the search. All the matching occurrences are listed in the Messages window. You can then very simply edit each occurrence by double-clicking it:

This opens the corresponding file in an editor window with the cursor positioned at the start of the line containing the specified text:

Page 106: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

VIEW MENU REFERENCE

EWH8-1

100

MATCH BRACKETSIf the cursor is positioned next to a bracket this command moves the cursor to the matching bracket, or beeps if there is no matching bracket.

VIEW MENU The commands on the View menu allows you to change the information displayed in the Embedded Workbench window.

EDIT BARToggles the edit bar on and off.

PROJECT BARToggles the project bar on and off.

STATUS BARToggles the status bar on and off.

GOTO LINE…Displays the following dialog box to allow you to move the cursor to a specified line and column in the current editor window:

Page 107: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE PROJECT MENU

EWH8-1

101

PROJECT MENU The Project menu provides commands for adding files to a project, creating groups, and running the IAR tools on the current project.

FILES…Displays the following dialog box to allow you to edit the contents of the current project:

The Add to Group drop-down list box shows all the groups included in the current target. Select the one you want to edit, and the files currently in that group are displayed in the Files in Group list at the bottom of the dialog box.

The upper part of the Project Files dialog box is a standard file dialog box, to allow you to locate and select the files you want to add to each particular group.

Adding files to a groupTo add files to the currently displayed group select them using the standard file controls in the upper half of the dialog box and choose the Add button, or choose Add All to add all the files in the File Name list box.

Page 108: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

PROJECT MENU REFERENCE

EWH8-1

102

Removing files from a groupTo remove files from the currently displayed group select them in the Files in Group list and choose Remove, or choose Remove All to remove all the files from the group.

You can use the Project Files dialog box to make changes to several groups. Choosing Done will then apply all the changes to the project. Alternatively, choosing Cancel will discard all the changes and leave the project unaffected.

Source file pathsThe Embedded Workbench supports relative source file paths to a certain degree.

If a source file is located in the project file directory or in any subdirectory of the project file directory, the Embedded Workbench will use a path relative to the project file when accessing the source file.

NEW GROUP…Displays the following dialog box to allow you to create a new group:

Specify the name of the group you want to create in the Group Name text box. Select the targets to which you want to add the new group in the Add to Targets list. By default the group is added to all targets.

Page 109: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE PROJECT MENU

EWH8-1

103

TARGETS…Displays the following dialog box to allow you to create new targets, and display or change the groups included in each target:

To create a new target click New… and enter a name for the new target.

To delete a target select it and click Delete.

To view the groups included in a target select it in the Targets list.

The groups are shown in the Included Groups list, and you can add or remove groups using the arrow buttons:

OPTIONS…Displays the Options dialog box to allow you to set directory and compiler options on the selected item in the Project window.

You can set options on the entire target, on a group of files, or on an individual file.

See the chapter Setting options, page 35.

COMPILECompiles or assembles the currently active file as appropriate.

Page 110: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

PROJECT MENU REFERENCE

EWH8-1

104

You can compile a file by selecting its icon in the Project window and choosing Compile. Alternatively, you can compile the file in the currently active editor window provided it is a member of the current target.

MAKEBrings the current target up to date by compiling, assembling, and linking only those files as necessary.

LINKExplicitly re-links the current target.

BUILD ALLMarks all the components of the current target as having changed, and then runs Make to re-build and re-link all files in the current target.

STOP BUILDStops the current build operation.

LIBRARIANRuns the XLIB Librarian to allow you to perform operations on library modules in library files.

DEBUGGERRuns the optional C-SPY for Windows debugger so that you can debug the project object file.

You can specify the version of C-SPY to run in the Debug options for the target. If necessary a Make will be performed before running C-SPY to ensure that the project is up to date.

Page 111: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE TOOLS MENU

EWH8-1

105

TOOLS MENU The Tools menu is a user-configurable menu to which you can add tools for use with the Embedded Workbench.

ADD TOOL…Add Tool… displays the following dialog box to allow you to specify a user-defined tool to add to the menu:

Specify the text for the menu item in the Menu Text box, and the command to be run when you select the item in the Command text box. Alternatively, choose Browse to display a standard file dialog box to allow you to locate an executable file on disk and add its path to the Command text box.

Specify the argument for the command in the Argument text box, or select Prompt for Command Line to display a prompt for the command line argument when the command is selected from the Tools menu.

Variables can be used in the arguments, allowing you to set up useful tools like interfacing to a command-line revision control system, or running an external tool on the selected file.

The following variables can be used:

Variable Description

$FILE_PATH$ Full path of active file (in editor, project, or message window)

Page 112: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TOOLS MENU REFERENCE

EWH8-1

106

The Initial Directory text box allows you to specify an initial working directory for the tool.

Select Redirect to Output Window to display any console output from the tool in the Tools window. Note that tools that require user input or make special assumptions regarding the console that they execute in, will not work if you set this option.

When you have specified the command you want to add choose Add to add it to the Menu Content list. You can remove a command from the Tools menu by selecting it in this list and choosing Remove.

To confirm the changes you have made to the Tools menu and close the dialog box choose OK.

$FILE_FNAME$ File name of active file without path

$FILE_DIR$ Directory of active file, no file name

$CUR_LINE$ Current line

$TARGET_PATH$ Full path of primary output file

$TARGET_FNAME$ Filename without path of primary output file

$TARGET_DIR$ Directory of primary output file

$EXE_DIR$ Directory for exe output

$OBJ_DIR$ Directory for obj output

$LIST_DIR$ Directory for list output

$PROJ_PATH$ Full path of project file

$PROJ_FNAME$ Project file name without path

$PROJ_DIR$ Project directory

$CUR_DIR$ Current directory

Variable Description

Page 113: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE TOOLS MENU

EWH8-1

107

The menu items you have specified will then be displayed in the Tools menu:

Specifying MS-DOS commands or batch filesMS-DOS commands or batch files need to be run from a command shell, so to add these to the Tools menu you need to specify an appropriate command shell in the Command text box, and the MS-DOS command or batch file name in the Argument text box.

The command shells are specified as follows:

The Argument text should be specified as:

/C name

where name is the name of the MS-DOS command or batch file you want to run.

The /C option terminates the shell after execution, to allow the Embedded Workbench to detect when the tool has completed.

For example, to add the command Backup to the Tools menu to make a copy of the entire project directory to a network drive, you would specify Command as command and Argument as:

/C copy c:\project\*.* F:

or

/C copy $PROJ_DIR$\*.* F:

System Command shell

Windows 95/98 command.com

Windows NT cmd.exe (recommended) or command.com

Page 114: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

TOOLS MENU REFERENCE

EWH8-1

108

BROWSE BINARY DATA…Lists a file in binary and ASCII format for browsing and debugging. It displays a standard file dialog box to allow you to select a file, and then displays it in a Browse window:

Note that you cannot edit the contents of the Browse window.

RECORD MACROAllows you to record a sequence of editor keystrokes as a macro.

STOP RECORD MACROEnds the recording of a macro.

PLAY MACROReplays the macro you have recorded.

Page 115: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE OPTIONS MENU

EWH8-1

109

OPTIONS MENU The Options menu Settings… command allows you to customize the Embedded Workbench to your own requirements.

SETTINGS…Displays the Settings dialog box to allow you to customize the Embedded Workbench.

Select the feature you want to customize by clicking the Editor, Key Bindings, Colors and Fonts, or Make Control tabs.

EditorAllows you to change the editor options:

The Editor panel provides the following options:

Options Descriptions

Tab Spaces Specifies the number of character spaces corresponding to each tab.

Syntax Highlighting Displays the syntax of C programs in different text styles.

Show Bookmarks Indicates compiler errors and Find in Files... search results.

Show Line Number Displays line numbers in editor windows.

Page 116: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OPTIONS MENU REFERENCE

EWH8-1

110

An external editor can be called either by passing command line parameters or by using DDE (Windows Dynamic Data Exchange).

Selecting Type: Command Line will call the external editor by passing command line parameters.

Provide the file name and path of your external editor in the Editor field. A browse button is available for your convenience. Then specify the command line to pass to the editor in the Arguments field, for example:

Note that variables can be used in arguments, see page 105 for information about the argument variables available.

Selecting Type: DDE will call the external editor by using DDE.

Provide the file name and path of your external editor in the Editor field. A browse button is available for your convenience.

Scan for Changed Files The editor will check if files have been modified by some other tool and automatically reload them. If a file has been modified in the Embedded Workbench, you will be prompted first.

Use External Editor Starts an external editor when your open a file in the project or Message window.

Options Descriptions

Page 117: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE OPTIONS MENU

EWH8-1

111

Specify the DDE service name used by the editor in the Service field. Then specify a sequence of command strings to send to the editor in the Command field. The command strings should be entered as:

DDE-Topic CommandStringDDE-Topic CommandString

as in the following example, which applies to Codewright:

The service name and command strings depend on the external editor that you are using. Refer to the editor’s user documentation to find the appropriate settings.

Note that variables can be used in the arguments, see page 105 for more information about the argument variables available.

Page 118: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OPTIONS MENU REFERENCE

EWH8-1

112

Key BindingsDisplays the shortcut keys used for each of the menu options, and allows you to change them:

Select the command you want to edit in the Command list. Any currently defined shortcut keys are shown in the Current shortcut list.

To add a shortcut key to the command click in the Press new shortcut key box and type the key combination you want to use. Then click Set Shortcut to add it to the Current shortcut list. You will not be allowed to add it if it is already used by another command.

To remove a shortcut key select it in the Current shortcut list and click Remove, or click Remove All to remove all the command’s shortcut keys.

Then choose OK to use the new key bindings you have defined and the menus will be updated to show the shortcuts you have defined.

You can set up more than one shortcut for a command, but only one will be displayed in the menu.

Page 119: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE OPTIONS MENU

EWH8-1

113

Colors and FontsAllows you to specify the colors and fonts used for text in the editor windows, and the font used for text in the other windows.

The panel shows a list of the C syntax elements you can customize in the Editor window:

To specify the style used for each element of C syntax in the editor windows select the item you want to define from the Editor Window list. The current setting is shown in the Sample box below the list box.

You can choose a text color by clicking Color, and a font by clicking Font.... You can also choose the type style from the Type Style drop-down menu.

Then choose OK to use the new styles you have defined, or Cancel to revert to the previous styles.

Page 120: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

OPTIONS MENU REFERENCE

EWH8-1

114

Make ControlAllows you to set options for Make and Build:

The following table gives the options, and the alternative settings for each option:

Option Setting

Message Filtering Level All: Show all messages. Messages: Show message, warnings, and errors. Warnings: Show warnings and errors. Errors: Show errors only.

Stop Build Operation On

Never: Do not Stop. Warnings: Stop on warnings and errors. Errors: Stop on errors.

Save Editor Windows On Build

Always: Always save before Make or Build. Ask: Prompt before saving. Never: Do not save.

Page 121: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

REFERENCE WINDOW MENU

EWH8-1

115

WINDOW MENU The commands on the Window menu allow you to manipulate the Workbench windows and change their arrangement on the screen.

The last section of the Window menu lists the windows currently open on the screen, and allows you to activate one by selecting it.

NEW WINDOWOpens a new window for the current file.

CASCADE, TILE HORIZONTAL, TILE VERTICALProvide the standard Windows functions for arranging the Embedded Workbench windows on the screen.

ARRANGE ICONSArranges minimized window icons neatly at the bottom of the Embedded Workbench window.

CLOSE ALLCloses all open windows.

SPLITAllows you to split an editor window horizontally into two panes to allow you to see two parts of a file simultaneously.

MESSAGE WINDOWOpens the Messages window which displays messages and text output from the Embedded Workbench commands.

Page 122: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

HELP MENU REFERENCE

EWH8-1

116

HELP MENU Provides help about the Embedded Workbench.

CONTENTSDisplays the Contents page for help about the Embedded Workbench.

SEARCH FOR HELP ON…Allows you to search for help on a keyword.

HOW TO USE HELPDisplays help about using help.

IAR ON THE WEBAllows you to browse the home page, news page, and FAQ (frequently asked questions) page of the IAR web-site, and to contact IAR technical support.

ABOUT…Displays the version number of the Embedded Workbench.

Page 123: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INDEX

EWH8-1

117

AAbout... (Help menu) 116Active lines only

(assembler option) 67Active lines only

(C compiler option) 55Add Tool... (Tools menu) 105Add #include file information

(C compiler option) 52Add #include file text

(C compiler option) 55Always generate output

(XLINK option) 76applications 14arguments 105Arrange Icons (Window menu) 115Assembled lines only

(assembler option) 68assembler options

Active lines only 67Assembled lines only 68C style expression 63Case sensitive user symbols 62Define symbol 66Disable warnings 64Embedded source 65File references 65Generate debug information 65Include cross-reference 68Include header 67Include listing 67Include paths 70Lines/page 68List file 67List individual cycle count 67Macro definitions 68Macro execution info 68Macro expansions 67Macro quote chars 64Make a LIBRARY module 62

Maximum number of errors 63Multiline code 68No structured asm. list 67Tab spacing 68Undefine symbol 69#included text 67

assembler, features 7, 8Assembler, Linker, and Librarian

Programming Guide ivAssembly output file

(C compiler option) 57assumptions vauto indent 90

Bbatch files 107Binary Browse window 94bookmarks 109Browse Binary Data...

(Tools menu) 108Build All (Project menu) 13, 104

CC compiler options

Active lines only 55Add #include file information 52Add #include file text 55Assembly output file 57char is signed char 45Code added to statements 53Code segment 43Cross reference 56Disable warnings 46Dual line spacing 56Embedded source 52Enable language extensions 45Explain C declarations 57File references 52

Flag old-style functions 47Form-feed after function 56Generate debug information 52H8-specific extensions 44Include paths 59Include unreferenced enum and

typedefs 56Include unreferenced functions56Include unreferenced #defines 56Insert mnemonics 55Lines/page 56List file 55Make a library module 44Module header name 43Nested comments 46No register variables 52No type info in object code 47Optimization 44Optimize for size 44Optimize for speed 44Preprocessor output file 57Suppress source in object code 52Tab spacing 56Type checking 47Writable strings 46#define 54#undef 58// comments 46

C Compiler Programming Guide ivC compiler, features 6C program syntax, styles 89C style expression

(assembler option) 63Cascade (Window menu) 115Case sensitive user symbols

(assembler option) 62char is signed char

(C compiler option) 45Close (File menu) 96Code added to statements

(C compiler option) 53

INDEX

Page 124: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INDEX

EWH8-1

118

Code generation (assembler option) 62

Code generation (C compiler option) 43

Code segment (C compiler option) 43Colors and Fonts settings 113command 79Compile (Project menu) 13, 24, 103Contents (Help menu) 116conventions vCopy (Edit menu) 97Cross reference (C compiler option)56Cut (Edit menu) 97C-SPY 17, 27

features 10running 104setting a breakpoint 30stepping 28watching variables 28

C-SPY debuggerrunning 2

DDebug info with terminal I/O

(XLINK option) 73Debug info (XLINK option) 73Debug target 87Debug (assembler option) 65Debug (C compiler option) 52Debugger (Project menu) 27, 104Define symbol (assembler option) 66Define symbol (XLINK option) 75diagnostics options (XLINK) 76Disable range check

(XLINK option) 76Disable warnings

(assembler option) 64Disable warnings

(C compiler option) 46

Disable warnings(XLINK option) 77

documentation route map 3Double size (general option) 38Dual line spacing

(C compiler option) 56

Eedit bar 85Edit Bar (View menu) 86, 100Edit menu 97editing a file 88editor 89

key summary 91settings 90syntax checking 21

editor window 89new 95splitting into panes 92, 115

Editor (Settings panel) 109Embedded source

(assembler option) 65Embedded source

(C compiler option) 52Embedded Workbench

editor 5, 89features 5installing 1, 2running 1, 2, 18window 83

Enable language extensions (C compiler option) 45

exe directory 19Executable (general option) 38Exit (File menu) 96Explain C declarations

(C compiler option) 57

Ffeatures

assembler 7C compiler 6C-SPY debugger 10Embedded Workbench 5XLIB Librarian 9XLINK Linker 8

File menu 95File references (assembler option) 65File references (C compiler option) 52files, editing 88Files... (Project menu) 88, 101Fill unused code memory

(XLINK option) 81filtering messages 114Find in Files... (Edit menu) 98Find... (Edit menu) 97Flag old-style functions

(C compiler option) 47Format variant

(XLINK option) 74Form-feed after function

(C compiler option) 56

Ggeneral options

Double size 38Executable 38List files 39Memory model 38Object files 39Processor 37

Generate checksum(XLINK option) 81

Generate debug information (assembler option) 65

Page 125: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INDEX

EWH8-1

119

Generate debug information (C compiler option) 52

Generate linker listing(XLINK option) 77

Goto Line... (View menu) 100groups 12, 87

adding files 101removing files 102

HHelp menu 116How to use help (Help menu) 116H8-specific extensions

(C compiler option) 44

IInclude cross-reference

(assembler option) 68include files in projects 32Include header (assembler option) 67Include listing (assembler option) 67include options (assembler) 70include options (XLINK) 78Include paths (assembler option) 70Include paths (C compiler option) 59Include paths (XLINK option) 78Include unreferenced enum and

typedefs (C compiler option) 56Include unreferenced functions

(C compiler option) 56Include unreferenced #defines

(C compiler option) 56Include (C compiler option) 59Inherent (XLINK option) 79Inherent, no object code

(XLINK option) 79input options (XLINK) 79

Insert mnemonics (C compiler option) 55

introduction 5

Kkey bindings 112key summary, editor 91keystrokes, recording 108

Llanguage facilities 6Language (C compiler option) 45Librarian (Project menu) 104Lines/page (assembler option) 68Lines/page (C compiler option) 56Lines/page (XLINK option) 78line, moving to 100Link (Project menu) 26, 104list directory 19List file (assembler option) 67List file (C compiler option) 55list files (general option) 39List individual cycle count

(assembler option) 67list options (assembler) 67list options (XLINK) 77List (C compiler option) 55Load as LIBRARY

(XLINK option) 80Load as PROGRAM

(XLINK option) 80

MMacro definitions

(assembler option) 68

Macro execution info (assembler option) 68

Macro expansions (assembler option) 67

Macro quote chars (assembler option) 64

macros, recording 108Make a LIBRARY module

(assembler option) 62Make a library module

(C compiler option) 44Make (Project menu) 13, 32, 34, 104Match Brackets (Edit menu) 90, 100Match Case (in Find in Files) 99Match Case (in Find) 97Match Whole Word Only

(in Find) 97Match Whole Word

(in Find in Files) 99Maximum number of errors

(assembler option) 63memory available 116Memory model (general option) 38Menu bar 84Message Window

(Window menu) 115Messages window 25, 93, 115

Build 94Find in Files 94Pin button 93Tool Output 94

messages, filtering 114Module header name

(C compiler option) 43Module map (XLINK option) 78MS-DOS commands 107Multiline code (assembler option) 68

Page 126: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INDEX

EWH8-1

120

NNested comments

(C compiler option) 46New Group... (Project menu) 102New Window (Window menu) 115New... (File menu) 18, 95No global type checking

(XLINK option) 77No register variables

(C compiler option) 52No structured asm. list

(assembler option) 67No type info in object code

(C compiler option) 47

Oobj directory 19object files (general option) 39Open... (File menu) 95Optimization (C compiler option) 44Optimize for size

(C compiler option) 44Optimize for speed

(C compiler option) 44options 103

AH8 36C-SPY 36dialog box 103general 35, 38ICCH8 23, 35setting 12target 22, 35XLINK 25, 36

Options menu 109Options... (Project menu) 22, 103output directories 38Output file (XLINK option) 73Output format (XLINK option) 74

output options (XLINK) 73overview 11

PPaste (Edit menu) 97Pin button 87, 93Play Macro (Tools menu) 108Preprocessor output file

(C compiler option) 57Print Setup... (File menu) 96Print... (File menu) 96Processing options (XLINK) 81Processor (general option) 37project bar 85, 86Project Bar (View menu) 86, 100Project menu 101Project window 19, 87

groups 87new 95source files 88targets 87

projectsadding files 101building 13include files 32moving files 88removing items 88

RRecord Macro (Tools menu) 108Redo (Edit menu) 97reference 83relative paths 102Release target 87Replace... (Edit menu) 98route map 3running

C-SPY 104

C-SPY debugger 2Embedded Workbench 1, 2, 18

Ssample applications 14Save All (File menu) 96Save As... (File menu) 96Save (File menu) 96Search for help on... (Help menu) 116search, toolbar 86Segment map (XLINK option) 78Segment overlap warnings

(XLINK option) 76Settings... (Options menu) 90, 109source file paths 102source files 12, 88

editing 88moving between groups 88

Split (Window menu) 115status bar 93Status Bar (View menu) 93, 100Stop Build (Project menu) 104Stop Record Macro (Tools menu) 108Suppress source in object code

(C compiler option) 52Symbol listing (XLINK option) 78syntax highlighting 89

TTab spacing (assembler option) 68Tab spacing (C compiler option) 56Target (C compiler option) 37targets 11, 87

changing groups in 103creating 103

Targets... (Project menu) 103Tile Horizontal (Window menu) 115Tile Vertical (Window menu) 115

Page 127: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INDEX

EWH8-1

121

toolbar search 86toolbars 85

edit bar 85project bar 85, 86

Tools menu 105tutorial 17

compiling a file 24creating a new project 18debugging with C-SPY 27editing a file 21linking the files 26making the project 34running the Workbench 18setting compiler options 22setting linker options 25using Make 32

Type checking (C compiler option) 47

UUndefine symbol

(assembler option) 69Undo (Edit menu) 97

VVariables, in arguments 105View menu 100

WWindow menu 115windows

Binary Browse 94Editor 89Messages 25, 93, 115Project 19, 87

Workbenchfeatures 5

installing 1, 2running 1, 2, 18

Writable strings (C compiler option) 46

XXCL filename (XLINK option) 79XLIB Librarian, features 9XLINK Linker

options summary 71XLINK Linker options

Always generate output 76Debug info 73Debug info with terminal I/O 73Define symbol 75Disable range check 76Disable warnings 77Fill unused code memory 81Format variant 74Generate checksum 81Generate linker listing 77Include paths 78Inherent 79Inherent, no object code 79Lines/page 78Load as LIBRARY 80Load as PROGRAM 80No global type checking 77Output file 73Output format 74Segment overlap warnings 76XCL filename 79

XLINK Linker, features 8

Symbols#define (assembler option) 66#define (C compiler option) 54#define (XLINK option) 75

#included text (assembler option) 67

#undef options 69#undef (C compiler option) 58// comments (C compiler option) 46

Page 128: Interface Guide - IAR Systemsnetstorage.iar.com/SuppDB/Public/UPDINFO/006051/ewh8.pdf · Windows and MS-DOS are trademarks of Microsoft Corp. ... Systems assembler, linker, and librarian,

INDEX

EWH8-1

122