JP4325786B2 - How to download the program - Google Patents

How to download the program Download PDF

Info

Publication number
JP4325786B2
JP4325786B2 JP2003081687A JP2003081687A JP4325786B2 JP 4325786 B2 JP4325786 B2 JP 4325786B2 JP 2003081687 A JP2003081687 A JP 2003081687A JP 2003081687 A JP2003081687 A JP 2003081687A JP 4325786 B2 JP4325786 B2 JP 4325786B2
Authority
JP
Japan
Prior art keywords
data
received
file
flash memory
program
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
JP2003081687A
Other languages
Japanese (ja)
Other versions
JP2004288074A (en
Inventor
雅樹 山室
昌弘 西本
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Engineering Ltd
Original Assignee
NEC Engineering Ltd
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 NEC Engineering Ltd filed Critical NEC Engineering Ltd
Priority to JP2003081687A priority Critical patent/JP4325786B2/en
Publication of JP2004288074A publication Critical patent/JP2004288074A/en
Application granted granted Critical
Publication of JP4325786B2 publication Critical patent/JP4325786B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)
  • Detection And Correction Of Errors (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、プログラムダウンロード方法に関し、特に、PC(パーソナルコンピュータ)などと通信することで、フラッシュメモリなどの不揮発性メモリを更新するプログラムダウンロード方法に関する。
【0002】
【従来の技術】
従来のプログラムダウンロード方法では、図7に示すように、ファイル転送機能を有するPC、あるいはファイル転送機能を持つプログラムをインストールしたPCなどが、アスキー形式に保存されたインテルヘクサフォーマットなどのプログラムファイルが書きこまれたメディアからデータを読み出して送信する。
【0003】
ダウンロードの対象装置は、シリアルコントローラ60がPC10から受信したデータをCPU30に転送し、CPU30は、シリアルコントローラ60から転送されたデータをRAM50上に保存していくという動作を繰り返す。
【0004】
そして、全データを受信したCPU30は、PC10からフラッシュメモリ40の更新の指示を受けると、PC10から受信してRAM50上に格納しておいたダウンロードファイルのデータをフラッシュメモリ40に書き込む。
【0005】
この方法では、受信時にエラーが発生したか否かの判断をしていないRAM50上に格納したダウンロードファイルのデータを、そのままフラッシュメモリ40に書き込んでしまう可能性があり、データの信頼性が低いという問題点があった。
【0006】
そこで、受信したダウンロードファイルのデータの信頼性を向上させるため、特許文献1に記載のプログラムダウンロード方法では、図8に示すように、サム計算回路80によってダウンロードファイルのデータのサムを計算して、RAM50上に格納したデータと、予めダウンロードファイルに付加してあるサムとを比較して、受信して格納したRAM50上のダウンロードファイルのデータを評価してから書き込む。
【0007】
【特許文献1】
特開2000−122884号公報
【0008】
【発明が解決しようとする課題】
しかし、上記従来のプログラムダウンロード方法においては、行ごとに付加されるサムのチェックのみでは、例えば、インテルヘクサフォーマットのファイルであれば、レコードマーク(’:’)からニューライン(’¥n’)コードまでの1行全部のデータを受信できなかった場合には、受信データの異常を検出することができないため、受信したダウンロードファイルのデータの信頼性に問題があった。
【0009】
また、ダウンロードファイルに付加するサムに影響を与えないようなデータが受信できなかった場合、例えば、ダウンロードファイルがインテルヘクサフォーマットとしたときに、下記のような行
「:1020304060000000000000000000000000000000」
すなわち、レコードマーク(':')からニューライン('\n')コードのサムが0x00の行のデータを受信できなかった場合には、ダウンロードファイル全体のサムが一致してしまうため、受信データの異常を検出することができず、あるいは、サムが0x00になるような複数行のデータを受信できなかった場合にも、ダウンロードファイル全体のサムが一致してしまうために、受信データの異常を検出することができず、ダウンロードファイルにサムを付加しても、受信したデータの信頼性に問題があった。
【0010】
そこで、本発明は、上記従来のプログラムダウンロード方法における問題点に鑑みてなされたものであって、受信したデータの信頼性を向上させるとともに、送信受信処理の高速化、及び、装置構成を簡易化することができるプログラムダウンロード方法を提供することを目的とする。
【0011】
【課題を解決するための手段】
上記目的を達成するため、本発明は、一方の機器からインテルヘクサフォーマット又はSフォーマットのプログラムファイルを送信し、該プログラムファイルを他方の機器にダウンロードするプログラムダウンロード方法であって、前記一方の機器において、前記プログラムファイルの総行数に関する情報を付加して該ファイルを送信し、前記他方の機器において、受信したプログラムファイルをRAMに格納しつつ、前記受信したプログラムファイルの1行毎のサムチェック処理を行うとともに、前記受信したプログラムファイルの行数を計数して前記付加された総行数と比較し、前記サムチェック処理の結果が正しいデータを受信したことを示し、かつ、前記計数した行数と前記付加された総行数とが一致した場合に、受信したデータにエラーがないと判断し、前記RAMに格納したプログラムファイルを不揮発性メモリに書き込むことを特徴とする。
【0012】
そして、本発明によれば、ファイル全体の行数をデータとして付加することによって、ファイル転送でのデータの受信抜けの検出を可能にし、受信したデータの信頼性を向上させることができる。
【0013】
また、ファイル全体の行数をデータとして付加することでデータの信頼性を向上させるので、各行のデータに対してヘッダやパケット番号を付加して信頼性を向上させる方法に比べ、データの転送量を少なくすることにより、データ転送時間の高速化を図ることができる。また、ファイル全体のサムを付加して信頼性を向上させる方法に比べ、サムの計算を不要にすることで、送信受信処理の高速化を図ることができる。
【0014】
さらに、ファイル全体の行数をデータとして付加することでデータの信頼性を向上させるので、各行のデータに対してヘッダやパケット番号を付加して信頼性を向上させる方法や、ファイル全体のサムを計算してデータに付加して信頼性を向上させる方法に比べて、装置構成を簡易化することができる。
【0016】
【発明の実施の形態】
次に、本発明の実施の形態について図面を参照しながら説明する。
【0017】
図1は、本発明にかかるプログラムダウンロード方法を実施する装置の構成を示し、この装置は、図7に示した従来例に行数カウンタ70を付加した構成を有する。
【0018】
本発明にかかるプログラムダウンロード方法によれば、ダウンロードファイルが書かれたメディア20からファイルを読み出し、データを送信する機能を有するPC10が、シリアルコントローラ60を介してPC10からデータを受信する機能を有するCPU30と接続される構成において、CPU30は、シリアルコントローラ60から転送されたデータを受け取り、行数カウンタ70によってPC10から受信したデータの行数をカウントしながら、受信したデータをRAM50に格納して行き、全データの受信終了時に、行数カウンタ70のカウント結果と、PC10から送信された受信データの総行数のデータを比較し、これらが一致すれば、PC10からのフラッシュメモリ更新の指示によって、フラッシュメモリ40に書かれたデータを消去し、RAM50に格納したデータを書き込む。
【0019】
次に、上記CPU30などの動作について、図1及び図3〜図5を参照しながらさらに詳細に説明する。
【0020】
まず最初に、メディア20にダウンロードファイルを準備する。ここでは、ダウンロードファイルにインテルヘクサフォーマットのファイルを準備した場合を例にとって説明する。
【0021】
このファイルを準備する際、PC10が送信した総行数を計算して総行数のデータを付加して送信できる機能を持つ(ソフトをインストール済み)場合には、ダウンロードファイルに予め総行数のデータを付加しておく必要はなく、PC10が送信した総行数を計算して総行数のデータを付加して送信できる機能を持たない(ソフトをインストールしていない)場合には、ダウンロードファイルに予め総行数のデータを付加しておく必要がある。
【0022】
次に、PC10は、CPU30に対してダウンロード開始コマンドを送信する。CPU30は、PC10からダウンロード開始コマンドを受信しないと、PC10からのダウンロードは受け付けない。
【0023】
CPU30は、シリアルコントローラ60を介してPC10からダウンロード開始のコマンドを受信すると(図3、Step1)、受信したダウンロードファイルを格納するためのRAM50と、行数カウンタ70とを初期化し、ダウンロードファイルの受信の準備を行う(図3、Step2)。
【0024】
ここで、RAM50の初期化とは、更新するフラッシュメモリ40を消去した時と同じ状態のデータをRAM50に書き込んでおくことである。例えば、フラッシュメモリ40の消去後の状態が0xFFであれば、RAM50を0xFFで、フラッシュメモリ40の消去後の状態が0x00であればRAM50を0x00で初期化しておく。
【0025】
このように、受信したダウンロードファイルを格納するためのRAM50を初期化しておくことで、RAM50に格納したデータをフラッシュメモリ40へ書き込む時に、RAM50のデータと一致している場合には、書き込みを行わないような処理を行うことで(図5、Step5)、フラッシュメモリ40の更新処理の時間を減少させるだけでなく、フラッシュメモリ40へ余分な書き込みを行わないことによって、フラッシュメモリ40の寿命を延ばすことが可能になるという効果がある。
【0026】
CPU30は、ダウンロードファイルを受信する準備が完了すると、シリアルコントローラ60を経由してPC10に対してダウンロード開始コマンドに対する応答を返す(図3、Step3)。
【0027】
PC10は、CPU30からダウンロード開始コマンドに対する応答を受信すると、ダウンロードファイルが書かれたメディア20からデータを読み出してデータの送信を開始する。
【0028】
CPU30は、シリアルコントローラ60を経由して、PC10からニューライン('\n')コードまでのデータ、すなわち、インテルヘクサフォーマットのダウンロードファイルの1行分のデータを受信する(図3、Step4〜5)。
【0029】
CPU30は、1行分のデータを受信すると、受信したデータのサムを計算し(図3、Step6)、インテルヘクサフォーマットの各行に付加されるチェックサムコードと比較することで正しいデータを受信できたかどうか判定を行う(図3、Step7)。
【0030】
このとき、チェックサムコードが不一致の場合には、正しいデータを受信できなかったことになるので、受信したデータを破棄してPC10に対して受信データの異常を検出したことを報告する(図3、Step11)。逆に、チェックサムコードが一致した場合には、正しいデータを受信できたことになるので、インテルヘクサフォーマットのどのレコードタイプのデータを受信したか判定する(図3、Step8)。
【0031】
ここで、受信したデータのレコードタイプによって、以下のように動作を行う。
【0032】
エントリポイントアドレスを示すスタートアドレスレコードのデータを受信した場合には、RAM50には格納せずにデータを破棄し、次に送られてくるデータを格納するアドレスを計算し、行数カウンタ70のカウント値を加算してデータを待つ(図4、Step1〜4)。
【0033】
ロードアドレスのパラグラフ値を示す拡張アドレスレコードのデータを受信した場合には、RAM50には格納せずにデータを破棄し、次に送られてくるデータを格納するアドレスの計算を行い、行数カウンタ70のカウント値を加算してデータを待つ(図4、Step5〜8)。
【0034】
コードの値を示すデータレコードのデータを受信した場合には、必要なデータを抜き取り、RAM50のダウンロードデータを格納するエリアにデータを格納し、行数カウンタ70のカウント値を加算して次に送られてくるデータを待つ(図4、Step9〜12)。
【0035】
コードの終わりを示すエンドレコードのデータを受信した場合には、RAM50には格納せずにデータを破棄し、行数カウンタ70のカウント値を加算して、次に送られてくる総行数のデータを待つ(図4、Step13〜16)。
【0036】
CPU30は、上記のデータレコードに対応した処理を終えると、PC10に対して受信データが正常であったことを報告する(図4、Step18)。尚、正常時の報告は省略可能である。
【0037】
PC10は、全てのデータの送信が終わるまで、メディア20からファイルを読み出してデータの送信を行い(PC10からの正常応答を待ち、応答があれば)、また、メディア20からデータを読み出してデータの送信を行い(PC10からの正常応答を待つ)という処理を繰り返す。
【0038】
CPU30も、全てのデータの受信が終わるまで受信したデータを、RAM50のダウンロードデータを格納するエリアにデータを格納する処理を繰り返す(図3、Step4〜9)。
【0039】
PC10が送信した総行数を計算して総行数のデータを付加して送信できる機能を持つ場合には、PC10は、ファイルのエンドレコードの送信後にニューライン('\n')コードを送信した回数、すなわち、送信した行数のデータを送信する。
【0040】
一方、PC10が送信した総行数を計算して総行数のデータを送信できる機能を持たない場合には、メディア20には、予め総行数のデータを付加してあるので、そのまま全てのデータの送信を行っていく。
【0041】
PC10は、メディア20に書き込まれた全てのデータ(及び、送信した行数のデータ)を送信して、CPU30からの異常データ受信の応答(報告)がなければ、フラッシュメモリ40を更新させるため、CPU30に対してフラッシュメモリ更新コマンドを送信する。
【0042】
CPU30は、シリアルコントローラ60を介してPC10からフラッシュメモリ更新コマンドを受信すると(図5、Step1)、フラッシュメモリ40の消去を行い、フラッシュメモリ40が消去できているか否かを確認し(図5、Step2〜3)、フラッシュメモリ40が消去できている場合には、次のステップに進み、フラッシュメモリ40が消去できていなかった場合には、フラッシュメモリ更新処理の異常終了をシリアルコントローラ60を介してPC10に通知して終了する(図5、Step10)。
【0043】
次に、RAM50に格納したデータを読み出し、フラッシュメモリ40のデータと比較し(図5、Step4〜5)、一致していない場合には、フラッシュメモリ40にデータの書き込みを行い、フラッシュメモリ40に正常に書き込みができているかを確認し(図5、Step6〜7)、フラッシュメモリ40に正常に書き込みができている場合には、次のステップに進み、フラッシュメモリ40に書き込みができていなかった場合には、フラッシュメモリ更新処理の異常終了をシリアルコントローラ60を介してPC10に通知して終了する(図5、Step10)。
【0044】
フラッシュメモリ40に正常に書き込みができている場合には、全データの書き込みが終了したか否かを確認し(図5、Step8)、全データの書き込みが終了した場合には、フラッシュメモリ更新処理の正常終了をシリアルコントローラ60を介してPC10に通知して終了し(図5、Step9)、全データの書き込みが終了していない場合には、前のステップに戻り、フラッシュメモリ40への書き込み処理を繰り返す(図5、Step4〜7)。
【0045】
尚、この動作の説明では、最初にメディア20に準備するファイル形式をインテルヘクサフォーマットのファイルとしたが、Sフォーマットなどその他の形式のファイルでも実現することが可能であり、行数カウンタ70は、ハードウェアでの実施例を示したが、ソフトウェアによっても実現することができる。
【0046】
次に、本発明にかかるプログラムダウンロード方法の第2実施例について、図2を参照しながら説明する。
【0047】
この装置は、図1に示した構成に、さらにサム計算回路80を付加している。
【0048】
ダウンロードファイルが書かれたメディア20からファイルを読み出し、データを送信する機能を有するPC10が、シリアルコントローラ60を介してPC10からデータを受信する機能を有するCPU30と接続される構成において、CPU30は、シリアルコントローラ60から転送されたデータを受け取り、行数カウンタ70によってPC10から受信したデータの行数をカウントしながら、受信したデータをRAM50に格納して行き、全データの受信終了時に行数カウンタ70のカウント結果と、PC10から送信された受信データ総行数のデータを比較し、これらが一致すれば、PC10からのフラッシュメモリ更新の指示によって、サム計算回路80によってRAM50に格納したデータのサムを計算し、フラッシュメモリ40に書かれたデータを消去して、RAM50に格納したデータとサム計算回路80によって計算したサムを書き込む。
【0049】
次に、上記CPU30などの動作について説明する。尚、CPU30がPC10からダウンロードファイルを受信するまでの手順(図3、Step1〜)(図4、Step1〜)は、先に説明した実施手順と同様である。よって、ここではデータを正常に受信した後のフラッシュメモリの更新処理について図6を参照しながら説明する。
【0050】
PC10は、CPU30からの異常データ受信の応答(報告)がなければ、フラッシュメモリ40を更新するため、CPU30に対してフラッシュメモリ更新コマンドを送信する。
【0051】
CPU30は、シリアルコントローラ60を介してPC10からフラッシュメモリ更新コマンドを受信すると(図6、Step1)、サム計算回路80により、受信したダウンロードファイルを格納したRAM50のエリアのサム、すなわち、フラッシュメモリ40のプログラム更新エリアのサムを計算し、フラッシュメモリ40のサム格納エリアに該当するRAM50にサムを書き込む。
【0052】
以降のフラッシュメモリ40の消去から更新終了の応答処理(図6、Step2〜10)は、先に説明した実施手順と同様であり、更新したフラッシュメモリ40には、先のステップで計算したフラッシュメモリ40のサムが書き込まれていることになる。
【0053】
ここで、フラッシュメモリ40にサムを書き込むことによって、装置の立ち上げ時または/及び一定周期ごとにプログラムエリアのサムを計算して自己診断(サムチェック)を行うことが可能になる。
【0054】
尚、この動作の説明では、サム計算回路80はハードウェアでの実施例を示したが、ソフトウェアによっても実現することは可能である。
【0055】
【発明の効果】
以上説明したように、本発明によれば、受信したデータの信頼性を向上させ、送信受信処理の高速化を図り、装置構成を簡易化することができるプログラムダウンロード方法を提供することが可能となる。
【図面の簡単な説明】
【図1】本発明にかかるプログラムダウンロード方法の第1実施例を示すブロック図である。
【図2】本発明にかかるプログラムダウンロード方法の第2実施例を示すブロック図である。
【図3】本発明にかかるプログラムダウンロード方法の第1実施例を示すフローチャートである。
【図4】本発明にかかるプログラムダウンロード方法の第1実施例を示すフローチャートである。
【図5】本発明にかかるプログラムダウンロード方法の第1実施例を示すフローチャートである。
【図6】本発明にかかるプログラムダウンロード方法の第2実施例を示すフローチャートである。
【図7】従来のプログラムダウンロード方法の一例を示すブロック図である。
【図8】従来のプログラムダウンロード方法の一例を示すブロック図である。
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a program download method , and more particularly to a program download method for updating a nonvolatile memory such as a flash memory by communicating with a PC (personal computer) or the like.
[0002]
[Prior art]
In the conventional program download method , as shown in FIG. 7, a PC having a file transfer function or a PC in which a program having a file transfer function is installed writes a program file such as an Intel hexa format stored in ASCII format. Data is read from the inserted media and transmitted.
[0003]
The download target device transfers the data received from the PC 10 by the serial controller 60 to the CPU 30, and the CPU 30 repeats the operation of storing the data transferred from the serial controller 60 in the RAM 50.
[0004]
When the CPU 30 receives all the data and receives an instruction to update the flash memory 40 from the PC 10, the CPU 30 writes the download file data received from the PC 10 and stored in the RAM 50 into the flash memory 40.
[0005]
According to this method, there is a possibility that the data of the download file stored on the RAM 50 that has not been determined whether or not an error has occurred at the time of reception is written to the flash memory 40 as it is, and the data reliability is low. There was a problem.
[0006]
Therefore, in order to improve the reliability of the data of the received download file, the program download method described in Patent Document 1 calculates the sum of the data of the download file by the sum calculation circuit 80 as shown in FIG. The data stored on the RAM 50 is compared with the sum added to the download file in advance, and the data of the downloaded file on the RAM 50 received and stored is evaluated before writing.
[0007]
[Patent Document 1]
Japanese Patent Laid-Open No. 2000-122848
[Problems to be solved by the invention]
However, in the above-described conventional program downloading method , only the check of the sum added for each line is performed. For example, in the case of an Intel hexa format file, the record mark (':') to the new line ('¥ n') When all the data of one line up to the code could not be received, the abnormality of the received data cannot be detected, and there was a problem in the reliability of the data of the received download file.
[0009]
In addition, when data that does not affect the sum added to the download file could not be received, for example, when the download file is in Intel hexa format, the following line: “1020304060000000000000000000000000000000”
In other words, if the data of the line where the sum of the new line ('\ n') code is 0x00 cannot be received from the record mark (':'), the sum of the downloaded files will match, so the received data Even if it is not possible to detect any abnormalities in the data, or even if it is not possible to receive a plurality of lines of data whose sum is 0x00, the totals of the downloaded files will match, so the abnormalities in the received data Even if it cannot be detected and a sum is added to the download file, there is a problem in the reliability of the received data.
[0010]
Therefore, the present invention has been made in view of the problems in the conventional program download method described above, and improves the reliability of received data, speeds up transmission / reception processing, and simplifies the apparatus configuration. An object of the present invention is to provide a program download method that can be used.
[0011]
[Means for Solving the Problems]
In order to achieve the above object, the present invention provides a program download method for transmitting an Intel hexa format or S format program file from one device and downloading the program file to the other device. , Adding information about the total number of lines of the program file, transmitting the file, and storing the received program file in the RAM in the other device, and performing a checksum for each line of the received program file And the number of lines of the received program file is counted and compared with the added total number of lines to indicate that the result of the sum check process has received correct data, and the number of counted lines when said number of appended total rows and matches, the received data and It is determined that there is no error, and writes the program file stored in the RAM in the nonvolatile memory.
[0012]
According to the present invention, by adding the number of lines of the entire file as data, it is possible to detect missing reception of data in file transfer and improve the reliability of received data.
[0013]
In addition, since the reliability of data is improved by adding the number of lines in the entire file as data, the amount of data transferred compared to the method of improving reliability by adding headers and packet numbers to the data in each line By reducing the number of times, the data transfer time can be increased. Further, compared to the method of adding the sum of the entire file to improve the reliability, it is possible to speed up the transmission / reception process by eliminating the calculation of the sum.
[0014]
Furthermore, since the reliability of the data is improved by adding the number of lines of the entire file as data, a method of improving the reliability by adding a header or packet number to the data of each line, Compared with a method of improving reliability by calculating and adding to data, the apparatus configuration can be simplified.
[0016]
DETAILED DESCRIPTION OF THE INVENTION
Next, embodiments of the present invention will be described with reference to the drawings.
[0017]
FIG. 1 shows the configuration of an apparatus for executing a program download method according to the present invention. This apparatus has a configuration in which a row counter 70 is added to the conventional example shown in FIG.
[0018]
According to the program download method of the present invention, the CPU 30 having the function of reading the file from the medium 20 on which the download file is written and receiving the data from the PC 10 via the serial controller 60. The CPU 30 receives the data transferred from the serial controller 60 and stores the received data in the RAM 50 while counting the number of rows of data received from the PC 10 by the row number counter 70. At the end of reception of all data, the count result of the row counter 70 is compared with data of the total number of rows of received data transmitted from the PC 10, and if they match, the flash memory is instructed by the flash memory update instruction from the PC Written in memory 40 To erase the data, and writes the data stored in the RAM50.
[0019]
Next, the operation of the CPU 30 and the like will be described in more detail with reference to FIGS. 1 and 3 to 5.
[0020]
First, a download file is prepared on the medium 20. Here, a case where an Intel hexa format file is prepared as a download file will be described as an example.
[0021]
When this file is prepared, the total number of lines transmitted by the PC 10 can be calculated and the total number of lines can be added and transmitted (when the software is already installed). There is no need to add data. If you do not have the function to calculate the total number of lines sent by the PC 10 and add the total number of lines to send data (no software installed), download the file. It is necessary to add data for the total number of rows to the in advance.
[0022]
Next, the PC 10 transmits a download start command to the CPU 30. The CPU 30 does not accept a download from the PC 10 unless it receives a download start command from the PC 10.
[0023]
When the CPU 30 receives a download start command from the PC 10 via the serial controller 60 (FIG. 3, Step 1), the CPU 30 initializes the RAM 50 for storing the received download file and the line number counter 70, and receives the download file. Is prepared (FIG. 3, Step 2).
[0024]
Here, the initialization of the RAM 50 is to write data in the same state as when the flash memory 40 to be updated is erased. For example, if the state after erasure of the flash memory 40 is 0xFF, the RAM 50 is initialized with 0xFF, and if the state after erasure of the flash memory 40 is 0x00, the RAM 50 is initialized with 0x00.
[0025]
In this way, by initializing the RAM 50 for storing the received download file, when the data stored in the RAM 50 matches the data in the RAM 50 when the data stored in the flash memory 40 is written, the writing is performed. By performing such a process (FIG. 5, Step 5), not only the update process time of the flash memory 40 is reduced, but also the lifetime of the flash memory 40 is extended by not performing extra writing to the flash memory 40. There is an effect that it becomes possible.
[0026]
When the preparation for receiving the download file is completed, the CPU 30 returns a response to the download start command to the PC 10 via the serial controller 60 (FIG. 3, Step 3).
[0027]
When the PC 10 receives a response to the download start command from the CPU 30, the PC 10 reads data from the medium 20 in which the download file is written and starts transmitting data.
[0028]
The CPU 30 receives data from the PC 10 to the new line ('\ n') code, that is, data for one line of the download file in the Intel hexa format via the serial controller 60 (FIG. 3, Steps 4 to 5). ).
[0029]
When the CPU 30 receives the data for one line, the CPU 30 calculates the sum of the received data (FIG. 3, Step 6), and compares it with the checksum code added to each line in the Intel hex format to confirm that the correct data has been received. Whether or not is determined (FIG. 3, Step 7).
[0030]
At this time, if the checksum codes do not match, it means that the correct data could not be received. Therefore, the received data is discarded and the PC 10 is notified that an abnormality in the received data has been detected (FIG. 3). , Step 11). Conversely, if the checksum codes match, it means that correct data has been received, and therefore it is determined which record type data in the Intel hexa format has been received (step 8, FIG. 3).
[0031]
Here, the operation is performed as follows according to the record type of the received data.
[0032]
When the data of the start address record indicating the entry point address is received, the data is discarded without being stored in the RAM 50, the address for storing the next transmitted data is calculated, and the count of the row number counter 70 is counted. The value is added to wait for data (FIG. 4, Steps 1 to 4).
[0033]
When the data of the extended address record indicating the paragraph value of the load address is received, the data is discarded without being stored in the RAM 50, the address for storing the next data to be sent is calculated, and the row number counter The count value of 70 is added to wait for data (FIG. 4, Steps 5 to 8).
[0034]
When data of the data record indicating the code value is received, the necessary data is extracted, stored in the RAM 50 download data storage area, the count value of the row counter 70 is added, and then sent. Wait for the data to be received (FIG. 4, Steps 9 to 12).
[0035]
When data of an end record indicating the end of the code is received, the data is discarded without being stored in the RAM 50, the count value of the line number counter 70 is added, and the total number of lines sent next is counted. Wait for data (FIG. 4, Steps 13 to 16).
[0036]
When the CPU 30 finishes the process corresponding to the data record, it reports to the PC 10 that the received data is normal (FIG. 4, Step 18). The normal report can be omitted.
[0037]
The PC 10 reads the file from the medium 20 and transmits the data until transmission of all data is completed (waits for a normal response from the PC 10 and if there is a response), and also reads the data from the medium 20 and stores the data. The process of transmitting (waiting for a normal response from the PC 10) is repeated.
[0038]
The CPU 30 also repeats the process of storing the received data in the area for storing the download data in the RAM 50 until the reception of all the data is completed (FIG. 3, Steps 4 to 9).
[0039]
When the PC 10 has a function capable of calculating the total number of lines transmitted and adding the total number of lines to be transmitted, the PC 10 transmits a new line ('\ n') code after transmitting the end record of the file. Is transmitted, that is, the number of transmitted lines is transmitted.
[0040]
On the other hand, if the PC 20 does not have a function for calculating the total number of lines transmitted and transmitting the total number of lines of data, since the total number of lines of data is added to the media 20 in advance, Send data.
[0041]
The PC 10 transmits all the data written in the medium 20 (and the data of the number of lines transmitted), and updates the flash memory 40 if there is no response (report) of abnormal data reception from the CPU 30. A flash memory update command is transmitted to the CPU 30.
[0042]
When the CPU 30 receives a flash memory update command from the PC 10 via the serial controller 60 (FIG. 5, Step 1), the CPU 30 erases the flash memory 40 and confirms whether or not the flash memory 40 has been erased (FIG. 5, Steps 2-3) If the flash memory 40 has been erased, the process proceeds to the next step. If the flash memory 40 has not been erased, an abnormal end of the flash memory update process is detected via the serial controller 60. It notifies to PC10 and complete | finishes (FIG. 5, Step10).
[0043]
Next, the data stored in the RAM 50 is read out and compared with the data in the flash memory 40 (FIG. 5, Steps 4 to 5). If they do not match, the data is written into the flash memory 40 and stored in the flash memory 40. It is confirmed whether or not writing has been performed normally (FIG. 5, Steps 6 to 7). If writing to the flash memory 40 is successful, the process proceeds to the next step, and writing to the flash memory 40 has not been performed. In this case, the abnormal end of the flash memory update process is notified to the PC 10 via the serial controller 60 and the process ends (FIG. 5, Step 10).
[0044]
If the writing to the flash memory 40 has been normally completed, it is confirmed whether or not the writing of all data has been completed (FIG. 5, Step 8). Is completed by notifying the PC 10 via the serial controller 60 (FIG. 5, Step 9). If all the data has not been written, the process returns to the previous step to write to the flash memory 40. Is repeated (FIG. 5, Steps 4 to 7).
[0045]
In the description of this operation, the file format initially prepared in the medium 20 is the Intel hexa format file, but it can be realized by other format files such as the S format. Although an embodiment in hardware is shown, it can also be realized by software.
[0046]
Next, a second embodiment of the program download method according to the present invention will be described with reference to FIG.
[0047]
In this apparatus, a sum calculation circuit 80 is further added to the configuration shown in FIG.
[0048]
In a configuration in which a PC 10 having a function of reading a file from a medium 20 in which a download file is written and transmitting data is connected to a CPU 30 having a function of receiving data from the PC 10 via a serial controller 60, the CPU 30 has a serial interface. The received data is stored in the RAM 50 while receiving the data transferred from the controller 60 and counting the number of rows of data received from the PC 10 by the row number counter 70. The count result is compared with the data of the total number of received data transmitted from the PC 10, and if they match, the sum of the data stored in the RAM 50 is calculated by the sum calculation circuit 80 according to the flash memory update instruction from the PC 10. Flash memory And erasing data written in 0, and writes the sum calculated by the data and the checksum calculation circuit 80 stored in the RAM 50.
[0049]
Next, the operation of the CPU 30 and the like will be described. The procedure (FIG. 3, Step 1) (FIG. 4, Step 1) until the CPU 30 receives the download file from the PC 10 is the same as the implementation procedure described above. Therefore, the flash memory update processing after data is normally received will be described with reference to FIG.
[0050]
If there is no response (report) for receiving abnormal data from the CPU 30, the PC 10 transmits a flash memory update command to the CPU 30 in order to update the flash memory 40.
[0051]
When the CPU 30 receives a flash memory update command from the PC 10 via the serial controller 60 (FIG. 6, Step 1), the sum calculation circuit 80 causes the sum of the area of the RAM 50 storing the received download file, that is, the flash memory 40 The sum of the program update area is calculated, and the sum is written in the RAM 50 corresponding to the thumb storage area of the flash memory 40.
[0052]
The subsequent flash memory 40 erasure to update end response processing (FIG. 6, Steps 2 to 10) is the same as the implementation procedure described above, and the updated flash memory 40 includes the flash memory calculated in the previous step. 40 sums are written.
[0053]
Here, by writing the sum into the flash memory 40, it is possible to perform the self-diagnosis (sum check) by calculating the sum of the program area at the time of starting the apparatus or / and at regular intervals.
[0054]
In the description of this operation, the thumb calculation circuit 80 is shown as an embodiment in hardware, but it can also be realized by software.
[0055]
【The invention's effect】
As described above, according to the present invention, it is possible to provide a program download method capable of improving the reliability of received data, speeding up transmission / reception processing, and simplifying the device configuration. Become.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a first embodiment of a program download method according to the present invention.
FIG. 2 is a block diagram showing a second embodiment of the program download method according to the present invention.
FIG. 3 is a flowchart showing a first embodiment of a program download method according to the present invention.
FIG. 4 is a flowchart showing a first embodiment of a program download method according to the present invention.
FIG. 5 is a flowchart showing a first embodiment of a program download method according to the present invention.
FIG. 6 is a flowchart showing a second embodiment of the program download method according to the present invention.
FIG. 7 is a block diagram showing an example of a conventional program download method .
FIG. 8 is a block diagram showing an example of a conventional program download method .

