Fujitsu F2MC-16L Series User manual

FUJITSU SEMICONDUCTOR
CONTROLLER MANUAL
F2MC-16L/16LX/16/16H/16F
µITRON 2.01 SPECIFICATIONS COMPLIANT
SOFTUNE REALOS/907
USER’S GUIDE
CM42-00325-3E
*

*

FUJITSU LIMITED
F2MC-16L/16LX/16/16H/16F
µITRON 2.01 SPECIFICATIONS COMPLIANT
SOFTUNE REALOS/907
USER’S GUIDE
*

*

i
PREFACE
■Objective of this manual
Thank you for purchasing Softune REALOS/907 (REALOS/907 in this document).
REALOS/907 is a realtime operating system for Fujitsu's F2MC-16L/16LX/16/16H/16F 16-bit
microprocessors. The REALOS/907 kernel conforms to the µITRON 2.01 specifications. As the
eventflag function supports both single word eventflags and single bit eventflags, either eventflag
function can be selected. This manual uses the following notation to clarify the number of bits.
µITRON 2.01 specification REALOS/907 manual
Single word eventflag →16-bit eventflag
Single bit eventflag →1-bit eventflag
This manual contains information required when configuring a REALOS/907 system. The
manual describes how to configure and run the system. Refer to this manual for operations
relating to the overall system.
The description of this manual is premised on using the integrated development environment
"Softune" of our company. For more information, refer to the manual of each product.
■Trademarks
TRON is an abbreviation of "The Realtime Operating System Nucleus".
ITRON is an abbreviation of "Industrial TRON".
µITRON is an abbreviation of "Micro Industrial TRON".
SOFTUNE is a trademark of FUJITSU LIMITED.
REALOS (REALtime Operating System) is a trademark of FUJITSU LIMITED.
Microsoft, Windows, and Windows NT are registered trademarks of Microsoft Corporation in the
U.S. and other countries.
The names of products and systems appearing in this manual are trademarks or registered
trademarks of their respective companies.
■Intended reader of this manual
This manual is intended for engineers who are using REALOS/907 to develop actual products.
The manual describes application system development, debugging, and the REALOS/907
libraries. Please take time to read through the manual.
The Configurator and Analyzer is software that runs on Windows XP, Windows Me, Windows
2000, Windows 98 and Windows NT 4.0.
Readers of this manual should have a fundamental knowledge of the operations of Windows XP,
Windows Me, Windows 2000, Windows 98 or Windows NT 4.0 and a basic understanding of the
use of embedded software.
*

ii
■Organization of this manual
This manual consists of the following 4 chapters and an Appendix.
Chapter 1 Notes on Operation
Explains a number of important points on using REALOS/907.
Chapter 2 Developing Application Systems
Describes how to develop application systems using REALOS/907.
Chapter 3 Overview of the Standard I/O Library
Introduces the standard I/O library.
Chapter 4 Program Reference for the Standard I/O Library
Lists standard I/O library details in reference format.
Appendix
Summarizes the REALOS/907 upgrade and describes how to generate and run the
sample system.
*

iii
2002 FUJITSU LIMITED Printed in Japan
• The contents of this document are subject to change without notice. Customers are advised to consult
with FUJITSU sales representatives before ordering.
• The information and circuit diagrams in this document are presented as examples of semiconductor
device applications, and are not intended to be incorporated in devices for actual use. Also, FUJITSU is
unable to assume responsibility for infringement of any patent rights or other rights of third parties
arising from the use of this information or circuit diagrams.
• The products described in this document are designed, developed and manufactured as contemplated
for general use, including without limitation, ordinary industrial use, general office use, personal use, and
household use, but are not designed, developed and manufactured as contemplated (1) for use
accompanying fatal risks or dangers that, unless extremely high safety is secured, could have a serious
effect to the public, and could lead directly to death, personal injury, severe physical damage or other
loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass
transport control, medical life support system, missile launch control in weapon system), or (2) for use
requiring extremely high reliability (i.e., submersible repeater and artificial satellite).
Please note that Fujitsu will not be liable against you and/or any third party for any claims or damages
arising in connection with above-mentioned uses of the products.
• Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage
or loss from such failures by incorporating safety design measures into your facility and equipment such
as redundancy, fire protection, and prevention of over-current levels and other abnormal operating
conditions.
• If any products described in this document represent goods or technologies subject to certain
restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the prior
authorization by Japanese government will be required for export of those products from Japan.
*

