Panasonic MN1030 User Manual

MICROCOMPUTER MN1030
MN1030 Series Cross Assembler User’s Manual
Pub.No.13110-120E
PanaXSeries is a trademark of Matsushita Electric Industrial Co., Ltd. Sun and Sun OS are registered trademarks of Sun Microsystems Inc. of the United States. MS-DOS is a registered trademark of Microsoft Corporation of the United States. VZ Editor is a registered trademark of Village Center, Inc. PC/AT is a registered trademark of the International Business Machines Corporation of the United States. UNIX is a registered trademark licensed by X/Open Co., Ltd. in the United States and/or other countries. MIFES is a trademark of Megasoft, Inc. All other corporation names, logotype and product names written in this book are trademarks or registered trademarks of their corresponding corporations.
Request for your special attention and precautions in using the technical information
and semiconductors described in this book
(1) An export permit needs to be obtained from the competent authorities of the Japanese Government if any of
the products or technologies described in this book and controlled under the "Foreign Exchange and Foreign Trade Law" is to be exported or taken out of Japan.
(2) The technical information described in this book is limited to showing representative characteris tics and
applied circuits examples of the products. It neither warrants non-infringement of intellectual property right or any other rights owned by our company or a third party, nor grants any license.
(3) We are not liable for the infringement of rights owned by a third party arising out of the use of the product or
technologies as described in this book.
(4) The products described in this book are intended to be used for standard applications or general electronic
equipment (such as office equipment, communications equipment, measuring instruments and hou seh old appliances). Consult our sales staff in advance for information on the following applications:
• Special applications (such as for airplanes, aerospace, automobiles, traffic control equipment, combustion equipment, life support systems and safety devices) in which exceptional quality and reliability are required, or if the failure or malfunction of the products may directly jeopardize life or harm the human body.
• Any applications other than the standard applications intended.
(5) The products and product specifications described in this book are subject to change without notice for
modification and/or improvement. At the final stage of your design, purchasing, or use of the products, therefore, ask for the most up-to-date Product Standards in advance to make sure that the latest specifications satisfy your requirements.
(6) When designing your equipment, comply with the guaranteed values, in particular those of maximum rating,
the range of operating power supply voltage, and heat radiation characteristics. Otherwise, we will not be liable for any defect which may arise later in your equipment. Even when the products are used within the guaranteed values, take into the consideration of incidence of break down and failure mode, possible to occur to semiconductor products. Measures on the systems such as redundant design, arresting the spread of fire or preventing glitch are recommended in order to prevent physical injury, fire, social damages, for example, by using the products.
(7) When using products for which damp-proof packing is required, observe the conditions (including shelf life
and amount of time let standing of unsealed items) agreed upon when specification sheets are individually exchanged.
(8) This book may be not reprinted or reproduced whether wholly or partially, without the prior written
permission of Matsushita Electric Industrial Co., Ltd.
If you have any inquiries or questions about this book or our semiconductors, please contact one of our sales offices listed at the back of this book.

About This Manual

