JP3022848B2 - Multitask task switching method and real-time operating system - Google Patents

Multitask task switching method and real-time operating system

Info

Publication number
JP3022848B2
JP3022848B2 JP10234210A JP23421098A JP3022848B2 JP 3022848 B2 JP3022848 B2 JP 3022848B2 JP 10234210 A JP10234210 A JP 10234210A JP 23421098 A JP23421098 A JP 23421098A JP 3022848 B2 JP3022848 B2 JP 3022848B2
Authority
JP
Japan
Prior art keywords
memory
address
flash memory
task
register
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP10234210A
Other languages
Japanese (ja)
Other versions
JP2000066909A (en
Inventor
義信 山田
Original Assignee
日本電気アイシーマイコンシステム株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電気アイシーマイコンシステム株式会社 filed Critical 日本電気アイシーマイコンシステム株式会社
Priority to JP10234210A priority Critical patent/JP3022848B2/en
Publication of JP2000066909A publication Critical patent/JP2000066909A/en
Application granted granted Critical
Publication of JP3022848B2 publication Critical patent/JP3022848B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、リアルタイム・オ
ペレーティング・システム、以下リアルタイムOSとい
う、に関し、特に時分割型リアルタイム0Sのタスク切
り替え処理の技術に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a real-time operating system (hereinafter referred to as "real-time OS"), and more particularly, to a technique for task switching of a time-division real-time OS.

【0002】[0002]

【従来の技術】リアルタイムOSは、システムコールと
呼ばれるユーザープログラムから依頼されたタスクの起
動や終了等を処理するサブルーチン・コールと、カーネ
ルと呼ばれるリアルタイムOS自身がユーザープログラ
ムとは独立してタスクの切り替え等を起動する中核プロ
グラムとからなり、主として制御、通信、周辺装置等に
組み込まれたマイクロプロセッサの0Sとして用いら
れ、一般のOSではマン・マシン・インタフェースが重
視されるのに対して、リアルタイムOSではマン・マシ
ン・インタフェースよりも実行速度の方が重視される。
2. Description of the Related Art A real-time OS includes a subroutine call called a system call for processing activation and termination of a task requested by a user program, and a real-time OS itself called a kernel switches tasks independently of the user program. It is mainly used as the OS of a microprocessor incorporated in control, communication, peripheral devices, etc., while a man-machine interface is emphasized in a general OS, whereas a real-time OS The emphasis is on execution speed over man-machine interface.

【0003】また、マイクロプロセッサによって制御さ
れる幾つかの周辺装置は、それぞれの状態情報がメモリ
の固定番地に割り付けられた制御レジスタに格納されて
いる。これらの周辺装置の内、割り付けられた制御レジ
スタに格納された状態情報が一旦別のメモリ番地に退避
された後、再びその退避情報が元の制御レジスタに戻さ
れたとき、退避前の状態に戻って動作することができる
周辺装置を時分割使用可能なハードウェアとして定義さ
れる。このようなハードウェアの典型的な例としては、
外付けの補助記憶装置の1つであるシリコン・ディスク
等に用いられるフラッシュ・メモリがある。
In some peripheral devices controlled by a microprocessor, status information is stored in a control register assigned to a fixed address of a memory. Of these peripheral devices, after the status information stored in the allocated control register is once saved to another memory address, when the saved information is returned to the original control register again, the state before the save is restored. A peripheral device that can operate back is defined as time-sharing enabled hardware. Typical examples of such hardware include:
There is a flash memory used for a silicon disk or the like which is one of external auxiliary storage devices.

【0004】図8は、上述の従来の典型的な時分割リア
ルタイムOSによるタスク切り替えの流れ図である。
FIG. 8 is a flowchart of task switching by the above-described conventional typical time-division real-time OS.

【0005】先ず、タスク切り替えのためのタイマ割り
込みを発生し(ステップS1)、現行タスクが使用して
いる動的変数を退避し(ステップS2)、現行タスクの
アドレスを退避し(S3)、切り替わる次のタスクを選
択してタスクの実行時間を設定し(S4)、選択された
タスクが使用していた動的変数を復帰し(S5)、選択
されたタスクの復帰アドレスをスタックに設定し(S
6)、タイマ割り込みから復帰している(S7)。
First, a timer interrupt for task switching is generated (step S1), the dynamic variables used by the current task are saved (step S2), the address of the current task is saved (S3), and the task is switched. The next task is selected, the execution time of the task is set (S4), the dynamic variables used by the selected task are restored (S5), and the return address of the selected task is set in the stack ( S
6), returning from the timer interrupt (S7).

【0006】例えば、特開平3−201138号公報の
「スタックポインタ管理方法」は、多重割り込み処理に
おいてリアルタイム性を保持し、かつ、各タスクのスタ
ックエリアに設けられる割り込み処理用の予備スタック
エリアを大幅に削減することを目的として、各タスクご
とのスタックエリアの他に、「割り込み処理スタックエ
リア」と「スタックポインタの保存ワークエリア」とを
備えるものである。そして、先ず、タスクからの割り込
み発生時にスタックポインタが割り込み処理スタックエ
リアに切り替えられているかを判定し(1)、未だ切り
替えられていないと判定したときは、該当タスクのスタ
ックエリアにテンポラリ・ワークエリアを確保してそこ
に保存ワークエリアの内容を移し、併せてそのタスクの
スタックポインタの内容を保存ワークエリアに保存し
(2)、次に、スタックポインタの内容を割り込み処理
スタックエリア用に切り替えて割り込み処理を行って
(3)、割り込み処理の終了後にスタックポインタの内
容を先に保存ワークエリアに保存しておいた内容に戻し
て(4)そのタスクを実行することが開示されている。
For example, the "stack pointer management method" disclosed in Japanese Unexamined Patent Publication No. Hei 3-201138 keeps real-time performance in multiple interrupt processing and greatly increases a spare stack area for interrupt processing provided in the stack area of each task. In addition to the stack area for each task, an "interrupt processing stack area" and a "stack pointer storage work area" are provided for the purpose of reducing the number of tasks. First, it is determined whether or not the stack pointer has been switched to the interrupt processing stack area when an interrupt from the task occurs (1). If it is determined that the stack pointer has not been switched yet, a temporary work area is added to the stack area of the task. Then, the contents of the save work area are moved to it, and the contents of the stack pointer of the task are also saved in the save work area (2). Then, the contents of the stack pointer are switched for the interrupt processing stack area. It discloses that interrupt processing is performed (3), and after the interrupt processing is completed, the contents of the stack pointer are returned to the contents previously saved in the save work area (4) and the task is executed.

【0007】また、特開平7−141208号公報及び
特開平7−210400号公報の「マルチタスク処理装
置」は、マルチタスク処理におけるタスク切り替え時の
ディスパッチ処理時間、すなわち、あるタスクが処理要
求を発した時から、退避していたコンテキスト等を復帰
させて実行権を与えるまでの時間、を短縮することを目
的として、各タスクに対応して占有される複数のレジス
タバンクと、さらにはレジスタバンクの空き待ち手段と
を備え、これらの複数のレジスタバンクを各タスクに動
的に割り当てることが開示されている。
The "multitask processing device" disclosed in Japanese Patent Application Laid-Open Nos. 7-141208 and 7-210400 discloses a dispatch processing time at the time of task switching in multitask processing, that is, a task issues a processing request. For the purpose of shortening the time from when the context is saved and the execution right is given to the execution right after execution, a plurality of register banks occupied for each task, and It is disclosed that a vacant waiting means is provided, and these plurality of register banks are dynamically allocated to each task.

【0008】[0008]

【発明が解決しようとする課題】しかし、従来の時分割
型リアルタイムOSにおいては、制御レジスタに割り付
けられたメモリ番地が固定されていて、プログラム上で
使用する変数とは異なっており、また、タスクの切り替
え時に実行されるのは、各タスクが使用している動的変
数の退避、復帰と、各アドレスの実行アドレス管理とだ
けなので、フラッシュ・メモリのような時分割使用可能
な周辺装置に対しては、タスク側のソフトウェアを変更
しなければならないという問題点があった。
However, in the conventional time-division real-time OS, the memory address allocated to the control register is fixed, which is different from the variable used in the program. Only the saving and restoring of the dynamic variables used by each task and the execution address management of each address are performed at the time of switching, so peripheral devices such as flash memory that can be used in a time-sharing manner In other words, there was a problem that the software on the task side had to be changed.

【0009】時分割型リアルタイムOSを使用すると、
例えば、ユーザーのプログラムでフラッシュ・メモリの
メモリ番地レジスタを変数にしている場合は、このフラ
ッシュ・メモリのメモリ番地レジスタが共通になってし
まうため、複数のタスクのメモリ処理期間が重複する場
合は、所定のフラッシュ・メモリにデータを書き込むこ
とができなくなるという不具合が生じる。
When a time-sharing real-time OS is used,
For example, if the memory address register of the flash memory is used as a variable in the user's program, the memory address register of the flash memory becomes common, so if the memory processing periods of multiple tasks overlap, There is a problem that data cannot be written to a predetermined flash memory.

【0010】従来はこの不具合を避けるために、各タス
クが管理するメモリ番地を格納するメモリ領域を用意
し、フラッシュ・メモリに書き込む直前にこのメモリ領
域で1を加算してフラッシ・ュメモリのメモリ番地レジ
スタに格納してから、フラッシュ・メモリへのデータ書
き込みを開始していた(図9参照)。
Conventionally, in order to avoid this problem, a memory area for storing a memory address managed by each task is prepared, and 1 is added to this memory area immediately before writing to the flash memory, and the memory address of the flash memory is added. After the data was stored in the register, data writing to the flash memory was started (see FIG. 9).

【0011】従って、マルチタスク化してスループット
を向上する為には、シーケンシャルな処理を対象に作成
された各タスクの既存のプログラムを全てこのように変
更して並行処理を可能にする必要があった。
Therefore, in order to improve the throughput by multitasking, it is necessary to change all the existing programs of each task created for sequential processing in this way to enable parallel processing. .

【0012】本発明の目的は、上述の問題点を解消し、
多重処理化に伴うタスク側のプログラム作成を容易にし
て工数を削減できるリアルタイムOSを提供することに
ある。
An object of the present invention is to solve the above-mentioned problems,
An object of the present invention is to provide a real-time OS capable of easily creating a program on the task side accompanying the multiprocessing and reducing man-hours.

【0013】[0013]

【課題を解決するための手段】本発明のリアルタイムO
は、各タスクが使用している動的変数を退避、復旧す
る手段と、各タスクの実行アドレス管理手段と、起動中
のタスクが使用している時分割使用可能なハードウェア
の情報を退避、復旧する手段とをカーネル部分に有する
リアルタイム・オペレーティング・システムにおいて、
ハードウェアの情報は、時分割使用可能なハードウェア
であるフラッシュ・メモリのメモリ番地レジスタのアド
レス情報、フラッシュ・メモリに格納されるデータ情
報、及びフラッシュ・メモリの動作状態情報を含み、か
つ、制御レジスタに格納されることを特徴とする。
According to the present invention, a real-time O
S saves and restores dynamic variables used by each task
Means, execution address management means for each task, and running
Time-sharing available hardware used by other tasks
Means for saving and restoring information in the kernel
In a real-time operating system,
Hardware information is time-shared hardware
Address of the memory address register of the flash memory
Address information and data information stored in the flash memory.
Information, and flash memory operating status information.
And stored in a control register.

【0014】本発明のリアルタイムOSのカーネル部分
は、従来と同様な「各タスクが使用している動的変数の
退避、復旧手段」及び「各タスクの実行アドレスの管理
手段」を備えると共に、さらに、起動中のタスクが使用
している「時分割使用可能なハードウェアの情報」を格
納、退避する手段を有する。そして、マルチタスクの切
替時には、タスク切替のためのタイマ割り込みを発生さ
せ、起動中の現行タスクが使用している動的変数及び現
行タスクのアドレスを退避し、現行タスクが使用してい
るフラッシュ・メモリの情報を退避し、実行時間を設定
して次に実行するタスクを選択し、現行タスクの実行を
選択したタスクの実行に切り替え、選択したタスクが使
用した動的変数を退避先から復帰し、選択したタスクの
復帰アドレスをスタックに設定し、タイマ割り込みから
復帰する。
The kernel part of the real-time OS according to the present invention includes “means for saving and restoring dynamic variables used by each task” and “means for managing the execution address of each task” as in the conventional case. And means for storing and saving “time-division usable hardware information” used by the running task. And turn off multitasking
A timer interrupt for task switching
Dynamic variables used by the current task
Saves the address of the line task and saves the address used by the current task.
Saves flash memory information and sets execution time
To select the next task to execute and execute the current task.
Switches to the execution of the selected task, and the selected task
Restore the used dynamic variables from the save destination and
Set the return address on the stack and start from the timer interrupt.
Return.

【0015】[0015]

【発明の実施の形態】次に、本発明の実施の形態につい
て図面を参照して説明する。
Next, embodiments of the present invention will be described with reference to the drawings.

【0016】図1は本発明の時分割型リアルタイムOS
のタスク切り替え方法の1実施例の流れ図、図2は図1
の実施例のシステム構成図、図3は制御レジスタのメモ
リ割り当て図、図4はマルチタスク処理時の内部メモリ
の推移を示す図である。
FIG. 1 shows a time-division real-time OS according to the present invention.
FIG. 2 is a flowchart of one embodiment of the task switching method of FIG.
FIG. 3 is a diagram showing memory allocation of control registers, and FIG. 4 is a diagram showing transition of an internal memory during multitask processing.

【0017】本実施例のシステムは、図2に示すよう
に、複数のタスクを有するシーケンスプログラムが格納
されるプログラムメモリ2と、システムプログラムが格
納されるシステムメモリ3と、制御レジスタ11と内部
メモリ12とを有してシステムプログラムの制御により
シーケンスプログラムを実行する中央処理装置1と、フ
ラッシュ・メモリ41を含む周辺装置4とからなる。カ
ーネル部分を含むリアルタイムOSは、システムメモリ
から中央処理装置1にロードされ、制御レジスタ11を
用いて周辺装置4を駆動し、タスクを切り替えながらシ
ーケンスプログラムを実行させる。なお、制御レジスタ
11は、図3に示すように、100番地にフラッシュメ
モリのメモリ番地レジスタ、101番地にフラッシュメ
モリのデータ内容レジスタ、102番地に書き込み中フ
ラグと書き込み依頼フラグとを有するフラッシュメモリ
の状態レジスタがそれぞれ割り当てられる。
As shown in FIG. 2, the system according to the present embodiment includes a program memory 2 for storing a sequence program having a plurality of tasks, a system memory 3 for storing a system program, a control register 11 and an internal memory. And a peripheral device 4 including a flash memory 41 for executing a sequence program under the control of a system program. The real-time OS including the kernel portion is loaded from the system memory into the central processing unit 1, drives the peripheral device 4 using the control register 11, and executes the sequence program while switching tasks. Note that the control register
Reference numeral 11 denotes a flash memory at address 100 as shown in FIG.
Memory memory address register, flash memory at address 101
Memory data contents register, writing to address 102
Flash memory with lag and write request flag
Are respectively assigned.

【0018】図1によりタスク切り替え時の動作につい
て説明する。
The operation at the time of task switching will be described with reference to FIG.

【0019】先ず、タスク切り替えのためのタイマ割り
込みを発生し(ステップS1)、現タスクが使用してい
る動的変数を退避し(ステップS2)、その後、現タス
クが使用している時分割使用可能なハードウェア情報を
退避し(S25)、現行タスクのアドレスを退避し(S
3)、切り替わるタスクの選択とタスクの実行時間を設
定し(S4)、選択されたタスクが使用していた動的変
数を復帰し(S5)、選択されたタスクが使用していた
時分割使用可能なハードウェア情報を復帰し(S5
5)、選択されたタスクの復帰アドレスをスタックに設
定し(S6)、タイマ割り込みから復帰する(S7)。
First, a timer interrupt for task switching is generated (step S1), and the dynamic variables used by the current task are saved (step S2). Possible hardware information is saved (S25), and the address of the current task is saved (S25).
3) Selecting the task to be switched and setting the execution time of the task (S4), restoring the dynamic variables used by the selected task (S5), and using the time-sharing used by the selected task Restore available hardware information (S5
5) The return address of the selected task is set in the stack (S6), and the process returns from the timer interrupt (S7).