iv
Softune REALOS/907 MANUAL SET
The REALOS/907 manual set consists of four volumes listed below. A first-time user of
REALOS/907 should first read the F2MC-16L/16LX/16/16H/16F User's Guide.
F2MC-16L/16LX/16/16H/16F
Softune REALOS/907
User's Guide
This manual contains the following items: application
system creation procedure and precautionary information
on system use.
F2MC-16L/16LX/16/16H/16F
Softune REALOS/907
Kernel Manual
FR/F2MC Family
Softune REALOS/FR/907/896
Configurator Manual
This manual contains information required to
create user programs.
This manual explains the REALOS
Configurator functions and how to use them.
FR-V/FR/F2MC Family
Softune REALOS
Analyzer Manual
This manual explains the REALOS Analyzer
functions and how to use them.
Softune REALOS/896 is not supported.
*

v
READING THIS MANUAL
■Product names
In this manual and this product, product names are designated as follows:
SOFTUNE is designated as Softune.
The Microsoft®Windows®98 operating system is abbreviated to Windows 98.
The Microsoft®Windows®Millennium Edition operating system is abbreviated to Windows Me.
The Microsoft®Windows NT®Workstation operating system Version 4.0 and
the Microsoft®Windows NT®Server network operating system Version 4.0 are abbreviated to
Windows NT 4.0.
The Microsoft®Windows®2000 Professional operating system,
the Microsoft®Windows®2000 Server operating system,
the Microsoft®Windows®2000 Advanced Server operating system, and
the Microsoft®Windows®2000 Datacenter Server operating system are abbreviated to
Windows 2000.
The Microsoft®Windows®XP Professional operating system and
the Microsoft®Windows®XP Home Edition operating system are abbreviated to
Windows XP.
■Meaning of symbols
Note: Special attention is required. Always read these notes.
*

vi
*

vii
CONTENTS
CHAPTER 1 Notes on Operation .......................................................................................1
1.1 Notes on Programming............................................................................................................................2
1.2 Notes on Hardware..................................................................................................................................4
CHAPTER 2 Developing Application Systems .................................................................5
2.1 REALOS/907 Products ............................................................................................................................6
2.2 Directory Configuration ............................................................................................................................8
2.3 Preparing a Development Environment...................................................................................................9
2.4 Installing REALOS/907 ..........................................................................................................................10
2.5 Programs Required for an Application System......................................................................................11
2.6 Development Steps ...............................................................................................................................12
2.7 Developing User Programs....................................................................................................................14
2.8 Developing a User-Defined Module.......................................................................................................15
2.9 Configuring and Running a System .......................................................................................................17
CHAPTER 3 Overview of the Standard I/O Library ........................................................19
3.1 Structure of the Standard I/O Library.....................................................................................................20
3.2 Incorporating the Standard I/O Driver....................................................................................................22
3.3 Example of Creating a Standard I/O Driver ...........................................................................................23
3.4 How to Use the Standard I/O Library.....................................................................................................25
CHAPTER 4 Program Reference for the Standard I/O Library......................................27
4.1 Standard I/O Function Interface Putchar ...............................................................................................28
4.2 Standard I/O Function Interface Getchar...............................................................................................29
4.3 Standard I/O Function Interface Printf ...................................................................................................30
APPENDIX..............................................................................................................................33
APPENDIX A Program Description................................................................................................................34
APPENDIX B Running the Sample System...................................................................................................37
APPENDIX C Sample System Memory Map .................................................................................................51
INDEX ....................................................................................................................................53
*

viii
*

1
CHAPTER 1 Notes on Operation
This chapter explains a number of important points on using Softune REALOS/907.
1.1 Notes on Programming
1.2 Notes on Hardware
*

2
CHAPTER 1 Notes on Operation
1.1 Notes on Programming
Describes important points on programming for Softune REALOS/907.
■Notes on programming
Note:
• Do not call ext_tsk from task independent portions.
Calling ext_tsk from a task independent portion generates an error and enters an
infinite loop on returning to the task independent portion.
• Do not call ret_int from task portions.
The previous context may not be able to be restored if ret_int is called from a task
portion.
• Call ext_tsk to terminate a task.
Tasks do not terminate on the ret_int or return instructions (such as the retp and ret
assembler instructions or the C language return statement). The program will not
function correctly if these instructions are used instead of calling ext_tsk.
• Do not write directly to the following registers and memory areas from within user
programs.
Special registers (PS, SSB, SSP, USB, USP), register memory banks used by the
kernel (between 190H and 19fH in the general-purpose register area), delayed
interrupt control register, interrupt control register, interrupt vector table, and OS data
area.
These areas are used by the kernel.
• The user does not need to create a program containing the interrupt vector table and
OS initial data. These are generated as programs by the configurator during system
configuration.
• After a reset, system calls cannot be used before execution of the OS entry routine.
The first system call that can be used after the completion of OS initialization is the
initialize handler routine.
• The initialize handler routine can only use system calls that can be used in task
independent portions. The initialize handler program must specify use of memory
areas other than the memory register bank used by the kernel.
• As message passing using the mailboxes is performed by passing pointers, there must
be a one-to-one relationship between send and receive operations.
• The message header area is used when passing messages using the mailboxes.
Therefore, do not write to the message header after sending the message.
*