This manual describes the functions and operation of the cross assembler for this series of microcomputers.
• Manual Features
Chapters on installation, program development flow, and introductory operati on are provided, so first-time users can quickly get an overview and easily master operation.
Optimization, a special feature of the cross assembler, is explained in its own chapter.
Explanations of how to operate the assembler and lin ker and how to write programs are made mostly through the use of examples.
Syntax, usage notes, and examples are given for each assembler directive, assembler control statement, and macro control statement.
Use of the library manager, a tool for managing library files, is also explained.
For users of engineering workstations (EWS), a separate chapter describes differences from the MS-DOS version.
Chapters provides listings of machine-language instructions and error messages, as well as sample programs that demonstrate usage.
• Reference Techniques
This document supports four techniques for quickly finding the required information.
1. Use the index at the front of the document to find the beginnings of chapters.
2. Use the table of contents at the front of the document to find subsection headings.
3. The chapter name and the subsection heading are listed at the top and bottom edges, respectively, on each page. Thus the contents of each page can be seen at a glance.
4. Use the index at the end of the document to find technical terms.
< About This Manual 1 >
• How to read
Chapter 1 Installation
1.3.4 Environment Settings
Heading
Before using the Cross-Assembler, verify or change the following two les.
CONFIG.SYS
If FILES and BUFFERS specications do not already exist in CONFIG.SYS, then you must add them. If they do already exist, then check their settings, and change them if necessary.
FILES=20 BUFFERS=20
NOTE: Be sure to make these settings. If the assembler is started without them, then
the error message "bad tmpbss(w)" will be output and processing will stop. This means that the number of les that can be opened simultaneously is insufficient.
Terminology: CONFIG.SYS
This is the le that sets the MS-DOS operating environment. FILES specifies the number of les that can be read and written simultaneously. BUFFERS species the size of memory used for reading/writing disks.
Supplementary explanation
Program example
Usage note
Installing PC Version
14
Heading
Chapter titles are shown here on each page, so the reader can get a quick idea of contents while flipping through the pages.
Program example
These are actual examples of command options and instructions used by the assembler. First­time users should refer to these examples when trying to use the assembler.
Usage note
These give important information. Usage note provide cautions about usage, so they should always be read.
Supplementary explanation
These are hints and terminology definitions that can help the reader use the assembler.
<About This Manual 2 >
• Related Manuals
The following related manuals are available. Please contact our sales representative for more details.
MN1030/MN103S Series Instruction Manual
<Describes the instruction set>
MN1030 Series C Compiler User's Manual: Usage Guide
<Describes the installation, the commands, and options of the C Compiler>
MN1030/MN103S/MN103E Series C Compiler User's Manual: Language Description
<Describes the syntax of the C Compiler>
MN1030/MN103S/MN103E Series C Compiler User's Manual: Library Reference
<Describes the standard library of the C Compiler>
MN1030 Series C Source Code Debugger for Windows® User's Manual
<Describes the use of the C source code debugger for Windows®>
MN1030/MN103S/MN103E Series Onboard Debug Unit Setup Manual
<Describes the connection of the Debug Unit and explains about initial settings of the Onboard Debugger>
MN1030/MN103S Series Installation Manual
<Describes the installation of the C compiler, cross-assembler and C source code debugger and the procedure for bringing up the in-circuit emulator>
< About This Manual 3 >
0
Chapter 1 Getting Started Chapter 2 Program Development Flow Chapter 3 Introduction to Operation Chapter 4 Optimization Chapter 5 Using Assembler Chapter 6 Using Linker Chapter 7 Types of Source Statements Chapter 8 Writing Source Statements
Chapter 9 Writing Machine Language Instruction
Statements and Directive Statements
Chapter 10 Writing Assembler Control Statements Chapter 11 Writing Macro Control Statements
1 2 3 4 5
6 7 8 9
10
11
Chapter 12 List of Machine Language Instructions Chapter 13 Error Messages Chapter 14 Reading List Files Chapter 15 Using Library Manager Chapter 16 Notes on Operating Environment Chapter 17 Appendix
12 13 14 15 16 17
index

Table of Contents