【0020】すなわち、任意の時間ごとに実行タスクを
切り替えるとき、実行タスクのスタック情報と実行タス
クが使用している時分割使用可能な共有のハードウェア
情報を退避して、次タスクが以前格納していたスタック
情報と次タスクが使用していた時分割使用可能な共有ハ
ードウェア情報を元に戻し、次タスクの起動を指示す
る。
That is, when the execution task is switched at an arbitrary time, the stack information of the execution task and the shared hardware information used by the execution task that can be used in a time-sharing manner are saved, and the next task is stored before. The stack information that was used and the shared hardware information that can be used in a time-sharing manner used by the next task are returned to the original state, and the activation of the next task is instructed.

【0021】例えば、タスクAとタスクBの共有ハード
ウェアであるフラッシュ・メモリの処理時間が重複する
区間で、タスクAが起動しているときは、フラツシュ・
メモリのメモリ番地レジスタ(制御レジスタ11の10
0番地)にはタスクA用のフラツシュ・メモリのメモリ
番地が格納され、また、リアルタイムOSが管理してい
る内部メモリ12にはタスクB用のフラツシュ・メモリ
のメモリ番地が格納される。
For example, in a section where the processing times of the flash memories which are the shared hardware of the task A and the task B overlap, when the task A is activated,
Memory address register of memory (10 of control register 11)
The memory address of the flash memory for task A is stored in address (0), and the memory address of the flash memory for task B is stored in the internal memory 12 managed by the real-time OS.

【0022】一方、同じ重複区間でタスクBが起動して
いるときは、タスクAの起動時とは反対に、フラツシュ
・メモリのメモリ番地レジスタにはタスクB用のメモリ
番地が格納され、内部メモリ12にはタスクA用のフラ
ツシュ・メモリのメモリ番地がそれぞれ格納される。
On the other hand, when the task B is activated in the same overlapping section, contrary to the activation of the task A, the memory address for the task B is stored in the memory address register of the flash memory. Reference numeral 12 stores a memory address of the flash memory for the task A.

【0023】同様に、タスクBとタスクCの処理時間が
重複する区間では、タスクBが起動しているときは、フ
ラツシュ・メモリのメモリ番地レジスタにタスクB用の
メモリ番地が格納され、内部メモリ12にタスクC用の
フラツシュ・メモリのメモリ番地が格納されており、タ
スクCが起動されているときは、フラツシュ・メモリの
メモリ番地レジスタにタスクC用のメモリ番地が格納さ
れ、内部メモリ12にはタスクB用のフラツシュ・メモ
リのメモリ番地が格納される。
Similarly, in the section where the processing times of task B and task C overlap, when task B is running, the memory address for task B is stored in the memory address register of the flash memory, and the internal memory 12 stores the memory address of the flash memory for the task C. When the task C is activated, the memory address for the task C is stored in the memory address register of the flash memory. Is the memory address of the flash memory for task B.