3
1.1 Notes on Programming
Note:.
• Rigorous error checking is not performed on addresses returned to a memorypool.
Therefore, you must store the address of memory reserved from the pool until the
memory is released. System operation may be corrupted if the address specified when
releasing memory is different to the reserved address.
• Symbol and label names starting with the labels listed below are reserved by the OS.
Do not use in user programs.
“r97_”, “_r97_” (Used in programs)
“R97_”, “_R97_” (Used in programs)
“R_”, “r_” (Used in programs)
• The system stack is used by the OS and interrupt program (handlers).
• Except when using a common stack, separate stacks must be provided for each task.
• Task stack areas must be maintained at all times except when the task is in the
DORMANT state. Do not manipulate stack areas belonging to other tasks or use as the
stack for different tasks.
• All tasks go to the DORMANT state after the OS is initialized. To set tasks to the
READY state, tasks must be started (by calling the sta_tsk system call) in the initialize
handler or in an interrupt handler.
• Do not use double-byte codes or Japanese characters for a directory name.
• Do not use double-byte codes or Japanese characters for a file name.
• It is necessary to locate these sections ( R97_TBL, R97_ILV,R97_CODE,
R97_CODE1, and R97_CODE2 ) in the same bank. Please be sure to specify the
address of kernel code at the "Kernel code address" in the "Memory" tab of the "Set
Configration File" dialog.
*

4
CHAPTER 1 Notes on Operation
1.2 Notes on Hardware
Describes important points relating to the hardware.
■Notes on hardware
Note:
• Softune REALOS/907 requires a 16-bit microcontroller (F2MC-16L/16LX/16/16H/16F
series) with an internal delayed interrupt module and bit search module.
• One interrupt is required to operate the system clock. Normally, an interval timer is
used to generate fixed-period interrupts. An interval timer internal to the MCU can also
be used.
• The OS uses the delayed interrupt module. Do not specify a user program in the
delayed interrupt vector table.
• The performance of the OS improves if the system stack and kernel management data
areas are located in high-speed memory.
• Do not use the internal EI²OS in the microcontroller.
*

5
CHAPTER 2 Developing Application Systems
This chapter describes how to develop application systems using Softune REALOS/
907.
2.1 Softune REALOS/907 Products
2.2 Directory Configuration
2.3 Preparing a Development Environment
2.4 Installing Softune REALOS/907
2.5 Programs Required for an Application System
2.6 Development Steps
2.7 Developing User Programs
2.8 Developing a User-Defined Module
2.9 Configuring and Running a System
*

6
CHAPTER 2 Developing Application Systems
2.1 REALOS/907 Products
The REALOS/907 products consist of the REALOS/907 realtime OS programs (included
in provided media) and the manual set.
■REALOS/907 products
Figure 2.1 shows the REALOS/907 products.
Figure 2.1 REALOS/907 Products
Available on CD-ROM
Kernel Manual
User's Guide
Configurator Manual
+
REALOS/907
Analyzer Manual
*

7
2.1 REALOS/907 Products
■Manuals
Table 2.1 lists the REALOS/907 manuals.
Table 2.1 REALOS/907 Manuals
Manual Contents
Kernel Manual Describes information required for developing user programs.
Refer to this manual when developing tasks and handlers.
Configurator Manual
Describes the function and operation of the Softune REALOS/907
configurator.
Refer to this manual when configuring an application system.
User's Guide
This manual.
The manual describes the procedure for generating application
systems and important points regarding the overall system. The
manual also describes the debugger macro commands used when
debugging Softune REALOS/907 applications using the debugger.
Analyzer Manual Describes the function and operation of the Softune REALOS analyzer.
*

8
CHAPTER 2 Developing Application Systems
2.2 Directory Configuration
Figure 2.2 lists the programs that appear in the directory after installation.
■Files
Figure 2.2 shows the structure of the realos directory after installing REALOS/907.
Figure 2.2 REALOS/907 File Structure
Directory
for installation realos907.txt
bin
Updated information file regarding supplied files
Configurator & Analyzer (Storage directory for
configurator executable file)
lib 907 Storage directory for help file
rtos 907
knl
syslib
rcf Directory that configurator uses
Directory for standard I/O liblary
creation
smpsys
smpdrv
scdef*.inc
scdef*.h
stdio.lib
OS definition file for assembly
language
OS definition file for C language
Standard I/O library
r97ins.asm
*1
Kernel source file
stdio
Strage directory for sample system1
Strage directory for sample system2
*1: Not include in the evaluation version.
smp1
smp2
Sample system1 work space file
Sample system2 work space file
smp1.wsp
smp2.wsp
dbg Storage directory for task Analysis
Modules of Analyzer
*
Other manuals for F2MC-16L Series
3
This manual suits for next models
4
Table of contents
Other Fujitsu Semiconductor manuals