Chapter 1 Getting Started
1.1 Purpose of This Chapter............................................................................................................................. 2
1.2 Operating Environment................................................................................................................. ............. 3
1.3 File Organization........................................................................................................................ ................ 4
1.4 Installation.................................................................................................................................. ................ 5
1.5 Setup...................................................................................................................................................... ..... 6
1.6 File Conversion Utility............................................................................................................................. 10
Chapter 2 Program Development Flow
2.1 Purpose of This Chapter........................................................................................................................... 14
2.2 Program Development Flow .................................. .......................................................................... ........ 15
2.3 Programming with Assembler....................................................................................................... ........... 17
Chapter 3 Introduction to Operation
3.1 Purpose of This Chapter........................................................................................................................... 22
3.2 Files Used by Assembler and Linker....................................................................................................... 23
3.3 Basic Operation of Assembler and Linker............................................................................................... 25
3.4 Assembling and Linking Multiple Sections............................................................................................. 30
3.5 Conditional Assembly and Linking ...................................................... ................................................... 38
Chapter 4 Optimization
4.1 Purpose of This Chapter........................................................................................................................... 44
4.2 Rules of Usage .............................................................................................................................. ........... 45
4.3 Usage Example......................................................................................................................................... 46
Chapter 5 Using Assembler
5.1 Purpose of This Chapter........................................................................................................................... 60
5.2 Starting Assembler................................................................................................................................ ... 61
5.3 Command Options ................................................................................................................................... 63
5.3.1 Output File Options........................................................................................................................ 64
5.3.2 Error Message Options................................................................................................................... 70
5.3.3 Preprocessor Options ............................................................................................................. .. ...... 76
5.3.4 Program Generation Options.......................................................................................................... 78
5.3.5 Other Options................................................................................................................................. 80
5.4 Operation Examples................................................................................................................................. 81
Chapter 6 Using Linker
6.1 Purpose of This Chapter........................................................................................................................... 84
< 1 TOC >
6.2 Starting Linker......................................................................................................................................... 85
6.3 Command Options................................................................................................................................... 88
6.3.1 Output File Options ....................................................................................................................... 89
6.3.2 Error Message Options .................................................................................................................. 91
6.3.3 Program Generation Options......................................................................................................... 97
6.3.4 Library File Options.............................................................................................. ....................... 103
6.3.5 Other Options............................................................................................................................... 105
6.4 Instruction RAM Support ............................................................................................................. ......... 107
6.4.1 Structure of IRAM Support Executable File ............................................................................... 108
6.4.2 IRAM Support Options................................................................................................................ 111
6.4.3 Operation Examples..................................................................................................................... 114
Chapter 7 Types of Source Statements
7.1 Purpose of This Chapter ........................................................................................................................ 118
7.2 Program Format..................................................................................................................................... 119
7.3 Machine Language Instruction Statements and Directive Statements................................................... 121
7.4 Assembler Control Statements................................................................................................... ............ 122
7.5 Macro Control Statements.................................................................................................................... . 123
7.6 Comment Statements............................................................................................................................. 124
7.7 Blank Statements ................................................................................................................................... 125
Chapter 8 Writing Source Statements
8.1 Purpose of This Chapter ........................................................................................................................ 128
8.2 Permitted Characters.............................................................................................................................. 129
8.3 Numbers.................................................................................................................................. ............... 130
8.4 Character Constants........................................................................................................... .................... 133
8.5 Address Constants................................................................................................................................. . 135
8.6 Location Counter ................................................................................................................................... 136
8.7 Expressions............................................................................................................................................ 137
8.7.1 Operators...................................................................................................................................... 138
8.7.2 Expression Evaluation ................................................................................................................. 140
8.7.3 Expression Syntax........................................................................................................................ 141
8.7.4 Expression Attributes................................................................................................................... 142
8.8 Reserved Words................................................................................................................. .................... 144
Chapter 9 Writing Machine Language Instruction Statements and
Directive Statements
9.1 Purpose of This Chapter ........................................................................................................................ 146
9.2 Instruction Statement Fields .................................................................................................................. 147
9.2.1 Writing Label Field............................................................................................................ ......... 148
9.2.2 Writing Operation Field............................................................................................................... 149
9.2.3 Writing Operand Field................................................................................................................. 150
9.2.4 Writing Comment Field............................................................................................................... 151
9.3 Writing Machine Language Instruction Statements .............................................................................. 152
9.4 Writing Directive Statements................................................................................................................. 153
9.4.1 section.......................................................................................................................................... 154
9.4.2 align ............................................................................................................................................ . 156
9.4.3 end............................................................................................................................................... . 158
< TOC 2 >
9.4.4 listoff, liston ................................................................................................................................. 159
9.4.5 notation......................................................................................................................................... 160
9.4.6 org ................................................................................................................................................ 162
9.4.7 opt................................................................................................................................................. 163
9.4.8 page.............................................................................................................................................. 164
9.4.9 radix.............................................................................................................................................. 165
9.4.10 dc................................................................................................................................................ 166
9.4.11 ds................................................................................................................................................ 167
9.4.12 dw............................................................................................................................................... 169
9.4.13 dd................................................................................................................................................ 170
9.4.14 equ.............................................................................................................................................. 171
9.4.15 global.......................................................................................................................................... 173
9.4.16 tit ................................................................................................................................................ 175
9.4.17 xlistoff, xliston ........................................................................................................................... 176
9.4.18 funcinfo...................................................................................................................................... 177
9.4.19 assign.......................................................................................................................................... 179
Chapter 10 Writing Assembler Control Statements
10.1 Purpose of This Chapter....................................................................................................................... 182
10.2 File Inclusion........................................................................................................................................ 183
10.2.1 #include...................................................................................................................................... 184
10.3 Identifier Definement........................................................................................................................... 186
10.3.1 #define........................................................................................................................................ 187
10.3.2 #undef......................................................................................................................................... 188
10.4 Conditional Assembly.......................................................................................................................... 189
10.4.1 #ifdef, #ifndef............................................................................................................................. 191
10.4.2 #if, #ifn....................................................................................................................................... 193
10.4.3 #ifeq, #ifneq ............................................................................................................................... 195
10.4.4 #iflt, #ifle.................................................................................................................................... 198
10.4.5 #ifgt, #ifge.................................................................................................................................. 200
10.4.6 #ifb, #ifnb.............................................................. ..................................................................... 202
Chapter 11 Writing Macro Control Statements
11.1 Purpose of This Chapter....................................................................................................................... 206
11.2 Macro Definitions (macro, endm) ........................................................................................................ 207
11.3 Macro Calls and Expansion ................................................................................................................. 209
11.4 Macro Operators................................................................................................................................... 211
11.5 Local Symbol Declaration (local)........................................................................................................ 213
11.6 Forced Termination of Macro Expansion (exitm) ............................................................................... 215
11.7 Purging Macro Definitions (purge)...................................................................................................... 217
11.8 rept........................................................................................................................................................ 218
11.9 irp ......................................................................................................................................................... 220
11.10 irpc...................................................................................................................................................... 222
Chapter 12 List of Machine Language Instructions
12.1 Purpose of This Chapter....................................................................................................................... 226
12.2 Addressing Modes................................................................................................................................ 227
12.3 List of Machine Language Instructions................................................................................................ 231
< 3 TOC >
12.3.1 Data Move Instructions........................................................................................................... ... 232
12.3.2 Arithmetic Instructions.............................................................................................................. 237
12.3.3 Logical Instructions ................................................................................................................... 239
12.3.4 Bit Manipulation Instructions.................................................................................................... 241
12.3.5 Branching Instructions............................................................................................................... 243
12.3.6 User-Defined Instructions........................................................................................... ............... 247
12.3.7 Other Instructions ............................................................................................................. ......... 248
Chapter 13 Error Messages
13.1 Purpose of This Chapter ....................................................................................................... ............... 250
13.2 Assembler Errors ................................................................................................................................. 251
13.2.1 Warning Messages..................................................................................................................... 252
13.2.2 Error Messages ........................................................................................................... ............... 254
13.2.3 Fatal Error Messages ................................................................................................................. 257
13.3 Linker Errors............................................................................................................................ ............ 258
13.3.1 Warning Messages..................................................................................................................... 259
13.3.2 Error Messages ........................................................................................................... ............... 260
13.3.3 Fatal Error Messages ................................................................................................................. 262
Chapter 14 Readinig List Files
14.1 Purpose of This Chapter ....................................................................................................... ............... 266
14.2 Reading List Files............................................................................................................... ................. 267
14.2.1 Output Format of Machine Language Code.............................................................................. 268
14.2.2 Symbol Table............................................................................................................................. 271
Chapter 15 Using Library Manager
15.1 Purpose of This Chapter ....................................................................................................... ............... 274
15.2 Starting Library Manager...................................................................................................... ............... 275
15.3 Command Options............................................................................................................................... 276
15.3.1 Error Message Options ............................................................................................... ............... 276
15.3.2 Program Generation Options..................................................................................................... 282
15.3.3 Functional Options..................................................................................................................... 284
15.3.4 Other Options................................................................................................................. ............ 290
15.4 Error Messages .................................................................................................................................... 292
15.4.1 Warning Messages..................................................................................................................... 293
15.4.2 Error Messages ........................................................................................................... ............... 294
15.4.3 Fatal Error Messages ................................................................................................................. 296
Chapter 16 Notes on Operating Environment
16.1 Purpose of This Chapter ....................................................................................................... ............... 298
16.2 Personal Computer Versions ............................................................................................................ ... 299
16.2.1 Operating Environment..................................................................................................... ......... 300
16.2.2 Files............................................................................................................................................ 301
16.2.3 Installation ................................................................................................................ ................. 302
16.2.4 Environment Settings................................................................................................................. 303
16.2.5 Differences From Workstation Versions................................................................................... 305
< TOC 4 >
16.2.6 Error Correction Using Tag Jumps............................................................................................ 306
Chapter 17 Appendix
17.1 Numeric Restrictions............................................................................................................................ 310
17.2 List of Command Options.................................................................................................................... 311
17.2.1 List of Assembler Command Options........................................................................................ 312
17.2.2 List of Linker Command Options.............................................................................................. 315
17.3 List of Assembler Directives................................................................................................................ 318
17.4 List of Assembler Control Statements ................................................................................................. 321
< 5 TOC >

Chapter 1 Getting Started

1
Chapter 1 Getting Started

1.1 Purpose of This Chapter

This chapter describes the operating environment for this system and the usage of the file conversion tool.
2 Purpose of This Chapter

1.2 Operating Environment

This system runs on the following workstations, personal computers and compatibles.
Host machine Operating system Version of OS
Sun/Sparc Solaris 2.6 or later
PC/AT Windows 98/Me/2000/XP
DOS/V Windows 98/Me/2000/XP
For the PC/AT and compatibles, because of such differences as the ability to display Japanese, this Manual indicates a machine running the English-only operating system as a PC/AT and one running the Japanese operating system as a DOS/V machine.
Refer to the Release Notes for other restrictions.
Chapter 1 Getting Started
Operating Environment 3
Chapter 1 Getting Started

1.3 File Organization

The installation media for this system contain the following files.
as103 (assembler)
as103 is the assembler. For a description, see Chapter 5 "Using Assembler."
ld103 (linker)
ld103 is the linker. For a description, see Chapter 6 "Using Linker."
slib103 (library manager)
slib103 is the library manager, a utility for creating library files. For a description, see Chapter 15 "Using Library Manager."
excv103 (file conversion utility)
This utility converts an executable produced by the linker into a file in Motorola S format, Intel HEX format, or Matsushita format.
In addition to the above files, the installation media may contain a README or README.DOC file containing late-breaking news missing from this Manual. Please read this file carefully before proceeding.
4 File Organization

1.4 Installation

For the installation media, installation procedures, and notes on installation, see the Installation Manual.
Chapter 1 Getting Started
Installation 5
Chapter 1 Getting Started

1.5 Setup

These procedures are for setting up this system when it has just been installed or for altering basic settings.
Setting command path
Unix uses the environment variable PATH when searching for executable files. Setting up this variable properly allows users to omit the directory name for commands and run them using their base names only.
If this system has been installed in /usr/local/bin, for example, adding the directory /usr/local/bin to the PATH environment variable permits the use of the command name only for the commands in this system.
Under Unix, most users initialize environment variables via a start-up file named .cshrc and located in the user's home directory. If this is the case, use an editor to modify the PATH variable setting in this start-up file.
To put the changes into effect, either log out and then log in again or use the source command to execute the contents of .cshrc.
Start-up files
The assembler and linker start by reading start-up files which contain statements for initializing start­up variables.
The assembler start-up file (.as103rc) contains statements specifying the following three items.
1. The default language and character coding scheme for messages from the assembler
2. The radix notation used for numbers
3. The default toggle switch setting for optimization
The linker start-up file (.ld103rc) contains statements specifying the following eight items.
1. The language and character coding scheme for messages from the linker
2. A toggle controlling output of debug ging information to the executable file
3. A toggle controlling output of the symbol table to the executable file
4. A toggle controlling output of DATA sections to the executable file
5. A toggle controlling output of a map fil e
6. A toggle controlling output of an executable file when there are errors
7. A library file
8. A directory searching for a library file
6 Setup
The assembler and linker search directories for these start-up files in the following order: the current directory, the user's home directory, and the directory containing the executable. If they find such a file, they use the contents to initialize their starting parameters. Otherwise, they set the parameters to their default values. These default values are given in the section "Start-up file format."
NOTE: Note that the command line is preceded when specifying the option which can
Start-up file format
The start-up files contain statements using the following format.
keyword parameter
The first field is a keyword giving the name of the start-up parameter. The second field specifies the value to assign to that parameter. The two fields must be separated by at least one tab or space.
A sharp (#) may be used to incorporate comments into these start-up files. The assembler and linker then ignore all text from the sharp through to the end of the line.
Chapter 1 Getting Started
be set in an environmental setting file with the command line at starting the assembler and the linker. Refer to the Chapter 5 “Using Assembler” for the assembler and to the Chapter 6 “Using Linker” for the linker. The order of precedence is as follows.
1) Specify by Command
2) Specify in Environmental setting file
NOTE: Each specification must end with a carriage return. In particular, make sure that
the last line ends with a carriage return. Some editors allow users to end the last line with an end-of-file mark instead of a carriage return.
NOTE: There is no way to specify multiple parameters on the same line.
Setup 7
Chapter 1 Getting Started
The start-up file .as103rc supports the following keywords.
Keyword Description
This entry specifies the language and coding scheme for messages from the assembler. One of the parameters ENGLISH, EUC, SJIS, or JIS comes after the keyword “message” followed by a blank space. These parameters have the following meanings. message ENGLISH Outputs messages in English message EUC Outputs messages in Japanese using EUC encoding
message
message SJIS Outputs messages in Japanese using Shift JIS encoding message JIS Outputs messages in Japanese using JIS encoding The default setting depends on the host machine and operating system. Sun/Sparc ENGLISH DOS/V SJIS PC/AT ENGLISH
This entry specifies the notation used for numbers in assembly language programs. One of the parameters PANA, CLANG, or INTEL comes after the keyword “notation” followed by a blank space. These parameters have the following meanings.
notation
notation PANA Use Panasonic notation notation CLANG Use C language notation notation INTEL Use Intel notation The default setting is in extended C language format.
This entry controls optimization. Either ON or OFF of the parameters comes after the keyword O-OPTION followed by a blank space. These parameters have the following
O-OPTION
meanings. O-OPTION ON Enable optimization O-OPTION OFF Disable optimization The default setting is to disable optimization.
The start-up file .ld103rc supports the following keyboards.
Keyword Description
This entry specifies the language and coding scheme for messages from the linker. One of the parameters ENGLISH, EUC, SJIS, or JIS comes after the keyword “message” followed by a blank space. These parameters have the following meanings. message ENGLISH Outputs messages in English message EUC Outputs messages in Japanese using EUC encoding
message
message SJIS Outputs messages in Japanese using Shift JIS encoding message JIS Outputs messages in Japanese using JIS encoding The default setting depends on the host machine and operating system. Sun/Sparc ENGLISH DOS/V SJIS PC/AT ENGLISH
This entry controls the output of debugging information. Either ON or OFF of the parameters comes after the keyword g-OPTION followed by a blank space. These
g-OPTION
parameters have the following meanings. g-OPTION ON Enable output of debugging information g-OPTION OFF Disable output of debugging information The default setting is to disable output of debugging information.
8 Setup
Keyword Description
This entry controls the output of debugging of the symbol table to the executable file. Either ON or OFF of the parameters comes after the keyword En-OPTION followed by a
En-OPTION
blank space. These parameters have the following meanings. En-OPTION ON Disable output of the symbol table to the executable file. En-OPTION OFF Enable output of the symbol table to the executable file. The default setting is to disable output of the symbol table to the executable file.
This entry controls the output of DATA sections to the executable file. Either ON or OFF of the parameters comes after the keyword Ed-OPTION followed by a blank space. These
Ed-OPTION
parameters have the following meanings. Ed-OPTION ON Enable output of DATA section to the executable file. O-OPTION OFF Disable output of DATA section to the executable file. The default setting is to disable output of DATA section to the executable file.
This entry controls the output of the map file. Either ON or OFF of the parameters comes after the keyword m-OPTION followed by a blank space. These parameters have the
m-OPTION
following meanings. m-OPTION ON Enable output of the map file. m-OPTION OFF Disable output of the map file. The default setting is to disable output of the map file.
Chapter 1 Getting Started
r-OPTION
stdlib
libdir
This entry controls the output of the executable file when there are assembler errors. Either ON or OFF of the parameters comes after the keyword r-OPTION followed by a blank space. These parameters have the following meanings. r-OPTION ON Enable output of the executable file when there are assembler errors. r-OPTION OFF Disable output of the executable file when there are assembler errors. The default setting is to disable output of executable file when there are assembler errors.
This entry specifies the library file. The library file name comes after the keyword stdlib followed by a blank space. Two or more stdlib descriptions are allowed. The default setting is no specification.
This entry specifies the directory for searching library files. The library file name comes after the keyword libdir followed by a blank space. Two or more libdir descriptions are allowed. The default setting is no specification.
Setup 9
Chapter 1 Getting Started