【0024】従って、時分割使用可能な共有ハードウェ
アの情報が一括して管理されるので、各タスクでそれぞ
れ個別に管理する場合に比較すると、プログラム容量が
少なくて済み、プログラム作成が容易になる。
Therefore, the information on the shared hardware that can be used in a time-sharing manner is managed collectively, so that the program capacity is smaller and the program creation becomes easier as compared with the case where each task is managed individually. .

【0025】このようなリアルタイムOSの具体例とし
て、ディジタル・スチル・カメラによる連続写真撮影、
すなわち、連写機能の制御の場合について説明する。
As a specific example of such a real-time OS, continuous photographing by a digital still camera,
That is, the case of controlling the continuous shooting function will be described.

【0026】ディジタル・スチル・カメラの撮影には、
図5に示すように、1回の撮影ごとに映像データを取り
込んで圧縮する処理と、圧縮されたデータをフラッシュ
・メモリに書込む処理との2つの処理をシーケンシャル
に行なう必要があり、マイクロプロセッサの処理では、
この1回ごとの1連の処理を1タスクとしている。
For shooting with a digital still camera,
As shown in FIG. 5, it is necessary to sequentially perform two processes of a process of capturing and compressing video data for each shooting and a process of writing the compressed data to a flash memory. In the processing of
One series of processing each time is regarded as one task.

【0027】従来の連写の場合は、図5に示すように、
1枚目の撮影の書込処理を終了してから次の2枚目の撮
影の映像取込圧縮処理を始めて、各タスクをシーケンシ
ャルに処理していた。
In the case of the conventional continuous shooting, as shown in FIG.
After completing the writing process for the first shot, the video capture compression process for the next second shot was started, and each task was processed sequentially.

【0028】しかし、連写の高速化が要求されると、図
6に示すように、1枚目のデータ取込圧縮処理が終わる
と、1枚目の圧縮データのメモリへの書込処理開始と同
時に2枚目のデータ取込圧縮処理を開始して、2つのタ
スクをオーバーラップさせて処理する必要があり、時分
割型リアルタイムOSによるマルチタスクの切り替え処
理が行なわれる。
However, when the speed of continuous shooting is required, as shown in FIG. 6, when the first data fetching compression process is completed, the process of writing the first compressed data to the memory is started. At the same time, it is necessary to start the second data fetch / compression process and process the two tasks in an overlapping manner, and a multitask switching process is performed by a time-division real-time OS.

【0029】各タスクの内、フラッシュ・メモリへの圧
縮データ書込み処理を図3及び図7により説明する。
The processing of writing compressed data to the flash memory in each task will be described with reference to FIGS.

【0030】マイクロプロセッサ1のメモリ上には、フ
ラッシュ・メモリ41に関する制御レジスタ11とし
て、動作を指示するフラッシュメモリのメモリ番地を示
す「フラッシュ・メモリのメモリ番地レジスタ」100
番地と、指定されたメモリに書込む内容が格納される
「フラッシュ・メモリのデータ内容レジスタ」101番
地と、フラッシュ・メモリの書き込み状態が格納される
「フラッシュ・メモリの状態レジスタ」102番地とが
割り付けられている。この「フラッシュ・メモリの状態
レジスタ」102番地は、フラッシュ・メモリの書き込
み中を示す「書込み中フラグ」と、フラッシュ・メモリ
に書き込みを依頼する「書込み依頼フラグ」とを有す
る。
On the memory of the microprocessor 1, as a control register 11 relating to the flash memory 41, a "memory address register of flash memory" 100 indicating the memory address of the flash memory instructing the operation.
The address, a "flash memory data content register" 101 storing the content to be written to the specified memory, and a "flash memory status register" 102 storing the flash memory write status are stored. Assigned. The "flash memory status register" 102 has a "writing flag" indicating that the flash memory is being written, and a "write request flag" for requesting the flash memory to write.

【0031】ユーザーのプログラムは、図7に示すよう
に、フラッシュ・メモリへの圧縮データの書込みを開始
しようとすると、まず、102番地の状態レジスタの書
込み中フラグを見て前回の書込みが終了しているかどう
かを判定し(ステップS11)、前回の書込みが終了し
ておればメモリ番地レジスタ100番地の内容に1を加
えて圧縮データの書込み先のアドレスを指定し(ステッ
プS12)、データ内容レジスタ101番地に圧縮デー
タの内容を格納し(ステップS13)、フラッシュ・メ
モリの状態レジスタ102番地の書込み依頼フラグを設
定してフラッシュ・メモリ41への書込みを開始し、書
込み中は書込み中フラグを設定する(ステップS1
4)。
As shown in FIG. 7, when the user program tries to start writing compressed data to the flash memory, the user program first looks at the writing flag of the status register at address 102, and the previous writing ends. It is determined whether or not the data has been written (step S11). If the previous writing has been completed, 1 is added to the content of the memory address register 100 to specify the write destination address of the compressed data (step S12). The contents of the compressed data are stored in the address 101 (step S13), the write request flag in the status register 102 of the flash memory is set, writing to the flash memory 41 is started, and the writing flag is set during writing. (Step S1
4).

【0032】このプログラム例では、フラッシュ・メモ
リのメモリ番地レジスタを変数にしているが、時分割型
リアルタイムOSを使用すると、この制御レジスタの
「フラッシュ・メモリのメモリ番地レジスタ」100番
地が各タスクに対して共通になってしまうため、図6の
区間1及び区間2で示されるように2つのタスクのメモ
リ書き込み処理期間が重複する場合は、所定のフラッシ
ュ・メモリに圧縮データを書き込むことができなくなる
という不具合が生じる。
In this example of the program, the memory address register of the flash memory is used as a variable. However, if a time-division real-time OS is used, the "memory address register of the flash memory" 100 of this control register is assigned to each task. When the memory write processing periods of the two tasks overlap as shown in section 1 and section 2 in FIG. 6, compressed data cannot be written to a predetermined flash memory. The problem described above occurs.

【0033】従来はこの不具合を避けるために、各タス
クが管理するメモリ番地を格納するメモリ領域を用意
し、図9のように、このメモリ領域で1を加算して(ス
テップS21,S22)、フラッシュ・メモリに書き込
む直前にフラッシ・ュメモリのメモリ番地レジスタに格
納してからフラッシュ・メモリへのデータ書き込みを開
始していた。従って、このようなタスクの並行処理を行
なうプログラムを全て変更しなければならなかった。
Conventionally, in order to avoid this problem, a memory area for storing a memory address managed by each task is prepared, and 1 is added to this memory area as shown in FIG. 9 (steps S21 and S22). Immediately before writing to the flash memory, the data is stored in the memory address register of the flash memory and then data writing to the flash memory is started. Therefore, all programs that perform such parallel processing of tasks have to be changed.

【0034】しかし、本発明によると、「フラッシュメ
モのメモリ番地レジスタ」を時分割使用可能なハードウ
ェア情報として設定することにより、タスクの切り替え
ごとに、実行タスクのスタック情報と共にそのタスクの
「フラッシュメモのメモリ番地レジスタ」も退避され、
次のタスクの起動に対しては、次のタスクのスタック情
報と「フラッシュメモのメモリ番地レジスタ」が元に戻
される。したがって、タスク1とタスク2のデータ書込
み処理が重複する図6の区間1の期間中で、タスク1が
起動して1枚目の書込みを行っているときは、フラツシ
ュ・メモリのメモリ番地レジスタ100番地にはタスク
1用のフラツシュ・メモリのメモリ番地が格納され、ま
た、リアルタイムOSが管理している内部メモリ12に
は2枚目の書込みであるタスク2用のフラツシュ・メモ
リのメモリ番地がそれぞれ格納される。
However, according to the present invention, by setting the "memory address register of the flash memo" as hardware information that can be used in a time-division manner, every time a task is switched, the "flash memory" of the task and the stack information of the task to be executed are updated. The memo memory address register is also saved,
When the next task is started, the stack information of the next task and the “memory address register of the flash memo” are restored. Therefore, during the period 1 in FIG. 6 in which the data write processing of task 1 and task 2 overlap, when task 1 is activated and the first sheet is written, the memory address register 100 of the flash memory is used. The address stores the memory address of the flash memory for task 1, and the internal memory 12 managed by the real-time OS stores the memory address of the flash memory for task 2, which is the second write. Is stored.

【0035】一方、同じ区間1でタスク2が起動して2
枚目を書き込んでいるときは、タスク1の起動時とは反
対に、フラツシュ・メモリのメモリ番地レジスタにはタ
スク2用のメモリ番地が格納され、内部メモリ12には
タスク1用のフラツシュ・メモリのメモリ番地がそれぞ
れ格納される。
On the other hand, task 2 is started in the same section 1 and 2
When the first page is being written, the memory address for the task 2 is stored in the memory address register of the flash memory, and the flash memory for the task 1 is stored in the internal memory 12, as opposed to when the task 1 is started. Are respectively stored.

【0036】同様に、2枚目と3枚目の書込みが重なる
区間2では、タスク2が起動しているときは、フラツシ
ュ・メモリのメモリ番地レジスタにタスク2用のメモリ
番地が格納され、内部メモリ12にタスク3用のフラツ
シュ・メモリのメモリ番地が格納されており、タスク3
が起動しているときは、フラツシュ・メモリのメモリ番
地レジスタにタスク3用のメモリ番地が格納され、内部
メモリにはタスク2用のフラツシュ・メモリのメモリ番
地が格納される。
Similarly, in the section 2 where the writing of the second sheet and the writing of the third sheet are overlapped, when the task 2 is activated, the memory address for the task 2 is stored in the memory address register of the flash memory. The memory address of the flash memory for task 3 is stored in the memory 12.
Is activated, the memory address for task 3 is stored in the memory address register of the flash memory, and the memory address of the flash memory for task 2 is stored in the internal memory.

【0037】従って、フラッシュ・メモリの情報がリア
ルタイムOSが管理している内部メモリ12により一括
して管理されるので、各タスクでそれぞれ個別に管理す
る場合に比較すると、プログラム容量が少なくて済み、
プログラム作成が容易になる。
Therefore, since the information of the flash memory is collectively managed by the internal memory 12 managed by the real-time OS, the program capacity can be reduced as compared with the case where each task is individually managed.
Program creation becomes easy.

【0038】[0038]

【発明の効果】上述のように本発明は、ハードウェアの
情報に時分割使用可能なハードウェアであるフラッシュ
・メモリのメモリ番地レジスタのアドレス情報、フラッ
シュ・メモリに格納されるデータ情報、及びフラッシュ
・メモリの動作状態情報を含めて制御レジスタに格納
し、各タスクが使用している時分割使用可能なハードウ
ェア情報の退避及びその復帰をリアルタイムOSのカー
ネル部によって行うことにより、多重処理化に伴なうタ
スク側のプログラム変更を用意にして工数を削減できる
効果がある。
As described above, the present invention provides a hardware
Flash is hardware that can be used in a time-sharing manner for information
・ Address information and flash memory address register
Information stored in flash memory and flash
・ Stored in the control register including the operation status information of the memory
And, man-hours and saving and restoring division available hardware information when each task is using by performing the kernel portion of the real-time OS, and the prepared program changes accompanying tasks side multiprocessing of There is an effect that can be reduced.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明の時分割型リアルタイムOSのタスク切
り替え方法の1実施例の流れ図である。
FIG. 1 is a flowchart of one embodiment of a task switching method of a time-division real-time OS according to the present invention.

