Renesas Emulator System M3T-MR100 User manual

To our customers,
Old Company Name in Catalogs and Other Documents
On April 1st, 2010, NEC Electronics Corporation merged with Renesas Technology
Corporation, and Renesas Electronics Corporation took over all the business of both
companies. Therefore, although the old company name remains in this document, it is a valid
Renesas Electronics document. We appreciate your understanding.
Renesas Electronics website: http://www.renesas.com
April 1st, 2010
Renesas Electronics Corporation
Issued by: Renesas Electronics Corporation (http://www.renesas.com)
Send any inquiries to http://www.renesas.com/inquiry.

Notice
1. All information included in this document is current as of the date this document is issued. Such information, however, is
subject to change without any prior notice. Before purchasing or using any Renesas Electronics products listed herein, please
confirm the latest product information with a Renesas Electronics sales office. Also, please pay regular and careful attention to
additional and different information to be disclosed by Renesas Electronics such as that disclosed through our website.
2. Renesas Electronics does not assume any liability for infringement of patents, copyrights, or other intellectual property rights
of third parties by or arising from the use of Renesas Electronics products or technical information described in this document.
No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights
of Renesas Electronics or others.
3. You should not alter, modify, copy, or otherwise misappropriate any Renesas Electronics product, whether in whole or in part.
4. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of
semiconductor products and application examples. You are fully responsible for the incorporation of these circuits, software,
and information in the design of your equipment. Renesas Electronics assumes no responsibility for any losses incurred by
you or third parties arising from the use of these circuits, software, or information.
5. When exporting the products or technology described in this document, you should comply with the applicable export control
laws and regulations and follow the procedures required by such laws and regulations. You should not use Renesas
Electronics products or the technology described in this document for any purpose relating to military applications or use by
the military, including but not limited to the development of weapons of mass destruction. Renesas Electronics products and
technology may not be used for or incorporated into any products or systems whose manufacture, use, or sale is prohibited
under any applicable domestic or foreign laws or regulations.
6. Renesas Electronics has used reasonable care in preparing the information included in this document, but Renesas Electronics
does not warrant that such information is error free. Renesas Electronics assumes no liability whatsoever for any damages
incurred by you resulting from errors in or omissions from the information included herein.
7. Renesas Electronics products are classified according to the following three quality grades: “Standard”, “High Quality”, and
“Specific”. The recommended applications for each Renesas Electronics product depends on the product’s quality grade, as
indicated below. You must check the quality grade of each Renesas Electronics product before using it in a particular
application. You may not use any Renesas Electronics product for any application categorized as “Specific” without the prior
written consent of Renesas Electronics. Further, you may not use any Renesas Electronics product for any application for
which it is not intended without the prior written consent of Renesas Electronics. Renesas Electronics shall not be in any way
liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for an
application categorized as “Specific” or for which the product is not intended where you have failed to obtain the prior written
consent of Renesas Electronics. The quality grade of each Renesas Electronics product is “Standard” unless otherwise
expressly specified in a Renesas Electronics data sheets or data books, etc.
“Standard”: Computers; office equipment; communications equipment; test and measurement equipment; audio and visual
equipment; home electronic appliances; machine tools; personal electronic equipment; and industrial robots.
“High Quality”: Transportation equipment (automobiles, trains, ships, etc.); traffic control systems; anti-disaster systems; anti-
crime systems; safety equipment; and medical equipment not specifically designed for life support.
“Specific”: Aircraft; aerospace equipment; submersible repeaters; nuclear reactor control systems; medical equipment or
systems for life support (e.g. artificial life support devices or systems), surgical implantations, or healthcare
intervention (e.g. excision, etc.), and any other applications or purposes that pose a direct threat to human life.
8. You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics,
especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation
characteristics, installation and other product characteristics. Renesas Electronics shall have no liability for malfunctions or
damages arising out of the use of Renesas Electronics products beyond such specified ranges.
9. Although Renesas Electronics endeavors to improve the quality and reliability of its products, semiconductor products have
specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Further,
Renesas Electronics products are not subject to radiation resistance design. Please be sure to implement safety measures to
guard them against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a
Renesas Electronics product, such as safety design for hardware and software including but not limited to redundancy, fire
control and malfunction prevention, appropriate treatment for aging degradation or any other appropriate measures. Because
the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system
manufactured by you.
10. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental
compatibility of each Renesas Electronics product. Please use Renesas Electronics products in compliance with all applicable
laws and regulations that regulate the inclusion or use of controlled substances, including without limitation, the EU RoHS
Directive. Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with
applicable laws and regulations.
11. This document may not be reproduced or duplicated, in any form, in whole or in part, without prior written consent of Renesas
Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this
document or Renesas Electronics products, or if you have any other inquiries.
(Note 1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its majority-
owned subsidiaries.
(Note 2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.

M3T-MR100/4 V.1.00
User’s Manual
User’s Manual
Rev.1.00 2007.09
Real-time OS for R32C/100 Series

zActive X, Microsoft, MS-DOS, Visual Basic, Visual C++, Windows and Windows NT are either registered trademarks or trademarks of
Microsoft Corporation in the United States and other countries.
zIBM and AT are registered trademarks of International Business Machines Corporation.
zIntel and Pentium are registered trademarks of Intel Corporation.
zAdobe, Acrobat, and Acrobat Reader are trademarks of Adobe Systems Incorporated.
zTRON is an abbreviation of "The Real-time Operating system Nucleus."
zITRON is an abbreviation of "Industrial TRON."
zμITRON is an abbreviation of "Micro Industrial TRON."
zTRON, ITRON, and μITRON do not refer to any specific product or products.
zAll other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
Keep safety first in your circuit designs!
zRenesas Technology Corporation and Renesas Solutions Corporation put the maximum effort into making semiconductor products
better and more reliable, but there is always the possibility that trouble may occur with them. Trouble with semiconductors may lead to
personal injury, fire or property damage. Remember to give due consideration to safety when making your circuit designs, with appro-
priate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any
malfunction or mishap.
Notes regarding these materials
zThese materials are intended as a reference to assist our customers in the selection of the Renesas Technology product best suited
to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to
Renesas Technology Corporation, Renesas Solutions Corporation or a third party.
zRenesas Technology Corporation and Renesas Solutions Corporation assume no responsibility for any damage, or infringement of
any third-party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application exam-
ples contained in these materials.
zAll information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information
on products at the time of publication of these materials, and are subject to change by Renesas Technology Corporation and Rene-
sas Solutions Corporation without notice due to product improvements or other reasons. It is therefore recommended that customers
contact Renesas Technology Corporation, Renesas Solutions Corporation or an authorized Renesas Technology product distributor
for the latest product information before purchasing a product listed herein. The information described here may contain technical in-
accuracies or typographical errors. Renesas Technology Corporation and Renesas Solutions Corporation assume no responsibility
for any damage, liability, or other loss rising from these inaccuracies or errors. Please also pay attention to information published by
Renesas Technology Corporation and Renesas Solutions Corporation by various means, including the Renesas home page
(http://www.renesas.com).
zWhen using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algo-
rithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the informa-
tion and products. Renesas Technology Corporation and Renesas Solutions Corporation assume no responsibility for any damage,
liability or other loss resulting from the information contained herein.
zRenesas Technology semiconductors are not designed or manufactured for use in a device or system that is used under circum-
stances in which human life is potentially at stake. Please contact Renesas Technology Corporation, Renesas Solutions Corporation
or an authorized Renesas Technology product distributor when considering the use of a product contained herein for any specific pur-
poses, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use.
zThe prior written approval of Renesas Technology Corporation and Renesas Solutions Corporation is necessary to reprint or repro-
duce in whole or in part these materials.
zIf these products or technologies are subject to the Japanese export control restrictions, they must be exported under a license from
the Japanese government and cannot be imported into a country other than the approved destination. Any diversion or reexport con-
trary to the export control laws and regulations of Japan and/or the country of destination is prohibited.
zPlease contact Renesas Technology Corporation or Renesas Solutions Corporation for further details on these materials or the prod-
ucts contained therein.
For inquiries about the contents of this document or product, fill in the text file the installer generates in the following
directory and email to your local distributor.
\SUPPORT\Product-name\SUPPORT.TXT
Renesas Tools Homepage http://www.renesas.com/en/tools

i
Preface
The M3T-MR100/4(abbreviated as MR100) is a real-time operating system1for the R32C/100 series microcomputers. The
MR100 conforms to the μITRON Specification.2
This manual describes the procedures and precautions to observe when you use the MR100 for programming purposes. For
the detailed information on individual service call procedures, refer to the MR100 Reference Manual.
Requirements for MR100 Use
When creating programs based on the MR100, it is necessary to purchase the following product of Renesas.
•C-compiler package for R32C/100 series microcomputers (abbreviated as NC100)
Document List
The following sets of documents are supplied with the MR100.
•Release Note
Presents a software overview and describes the corrections to the Users Manual and Reference Manual.
•Users Manual (PDF file)
Describes the procedures and precautions to observe when using the MR100 for programming purposes.
Right of Software Use
The right of software use conforms to the software license agreement. You can use the MR100 for your product develop-
ment purposes only, and are not allowed to use it for the other purposes. You should also note that this manual does not
guarantee or permit the exercise of the right of software use.
1Hereinafter abbreviated "real-time OS"
2μITRON4.0 Specification is the open real-time kernel specification upon which the TRON association decided
The specification document of μITRON4.0 specification can come to hand from a TRON association homepage
(http://www.assoc.tron.org/).
The copyright of μITRON4.0 specification belongs to the TRON association.


iii
Contents
Requirements for MR100 Use ......................................................................................................................................i
Document List...............................................................................................................................................................i
Right of Software Use...................................................................................................................................................i
Contents.............................................................................................................................................................iii
List of Figures ................................................................................................................................................. viii
List of Tables ..................................................................................................................................................... xi
1. User’s Manual Organization................................................................................................................... - 1 -
2. General Information ............................................................................................................................... - 3 -
2.1 Objective of MR100 Development...................................................................................................... - 3 -
2.2 Relationship between TRON Specification and MR100................................................................... - 5 -
2.3 MR100 Features ................................................................................................................................. - 6 -
3. Introduction to Kernel ............................................................................................................................ - 7 -
3.1 Concept of Real-time OS .................................................................................................................... - 7 -
3.1.1 Why Real-time OS is Necessary ................................................................................................. - 7 -
3.1.2 Operating Principles of Kernel................................................................................................. - 10 -
3.2 Service Call ....................................................................................................................................... - 14 -
3.2.1 Service Call Processing ............................................................................................................. - 15 -
3.2.2 Processing Procedures for Service Calls from Handlers......................................................... - 16 -
Service Calls from a Handler That Caused an Interrupt during Task Execution............................................. - 17 -
Service Calls from a Handler That Caused an Interrupt during Service Call Processing................................ - 18 -
Service Calls from a Handler That Caused an Interrupt during Handler Execution ....................................... - 19 -
3.3 Object................................................................................................................................................. - 20 -
3.3.1 The specification method of the object in a service call .......................................................... - 20 -
3.4 Task ................................................................................................................................................... - 21 -
3.4.1 Task Status ................................................................................................................................ - 21 -
3.4.2 Task Priority and Ready Queue ...............................................................................................- 25 -
3.4.3 Task Priority and Waiting Queue............................................................................................. - 26 -
3.4.4 Task Control Block(TCB) .......................................................................................................... - 27 -
3.5 System States.................................................................................................................................... - 28 -
3.5.1 Task Context and Non-task Context ........................................................................................ - 28 -
3.5.2 Dispatch Enabled/Disabled States ........................................................................................... - 30 -
3.5.3 CPU Locked/Unlocked States ................................................................................................... - 30 -
3.5.4 Dispatch Disabled and CPU Locked States............................................................................. - 30 -
3.6 Regarding Interrupts........................................................................................................................ - 31 -
3.6.1 Types of Interrupt Handlers .....................................................................................................- 31 -
3.6.2 The Use of Non-maskable Interrupt ........................................................................................ - 31 -
3.6.3 Controlling Interrupts............................................................................................................... - 32 -
3.7 Stacks ................................................................................................................................................ - 34 -
3.7.1 System Stack and User Stack................................................................................................... - 34 -
4. Kernel .................................................................................................................................................... - 35 -
4.1.1 Module Structure....................................................................................................................... - 35 -
4.1.2 Module Overview....................................................................................................................... - 36 -
4.1.3 Task Management Function ..................................................................................................... - 37 -
4.1.4 Synchronization functions attached to task ............................................................................ - 39 -
4.1.5 Synchronization and Communication Function (Semaphore)................................................ - 43 -
4.1.6 Synchronization and Communication Function (Eventflag) .................................................. - 45 -
4.1.7 Synchronization and Communication Function (Data Queue) .............................................. - 47 -

iv
4.1.8 Synchronization and Communication Function (Mailbox)..................................................... - 48 -
4.1.9 Memory pool Management Function(Fixed-size Memory pool) ............................................. - 50 -
4.1.10 Variable-size Memory Pool Management Function ................................................................ - 51 -
4.1.11 Time Management Function..................................................................................................... - 54 -
4.1.12 Cyclic Handler Function ........................................................................................................... - 56 -
4.1.13 Alarm Handler Function........................................................................................................... - 57 -
4.1.14 System Status Management Function..................................................................................... - 58 -
4.1.15 Interrupt Management Function ............................................................................................. - 59 -
4.1.16 System Configuration Management Function ........................................................................ - 60 -
4.1.17 Extended Function (Short Data Queue) .................................................................................. - 60 -
4.1.18 Extended Function (Reset Function) ....................................................................................... - 61 -
5. Service call reffernce............................................................................................................................. - 63 -
5.1 Task Management Function ............................................................................................................ - 63 -
act_tsk Activate task .......................................................................................................................... - 65 -
iact_tsk Activate task (handler only).................................................................................................. - 65 -
can_act Cancel task activation request.............................................................................................. - 67 -
ican_act Cancel task activation request (handler only) ..................................................................... - 67 -
sta_tsk Activate task with a start code ............................................................................................. - 69 -
ista_tsk Activate task with a start code (handler only)..................................................................... - 69 -
ext_tsk Terminate invoking task ....................................................................................................... - 71 -
ter_tsk Terminate task ....................................................................................................................... - 73 -
chg_pri Change task priority.............................................................................................................. - 75 -
ichg_pri Change task priority(handler only) ...................................................................................... - 75 -
get_pri Reference task priority .......................................................................................................... - 77 -
iget_pri Reference task priority(handler only) .................................................................................. - 77 -
ref_tsk Reference task status ............................................................................................................ - 79 -
iref_tsk Reference task status (handler only).................................................................................... - 79 -
ref_tst Reference task status (simplified version) ........................................................................... - 82 -
iref_tst Reference task status (simplified version, handler only) .................................................... - 82 -
5.2 Task Dependent Synchronization Function.................................................................................... - 84 -
slp_tsk Put task to sleep..................................................................................................................... - 85 -
tslp_tsk Put task to sleep (with timeout)............................................................................................ - 85 -
wup_tsk Wakeup task........................................................................................................................... - 88 -
iwup_tsk Wakeup task (handler only)............................................................................................... - 88 -
can_wup Cancel wakeup request ...................................................................................................... - 90 -
ican_wup Cancel wakeup request (handler only) ............................................................................. - 90 -
rel_wai Release task from waiting..................................................................................................... - 92 -
irel_wai Release task from waiting (handler only) ............................................................................ - 92 -
sus_tsk Suspend task .......................................................................................................................... - 94 -
isus_tsk Suspend task (handler only) ................................................................................................. - 94 -
rsm_tsk Resume suspended task ........................................................................................................ - 96 -
irsm_tsk Resume suspended task(handler only) ............................................................................. - 96 -
frsm_tsk Forcibly resume suspended task ....................................................................................... - 96 -
ifrsm_tsk Forcibly resume suspended task(handler only) ............................................................... - 96 -
dly_tsk Delay task............................................................................................................................... - 98 -
5.3 Synchronization & Communication Function (Semaphore) ........................................................ - 100 -
sig_sem Release semaphore resource ............................................................................................... - 101 -
isig_sem Release semaphore resource (handler only) ................................................................... - 101 -
wai_sem Acquire semaphore resource............................................................................................ - 103 -
pol_sem Acquire semaphore resource (polling) ................................................................................ - 103 -
ipol_sem Acquire semaphore resource (polling, handler only) ..................................................... - 103 -
twai_sem Acquire semaphore resource(with timeout).................................................................... - 103 -
ref_sem Reference semaphore status ...............................................................................................- 106 -
iref_sem Reference semaphore status (handler only)....................................................................... - 106 -
5.4 Synchronization & Communication Function (Eventflag)........................................................... - 108 -
set_flg Set eventflag......................................................................................................................... - 109 -
iset_flg Set eventflag (handler only) ................................................................................................ - 109 -
clr_flg Clear eventflag..........................................................................................................................- 111 -
iclr_flg Clear eventflag (handler only) .............................................................................................- 111 -

v
wai_flg Wait for eventflag................................................................................................................. - 113 -
pol_flg Wait for eventflag(polling)................................................................................................... - 113 -
ipol_flg Wait for eventflag(polling, handler only)............................................................................ - 113 -
twai_flg Wait for eventflag(with timeout)......................................................................................... - 113 -
ref_flg Reference eventflag status .................................................................................................. - 116 -
iref_flg Reference eventflag status (handler only).......................................................................... - 116 -
5.5 Synchronization & Communication Function (Data Queue)....................................................... - 118 -
snd_dtq Send to data queue ..............................................................................................................- 119 -
psnd_dtq Send to data queue (polling)............................................................................................ - 119 -
ipsnd_dtq Send to data queue (polling, handler only)..................................................................... - 119 -
tsnd_dtq Send to data queue (with timeout).................................................................................. - 119 -
fsnd_dtq Forced send to data queue ............................................................................................... - 119 -
ifsnd_dtq Forced send to data queue (handler only) ...................................................................... - 119 -
rcv_dtq Receive from data queue ..................................................................................................... - 122 -
prcv_dtq Receive from data queue (polling)................................................................................... - 122 -
iprcv_dtq Receive from data queue (polling, handler only)............................................................ - 122 -
trcv_dtq Receive from data queue (with timeout) ............................................................................ - 122 -
ref_dtq Reference data queue status ............................................................................................... - 125 -
iref_dtq Reference data queue status (handler only) ...................................................................... - 125 -
5.6 Synchronization & Communication Function (Mailbox).............................................................. - 127 -
snd_mbx Send to mailbox ................................................................................................................ - 128 -
isnd_mbx Send to mailbox (handler only) ....................................................................................... - 128 -
rcv_mbx Receive from mailbox........................................................................................................... - 130 -
prcv_mbx Receive from mailbox (polling) ........................................................................................ - 130 -
iprcv_mbx Receive from mailbox (polling, handler only)................................................................. - 130 -
trcv_mbx Receive from mailbox (with timeout) .............................................................................. - 130 -
ref_mbx Reference mailbox status .................................................................................................... - 133 -
iref_mbx Reference mailbox status (handler only) ........................................................................ - 133 -
5.7 Memory Pool Management Function (Fixed-size Memory Pool) ................................................. - 135 -
get_mpf Aquire fixed-size memory block .......................................................................................... - 136 -
pget_mpf Aquire fixed-size memory block (polling)........................................................................ - 136 -
ipget_mpf Aquire fixed-size memory block (polling, handler only) ................................................ - 136 -
tget_mpf Aquire fixed-size memory block (with timeout) ............................................................. - 136 -
rel_mpf Release fixed-size memory block......................................................................................... - 139 -
irel_mpf Release fixed-size memory block (handler only) ................................................................ - 139 -
ref_mpf Reference fixed-size memory pool status ........................................................................... - 141 -
iref_mpf Reference fixed-size memory pool status (handler only)................................................... - 141 -
5.8 Memory Pool Management Function (Variable-size Memory Pool) ............................................ - 143 -
pget_mpl Aquire variable-size memory block (polling) .................................................................. - 144 -
rel_mpl Release variable-size memory block ................................................................................... - 146 -
ref_mpl Reference variable-size memory pool status...................................................................... - 148 -
iref_mpl Reference variable-size memory pool status (handler only) ............................................. - 148 -
5.9 Time Management Function.......................................................................................................... - 150 -
set_tim Set system time.................................................................................................................... - 151 -
iset_tim Set system time (handler only) ........................................................................................... - 151 -
get_tim Reference system time......................................................................................................... - 153 -
iget_tim Reference system time (handler only) ................................................................................ - 153 -
isig_tim Supply a time tick................................................................................................................ - 155 -
5.10 Time Management Function (Cyclic Handler).............................................................................. - 156 -
sta_cyc Start cyclic handler operation............................................................................................. - 157 -
ista_cyc Start cyclic handler operation (handler only) .................................................................... - 157 -
stp_cyc Stops cyclic handler operation ............................................................................................ - 159 -
istp_cyc Stops cyclic handler operation (handler only).................................................................... - 159 -
ref_cyc Reference cyclic handler status........................................................................................... - 160 -
iref_cyc Reference cyclic handler status (handler only).................................................................. - 160 -
5.11 Time Management Function (Alarm Handler) ............................................................................. - 162 -
sta_alm Start alarm handler operation ............................................................................................ - 163 -
ista_alm Start alarm handler operation (handler only)................................................................ - 163 -
stp_alm Stop alarm handler operation ............................................................................................. - 165 -
istp_alm Stop alarm handler operation (handler only)................................................................. - 165 -

vi
ref_alm Reference alarm handler status.......................................................................................... - 166 -
iref_alm Reference alarm handler status (handler only) ................................................................. - 166 -
5.12 System Status Management Function .......................................................................................... - 168 -
rot_rdq Rotate task precedence........................................................................................................ - 169 -
irot_rdq Rotate task precedence (handler only) ............................................................................... - 169 -
get_tid Reference task ID in the RUNNING state......................................................................... - 171 -
iget_tid Reference task ID in the RUNNING state (handler only) ................................................ - 171 -
loc_cpu Lock the CPU ....................................................................................................................... - 172 -
iloc_cpu Lock the CPU (handler only)............................................................................................... - 172 -
unl_cpu Unlock the CPU ................................................................................................................... - 174 -
iunl_cpu Unlock the CPU (handler only) ....................................................................................... - 174 -
dis_dsp Disable dispatching .............................................................................................................- 175 -
ena_dsp Enables dispatching.............................................................................................................- 177 -
sns_ctx Reference context................................................................................................................. - 178 -
sns_loc Reference CPU state............................................................................................................ - 179 -
sns_dsp Reference dispatching state ................................................................................................ - 180 -
sns_dpn Reference dispatching pending state.................................................................................. - 181 -
5.13 Interrupt Management Function...................................................................................................- 182 -
ret_int Returns from an interrupt handler (when written in assembly language).................. - 183 -
5.14 System Configuration Management Function.............................................................................. - 184 -
ref_ver Reference version information ............................................................................................ - 185 -
iref_ver Reference version information (handler only) ................................................................... - 185 -
5.15 Extended Function (Short Data Queue)........................................................................................ - 187 -
vsnd_dtq Send to Short data queue ................................................................................................ - 188 -
vpsnd_dtq Send to Short data queue (polling).................................................................................. - 188 -
vipsnd_dtq Send to Short data queue (polling, handler only).......................................................... - 188 -
vtsnd_dtq Send to Short data queue (with timeout) ....................................................................... - 188 -
vfsnd_dtq Forced send to Short data queue..................................................................................... - 188 -
vifsnd_dtq Forced send to Short data queue (handler only) ............................................................ - 188 -
vrcv_dtq Receive from Short data queue ....................................................................................... - 191 -
vprcv_dtq Receive from Short data queue (polling)......................................................................... - 191 -
viprcv_dtq Receive from Short data queue (polling,handler only) .................................................. - 191 -
vtrcv_dtq Receive from Short data queue (with timeout) .............................................................. - 191 -
vref_dtq Reference Short data queue status..................................................................................... - 194 -
viref_dtq Reference Short data queue status (handler only)......................................................... - 194 -
5.16 Extended Function (Reset Function)............................................................................................. - 196 -
vrst_dtq Clear data queue area ......................................................................................................... - 197 -
vrst_vdtq Clear Short data queue area ...........................................................................................- 199 -
vrst_mbx Clear mailbox area ........................................................................................................... - 201 -
vrst_mpf Clear fixed-size memory pool area .................................................................................. - 203 -
vrst_mpl Clear variable-size memory pool area............................................................................. - 204 -
6. Applications Development Procedure Overview ................................................................................ - 205 -
6.1 Overview.......................................................................................................................................... - 205 -
6.2 Development Procedure Example.................................................................................................. - 207 -
6.2.1 Applications Program Coding................................................................................................. - 207 -
6.2.2 Configuration File Preparation .............................................................................................. - 208 -
6.2.3 Configurator Execution........................................................................................................... - 209 -
6.2.4 System generation................................................................................................................... - 209 -
6.2.5 Writing ROM............................................................................................................................ - 210 -
7. Detailed Applications .......................................................................................................................... - 211 -
7.1 Program Coding Procedure in C Language................................................................................... - 211 -
7.1.1 Task Description Procedure.................................................................................................... - 211 -
7.1.2 Writing a Kernel (OS Dependent) Interrupt Handler .......................................................... - 212 -
7.1.3 Writing Non-kernel Interrupt Handler.................................................................................. - 213 -
7.1.4 Writing Cyclic Handler/Alarm Handler ................................................................................. - 213 -
7.2 Program Coding Procedure in Assembly Language ..................................................................... - 215 -
7.2.1 Writing Task ............................................................................................................................ - 215 -
7.2.2 Writing Kernel Interrupt Handler ......................................................................................... - 216 -

vii
7.2.3 Writing Non-kernel Interrupt Handler.................................................................................. - 216 -
7.2.4 Writing Cyclic Handler/Alarm Handler ................................................................................. - 216 -
7.3 Modifying MR100 Startup Program.............................................................................................. - 218 -
7.3.1 C Language Startup Program (crt0mr.a30)........................................................................... - 219 -
7.4 Memory Allocation.......................................................................................................................... - 224 -
7.4.1 Section used by the MR100..................................................................................................... - 225 -
8. Using Configurator ................................................................................................................................. 227
8.1 Configuration File Creation Procedure ..............................................................................................227
8.1.1 Configuration File Data Entry Format.......................................................................................227
Operator ...................................................................................................................................................................228
Direction of computation .........................................................................................................................................228
8.1.2 Configuration File Definition Items............................................................................................229
[( System Definition Procedure )]............................................................................................................................229
[( System Clock Definition Procedure )]..................................................................................................................231
[( Definition respective maximum numbers of items )]..........................................................................................232
[( Task definition )]...................................................................................................................................................234
[( Eventflag definition )] ..........................................................................................................................................236
[( Semaphore definition )]........................................................................................................................................237
[(Data queue definition )] ........................................................................................................................................238
[( Short data queue definition )]..............................................................................................................................239
[( Mailbox definition )] .............................................................................................................................................240
[( Fixed-size memory pool definition )]....................................................................................................................241
[( Variable-size memory pool definition )]...............................................................................................................242
[( Cyclic handler definition )]...................................................................................................................................244
[( Alarm handler definition )] ..................................................................................................................................245
[( Interrupt vector definition )]................................................................................................................................246
[( Fixed interrupt vector definition )]......................................................................................................................247
8.1.3 Configuration File Example.........................................................................................................250
8.2 Configurator Execution Procedures ...................................................................................................254
8.2.1 Configurator Overview.................................................................................................................254
Executing the configurator requires the following input files: ..............................................................................254
When the configurator is executed, the files listed below are output. ..................................................................254
8.2.2 Setting Configurator Environment .............................................................................................255
8.2.3 Configurator Start Procedure......................................................................................................256
8.2.4 Precautions on Executing Configurator......................................................................................256
8.2.5 Configurator Error Indications and Remedies ...........................................................................257
Error messages ........................................................................................................................................................257
Warning messages ...................................................................................................................................................259
9. Sample Program Description.................................................................................................................. 260
9.1 Overview of Sample Program .............................................................................................................260
9.2 Program Source Listing.......................................................................................................................261
9.3 Configuration File................................................................................................................................262
10. Stack Size Calculation Method ........................................................................................................... 264
10.1 Stack Size Calculation Method ...........................................................................................................264
10.1.1 User Stack Calculation Method...................................................................................................266
10.1.2 System Stack Calculation Method ..............................................................................................268
10.2 Necessary Stack Size...........................................................................................................................272
11. Note.................................................................................................................................................. - 275 -
11.1 The Use of INT Instruction............................................................................................................ - 275 -
11.2 The Use of registers of bank .......................................................................................................... - 275 -
11.3 Regarding Delay Dispatching ........................................................................................................ - 276 -
11.4 Regarding Initially Activated Task................................................................................................ - 277 -
12. Appendix .......................................................................................................................................... - 279 -
12.1 Data Type ........................................................................................................................................ - 279 -
12.2 Common Constants and Packet Format of Structure .................................................................. - 280 -
12.3 Assembly Language Interface........................................................................................................ - 282 -

viii
List of Figures
Figure 3.1 Relationship between Program Size and Development Period.....................................- 7 -
Figure 3.2 Microcomputer-based System Example(Audio Equipment) .........................................- 8 -
Figure 3.3 Example System Configuration with Real-time OS(Audio Equipment) ......................- 9 -
Figure 3.4 Time-division Task Operation .......................................................................................- 10 -
Figure 3.5 Task Execution Interruption and Resumption ............................................................- 11 -
Figure 3.6 Task Switching ...............................................................................................................- 11 -
Figure 3.7 Task Register Area.........................................................................................................- 12 -
Figure 3.8 Actual Register and Stack Area Management .............................................................- 13 -
Figure 3.9 Service call......................................................................................................................- 14 -
Figure 3.10 Service Call Processing Flowchart..............................................................................- 15 -
Figure 3.11 Processing Procedure for a Service Call a Handler that caused an interrupt during Task
Execution - 17 -
Figure 3.12 Processing Procedure for a Service Call from a Handler that caused an interrupt during
Service Call Processing.............................................................................................................- 18 -
Figure 3.13 Processing Procedure for a service call from a Multiplex interrupt Handler ..........- 19 -
Figure 3.14 Task Identification .......................................................................................................- 20 -
Figure 3.15 Task Status...................................................................................................................- 21 -
Figure 3.16 MR100 Task Status Transition ...................................................................................- 22 -
Figure 3.17 Ready Queue (Execution Queue) ................................................................................- 25 -
Figure 3.18 Waiting queue of the TA_TPRI attribute ...................................................................- 26 -
Figure 3.19 Waiting queue of the TA_TFIFO attribute.................................................................- 26 -
Figure 3.20 Task control block ........................................................................................................- 27 -
Figure 3.21 Cyclic Handler/Alarm Handler Activation .................................................................- 29 -
Figure 3.22 Interrupt handler IPLs................................................................................................- 31 -
Figure 3.23 Interrupt control in a Service Call that can be Issued from only a Task .................- 32 -
Figure 3.24 Interrupt control in a Service Call that can be Issued from a Task-independent ...- 33 -
Figure 3.25 System Stack and User Stack .....................................................................................- 34 -
Figure 4.1 MR100 Structure............................................................................................................- 35 -
Figure 4.2 Task Resetting................................................................................................................- 37 -
Figure 4.3 Alteration of task priority..............................................................................................- 38 -
Figure 4.4 Task rearrangement in a waiting queue ......................................................................- 38 -
Figure 4.5 Wakeup Request Storage...............................................................................................- 39 -
Figure 4.6 Wakeup Request Cancellation.......................................................................................- 39 -
Figure 4.7 Forcible wait of a task and resume...............................................................................- 40 -
Figure 4.8 Forcible wait of a task and forcible resume..................................................................- 41 -
Figure 4.9 dly_tsk service call .........................................................................................................- 42 -
Figure 4.10 Exclusive Control by Semaphore ................................................................................- 43 -
Figure 4.11 Semaphore Counter .....................................................................................................- 43 -
Figure 4.12 Task Execution Control by Semaphore.......................................................................- 44 -
Figure 4.13 Task Execution Control by the Eventflag...................................................................- 46 -
Figure 4.14 Data queue ...................................................................................................................- 47 -
Figure 4.15 Mailbox .........................................................................................................................- 48 -
Figure 4.16 Message queue .............................................................................................................- 49 -
Figure 4.17 Memory Pool Management..........................................................................................- 50 -
Figure 4.18 pget_mpl processing.....................................................................................................- 52 -
Figure 4.19 rel_mpl processing .......................................................................................................- 53 -
Figure 4.20 Timeout Processing......................................................................................................- 54 -
Figure 4.21 Cyclic handler operation in cases where the activation phase is saved...................- 56 -
Figure 4.22 Cyclic handler operation in cases where the activation phase is not saved.............- 56 -
Figure 4.23 Typical operation of the alarm handler ......................................................................- 57 -
Figure 4.24 Ready Queue Management by rot_rdq Service Call..................................................- 58 -
Figure 4.25 Interrupt process flow..................................................................................................- 59 -
Figure 6.1 MR100 System Generation Detail Flowchart ............................................................- 206 -
Figure 6.2 Program Example ........................................................................................................- 208 -

ix
Figure 6.3 Configuration File Example ........................................................................................- 209 -
Figure 6.4 Configurator Execution ...............................................................................................- 209 -
Figure 6.5 System Generation.......................................................................................................- 210 -
Figure 7.1 Example Infinite Loop Task Described in C Language .............................................- 211 -
Figure 7.2 Example Task Terminating with ext_tsk() Described in C Language......................- 212 -
Figure 7.3 Example of Kernel Interrupt Handler........................................................................- 213 -
Figure 7.4 Example of Non-kernel Interrupt Handler ................................................................- 213 -
Figure 7.5 Example Cyclic Handler Written in C Language ......................................................- 214 -
Figure 7.6 Example Infinite Loop Task Described in Assembly Language................................- 215 -
Figure 7.7 Example Task Terminating with ext_tsk Described in Assembly Language...........- 215 -
Figure 7.8 Example of kernel(OS-depend) interrupt handler.....................................................- 216 -
Figure 7.9 Example of Non-kernel Interrupt Handler of Specific Level ....................................- 216 -
Figure 7.10 Example Handler Written in Assembly Language ..................................................- 217 -
Figure 7.11 C Language Startup Program (crt0mr.a30) .............................................................- 222 -
Figure 8.1 The operation of the Configurator .................................................................................. 255


xi
List of Tables
Table 3.1 Task Context and Non-task Context ..............................................................................- 28 -
Table 3.2 Invocable Service Calls in a CPU Locked State.............................................................- 30 -
Table 3.3 CPU Locked and Dispatch Disabled State Transitions Relating to dis_dsp and loc_cpu- 30 -
Table 5.1 Specifications of the Task Management Function.........................................................- 63 -
Table 5.2 List of Task Management Function Service Call...........................................................- 63 -
Table 5.3 Specifications of the Task Dependent Synchronization Function ................................- 84 -
Table 5.4 List of Task Dependent Synchronization Service Call ..................................................- 84 -
Table 5.5 Specifications of the Semaphore Function ...................................................................- 100 -
Table 5.6 List of Semaphore Function Service Call .....................................................................- 100 -
Table 5.7 Specifications of the Eventflag Function......................................................................- 108 -
Table 5.8 List of Eventflag Function Service Call .....................................................................- 108 -
Table 5.9 Specifications of the Data Queue Function ..................................................................- 118 -
Table 5.10 List of Dataqueue Function Service Call....................................................................- 118 -
Table 5.11 Specifications of the Mailbox Function.......................................................................- 127 -
Table 5.12 List of Mailbox Function Service Call ........................................................................- 127 -
Table 5.13 Specifications of the Fixed-size memory pool Function.............................................- 135 -
Table 5.14 List of Fixed-size memory pool Function Service Call ..............................................- 135 -
Table 5.15 Specifications of the Variable-size memory Pool Function........................................- 143 -
Table 5.16 List of Variable -size memory pool Function Service Call.........................................- 143 -
Table 5.17 Specifications of the Time Management Function ....................................................- 150 -
Table 5.18 List of Time Management Function Service Call ......................................................- 150 -
Table 5.19 Specifications of the Cyclic Handler Function.........................................................- 156 -
Table 5.20 List of Cyclic Handler Function Service Call.............................................................- 156 -
Table 5.21 Specifications of the Alarm Handler Function...........................................................- 162 -
Table 5.22 List of Alarm Handler Function Service Call.............................................................- 162 -
Table 5.23 List of System Status Management Function Service Call ......................................- 168 -
Table 5.24 List of Interrupt Management Function Service Call...............................................- 182 -
Table 5.25 List of System Configuration Management Function Service Call ..........................- 184 -
Table 5.26 Specifications of the Short Data Queue Function......................................................- 187 -
Table 5.27 List of Long Dataqueue Function Service Call ..........................................................- 187 -
Table 5.28 List of Reset Function Service Call.............................................................................- 196 -
Table 7.1 C Language Variable Treatment...................................................................................- 212 -
Table 8.1 Numerical Value Entry Examples .................................................................................... 227
Table 8.2 Operators............................................................................................................................ 228
Table 8.3 List of vector number and vector address ........................................................................ 248
Table 9.1 Functions in the Sample Program .................................................................................... 260
Table 10.1 Stack Sizes Used by Service Calls Issued from Tasks (in bytes) .................................. 272
Table 10.2 Stack Sizes Used by Service Calls Issued from Handlers (in bytes) ............................ 273
Table 10.3 Stack Sizes Used by Service Calls Issued from Tasks and Handlers (in bytes) .......... 273
Table 11.1 Interrupt Number Assignment....................................................................................- 275 -

xii

- 1 -
1. User’s Manual Organization
The MR100 User’s Manual consists of nine chapters and thee appendix.
•2 General Information
Outlines the objective of MR100 development and the function and position of the MR100.
•3 Introduction to Kernel
Explains about the ideas involved in MR100 operations and defines some relevant terms.
•4 Kernel
Outlines the applications program development procedure for the MR100.
•5 Service call reffernce
Details MR100 service call API
•6 Applications Development Procedure Overview
Details the applications program development procedure for the MR100.
•7 Detailed Applications
Presents useful information and precautions concerning applications program development with MR100.
•8 Using Configurator
Describes the method for writing a configuration file and the method for using the configurator in detail.
•9 Sample Program Description
Describes the MR100 sample applications program which is included in the product in the form of a source file.
•10 Stack Size Calculation Method
Describes the calculation method of the task stack size and the system stack size.
•11 Note
Presents useful information and precautions concerning applications program development with MR100.
•12 Appendix
Data type and assembly language interface.


- 3 -
2. General Information
2.1 Objective of MR100 Development
In line with recent rapid technological advances in microcomputers, the functions of microcomputer-based products have
become complicated. In addition, the microcomputer program size has increased. Further, as product development competi-
tion has been intensified, manufacturers are compelled to develop their microcomputer-based products within a short period
of time.
In other words, engineers engaged in microcomputer software development are now required to develop larger-size pro-
grams within a shorter period of time. To meet such stringent requirements, it is necessary to take the following considera-
tions into account.
1. To enhance software recyclability to decrease the volume of software to be developed.
One way to provide for software recyclability is to divide software into a number of functional modules wherever
possible. This may be accomplished by accumulating a number of general-purpose subroutines and other program
segments and using them for program development. In this method, however, it is difficult to reuse programs that
are dependent on time or timing. In reality, the greater part of application programs are dependent on time or tim-
ing. Therefore, the above recycling method is applicable to only a limited number of programs.
2. To promote team programming so that a number of engineers are engaged in the development
of one software package
There are various problems with team programming. One major problem is that debugging can be initiated only
when all the software program segments created individually by team members are ready for debugging. It is es-
sential that communication be properly maintained among the team members.
3. To enhance software production efficiency so as to increase the volume of possible software
development per engineer.
One way to achieve this target would be to educate engineers to raise their level of skill. Another way would be to
make use of a structured descriptive assembler, C-compiler, or the like with a view toward facilitating program-
ming. It is also possible to enhance debugging efficiency by promoting modular software development.
However, the conventional methods are not adequate for the purpose of solving the problems. Under these circumstances, it
is necessary to introduce a new system named real-time OS 3
To answer the above-mentioned demand, Renesas has developed a real-time operating system, tradenamed MR100, for use
with the R32C/100 series of 32-bit microcomputers .
When the MR100 is introduced, the following advantages are offered.
1. Software recycling is facilitated.
When the real-time OS is introduced, timing signals are furnished via the real-time OS so that programs depend-
ent on timing can be reused. Further, as programs are divided into modules called tasks, structured programming
will be spontaneously provided.
That is, recyclable programs are automatically prepared.
2. Ease of team programming is provided.
When the real-time OS is put to use, programs are divided into functional modules called tasks. Therefore, engi-
neers can be allocated to individual tasks so that all steps from development to debugging can be conducted inde-
pendently for each task.
Further, the introduction of the real-time OS makes it easy to start debugging some already finished tasks even if
the entire program is not completed yet. Since engineers can be allocated to individual tasks, work assignment is
easy.
3. Software independence is enhanced to provide ease of program debugging.
As the use of the real-time OS makes it possible to divide programs into small independent modules called tasks,
3OS:Operating System

- 4 -
the greater part of program debugging can be initiated simply by observing the small modules.
4. Timer control is made easier.
To perform processing at 10 ms intervals, the microcomputer timer function was formerly used to periodically in-
itiate an interrupt. However, as the number of usable microcomputer timers was limited, timer insufficiency was
compensated for by, for instance, using one timer for a number of different processing operations.
When the real-time OS is introduced, however, it is possible to create programs for performing processing at fixed
time intervals making use of the real-time OS time management function without paying special attention to the
microcomputer timer function. At the same time, programming can also be done in such a manner as to let the
programmer take that numerous timers are provided for the microcomputer.
5. Software maintainability is enhanced
When the real-time OS is put to use, the developed software consists of small program modules called tasks.
Therefore, increased software maintainability is provided because developed software maintenance can be carried
out simply by maintaining small tasks.
6. Increased software reliability is assured.
The introduction of the real-time OS makes it possible to carry out program evaluation and testing in the unit of a
small module called task. This feature facilitates evaluation and testing and increases software reliability.
7. The microcomputer performance can be optimized to improve the performance of microcom-
puter-based products.
With the real-time OS, it is possible to decrease the number of unnecessary microcomputer operations such as I/O
waiting. It means that the optimum capabilities can be obtained from microcomputers, and this will lead to mi-
crocomputer-based product performance improvement.
This manual suits for next models
1
Table of contents
Other Renesas Software manuals
Popular Software manuals by other brands

Extreme Networks
Extreme Networks IP Service Manager user guide

Yamaha
Yamaha MOTIF-RACK ES owner's manual

Patton electronics
Patton electronics ForeSight 6300 NMS Getting started guide

Siemens
Siemens Mouse user guide

Xtore
Xtore XN200 series XN-004-A1 Software guide

Focusrite
Focusrite Liquid Mix Plug-in owner's manual

Red Hat
Red Hat ENTERPRISE LINUX 3 - FOR IBM S-390 AND IBM ESERVER... installation guide

I.R.I.S.
I.R.I.S. POWERSCAN 9.5 user guide

CAKEWALK
CAKEWALK Cakewalk SONAR user guide

Brocade Communications Systems
Brocade Communications Systems Brocade 8/12c manual

Adobe
Adobe 38043755 - ColdFusion Enterprise - Mac Administration guide

Mustek
Mustek 2400 M user guide