1.6 File Conversion Utility

This file conversion utility converts an EX format file produced by the linker into a file in Intel HEX format, or Motorola S format.
General command format
The general command format used to start the file conversion utility is shown below.
excv103 [options] EX format file name
Contents of brackets [ ]may be omitted.
Options
Option Description
-j Displays error and warning messages in Japanese. *1
-e Displays error and warning messages in English. *2
-h Displays help information regarding file conversion utility options to the screen.
Perform conversion using a work file during execution. This enables a large amount of
-w
-i Output the execution file in Intel HEX format.
-S3 Output the execution file in Motorola S3 format.
-S2 Output the execution file in Motorola S2 format. S1 Output the execution file in Motorola S1 format.
-ofile Specify the file name to output
-p No padding.
-P Padding.
-R start address, end address
-A start address
data to be converted even if the personal computer has little memory. However, conversion speed will be slower.
Converts the addresses within the specified range. If omitting the end address, a conversion is performed until the last address of the execution module.
Perform conversion for the starting address of EX format file into the specified address.
10 File Conversion Utility
*1 Option for UNIX version. *2 Option for DOS/V version
Default specification
See the default settings for the following operations.
Operation Default Setting
Chapter 1 Getting Started
Message to output Conversion method Not with a work file
Output format Intel HEX format Padding No padding Output file name The same file name as EX format file but with “.hex” or “.rom” extensions. Conversion range From the start to the end address in EX format file.
UNIX and PC/AT versions: English DOS/V version: Japanese
Rules of output file name
Based on input file name or the file name specified with “o” option, change the extension. It is an output file name. The rules are different from each option specified.
Option Extension i .hex S3, S2, S1 .mot default .hex
In addition, a file with “.rom” extension is output with them. The file contains its tool information.
File Conversion Utility 11
Chapter 1 Getting Started
Example of specifying options
1. Specify the range of data conversion. (-R)
excv103 -R1000, 1020 sample.ex
Converts the data between the address 1000 and the address 1020 in the file of sample.ex.
2. Specify the start address upon format conversion. (-A)
excv103 -A1000 sample.ex
In the file of sample.ex, the information of start address specified when linking has been set. It will be needed when changing the start address for the format conversion. The example above, conversion has performed as the start address for the address 1000.
excv103 -A4000, 8000 -A1000 sample.ex
Converts the data between the address 4000 and the address 8000 in the file of sample.ex into the data of the address 1000.
3. Convert into a file in Intel HEX format.
excv103 -i sample.ex
Perform conversion a file into a file in Intel HEX format.
4. Convert into a file in Motorola S format.
excv103 -S1 sample.ex excv103 -S2 sample.ex excv103 -S3 sample.ex
Perform conversion a file into a file in Motorola format.
-S1: 16-bit address format
-S2: 24-bit address format
-S3: 32-bit address format
5. Convert without padding.
excv103 -p sample.ex
Do not pad (0xff) when converting.
6. Convert with padding.
excv103 -P sample.ex
Do pad (0xff) when converting.
12 File Conversion Utility