【図2】図1の実施例のシステム構成図である。FIG. 2 is a system configuration diagram of the embodiment of FIG.

【図3】組み込み用マイクロプロセッサのフラツシュ・
メモリと制御レジスタのメモリ割り付けの1実施例を示
す図である。
FIG. 3 is a diagram illustrating a flash memory of an embedded microprocessor.
FIG. 6 is a diagram showing one embodiment of memory allocation of a memory and a control register.

【図4】リアルタイムOSが管理しているメモリの動作
例である。
FIG. 4 is an operation example of a memory managed by a real-time OS.

【図5】ディジタル・スチール・カメラの連写撮影のシ
ーケンス図である。
FIG. 5 is a sequence diagram of continuous shooting by a digital still camera.

【図6】時分割リアルタイムOSを応用したディジタル
・スチール・カメラの連写撮影のシーケンス図である。
FIG. 6 is a sequence diagram of continuous shooting of a digital still camera to which a time-division real-time OS is applied.

【図7】フラッシュ・メモリへの圧縮データ書込み処理
の1例の流れ図である。
FIG. 7 is a flowchart illustrating an example of a process of writing compressed data to a flash memory;

【図8】従来の時分割リアルタイムOSによるタスク切
り替えの流れ図である。
FIG. 8 is a flowchart of task switching by a conventional time-division real-time OS.

【図9】フラッシュ・メモリへの圧縮データ書込み処理
の流れ図である。
FIG. 9 is a flowchart of a process of writing compressed data to a flash memory.

【符号の説明】[Explanation of symbols]

1 中央処理装置 2 プログラムメモリ 3 システムメモリ 4 周辺装置 11 制御レジスタ 12 内部メモリ 41 フラッシュ・メモリ S1〜S55 ステップ DESCRIPTION OF SYMBOLS 1 Central processing unit 2 Program memory 3 System memory 4 Peripheral device 11 Control register 12 Internal memory 41 Flash memory S1-S55 Step

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 平6−111032(JP,A) 特開 昭51−114839(JP,A) 特開 平7−284063(JP,A) 特開 平6−86203(JP,A) 特開 平8−125957(JP,A) (58)調査した分野(Int.Cl.7,DB名) G06F 9/46 G06F 9/30 G06F 13/10 G06F 13/12 G06F 12/02 G06F 12/00 G06F 12/06 G06F 15/78 G06F 3/06 G06F 3/08 G06T 1/60 H04N 5/781 H04N 5/907 G06K 17/00 G06K 19/00 ──────────────────────────────────────────────────続 き Continuation of the front page (56) References JP-A-6-111032 (JP, A) JP-A-51-114839 (JP, A) JP-A-7-284063 (JP, A) JP-A-6-110 86203 (JP, A) JP-A-8-125957 (JP, A) (58) Fields investigated (Int. Cl. 7 , DB name) G06F 9/46 G06F 9/30 G06F 13/10 G06F 13/12 G06F 12/02 G06F 12/00 G06F 12/06 G06F 15/78 G06F 3/06 G06F 3/08 G06T 1/60 H04N 5/781 H04N 5/907 G06K 17/00 G06K 19/00

Claims (5)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 複数のタスクを有するシーケンス・プロ
グラムが格納されるプログラム・メモリと、カーネル部
分を含むリアルタイム・オペレーティング・システムが
格納されるシステム・メモリと、内部に制御レジスタと
内部メモリを持ち、前記システム・プログラムの制御に
より前記シーケンス・プログラムを実行する中央処理装
置と、フラッシュ・メモリを含む周辺装置とを有し、前
記リアルタイム・オペレーティング・システムが前記制
御レジスタを用いて前記周辺装置を駆動し、タスクを切
り替えながら前記シーケンス・プログラムを実行させる
リアルタイム・オペレーティング・システムにおいて、 起動中のタスクに対応するフラッシュ・メモリのメモリ
番地レジスタのアドレス情報、該フラッシュ・メモリに
格納されるデータ情報、及び該フラッシュメモリの動作
状態情報が前記制御レジスタに格納され、起動中でない
タスクに対応するフラッシュ・メモリのメモリ番地レジ
スタのアドレス情報が前記内部メモリに格納されること
を特徴とするリアルタイム・オペレーティング・システ
ム。
A program memory for storing a sequence program having a plurality of tasks; a system memory for storing a real-time operating system including a kernel portion; a control register and an internal memory therein; A central processing unit for executing the sequence program under the control of the system program; and a peripheral device including a flash memory, wherein the real-time operating system drives the peripheral device using the control register. In a real-time operating system for executing the sequence program while switching tasks, address information of a memory address register of a flash memory corresponding to a task being started, data stored in the flash memory Information and operation status information of the flash memory are stored in the control register, and address information of a memory address register of the flash memory corresponding to a task that is not running is stored in the internal memory. operating system.
【請求項2】 前記フラッシュ・メモリの動作状態情報
が、書き込み中フラグと、書き込み依頼フラグとからな
る請求項1に記載のリアルタイム・オペレーティング・
システム。
2. The real-time operating system according to claim 1, wherein the operation state information of the flash memory includes a writing flag and a writing request flag.
system.
【請求項3】 前記メモリ番地レジスタのアドレス情
報、前記データ情報、及び前記動作状態情報は、前記制
御レジスタの連続したアドレス番地にある各レジスタに
格納される請求項1に記載のリアルタイム・オペレーテ
ィング・システム。
3. The real-time operating system according to claim 1, wherein the address information of the memory address register, the data information, and the operation state information are stored in respective registers at consecutive address addresses of the control register. system.
【請求項4】 前記メモリ番地レジスタのアドレス情
報、前記データ情報、及び前記動作状態情報は、前記制
御レジスタの連続したアドレス番地にあるメモリ番地レ
ジスタ、データ内容レジスタ、及び状態レジスタにそれ
ぞれ格納され、前記状態レジスタは、書き込み中フラグ
と書き込み依頼フラグとを有する請求項1に記載のリア
ルタイム・オペレーティング・システム。
4. The address information, the data information, and the operation state information of the memory address register are stored in a memory address register, a data content register, and a state register at consecutive address addresses of the control register, respectively. 2. The real-time operating system according to claim 1, wherein the status register includes a writing flag and a write request flag.
【請求項5】 前記フラッシュ・メモリへの書き込みの
手順が、前記書き込み中フラグのオフを検出するステッ
プと、前記メモリ番地レジスタで指定される前記フラッ
シュ・メモリのアドレス番地に所定の数を加えて次にデ
ータを書込 むべき前記フラッシュ・メモリのアドレス番
地を指定するステップと、前記データ内容レジスタに前
記フラッシュ・メモリへ書き込むべき内容を格納するス
テップと、前記書き込み依頼フラグをセットし、前記フ
ラッシュ・メモリへの書き込みを開始するステップと、
前記フラッシュ・メモリへの書き込みを終了するステッ
プとからなる請求項4に記載のリアルタイム・オペレー
ティング・システム。
5. A method of writing to the flash memory, comprising the steps of: detecting the turning-off of the writing flag; and setting the flash address specified by the memory address register.
A predetermined number is added to the address of the
Write Mbeki the over data the flash memory of the address number
Specifying a location, storing the content to be written to the flash memory in the data content register, setting the write request flag, and starting writing to the flash memory;
5. The real-time operating system according to claim 4, comprising a step of terminating writing to said flash memory.
JP10234210A 1998-08-20 1998-08-20 Multitask task switching method and real-time operating system Expired - Fee Related JP3022848B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10234210A JP3022848B2 (en) 1998-08-20 1998-08-20 Multitask task switching method and real-time operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10234210A JP3022848B2 (en) 1998-08-20 1998-08-20 Multitask task switching method and real-time operating system

Publications (2)

Publication Number Publication Date
JP2000066909A JP2000066909A (en) 2000-03-03
JP3022848B2 true JP3022848B2 (en) 2000-03-21

Family

ID=16967432

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10234210A Expired - Fee Related JP3022848B2 (en) 1998-08-20 1998-08-20 Multitask task switching method and real-time operating system

Country Status (1)

Country Link
JP (1) JP3022848B2 (en)

Also Published As

Publication number Publication date
JP2000066909A (en) 2000-03-03

Similar Documents

Publication Publication Date Title
JP3253303B2 (en) Context switching apparatus and method
JP3074178B2 (en) Program module loading and execution method
JP2001516922A (en) Data processing device with hardware auxiliary context switching function
JPS6040067B2 (en) Distributed control multiprocessing system
JP3970609B2 (en) Processor system
JP5131269B2 (en) Multi-processing system
JP3022848B2 (en) Multitask task switching method and real-time operating system
JP2002149491A (en) Processor memory system
JP2001256062A (en) Interruption processing method and operation processor using the same
JPH0916409A (en) Microcomputer
JP2568017B2 (en) Microprocessor and data processing system using the same
JPS62151940A (en) Register saving/return system
JP3956305B2 (en) Nonvolatile semiconductor memory device and data processing device
JP2579008B2 (en) Time-division multitasking execution device
JP2000040028A (en) System for extending dsp program area by cpu control
JP2790472B2 (en) Multiple conversation processing control method
JPH0756633B2 (en) Task switching method
JP2000099342A (en) Computer system capable of effective use of memory
JP2896207B2 (en) A / D converter
EP1104899A2 (en) Data processing apparatus and method of controlling the same
JP3127737B2 (en) Digital signal processor
JPS635790B2 (en)
JPH08507630A (en) Memory management device and memory management method
JPH03182945A (en) Transfer system for data in main storage
JPH02129724A (en) Program executing system

Legal Events

Date Code Title Description
R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313113

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080114

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090114

Year of fee payment: 9

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100114

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110114

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110114

Year of fee payment: 11

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110114

Year of fee payment: 11

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110114

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120114

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130114

Year of fee payment: 13

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130114

Year of fee payment: 13

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140114

Year of fee payment: 14

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees