JP2006178829A - Microcomputer - Google Patents
Microcomputer Download PDFInfo
- Publication number
- JP2006178829A JP2006178829A JP2004372996A JP2004372996A JP2006178829A JP 2006178829 A JP2006178829 A JP 2006178829A JP 2004372996 A JP2004372996 A JP 2004372996A JP 2004372996 A JP2004372996 A JP 2004372996A JP 2006178829 A JP2006178829 A JP 2006178829A
- Authority
- JP
- Japan
- Prior art keywords
- data
- program
- memory
- patch
- flash
- 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.)
- Withdrawn
Links
Images
Abstract
Description
本発明は、マイクロコンピュータに関し、特に、ユーザプログラムを内部に記憶するマイクロコンピュータに関する。 The present invention relates to a microcomputer, and more particularly to a microcomputer that stores a user program therein.
マイクロコンピュータに内蔵されている内部メモリに様々なユーザプログラムを格納することで、マイクロコンピュータに様々な処理を実行させることができる。
このユーザプログラムを変更する場合、UART(Universal Asynchronous Receiver Transmitter)を利用し、内部メモリに新しいユーザプログラムをシリアル通信にてダウンロードして、書き込んでいる。この場合、ROM(Read Only Memory)に記憶されているプログラムを実行することで、ユーザプログラムを書き込んでいる(例えば、特許文献1)。
By storing various user programs in an internal memory built in the microcomputer, the microcomputer can execute various processes.
When changing this user program, a new user program is downloaded to the internal memory by serial communication using a UART (Universal Asynchronous Receiver Transmitter). In this case, a user program is written by executing a program stored in a ROM (Read Only Memory) (for example, Patent Document 1).
しかし、マイクロコンピュータを製造した時点において、ROMに記憶されているプログラムに不具合箇所が存在する場合、ROMは読み出し専用のメモリであるので、不具合箇所を修正できない。よって、内部メモリに新しいユーザプログラムを書き込めない。 However, when a defective part exists in the program stored in the ROM at the time of manufacturing the microcomputer, the defective part cannot be corrected because the ROM is a read-only memory. Therefore, a new user program cannot be written in the internal memory.
この対策として、ROMを、書換可能なフラッシュメモリに置き換える方法が考えられる。なお、ユーザプログラムを書き込むプログラムがROMに記憶されるのに対し、ユーザプログラムがROM、RAM(Random Access Memory)及びEAROM(Electrically Alterable Read Only Memory)に記憶される方法も提案されている(例えば、特許文献2)。
しかし、ROMは予めプログラムを記憶するのに対してフラッシュメモリは初期値を持たないので、マイクロコンピュータを製造した時点において、フラッシュメモリに対して時間をかけてプログラムを書き込む必要がある。よって、この方法は実用的でない。 However, the ROM stores the program in advance, whereas the flash memory does not have an initial value. Therefore, when the microcomputer is manufactured, it is necessary to write the program over the flash memory over time. Therefore, this method is not practical.
本発明は、このような点に鑑みてなされたものであり、マイクロコンピュータを製造した時点において、メモリに記憶されたプログラムに不具合箇所が発生した場合でも不具合箇所を修正でき、かつ、プログラムを記憶するメモリが初期値を持つマイクロコンピュータを提供することを目的とする。 The present invention has been made in view of the above points, and when a microcomputer has been manufactured, even if a defective part occurs in a program stored in a memory, the defective part can be corrected and the program is stored. An object of the present invention is to provide a microcomputer having an initial value for a memory to be used.
本発明では、上記課題を解決するために、図1に示すように、ユーザプログラムを内部に記憶するマイクロコンピュータ10において、プログラムを予め記憶する読み出し専用の第1のメモリ12と、第1のメモリ12と同一のアドレス空間を有し、第1のメモリ12と同一のアドレス信号が入力される、プログラムの不具合箇所を修正したパッチデータを記憶する書換可能な第2のメモリ13と、アドレス信号によって出力されるプログラムとパッチデータとが入力され、第2のメモリ13のパッチデータの記憶内容に基づいて一方を出力するデータ選択回路14と、を有するマイクロコンピュータ10が提供される。
In the present invention, in order to solve the above problem, as shown in FIG. 1, in a microcomputer 10 that stores a user program, a read-only
このようなマイクロコンピュータ10によれば、読み出し専用の第1のメモリ12により、プログラムが予め記憶される。また、第1のメモリ12と同一のアドレス空間を有し、第1のメモリ12と同一のアドレス信号が入力される書換可能な第2のメモリ13により、プログラムの不具合箇所を修正したパッチデータが記憶される。そして、データ選択回路14に対して、アドレス信号によって出力されるプログラムとパッチデータとが入力され、データ選択回路14により、第2のメモリ13のパッチデータの記憶内容に基づいて一方が出力され、不具合箇所が修正されたプログラムが生成される。
According to such a microcomputer 10, the program is stored in advance by the read-only
また、本発明では、上記課題を解決するために、ユーザプログラムを内部に記憶するマイクロコンピュータにおいて、第1のデータを予め記憶する読み出し専用の第1のメモリと、第1のメモリと同一のアドレス空間を有し、第1のメモリと同一のアドレス信号が入力される、第2のデータを記憶する書換可能な第2のメモリと、アドレス信号によって出力される第1のデータと第2のデータとによって、外部からユーザプログラムを受信し、内部メモリに格納するプログラムを生成するプログラム生成回路と、を有するマイクロコンピュータが提供される。 In the present invention, in order to solve the above-mentioned problem, in a microcomputer that stores a user program therein, a read-only first memory that stores first data in advance and an address that is the same as the first memory A rewritable second memory for storing second data, having a space and receiving the same address signal as the first memory, and the first data and the second data output by the address signal A microcomputer having a program generation circuit that receives a user program from the outside and generates a program to be stored in an internal memory is provided.
このようなマイクロコンピュータによれば、読み出し専用の第1のメモリにより、第1のデータが予め記憶される。また、第1のメモリと同一のアドレス空間を有し、第1のメモリと同一のアドレス信号が入力される書換可能な第2のメモリにより、第2のデータが記憶される。そして、プログラム生成回路により、アドレス信号によって出力される第1のデータと第2のデータとによって内部メモリに格納するプログラムが生成され、外部からユーザプログラムを受信することができる。 According to such a microcomputer, the first data is stored in advance by the read-only first memory. The second data is stored in a rewritable second memory that has the same address space as the first memory and receives the same address signal as the first memory. The program generation circuit generates a program to be stored in the internal memory using the first data and the second data output by the address signal, and can receive the user program from the outside.
本発明では、読み出し専用の第1のメモリのプログラムと書換可能な第2のメモリのパッチデータとが入力され、第2のメモリのパッチデータの記憶内容に基づいて一方を出力するデータ選択回路により、不具合箇所が修正されたプログラムが生成されるようにした。 In the present invention, the data selection circuit that inputs the read-only first memory program and the rewritable second memory patch data and outputs one based on the stored contents of the second memory patch data. , The program where the defect part was corrected was generated.
このようにすると、マイクロコンピュータを製造した時点において、読み出し専用の第1のメモリに記憶されたプログラムに不具合箇所が発生した場合でも不具合箇所を修正でき、かつ、プログラムを記憶する読み出し専用の第1のメモリが初期値を持つことができる。 In this way, even when a defective part occurs in the program stored in the read-only first memory at the time of manufacture of the microcomputer, the defective part can be corrected and the read-only first memory for storing the program is stored. Memory can have an initial value.
また、本発明では、読み出し専用の第1のメモリの第1のデータと、書換可能な第2のメモリの第2のデータとによってプログラムを生成するプログラム生成回路により、不具合箇所が修正されたプログラムが生成されるようにした。 Further, according to the present invention, a program in which a defective portion is corrected by a program generation circuit that generates a program from the first data of the read-only first memory and the second data of the rewritable second memory. Was generated.
このようにすると、マイクロコンピュータを製造した時点において、読み出し専用の第1のメモリに記憶された第1のデータに不具合箇所が発生した場合でも不具合箇所を修正でき、かつ、第1のデータを記憶する読み出し専用の第1のメモリが初期値を持つことができる。 In this way, even when a defective part occurs in the first data stored in the read-only first memory when the microcomputer is manufactured, the defective part can be corrected and the first data is stored. The read only first memory can have an initial value.
以下、本発明の実施の形態を図面を参照して説明する。まず、本発明の概念について説明し、その後、本発明の実施の形態の具体的な内容について説明する。
以下、本発明の概念について説明する。図1は、本発明の概念図である。
Hereinafter, embodiments of the present invention will be described with reference to the drawings. First, the concept of the present invention will be described, and then the specific contents of the embodiment of the present invention will be described.
The concept of the present invention will be described below. FIG. 1 is a conceptual diagram of the present invention.
本発明に係るマイクロコンピュータ10は、CPU(Central Processing Unit)11、第1のメモリ12、第2のメモリ13、データ選択回路14及び内部メモリ15から構成される。
A microcomputer 10 according to the present invention includes a CPU (Central Processing Unit) 11, a
マイクロコンピュータ10のCPU11は、ユーザプログラムに従ってマイクロコンピュータ10の内部装置及び外部装置を制御する。このユーザプログラムは、ユーザプログラムダウンロードモードを設定した時に、外部端子10aから受信されて内部メモリ15に格納される。このユーザプログラムを内部メモリ15に書き込む際に使用するプログラムは、読み出し専用の第1のメモリ12及び書換可能な第2のメモリ13から出力される。
The
読み出し専用の第1のメモリ12は、外部端子10aからユーザプログラムを受信して内部メモリ15に格納するプログラムを、予め記憶する。また、第1のメモリ12と同一のアドレス空間を有し、第1のメモリ12と同一のアドレス信号が入力される書換可能な第2のメモリ13は、プログラムに不具合箇所が存在する場合において、プログラムの不具合箇所を修正したパッチ情報を含むパッチデータを記憶する。さらに、内部メモリ15は、ユーザプログラムを格納する。
The first read-
ここで、第2のメモリ13に記憶されるパッチデータは、例えば、9ビット単位で構成される。この第2のメモリ13のパッチデータにおいて、例えば、最上位ビットを除く8ビットは、第2のメモリ13と同一のアドレスにおける第1のメモリ12のプログラムの不具合箇所を、修正するデータである。また、例えば、最上位ビットである1ビットは、そのパッチデータを使用するか否かを示すパッチ情報である。このパッチデータは、CPU11が実行する命令データ及びCPU11が参照する演算データ等を含む。また、第1のメモリ12に記憶されるプログラムは、例えば、8ビット単位で構成される。
Here, the patch data stored in the
データ選択回路14は、CPU11からのアドレス信号によって第1のメモリ12及び第2のメモリ13から出力される、8ビットのプログラム及び最上位ビットを除く8ビットのパッチデータの入力を受け付ける。そして、データ選択回路14は、パッチデータの最上位ビットである1ビットに応じてプログラムまたはパッチデータの一方を出力する。つまり、データ選択回路14は、プログラムに不具合箇所が存在する場合において、パッチデータ内のパッチ情報に基づいて、プログラムとパッチデータのうち、パッチデータを出力し、不具合箇所が修正されたプログラムを生成する。また、データ選択回路14は、プログラムに不具合箇所が存在しない場合において、パッチデータ内のパッチ情報に基づいて、プログラムとパッチデータのうち、プログラムを出力する。
The
次に、図1の概念図の動作について説明する。
ここで、第1のメモリ12は、外部端子10aからユーザプログラムを受信して内部メモリ15に格納するプログラムを、予め記憶しているとする。なお、プログラムに不具合箇所が存在しているとする。また、第2のメモリ13は、プログラムの不具合箇所だけを修正した、パッチ情報を含むパッチデータを記憶しているとする。
Next, the operation of the conceptual diagram of FIG. 1 will be described.
Here, it is assumed that the
CPU11は、第1のメモリ12及び第2のメモリ13に同一のアドレス信号を出力する。そして、データ選択回路14は、CPU11からのアドレス信号によって第1のメモリ12及び第2のメモリ13から出力される、プログラム及びパッチ情報を含むパッチデータの入力を受け付ける。その後、データ選択回路14は、パッチ情報に基づいて、プログラムまたはパッチデータのうちどちらか一方を出力し、不具合箇所だけが修正されたプログラムを生成する。
The
CPU11は、データ選択回路14から出力された修正されたプログラムを実行し、外部端子10aから受信したユーザプログラムを内部メモリ15に格納する。
このようにすると、マイクロコンピュータ10を製造した時点において、読み出し専用の第1のメモリ12に格納されたプログラムに不具合箇所が発生した場合でも、不具合箇所を修正できるようになる。
The
In this way, even when a defective part occurs in the program stored in the read-only
また、読み出し専用の第1のメモリ12と書換可能な第2のメモリ13とが存在し、マイクロコンピュータ10を製造した時点において、読み出し専用の第1のメモリ12に予めプログラムを記憶できるので、書換可能な第2のメモリ13に時間をかけてプログラムを書き込む必要はない。
In addition, there is a read-only
さらに、第1のメモリ12のプログラムに不具合箇所が存在する場合、プログラムの不具合箇所だけを修正した、パッチ情報を含むパッチデータを第2のメモリ13に記憶するだけで、データ選択回路14から修正されたプログラムが出力されるようにしたので、第2のメモリ13のパッチデータの全部を修正されたプログラムに書き換える必要はなく、プログラムの修正時間を短縮できる。
Further, when there is a defective part in the program of the
なお、第1のメモリ12に記憶されるプログラムは、8ビット単位に限定されない。また、第2のメモリ13に記憶されるパッチデータは、9ビット単位に限定されない。
[第1の実施の形態]
以下、第1の実施の形態の具体的な内容について説明する。図2は、第1の実施の形態に係るマイクロコンピュータのブロック回路図である。
Note that the program stored in the
[First Embodiment]
The specific contents of the first embodiment will be described below. FIG. 2 is a block circuit diagram of the microcomputer according to the first embodiment.
第1の実施の形態に係るマイクロコンピュータ30は、CPU31、MPX32、ROM33、FLASH34、セレクタ35、UART36及びFLASH37から構成される。
The microcomputer 30 according to the first embodiment includes a
マイクロコンピュータ30のCPU31は、ユーザプログラムに従ってマイクロコンピュータ30の内部装置及び外部装置を制御する。このユーザプログラムは、外部端子30dから受信されてFLASH37に格納される。このユーザプログラムをFLASH37に書き込む際に使用するプログラムは、ROM33及びFLASH34から出力される。
The
MPX32は、FLASH34に出力するアドレス信号について、外部端子30bから入力されたアドレス信号及びCPU31から入力されたアドレス信号を受け付ける。そして、MPX32は、外部端子30aから入力されたモード信号によって、2つのアドレス信号の中の1つをFLASH34に出力する。
The
ROM33は、外部端子30dからユーザプログラムを受信してFLASH37に格納するプログラムを、予め記憶する。また、ROM33と同一のアドレス空間を有し、ROM33と同一のアドレス信号が入力されるFLASH34は、プログラムに不具合箇所が存在する場合において、プログラムの不具合箇所を修正した、パッチ符号を含むパッチデータを記憶する。さらに、FLASH37は、ユーザプログラムを格納する。
The
ここで、FLASH34に記憶されるパッチデータは、例えば、9ビット単位で構成される。このFLASH34のパッチデータにおいて、例えば、最上位ビットを除く8ビットは、FLASH34と同一のアドレスにおけるROM33のプログラムの不具合箇所を、修正するデータである。また、例えば、最上位ビットである1ビットは、そのパッチデータを使用するか否かを示す符号である。このパッチデータは、CPU31が実行する命令データ及びCPU31が参照する演算データ等を含む。また、ROM33に記憶されるプログラムは、例えば、8ビット単位で構成される。
Here, the patch data stored in the
セレクタ35は、CPU31からのアドレス信号によってROM33及びFLASH34から出力される、8ビットのプログラム及び最上位ビットを除く8ビットのパッチデータの入力を受け付ける。そして、セレクタ35は、パッチデータの最上位ビットである1ビットに応じてプログラムまたはパッチデータの一方を出力する。つまり、セレクタ35は、プログラムに不具合箇所が存在する場合において、パッチデータ内のパッチ符号に基づいて、プログラムとパッチデータのうちパッチデータを出力し、不具合箇所が修正されたプログラムを生成する。また、セレクタ35は、プログラムに不具合箇所が存在しない場合において、パッチデータ内のパッチ符号に基づいて、プログラムとパッチデータのうちプログラムを出力する。
The
UART36は、RS232C(Recommended Standard 232 version C)に対応し、1本の信号線で1ビットずつデータを伝送するシリアル転送方式によって、外部端子30dから送られてきたシリアル信号をパラレル信号に変換する。
The
次に、図2のブロック回路図の動作について説明する。
ここで、ROM33は、外部端子30dからUART36を介してユーザプログラムを受信してFLASH37に格納するプログラムを、予め記憶しているとする。なお、プログラムに不具合箇所が存在しているとする。また、FLASH34は、プログラムの不具合箇所だけを修正した、パッチ符号を含むパッチデータを記憶しているとする。
Next, the operation of the block circuit diagram of FIG. 2 will be described.
Here, it is assumed that the
MPX32は、外部端子30aから受信したモード信号により、外部端子30bから入力されたアドレス信号をFLASH34に出力する。そして、FLASH34は、外部端子30bから入力されたアドレス信号に基づいて、外部端子30cから受信したパッチデータを記憶する。その後、MPX32は、外部端子30aから受信したモード信号により、CPU31から入力されたアドレス信号をFLASH34に出力するように切り替わる。
The
CPU31は、MPX32はCPU31から入力されたアドレス信号をFLASH34に出力することになっていることを受け、ROM33及びFLASH34に同一のアドレス信号を出力する。そして、セレクタ35は、CPU31からのアドレス信号によってROM33及びFLASH34から出力された、プログラム及びパッチ符号を含むパッチデータの入力を受け付ける。さらに、セレクタ35は、パッチ符号に基づいて、プログラムとパッチデータのうちどちらか一方を出力し、不具合箇所だけが修正されたプログラムを生成する。
In response to the fact that the
CPU31は、セレクタ35から出力された修正されたプログラムを実行し、外部端子30dからUART36を介して受信したユーザプログラムをFLASH37に格納する。
The
以下、第1の実施の形態で実行される処理の概念について、図3を参照して説明する。なお、図3の処理は、ユーザプログラムを受信してFLASH37に格納する場合、CPU31からのアドレス信号がROM33及びFLASH34に対して存在する場合に実行される。図3のフローチャートが実行されると、以下のステップが実行される。図3は、データ選択処理を示すフローチャートである。
The concept of processing executed in the first embodiment will be described below with reference to FIG. 3 is executed when a user program is received and stored in the
[ステップS11]セレクタ35は、CPU31からの同一のアドレス信号によってROM33及びFLASH34から出力された、プログラム及びパッチデータの入力を受け付ける。
[Step S11] The
[ステップS12]セレクタ35は、パッチデータ内のパッチ符号について0か1か判断する。0の場合、処理はステップS13に進む。1の場合、処理はステップS14に進む。
[Step S12] The
[ステップS13]ステップS12の処理から、パッチ符号は0の場合であり、セレクタ35は、ROM33のプログラムに不具合箇所が存在するので、ROM33のプログラムをパッチを当ててから出力する。具体的には、同一のアドレスにおいて、不具合箇所とされるROM33のプログラムのデータと、FLASH34のパッチ符号を除くパッチデータとを、8ビット単位で置き換える。
[Step S13] From the processing in step S12, the patch code is 0, and the
[ステップS14]ステップS12の処理から、パッチ符号は1の場合であり、セレクタ35は、ROM33のプログラムに不具合箇所が存在しないので、ROM33のプログラムをそのまま出力する。
[Step S14] From the processing in step S12, the patch code is 1 and the
以下、図3のフローチャートが実行された結果について説明する。図4は、第1の実施の形態のデータ選択結果を示す図である。
データ選択結果100は、同一のアドレスにおいて、ROM33の8ビット単位のプログラムの入力、FLASH34の9ビット単位のパッチデータの入力、及び、8ビット単位のプログラムの出力を、パッチを当てる前とパッチを当てた後とに分けて示した図である。なお、プログラム及びパッチデータは、16進数で表現している。また、パッチ符号を除くパッチデータは8ビット単位であり、パッチ符号は1ビット単位である。
Hereinafter, a result of executing the flowchart of FIG. 3 will be described. FIG. 4 is a diagram illustrating a data selection result according to the first embodiment.
The data selection result 100 shows that the input of the 8-bit unit program of the
例えば、パッチを当てる前の場合、セレクタ35は、ROM33のプログラムが”5、A”であってFLASH34のパッチデータが”1、F、F”であるならば、ROM33のプログラムをそのまま出力するので、”5、A”を出力する。また、パッチを当てた後の場合、セレクタ35は、ROM33のプログラムが”5、A”であってFLASH34のパッチデータが”0、6、6”であるならば、FLASH34のパッチデータを出力するので、”6、6”を出力する。
For example, before applying a patch, if the program of the
このようにすると、マイクロコンピュータ30を製造した時点において、ROM33に格納されたプログラムに不具合箇所が発生した場合でも、不具合箇所を修正できるようになる。
In this way, even when a defective part occurs in the program stored in the
また、ROM33の代りにFLASH34のみが実装されるシステムと比較した場合、ROM33とFLASH34とが存在する本実施の形態ではマイクロコンピュータ30を製造しFLASH34を消去した時点において、ROM33に予めプログラムを記憶できるので、FLASH34に時間をかけてプログラムを書き込む必要はない。
Further, when compared with a system in which only the
さらに、セレクタ35から出力されたプログラムに不具合箇所が存在する場合、プログラムの不具合箇所だけを修正した、パッチ符号を含むパッチデータをFLASH34に記憶するだけで、セレクタ35から修正されたプログラムが出力されるようにしたので、FLASH34のパッチデータの全部を修正されたプログラムに書き換える必要はなく、プログラムの修正時間を短縮できる。
Further, when there is a defective part in the program output from the
なお、ROM33に記憶されるプログラムは、8ビット単位に限定されない。また、FLASH34に記憶されるパッチデータは、9ビット単位に限定されない。
[第2の実施の形態]
以下、第2の実施の形態の具体的な内容について説明する。図5は、第2の実施の形態に係るマイクロコンピュータのブロック回路図である。
The program stored in the
[Second Embodiment]
The specific contents of the second embodiment will be described below. FIG. 5 is a block circuit diagram of a microcomputer according to the second embodiment.
第2の実施の形態に係るマイクロコンピュータ50は、CPU51、MPX52、FLASH53、ROM54、INV55、MPX56、UART57及びFLASH58から構成される。
The microcomputer 50 according to the second embodiment includes a
マイクロコンピュータ50のCPU51は、ユーザプログラムに従ってマイクロコンピュータ50の内部装置及び外部装置を制御する。このユーザプログラムは、外部端子50dから受信されてFLASH58に記憶される。このユーザプログラムをFLASH58に書き込む際に使用するプログラムは、FLASH53及びROM54から生成される。
The
MPX52は、FLASH53に出力するアドレス信号について、外部端子50bから入力されたアドレス信号及びCPU51から入力されたアドレス信号を受け付ける。そして、MPX52は、外部端子50aから入力されたモード信号によって、2つのアドレス信号の中の1つをFLASH53に出力する。
The
FLASH53は、外部端子50dからユーザプログラムを受信してFLASH58に格納するプログラムを生成するためのデータを記憶する。また、FLASH53と同一のアドレス空間を有し、FLASH53と同一のアドレス信号が入力されるROM54は、FLASH53のデータを反転させる反転符号を予め記憶する。さらに、FLASH58は、ユーザプログラムを格納する。
The
ここで、ROM54に記憶されている反転符号は、例えば、8ビット単位で構成される。ROM54の反転符号の各ビットと、ROM54と同一のアドレスにおけるFLASH53のデータの各ビットとは対応し、ROM54のあるビットの反転符号は、ROM54と同一のアドレスにおけるFLASH53の対応するビットのデータを反転するか否かを示している。また、FLASH53に記憶されているデータは、例えば、8ビット単位で構成される。
Here, the inversion code stored in the
この反転符号は、マイクロコンピュータ50を製造した時点において、ユーザプログラムをFLASH58に書き込む際に使用するプログラムが、FLASH53及びROM54から生成されるように工夫されている。具体的には、マイクロコンピュータ50を製造した時点において、FLASH53のデータの各ビットは全て”1”であり、それでも適正なプログラムが生成されるように、ROM54の反転符号の各ビットを予め記憶している。
This inversion code is devised so that a program used to write a user program to the
なお、FLASH53のデータをFとし、ROM54のデータをRとし、出力されるデータをPとして式で表すと、
P=(F∩R)∪(〜F∩〜R)
となる。例えば、Fが”1”でありRが”0”である場合、(F∩R)は(1∩0)となって”0”であり、(〜F∩〜R)は(0∩1)となって”0”であり、P=(F∩R)∪(〜F∩〜R)はP=(0∪0)となって”0”である。
It is to be noted that the data of
P = (F∩R) ∪ (~ F∩ ~ R)
It becomes. For example, when F is “1” and R is “0”, (F∩R) is (1∩0) and is “0”, and (˜F∩˜R) is (0∩1). ) And “0”, and P = (F∩R) ∪ (˜F∩˜R) is P = (0∪0) and is “0”.
MPX56及びINV55は、図6で詳細に説明するが、FLASH53のデータの各ビットに対して設けられている。つまり、FLASH53のデータ幅を8ビットとすると、MPX56及びINV55は、8個設けられることになる。
The
MPX56のそれぞれには、FLASH53の各ビットのデータと、このデータをINV55のそれぞれによって反転した各ビットのデータとが入力される。また、MPX56のそれぞれには、FLASH53の各ビットのデータに対応する、ROM54の各ビットの反転符号が入力される。MPX56のそれぞれは、ROM54の各ビットの反転符号に応じて、入力されているFLASH53のデータと、入力されているINV55によって反転したデータとの一方を出力する。つまり、MPX56からは、ROM54の反転符号に応じたFLASH53のデータが出力される。
Each
UART57は、RS232Cに対応し、1本の信号線で1ビットずつデータを伝送するシリアル転送方式によって、外部端子50dから送られてきたシリアル信号をパラレル信号に変換する。
The
次に、図5のブロック回路図の動作について説明する。
ここで、FLASH53は、外部端子50dからUART57を介してユーザプログラムを受信してFLASH58に格納するプログラムを生成するためのデータを記憶しているとする。なお、プログラムに不具合箇所が存在しているとする。また、ROM54は、FLASH53のデータを反転させる反転符号を予め記憶しているとする。
Next, the operation of the block circuit diagram of FIG. 5 will be described.
Here, it is assumed that the
MPX52は、外部端子50aから受信したモード信号により、外部端子50bから入力されたアドレス信号をFLASH53に出力する。そして、FLASH53は、外部端子50bから入力されたアドレス信号に基づいて、外部端子50cから受信したプログラムの不具合箇所だけを修正するパッチデータを上書きして記憶する。その後、MPX52は、外部端子50aから受信したモード信号により、CPU51から入力されたアドレス信号をFLASH53に出力するように切り替わる。
The
CPU51は、MPX52はCPU51から入力されたアドレス信号をFLASH53に出力することになっていることを受け、FLASH53及びROM54に同一のアドレス信号を出力する。そして、FLASH53のデータの各ビットについて、MPX56は、ROM54の反転符号の各ビットが0の場合、同一のアドレスにおけるFLASH53のデータをINV55を介して受け付ける。また、FLASH53のデータの各ビットについて、ROM54の反転符号の各ビットが1の場合、同一のアドレスにおけるFLASH53のデータをINV55を介さないで受け付ける。その後、MPX56は、受け付けた8ビット単位のデータから、外部端子50dからユーザプログラムを受信してFLASH58に格納する、不具合箇所だけが修正されたプログラムを生成する。
The
CPU51は、MPX56から出力された修正されたプログラムを実行し、外部端子50dからUART57を介して受信したユーザプログラムをFLASH58に格納する。
以下、図5におけるINV55及びMPX56について、具体的に説明する。図6は、プログラム生成処理を示すブロック回路図である。
The
Hereinafter, the
第2の実施の形態に係るプログラム生成処理を示すブロック回路図は、FLASH53、ROM54、INV55a0〜7及びMPX56a0〜7から構成される。
FLASH53及びROM54は前述している。INV55a0〜7は、8ビット分存在し、INV55a0〜7のそれぞれは、データ0〜7のそれぞれを反転してMPX56a0〜7のそれぞれに出力する。MPX56a0〜7は、8ビット分存在し、MPX56a0〜7のそれぞれは、反転符号0〜7のそれぞれが1の場合、データ0〜7のそれぞれをそのまま出力し、反転符号0〜7のそれぞれが0の場合、データ0〜7のそれぞれを反転して出力する。
The block circuit diagram showing the program generation processing according to the second embodiment is composed of
The
以下、第2の実施の形態で実行される処理の概念について、図7を参照して説明する。なお、図7の処理は、ユーザプログラムを受信してFLASH58に格納する場合、CPU51からのアドレス信号がFLASH53及びROM54に対して存在する場合に実行される。図7のフローチャートが実行されると、以下のステップが実行される。図7は、プログラム生成処理を示すフローチャートである。
Hereinafter, the concept of processing executed in the second embodiment will be described with reference to FIG. 7 is executed when a user program is received and stored in the
[ステップS21]MPX56は、CPU51からの同一のアドレス信号によってFLASH53及びROM54から出力された、8ビットのデータ及び8ビットの反転符号の入力を受け付ける。
[Step S21] The
[ステップS22]MPX56は、ROM54の8ビットの反転符号についてそれぞれ0か1か判断する。0の場合、処理はステップS23に進む。1の場合、処理はステップS24に進む。
[Step S22] The
[ステップS23]ステップS22の処理から、反転符号は0の場合であり、MPX56は、FLASH53のビットを反転してから出力する。例えば、1ビットについて説明すると、FLASH53のデータが”0”であり、そのデータに対応するROM54の反転符号が”0”であるならば、FLASH53のデータを反転させるので、”1”を出力する。結果として、8ビットについて説明すると、FLASH53のデータが”01100110”であり、そのデータに対応するROM54の反転符号が”01011010”であるならば、”11000011”を出力する。
[Step S23] From the processing in step S22, the inversion code is 0, and the
[ステップS24]ステップS22の処理から、反転符号は1の場合であり、MPX56は、FLASH53のビットをそのまま出力する。
以下、図7のフローチャートが実行された結果について説明する。図8は、第2の実施の形態のプログラム生成結果を示す図である。
[Step S24] From the processing in step S22, the inversion code is 1 and the
Hereinafter, a result of executing the flowchart of FIG. 7 will be described. FIG. 8 is a diagram illustrating a program generation result according to the second embodiment.
プログラム生成結果200は、同一のアドレスにおいて、FLASH53の8ビット単位のデータの入力、ROM54の8ビット単位の反転符号の入力、及び、8ビット単位のプログラムの出力を、パッチを当てる前とパッチを当てた後とに分けて示した図である。なお、データ及び反転符号は、16進数で表現している。
The program generation result 200 is obtained by inputting the 8-bit unit data of
例えば、パッチを当てる前の場合、MPX56は、FLASH53のデータが”11111111”であってROM54の反転符号が”01011010”であるならば、”01011010”を出力する。また、パッチを当てた後の場合、MPX56は、FLASH53のデータが”01100110”であってROM54の反転符号が”01011010”であるならば、”11000011”を出力する。
For example, before applying the patch, the
このようにすると、マイクロコンピュータ50を製造した時点において、MPX56から出力されたプログラムに不具合箇所が発生した場合でも、不具合箇所を修正できるようになる。
In this way, even when a defective part occurs in the program output from the
また、ROM54の代りにFLASH53のみを実装するシステムと比較した場合、FLASH53とROM54とが存在する本実施の形態では、マイクロコンピュータ50を製造しFLASH53を消去した時点において、FLASH53のデータの各ビットは全て”1”であるが、それでも適正なプログラムが生成されるようにROM54の反転符号の各ビットを予め記憶できるので、FLASH53に時間をかけてデータを書き込む必要はない。
Further, when compared with a system in which only the
さらに、MPX56から出力されたプログラムに不具合箇所が存在する場合、プログラムの不具合箇所だけを修正した、パッチデータをFLASH53に上書きして記憶するだけで、MPX56から修正されたプログラムが出力されるようにしたので、FLASH53のデータの全部を修正されたデータに書き換える必要はなく、データの書換時間を短縮できる。
Further, when there is a defective part in the program output from the
なお、FLASH53に記憶されるデータは、8ビット単位に限定されない。また、ROM54に記憶される反転符号は、8ビット単位に限定されない。
(付記1) ユーザプログラムを内部に記憶するマイクロコンピュータにおいて、
プログラムを予め記憶する読み出し専用の第1のメモリと、
前記第1のメモリと同一のアドレス空間を有し、前記第1のメモリと同一のアドレス信号が入力される、前記プログラムの不具合箇所を修正したパッチデータを記憶する書換可能な第2のメモリと、
前記アドレス信号によって出力される前記プログラムと前記パッチデータとが入力され、前記第2のメモリの前記パッチデータの記憶内容に基づいて一方を出力するデータ選択回路と、
を有することを特徴とするマイクロコンピュータ。
Note that the data stored in the
(Supplementary Note 1) In a microcomputer that stores a user program therein,
A read-only first memory for storing a program in advance;
A rewritable second memory for storing patch data in which a defect portion of the program is corrected, having the same address space as the first memory and receiving the same address signal as the first memory; ,
A data selection circuit that receives the program and the patch data output by the address signal, and outputs one based on the storage content of the patch data in the second memory;
A microcomputer characterized by comprising:
(付記2) 前記パッチデータは、パッチ情報を含み、前記データ選択回路は、前記パッチ情報に基づいて、前記プログラムと前記パッチデータとの一方を出力することを特徴とする付記1記載のマイクロコンピュータ。 (Supplementary note 2) The microcomputer according to supplementary note 1, wherein the patch data includes patch information, and the data selection circuit outputs one of the program and the patch data based on the patch information. .
(付記3) 前記パッチデータのパッチデータ幅は、前記プログラムのデータ幅より冗長データ幅分大きく、前記パッチ情報は、前記冗長データ幅に格納されることを特徴とする付記1記載のマイクロコンピュータ。 (Supplementary note 3) The microcomputer according to supplementary note 1, wherein a patch data width of the patch data is larger than a data width of the program by a redundant data width, and the patch information is stored in the redundant data width.
(付記4) 前記パッチデータは、0もしくは1の前記パッチ情報を含み、前記データ選択回路は、前記パッチ情報が1の場合前記プログラムを出力し、前記パッチ情報が0の場合前記パッチデータを出力することを特徴とする付記3記載のマイクロコンピュータ。
(Supplementary Note 4) The patch data includes the patch information of 0 or 1, and the data selection circuit outputs the program when the patch information is 1, and outputs the patch data when the patch information is 0 The microcomputer according to
(付記5) 前記プログラム及び前記パッチデータを実行し、前記アドレス信号を出力する中央演算処理装置を有することを特徴とする付記1記載のマイクロコンピュータ。
(付記6) 前記中央演算処理装置は、前記ユーザプログラムを実行することを特徴とする付記5記載のマイクロコンピュータ。
(Additional remark 5) The microcomputer of Additional remark 1 characterized by having the central processing unit which performs the said program and the said patch data, and outputs the said address signal.
(Supplementary Note 6) The microcomputer according to
(付記7) 前記第2のメモリは、フラッシュメモリであることを特徴とする付記1記載のマイクロコンピュータ。
(付記8) ユーザプログラムを内部に記憶するマイクロコンピュータにおいて、
第1のデータを予め記憶する読み出し専用の第1のメモリと、
前記第1のメモリと同一のアドレス空間を有し、前記第1のメモリと同一のアドレス信号が入力される、第2のデータを記憶する書換可能な第2のメモリと、
前記アドレス信号によって出力される前記第1のデータと前記第2のデータとによって、外部から前記ユーザプログラムを受信し、内部メモリに格納するプログラムを生成するプログラム生成回路と、
を有することを特徴とするマイクロコンピュータ。
(Supplementary note 7) The microcomputer according to supplementary note 1, wherein the second memory is a flash memory.
(Additional remark 8) In the microcomputer which memorize | stores a user program inside,
A read-only first memory for storing first data in advance;
A rewritable second memory for storing second data, which has the same address space as the first memory and receives the same address signal as the first memory;
A program generation circuit that receives the user program from the outside by the first data and the second data output by the address signal and generates a program to be stored in an internal memory;
A microcomputer characterized by comprising:
(付記9) 前記第1のメモリの前記第1のデータの各ビットと、前記第1のメモリと同一のアドレスにおける前記第2のメモリの前記第2のデータの各ビットとは対応し、前記第1のメモリの前記第1のデータの各ビットは、前記第1のメモリと同一のアドレスにおける前記第2のメモリの前記第2のデータの各ビットを反転するか否かを示す反転符号であることを特徴とする付記8記載のマイクロコンピュータ。 (Supplementary Note 9) Each bit of the first data in the first memory corresponds to each bit of the second data in the second memory at the same address as the first memory, and Each bit of the first data in the first memory is an inversion code indicating whether to invert each bit of the second data in the second memory at the same address as the first memory. The microcomputer according to appendix 8, wherein there is a microcomputer.
(付記10) 前記第2のメモリは、フラッシュメモリであることを特徴とする付記8記載のマイクロコンピュータ。 (Supplementary note 10) The microcomputer according to supplementary note 8, wherein the second memory is a flash memory.
10 マイクロコンピュータ
11 CPU
12 第1のメモリ
13 第2のメモリ
14 データ選択回路
15 内部メモリ
10
12
Claims (5)
プログラムを予め記憶する読み出し専用の第1のメモリと、
前記第1のメモリと同一のアドレス空間を有し、前記第1のメモリと同一のアドレス信号が入力される、前記プログラムの不具合箇所を修正したパッチデータを記憶する書換可能な第2のメモリと、
前記アドレス信号によって出力される前記プログラムと前記パッチデータとが入力され、前記第2のメモリの前記パッチデータの記憶内容に基づいて一方を出力するデータ選択回路と、
を有することを特徴とするマイクロコンピュータ。 In a microcomputer that stores a user program internally,
A read-only first memory for storing a program in advance;
A rewritable second memory for storing patch data in which a defect portion of the program is corrected, having the same address space as the first memory and receiving the same address signal as the first memory; ,
A data selection circuit that receives the program and the patch data output by the address signal, and outputs one based on the storage content of the patch data in the second memory;
A microcomputer characterized by comprising:
第1のデータを予め記憶する読み出し専用の第1のメモリと、
前記第1のメモリと同一のアドレス空間を有し、前記第1のメモリと同一のアドレス信号が入力される、第2のデータを記憶する書換可能な第2のメモリと、
前記アドレス信号によって出力される前記第1のデータと前記第2のデータとによって、外部から前記ユーザプログラムを受信し、内部メモリに格納するプログラムを生成するプログラム生成回路と、
を有することを特徴とするマイクロコンピュータ。 In a microcomputer that stores a user program internally,
A read-only first memory for storing first data in advance;
A rewritable second memory for storing second data, which has the same address space as the first memory and receives the same address signal as the first memory;
A program generation circuit that receives the user program from the outside by the first data and the second data output by the address signal and generates a program to be stored in an internal memory;
A microcomputer characterized by comprising:
Each bit of the first data in the first memory corresponds to each bit of the second data in the second memory at the same address as the first memory, and the first memory Each bit of the first data is an inverted code indicating whether or not to invert each bit of the second data in the second memory at the same address as the first memory. The microcomputer according to claim 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004372996A JP2006178829A (en) | 2004-12-24 | 2004-12-24 | Microcomputer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004372996A JP2006178829A (en) | 2004-12-24 | 2004-12-24 | Microcomputer |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2006178829A true JP2006178829A (en) | 2006-07-06 |
Family
ID=36732885
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004372996A Withdrawn JP2006178829A (en) | 2004-12-24 | 2004-12-24 | Microcomputer |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2006178829A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010211595A (en) * | 2009-03-11 | 2010-09-24 | Renesas Electronics Corp | Data processor |
JP2010257367A (en) * | 2009-04-28 | 2010-11-11 | Sanyo Electric Co Ltd | Program update system, electronic device with program update function |
-
2004
- 2004-12-24 JP JP2004372996A patent/JP2006178829A/en not_active Withdrawn
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2010211595A (en) * | 2009-03-11 | 2010-09-24 | Renesas Electronics Corp | Data processor |
JP2010257367A (en) * | 2009-04-28 | 2010-11-11 | Sanyo Electric Co Ltd | Program update system, electronic device with program update function |
US8694717B2 (en) | 2009-04-28 | 2014-04-08 | Semiconductor Components Industries, Llc | Program update system and electronic device with program update function |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3252605B1 (en) | Vehicle-mounted control device, program writing device, program generating device and program | |
JP4574994B2 (en) | Microcomputer with external memory | |
JP2019016026A (en) | Electronic control system | |
JP2009093501A (en) | Image processing apparatus and control method | |
JP2006178829A (en) | Microcomputer | |
JPWO2008068937A1 (en) | Data transfer control device and computer system | |
WO2019221058A1 (en) | Vehicle-mounted relay device, communication system, bus determination method, and computer program | |
JP2007334813A (en) | Memory control circuit and data rewriting method | |
JP2007052558A (en) | Flash memory rewrite device, flash memory rewrite method and flash memory rewrite program | |
JP2007072695A (en) | Redundancy storage method and program to flash memory | |
JP7027940B2 (en) | Control device | |
US20030041282A1 (en) | Electronic apparatus and correction method | |
JP5098853B2 (en) | Data rewriting method, data rewriting device, and data management device | |
JP4568532B2 (en) | Wireless device control system, wireless device and control device | |
JP2002149457A (en) | Method for identifying reserved data area and device for the same | |
JP2010044638A (en) | Information processing apparatus | |
JP2004126658A (en) | Processor system | |
JP2006201878A (en) | Microcomputer | |
JP3947856B2 (en) | Data setting control device | |
JP2006217318A (en) | Data communication system | |
KR100216045B1 (en) | Bit arithmetic processing method and apparatus of programmable controller | |
JPH03266141A (en) | Microprocessor system | |
JP4462900B2 (en) | Memory access circuit | |
JP2005332228A (en) | Program switching controller | |
JP2023114517A (en) | Program update apparatus and program update method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20080304 |