Chapter 2 Program Development Flow

2
Chapter 2 Program Development Flow

2.1 Purpose of This Chapter

Programs can be developed with a compiler or an assembler.
Currently most program development is done with a compiler, but an assembler is where compact code generation or faster processing speed is required.
This chapter gives an overview of development with the assembler, and explains the flow of development through completion.
14 Purpose of This Chapter

2.2 Program Development Flow

Main development flow
The microcomputers are used in such diverse applications as AV equipment, household electronics, information equipment, automobiles, robots, portable phones, computer peripherals, etc. Programs developed with the Cross-Assembler are ultimately incorporated into these products.
The software is developed using a source code debugger running the software on a target board which differs from the operating environment for the final application.
Assembler and compiler
Both the assembler and C compiler can be used to develop programs for the microcomputers. Compared to assembly language, C language is a more productive language. Programs code d using a high-level language also offer superior ability for documentation.
Chapter 2 Program Development Flow
On the other hand, microcomputer operations can be directly coded by programming with assembly language. Compared to high-level languages, programs can be created with more compact code size, less redundancy, and faster processing.
Given the features of both languages, the main body of a program can be coded using C language, while parts that require fast processing can be coded using assembly language.
When developing a program, the programmer must first consider which language to use, program structure, processing speed required to meet the target performance of the end product, ROM size of the device, and several other related factors.
Program Development Flow 15
Chapter 2 Program Development Flow
Source code debugger
The software developed on a workstation or personal computer must be checked using a hardware environment similar to that used by the final product.
Nearly all of this series microcomputers will ultimately be incorporated wi thi n end products. Therefore, program debugging must also be performed under the same conditions as the end product. This is why a source code debugger and in-circuit emulator are provided.
The probe of the in-circuit emulator can operate in place of the microcomputer by connecting it through the microcomputer socket in the product.
The source code debugger is a program for controlling the in-circuit emulator's hardware. The debugger downloads the application developed on a workstation or personal computer to the emulator's memory to create an environment in which the application runs as if it were in the microcomputer's ROM. It can start program execution as the address of any source statement, and can temporarily stop execution. Also, when execution is stopped, the source code debugger can display values of internal registers and memory and can be used to verify desired operation of programs by changing those values. It also enables more detailed operation checks with step operation, whereby execution proceeds one instruction at a time.
Using this development environment, the developer can prove programs in the same state as when finally incorporated into the microprocessor.
16 Program Development Flow

2.3 Programming with Assembler

Before creating programs using the assembler, you must understand the following items.
Required knowledge
Machine-language instructions
Device operation
Editor use
C compiler use
Assembler and linker use (in this manual)
Debugger use
Program development is an iterative process of editing, assembling, linking, and debugging many times until finished. Therefore, you should as much as possible automate assembler and linker commands, debugger calls, and error correction.
Chapter 2 Program Development Flow
MAKE
When a program is divided into multiple files for joint development efforts by several programmers, a control system must be created for assembly and linking without error.
If this is not done, an old undebugged program could be linked within the iterative development process.
The solution lies with the following program which runs on the workstation or personal computer.
•MAKE
With MAKE the programmer defines the dependency relationships of the files needed to generate the final executable file and list files. Afterwards MAKE will automatically assemble and link only those files that have been modified.
Program format
The Cross-Assembler utilizes a program format called section address format. Section address format specifies the start addresses of programs for each section linked. Even when the
program is divided between multiple files, or when a file is divided into multiple sections, identical sections are linked together with the same attributes. Therefore, the programmer must create programs such that addresses do not overlap.
[Reference: Chapter 6, "Using Linker", for details]
Programming with Assembler 17
Chapter 2 Program Development Flow
Programming style
It is important to use a consistent style for program coding from start to finish. When several people are to create a program, they should meet in advance to decide on a common style.
You should consider the following points regarding the fixed style of the Cross Assembler.
Header files Constants and variables used in all files and define identifiers used in common should be gathered into a single header file. As a result, changes can be made at just one location in the header file.
Library files Subroutine programs frequently used by different files should be gathered by function as library files to make programs easier to use.
Declaration position global directives Use one position for global directive declarations. The global directive can be declared anywhere within a program, but confusion will result if the declaration positions differ across source files.
Unify radix and notation directives
Comment statements
Optimization
This Series' optimizations apply to unconditional branches, data transfer instructions, arithmetic instructions, logical instructions, bit manipulatio n instructions, and user-defined instructions.
Unconditional branches that undergo optimization
Data transfer, arithmetic, logical, bit manipulation, and user-defined instructions t hat undergo
Coding is not a simple task if the programmer must always select the optimal instruction from the above instructions. In particular, it is nearly impossible to select the optimal instructions when coding a program divided between files in section format.
The optimization functions provide a solution to these problems. The assembler and linker use them to produce the optimal code no matter what the source code.
Choose a common default radix for coding numbers, constant values, strings, etc.
Comments reveal program algorithms and processing details within a program. Choose a common format for coding comment statements.
optimization
The assembler evaluates the source statement notation. It evaluates the immediate data, memory specifications, and displacement data appearing as operands to a data transfer, arithmetic, logical, bit manipulation, and user-defined instructions and selects the shortest version of the instruction.
The assembler also examines unconditional branches, choosing the shortest versions for the CALL, CALLS, JMP, and JSR instructions.
The linker evaluates instructions that were the object of optimization, and selects the optimal codes. As a result, the programmer must be aware that the generated code will differ from the source
statements coded in the list file.
18 Programming with Assembler
Loading...
+ 310 hidden pages