Claims (1)

一方の機器からインテルヘクサフォーマット又はSフォーマットのプログラムファイルを送信し、該プログラムファイルを他方の機器にダウンロードするプログラムダウンロード方法であって、
前記一方の機器において、前記プログラムファイルの総行数に関する情報を付加して該ファイルを送信し、
前記他方の機器において、
受信したプログラムファイルをRAMに格納しつつ、前記受信したプログラムファイルの1行毎のサムチェック処理を行うとともに、前記受信したプログラムファイルの行数を計数して前記付加された総行数と比較し、
前記サムチェック処理の結果が正しいデータを受信したことを示し、かつ、前記計数した行数と前記付加された総行数とが一致した場合に、受信したデータにエラーがないと判断し、前記RAMに格納したプログラムファイルを不揮発性メモリに書き込むことを特徴とするプログラムダウンロード方法
A program download method for transmitting an Intel hexa format or S format program file from one device and downloading the program file to the other device,
In the one device, information on the total number of lines of the program file is added and the file is transmitted,
In the other device,
While the received program file is stored in the RAM, a sum check process is performed for each line of the received program file, and the number of lines of the received program file is counted and compared with the added total number of lines. ,
When the result of the sum check process indicates that the correct data has been received, and when the counted number of rows and the added total number of rows match, it is determined that there is no error in the received data, and A program download method for writing a program file stored in a RAM into a nonvolatile memory.
JP2003081687A 2003-03-25 2003-03-25 How to download the program Expired - Fee Related JP4325786B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003081687A JP4325786B2 (en) 2003-03-25 2003-03-25 How to download the program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003081687A JP4325786B2 (en) 2003-03-25 2003-03-25 How to download the program

Publications (2)

Publication Number Publication Date
JP2004288074A JP2004288074A (en) 2004-10-14
JP4325786B2 true JP4325786B2 (en) 2009-09-02

Family

ID=33295150

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003081687A Expired - Fee Related JP4325786B2 (en) 2003-03-25 2003-03-25 How to download the program

Country Status (1)

Country Link
JP (1) JP4325786B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006318198A (en) * 2005-05-12 2006-11-24 Hitachi Kokusai Electric Inc Download method to flash rom
JP6332970B2 (en) * 2011-02-11 2018-05-30 シーメンス・ヘルスケア・ダイアグノスティックス・インコーポレーテッドSiemens Healthcare Diagnostics Inc. System and method for secure software update

Also Published As

Publication number Publication date
JP2004288074A (en) 2004-10-14

Similar Documents

Publication Publication Date Title
JP5423830B2 (en) Update data transmission method, firmware update system, and host device
TWI220962B (en) Firmware updating method and related apparatus for checking content of replacing firmware before firmware updating
US8601464B2 (en) Memory online update system and method
US20110004871A1 (en) Embedded electronic device and firmware updating method thereof
US7383431B2 (en) Control system and method for rewriting data in a flash memory and a data storage medium in which a program is stored for rewriting data in a flash memory
CN102414666A (en) Low latency read operation for managed non-volatile memory
KR20070076849A (en) Apparatus and method for accomplishing copy-back operation in memory card
KR20100033507A (en) Emerging bad block detection
KR100986884B1 (en) External connection device, host device, and data communication system
CN110032339B (en) Data migration method, device, system, equipment and storage medium
US20080046778A1 (en) Memory controller and semiconductor memory device
CN113778822B (en) Error correction capability test method and device, readable storage medium and electronic equipment
KR100987205B1 (en) External connection device, host device, and data communication system
CN117687664A (en) Online upgrade configuration method and device for DSP
TW202036301A (en) Method and apparatus for performing access control between host device and memory device
JP4325786B2 (en) How to download the program
US20120303879A1 (en) Memory Device and Method for Programming Flash Memory Utilizing Spare Blocks
US7007036B2 (en) Method and apparatus for embedding configuration data
CN113867771B (en) Remote firmware upgrading method based on FPGA
US20190073134A1 (en) Methods for resetting a flash memory device and apparatuses using the same
JP4967881B2 (en) Update data transmission method, firmware rewriting system, and update data transmission program
JP4460850B2 (en) IC card and IC card processing method
US7313648B2 (en) Corruption tolerant method and system for deploying and modifying data in flash memory
JP2007069514A (en) Ink-jet recording device
US7080199B2 (en) Method to maintain data integrity during flash file transfer to raid controller flash using a terminal emulation program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060202

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080423

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090216

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090403

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20090513

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090603

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

Free format text: PAYMENT UNTIL: 20120619

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20120619

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20130619

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees