JP2021006973A - Semiconductor device, ic card, control method, and program - Google Patents

Semiconductor device, ic card, control method, and program Download PDF

Info

Publication number
JP2021006973A
JP2021006973A JP2019121185A JP2019121185A JP2021006973A JP 2021006973 A JP2021006973 A JP 2021006973A JP 2019121185 A JP2019121185 A JP 2019121185A JP 2019121185 A JP2019121185 A JP 2019121185A JP 2021006973 A JP2021006973 A JP 2021006973A
Authority
JP
Japan
Prior art keywords
patch
function
entry point
module
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.)
Granted
Application number
JP2019121185A
Other languages
Japanese (ja)
Other versions
JP7284003B2 (en
Inventor
和重 荒井
Kazue Arai
和重 荒井
祐樹 岩井
Yuki Iwai
祐樹 岩井
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.)
Toppan Inc
NTT Data Group Corp
Original Assignee
NTT Data Corp
Toppan Printing Co 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 NTT Data Corp, Toppan Printing Co Ltd filed Critical NTT Data Corp
Priority to JP2019121185A priority Critical patent/JP7284003B2/en
Publication of JP2021006973A publication Critical patent/JP2021006973A/en
Application granted granted Critical
Publication of JP7284003B2 publication Critical patent/JP7284003B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

To provide a semiconductor device configured to prevent increase in run time of ROM codes stored in a program due to increase in the number of entry points in the program, to prevent increase of storage area for storing information necessary for patch treatment, and to prevent available areas in a storage unit comprising rewritable memories, such as EEPROM, from being compressed.SOLUTION: A semiconductor device 1 includes: a first storage unit 131 in which programs are stored and data cannot be rewritten; a control unit 11 which executes the programs; a second storage unit 132 which allows data to be rewritten and stores patches being modules which are to be replaced with function modules in the programs; and a patch parameter area 350 arranged in the second storage unit 132, and storing patch data including patch flags indicating whether there are one or more entry points with patches, in all of entry points added to the function modules of the programs.SELECTED DRAWING: Figure 1

Description

本発明は、半導体装置、ICカード、制御方法およびプログラムに関する。 The present invention relates to semiconductor devices, IC cards, control methods and programs.

近年、IC(integrated circuit)カードが多くの業種で用いられており、ICカードに組み込まれるオペレーティングシステム・プログラムやアプリケーション・プログラムも用途に応じて多種多様である。
これらのプログラムは、ICカードの作成時において、書き換えできないプログラムコード(以下、ROM(read only memory)コードと示す)として、マスクROMやフラッシュメモリなどに書き込まれている。
In recent years, IC (integrated circuit) cards have been used in many industries, and the operating system programs and application programs incorporated in IC cards are also diverse depending on the application.
These programs are written in a mask ROM, a flash memory, or the like as a program code that cannot be rewritten (hereinafter referred to as a ROM (read only memory) code) when the IC card is created.

上述したように、出荷時に書き込まれたプログラムの書き換えができないことにより、ROMコードとして書き込まれているプログラムに不具合が見つかった場合、このICカードの不具合を修正したプログラムが書き込まれたICカードと交換する必要がある。
近年、一枚のICカードに対して多くの機能を持たせる場合が多く、プログラムのコード数が多くなり、プログラムの動作に不具合を生じる割合が高くなっている。
As described above, if a defect is found in the program written as the ROM code due to the inability to rewrite the program written at the time of shipment, replace the IC card with the program that corrects the defect in this IC card. There is a need to.
In recent years, one IC card is often provided with many functions, the number of program codes increases, and the rate of problems in program operation increases.

このため、ROMコードの修正が発生する可能性が高いと推定される箇所に、修正プログラム(以下、パッチと示す)の適用をチェックする入り口(以下、エントリポイント)を設ける。
そして、パッチプログラムを書き換え可能なフラッシュメモリやEEPROM(electrically erasable programmable read only memory)にロードしておき、ROMコードの置き換えが必要であるか否かを、上記エントリポイントにおいて判定して、不具合のあったROMコードをパッチプログラムで置き換えて、プログラムのROMコードの修正を行っている(例えば、特許文献1参照)。
For this reason, an entrance (hereinafter, entry point) for checking the application of the patch (hereinafter, referred to as a patch) is provided at a place where it is presumed that the ROM code is likely to be modified.
Then, the patch program is loaded into a rewritable flash memory or EEPROM (electrically erasable programmable read only memory), and whether or not the ROM code needs to be replaced is determined at the above entry point, and there is a problem. The ROM code of the program is replaced with a patch program to correct the ROM code of the program (see, for example, Patent Document 1).

特許第5017868号公報Japanese Patent No. 5017868

上述したように、不具合などにより修正する必要のあるプログラムのROMコードに代え、パッチプログラムが実行される(以下、パッチ処理と示す)場合、プログラムのROMコードに設けられたエントリポイントから、外部装置からロードしてフラッシュメモリやEEPROMに書き込まれたパッチプログラムが呼び出される。 As described above, when a patch program is executed (hereinafter referred to as patch processing) instead of the ROM code of the program that needs to be corrected due to a defect or the like, an external device is used from the entry point provided in the ROM code of the program. The patch program loaded from and written to the flash memory or EEPROM is called.

このとき、プログラムのROMコードに対してパッチ処理を行う際、エントリポイントに対応したパッチプログラムが用意されているか否かの検索を行う。
ここで、特許文献1においては、エントリポイントの各々にパッチが用意されているか否かを示すエントリポイントテーブルを設けておき、エントリポイント毎に付番した番号によりこのエントリポイントテーブルを検索する。
At this time, when patch processing is performed on the ROM code of the program, it is searched whether or not the patch program corresponding to the entry point is prepared.
Here, in Patent Document 1, an entry point table indicating whether or not a patch is prepared for each entry point is provided, and the entry point table is searched by a number assigned to each entry point.

そして、検索の結果において抽出したエントリポイントの番号に対応して、このエントリポイントのROMコードに対するパッチがあるか否かにより、エントリポイントにおけるパッチ処理が必要か否かの判定が行われる。
パッチ処理が必要である場合、エントリポイントテーブルにおいてエントリポイントに対応して記載されたパッチプログラムのアドレスを読出し、対象となるエントリポイントにおけるパッチ処理が行われる。
Then, it is determined whether or not patch processing at the entry point is necessary depending on whether or not there is a patch for the ROM code of the entry point corresponding to the number of the entry point extracted in the search result.
When patch processing is required, the address of the patch program described corresponding to the entry point is read in the entry point table, and patch processing is performed at the target entry point.

しかしながら、エントリポイントの数が増加するに従い、プログラムのROMコードにおけるエントリポイント毎に、エントリポイントテーブルを参照してパッチ処理を実行するための時間も増加して、プログラムの実行速度を低下させる原因となる。
また、引用文献1のように、エントリポイントテーブルにおいて、エントリポイント毎にパッチプログラムのアドレスを記載する場合、少なくともエントリポイントの数分、エントリポイントのID、エントリポイントに対応するパッチの有無、パッチのROMコードのアドレスを記載するための記憶領域が必要となり、フラッシュメモリやEEPROMにおける利用可能領域を低減させる。
However, as the number of entry points increases, the time required to refer to the entry point table and execute patch processing for each entry point in the program ROM code also increases, which causes the program execution speed to decrease. Become.
Further, when the address of the patch program is described for each entry point in the entry point table as in Reference 1, at least the number of entry points, the ID of the entry point, the presence / absence of the patch corresponding to the entry point, and the patch A storage area for describing the address of the ROM code is required, and the available area in the flash memory or the EEPROM is reduced.

本発明は、このような状況に鑑みてなされたもので、プログラムに付加されているエントリポイント毎にエントリポイントテーブルを用意することなくパッチプログラムを実行することにより、プログラムに記憶されたROMコードの実行時間の増加を抑制し、かつパッチ処理に必要な情報を記憶させるための記憶領域の増加を抑制し、フラッシュメモリやEEPROMなどの書き換え可能なメモリからなる記憶部における利用可能領域を低減させることがない半導体装置、ICカード、制御方法およびプログラムを提供する。 The present invention has been made in view of such a situation, and the ROM code stored in the program can be obtained by executing the patch program without preparing an entry point table for each entry point added to the program. Suppressing the increase in execution time, suppressing the increase in the storage area for storing information required for patch processing, and reducing the available area in the storage unit consisting of rewritable memory such as flash memory and EEPROM. Provides semiconductor devices, IC cards, control methods and programs without flash memory.

上述した課題を解決するために、本発明の一態様は、プログラムが記憶され、記憶されたデータの書き換えが不可能な第1記憶部と、前記プログラムを実行する制御部と、記憶されたデータの書き換えが可能であり、前記プログラムにおける前記関数モジュールと置き換えるモジュールであるパッチが記憶される第2記憶部と、前記第2記憶部に設けられており、前記プログラムにおける関数モジュールに付加されたエントリポイントの全てにおいて、前記パッチが用意されたエントリポイントが、少なくとも一つ以上存在するか否かを示すパッチ有無フラグを含むパッチデータを記憶するパッチパラメータ領域とを備えることを特徴とする半導体装置である。 In order to solve the above-mentioned problems, one aspect of the present invention is a first storage unit in which a program is stored and the stored data cannot be rewritten, a control unit that executes the program, and stored data. A second storage unit in which a patch, which is a module to replace the function module in the program, is stored, and an entry provided in the second storage unit and added to the function module in the program. A semiconductor device characterized in that all of the points include a patch parameter area for storing patch data including a patch presence / absence flag indicating whether or not at least one entry point for which the patch is prepared exists. is there.

また、本発明の一態様は、上記半導体装置であって、関数モジュールに配置された前記エントリポイントの各々を、当該関数モジュールの機能の種類に対応した機能グループそれぞれに分類しており、前記パッチデータが、前記機能グループに含まれる前記エントリポイントにおいて、前記パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグを含む。 Further, one aspect of the present invention is the above-mentioned semiconductor device, in which each of the entry points arranged in the function module is classified into each function group corresponding to the type of function of the function module, and the patch. The data includes a patch function flag indicating whether or not at least one or more prepared entry points of the patch exist at the entry point included in the function group.

また、本発明の一態様は、上記半導体装置であって、前記エントリポイントを識別するエントリポイント識別情報が、前記機能グループを示すグループ情報と、当該機能グループにおける前記エントリポイントに対応するパッチを示すパッチ情報とが組み合わされて生成されている。 Further, one aspect of the present invention is the semiconductor device, in which the entry point identification information for identifying the entry point indicates group information indicating the functional group and a patch corresponding to the entry point in the functional group. It is generated in combination with patch information.

また、本発明の一態様は、上記半導体装置であって、前記第2記憶部に対して自身の製造後に書き込まれた、前記関数モジュールと置き換えるパッチを含むパッチモジュールをさらに備え、前記制御部が、前記関数モジュールを実行する際、当該関数モジュールが前記エントリポイントを有する場合、前記パッチ有無フラグが前記パッチの用意されたエントリポイントがあることを示し、かつ当該関数モジュールのグループ情報が示す前記機能グループの前記パッチ機能フラグが当該機能グループに前記パッチが用意されたエントリポイントがあることを示す場合、前記パッチモジュールを実行する。 Further, one aspect of the present invention is the semiconductor device, further comprising a patch module including a patch to replace the function module written to the second storage unit after its manufacture, and the control unit. , When the function module is executed, if the function module has the entry point, the patch presence / absence flag indicates that there is an entry point for which the patch is prepared, and the function indicated by the group information of the function module. If the patch function flag of the group indicates that the function group has an entry point for which the patch is prepared, the patch module is executed.

また、本発明の一態様は、上記半導体装置であって、前記パッチモジュールにおいて、前記エントリポイントのパッチ情報に対応した前記パッチの各々が、前記機能グループ単位に分類されている。 Further, one aspect of the present invention is the semiconductor device, in which each of the patches corresponding to the patch information of the entry point is classified into the functional group unit in the patch module.

また、本発明の一態様は、上記半導体装置であって、前記制御部が、前記パッチモジュールに記載された機能グループにおける前記パッチのなかから前記パッチ情報に対応するパッチを、前記関数モジュールに代えて実行する。 Further, one aspect of the present invention is the semiconductor device, in which the control unit replaces the patch corresponding to the patch information from the patches in the functional group described in the patch module with the function module. And execute.

また、本発明の一態様は、少なくとも、上記半導体装置が搭載されているICカードである。 Further, one aspect of the present invention is at least an IC card on which the above-mentioned semiconductor device is mounted.

また、本発明の一態様は、記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイントが付加された関数モジュールを含むプログラムを制御部が実行する際、前記エントリポイントを識別するエントリポイント識別情報が、前記関数モジュールの機能の種類に対応した機能グループを示すグループ情報と、当該機能グループにおける前記関数モジュールに対応するパッチを示すパッチ情報とが含まれており、前記制御部が、第2記憶部に記憶されている前記プログラムにおけるエントリポイントの全てにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ有無フラグと、前記機能グループに含まれる前記エントリポイントにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグとを参照する過程と、前記制御部が、前記パッチ有無フラグが前記パッチが有ることを示し、かつ前記エントリポイントが含まれるパッチ機能フラグがパッチが有ることを示した場合、記憶されたデータの書き換えが可能な第2記憶部から、エントリポイントのパッチのプログラムを有するパッチモジュールを読出す過程と、前記制御部が、前記パッチモジュールにおいて前記機能グループに前記パッチが用意された前記エントリポイントがある場合、当該機能グループにおける前記パッチのなかから前記パッチ情報に対応するパッチを、前記関数モジュールに代えて実行する過程とを含む制御方法である。 Further, one aspect of the present invention is the entry point when the control unit executes a program including a function module to which an entry point is added, which is stored in a first storage unit in which the stored data cannot be rewritten. The entry point identification information for identifying the function includes group information indicating a function group corresponding to the type of function of the function module and patch information indicating a patch corresponding to the function module in the function group. The control unit sets the patch presence / absence flag indicating whether or not at least one patch-prepared entry point exists in all the entry points in the program stored in the second storage unit, and the function group. In the included entry point, the process of referring to the patch function flag indicating whether or not at least one entry point for which a patch is prepared exists, and the control unit has the patch presence / absence flag of the patch. When the fact is indicated and the patch function flag including the entry point indicates that there is a patch, the patch module having the entry point patch program is output from the second storage unit capable of rewriting the stored data. In the process of reading and when the control unit has the entry point in which the patch is prepared in the function group in the patch module, the patch corresponding to the patch information is selected from the patches in the function group. It is a control method including a process to be executed instead of a function module.

また、本発明の一態様は、記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイント識別情報に識別されるエントリポイントが付加された関数モジュールを含むプログラムをコンピュータに実行させる際、前記コンピュータを、第2記憶部に記憶されている前記プログラムにおけるエントリポイントの全てにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ有無フラグと、前記関数モジュールを機能別に分類した機能グループに含まれる前記エントリポイントにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグとを参照する手段、前記パッチ有無フラグが前記パッチが有ることを示し、かつ前記エントリポイントが含まれるパッチ機能フラグがパッチが有ることを示した場合、記憶されたデータの書き換えが可能な第2記憶部から、エントリポイントのパッチのプログラムを有するパッチモジュールを実行する手段として機能させるプログラムである。 Further, one aspect of the present invention is to provide a computer with a program including a function module in which an entry point identified by an entry point identification information is added, which is stored in a first storage unit in which the stored data cannot be rewritten. When executing the computer, a patch presence / absence flag indicating whether or not at least one patch-prepared entry point exists in all the entry points in the program stored in the second storage unit, and A means for referring to a patch function flag indicating whether or not at least one entry point for which a patch is prepared exists at the entry point included in a function group in which the function module is classified by function, the patch presence / absence flag. Indicates that the patch is present, and the patch function flag that includes the entry point indicates that the patch is present, the program of the entry point patch is provided from the second storage unit in which the stored data can be rewritten. It is a program that functions as a means for executing a patch module having.

また、本発明の一態様は、記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイント識別情報に識別されるエントリポイントが付加された関数モジュールを含むプログラムをコンピュータに実行させる際、前記コンピュータを、前記エントリポイントのパッチのプログラムを有するパッチモジュールにおいて、前記関数モジュールを機能別に分類した機能グループに前記パッチが用意された前記エントリポイントがある場合、当該機能グループにおける前記パッチのなかから、前記エントリポイントに対応するパッチを示すパッチ情報に対応するパッチを、前記関数モジュールに代えて実行する手段、として機能させ、前記エントリポイント識別情報が、前記関数モジュールの機能の種類に対応した機能グループを示すグループ情報と、当該機能グループにおける前記関数モジュールに対応するパッチを示す前記パッチ情報とが含まれているプログラムである。 Further, one aspect of the present invention is to provide a computer with a program including a function module in which an entry point identified by an entry point identification information is added, which is stored in a first storage unit in which the stored data cannot be rewritten. When the computer is executed, in the patch module having the program of the patch of the entry point, if the entry point in which the patch is prepared is in the functional group in which the function module is classified according to the function, the said in the functional group. Among the patches, the patch corresponding to the patch information indicating the patch corresponding to the entry point is made to function as a means for executing the patch in place of the function module, and the entry point identification information is the type of function of the function module. It is a program including the group information indicating the function group corresponding to the above and the patch information indicating the patch corresponding to the function module in the function group.

以上説明したように、本発明によれば、プログラムに付加されているエントリポイント毎にエントリポイントテーブルを用意することなくパッチプログラムを実行することにより、プログラムに記憶されたROMコードの実行時間の増加を抑制し、かつパッチ処理に必要な情報を記憶させるための記憶領域の増加を抑制し、EEPROMなどの書き換え可能なメモリからなる記憶部における利用可能領域を低減させることがない半導体装置、制御方法およびプログラムを提供する。 As described above, according to the present invention, by executing the patch program without preparing an entry point table for each entry point added to the program, the execution time of the ROM code stored in the program is increased. A semiconductor device and a control method that suppresses an increase in a storage area for storing information required for patch processing and does not reduce the available area in a storage unit composed of a rewritable memory such as an EEPROM. And provide programs.

本発明の一実施形態による半導体装置1の構成例を示すブロック図である。It is a block diagram which shows the structural example of the semiconductor device 1 by one Embodiment of this invention. EEPROM132のパッチパラメータ領域に書き込まれるパッチパラメータ350の構成例を示す図である。It is a figure which shows the configuration example of the patch parameter 350 written in the patch parameter area of the EEPROM 132. プログラム150におけるエントリポイントの付加された関数モジュールの記述例を示す図である。It is a figure which shows the description example of the function module with the entry point added in the program 150. エントリポイントモジュールにおけるパッチ関数により実行されるパッチモジュールの記述例を示す図である。It is a figure which shows the description example of the patch module executed by the patch function in the entry point module. プログラム150における第1分岐処理及び第2分岐処理の動作例を説明するフローチャートである。It is a flowchart explaining the operation example of the 1st branch processing and the 2nd branch processing in the program 150. 関数モジュールにおけるエントリポイントに対応したパッチが存在しない場合の第1分岐処理及び第2分岐処理の動作を説明する概念図である。It is a conceptual diagram explaining the operation of the 1st branch processing and the 2nd branch processing when the patch corresponding to the entry point in a function module does not exist. 関数モジュールにおけるエントリポイントに対応したパッチが存在する場合の第1分岐処理及び第2分岐処理の動作を説明する概念図である。It is a conceptual diagram explaining the operation of the 1st branch processing and the 2nd branch processing when the patch corresponding to the entry point in a function module exists. エントリポイントモジュール700から読み出されるパッチモジュールにおける第3分岐処理の動作例を説明するフローチャートである。It is a flowchart explaining the operation example of the 3rd branch processing in the patch module read from the entry point module 700.

以下、本発明の一実施形態について、図面を参照して説明する。
図1は、本発明の一実施形態による半導体装置1の構成例を示すブロック図である。
図1において、半導体装置1は、CPU(central processing unit)、メモリなどを構成する半導体素子を用いたIC(integrated circuit)を備え、情報を処理および記憶する装置である。
半導体装置1は、ICカード、SIM(subscriber identity module)カードなどである。図1に示す半導体装置1は、制御部11とデータ入出力部12と記憶部13とを備える。
Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
FIG. 1 is a block diagram showing a configuration example of a semiconductor device 1 according to an embodiment of the present invention.
In FIG. 1, the semiconductor device 1 is a device including an IC (integrated circuit) using semiconductor elements constituting a CPU (central processing unit), a memory, and the like, and processes and stores information.
The semiconductor device 1 is an IC card, a SIM (subscriber identity module) card, or the like. The semiconductor device 1 shown in FIG. 1 includes a control unit 11, a data input / output unit 12, and a storage unit 13.

制御部11は、CPU111を備え、記憶部13に記憶されているプログラム(例えば、アプリケーションプログラムや後述するモジュールなどのプログラム)を実行することで、所定の処理を行う。
データ入出力部12は、所定のプロトコルに従って外部装置(不図示)とのデータの送受信を行う。
The control unit 11 includes a CPU 111 and executes a program stored in the storage unit 13 (for example, a program such as an application program or a module described later) to perform a predetermined process.
The data input / output unit 12 transmits / receives data to / from an external device (not shown) according to a predetermined protocol.

記憶部13は、ROM131、EEPROM132及びRAM(random access memory)133を有する。
ROM131には、半導体装置1の製造の際に書き込まれる、ROMコードの形態のプログラム150が記憶されている。このプログラム150は、例えば、公共系、金融系及び交通系などの業界あるいはグループの提供するICカードで利用するサービスの処理を行うアプリケーションプログラムなどである。ROM131において、プログラム150はROMコードで書き込まれているため、不具合を有する関数モジュールが含まれていても書き換えることができない。本実施形態において、ROMコードでプログラムが記載された書き換え不能のROMとしてマスクROM131を用いているが、マスクROMに換えてフラッシュメモリを用いてもよい。
The storage unit 13 has a ROM 131, an EEPROM 132, and a RAM (random access memory) 133.
The ROM 131 stores a program 150 in the form of a ROM code, which is written when the semiconductor device 1 is manufactured. The program 150 is, for example, an application program that processes services used by IC cards provided by industries or groups such as public, financial, and transportation systems. In the ROM 131, since the program 150 is written in the ROM code, it cannot be rewritten even if a defective function module is included. In the present embodiment, the mask ROM 131 is used as the non-rewritable ROM in which the program is described by the ROM code, but a flash memory may be used instead of the mask ROM.

このため、上記プログラム150には、不具合が発生して修正することが予想される、あるいはアプリケーションの関係で書き換えることを前提とする関数モジュールに対してエントリポイントを付加させてある。
本実施形態においては、上記エントリポイントを識別するエントリポイント識別情報が、機能番号及び個別番号との組合せで形成されている。
機能番号は、プログラム150における関数モジュールの各々を機能(例えば、暗号機能、通信機能、数値計算機能などの各種機能)別に分類した機能グループを識別するグループ情報である。
個別番号は、機能番号が示す各々の機能グループにおいて、この機能グループに含まれるパッチのそれぞれを個別に識別するパッチ情報である。
For this reason, the program 150 is provided with an entry point for a function module that is expected to be corrected due to a problem or that is premised on being rewritten in relation to an application.
In the present embodiment, the entry point identification information for identifying the entry point is formed by a combination of a function number and an individual number.
The function number is group information that identifies a function group in which each of the function modules in the program 150 is classified according to a function (for example, various functions such as a cryptographic function, a communication function, and a numerical calculation function).
The individual number is patch information that individually identifies each of the patches included in this function group in each function group indicated by the function number.

本実施形態において、エントリポイント識別情報は2バイト(xxyyh)で記述されており、機能番号がxxhの1バイト、個別番号がyyhの1バイトである。
例えば、暗号機能の機能番号が01hであり、暗号機能の機能グループにおける個別番号が02hである場合、エントリポイント識別情報は、0102hで表される。
また、本実施形態においては、1バイトの機能番号と1バイトの個別番号とで、エントリポイント識別情報が2バイトとして説明している。しかしながら、プログラムに含まれる関数モジュール(エントリポイントが付加される関数モジュール)の機能の種類の数と、機能グループにおけるパッチの数とにより、エントリポイント識別情報のバイト数を任意に設定する。
In the present embodiment, the entry point identification information is described in 2 bytes (xxxhyh), the function number is 1 byte of xxxh, and the individual number is 1 byte of yyh.
For example, when the function number of the cryptographic function is 01h and the individual number in the function group of the cryptographic function is 02h, the entry point identification information is represented by 0102h.
Further, in the present embodiment, the entry point identification information is described as 2 bytes by the 1-byte function number and the 1-byte individual number. However, the number of bytes of the entry point identification information is arbitrarily set according to the number of function types of the function module (function module to which the entry point is added) included in the program and the number of patches in the function group.

EEPROM132には、パッチモジュール250とパッチパラメータ350とが記憶されている。EEPROM132は、書き換え可能な不揮発性メモリであれば何れでもよく、例えばフラッシュメモリを用いた構成としてもよい。
ここで、制御部11は、データ入出力部12を介して、外部装置からパッチモジュール250が供給された場合、パッチモジュール250と、このパッチモジュール250に対応したパッチパラメータ350をEEPROM132に書き込んで記憶させる。
The patch module 250 and the patch parameter 350 are stored in the EEPROM 132. The EEPROM 132 may be any rewritable non-volatile memory, and may be configured using, for example, a flash memory.
Here, when the patch module 250 is supplied from the external device via the data input / output unit 12, the control unit 11 writes and stores the patch module 250 and the patch parameter 350 corresponding to the patch module 250 in the EEPROM 132. Let me.

パッチモジュール250(後述する800)は、プログラム150において、不具合などで修正を必要とする関数モジュール、言い換えると、関数モジュールに付加されたエントリポイントに対応するパッチプログラムが、その関数モジュールの機能の種類で分類されてそれぞれの機能グループ単位に記述されている(詳細は後述)。 The patch module 250 (800 described later) is a function module that needs to be corrected due to a defect in the program 150, in other words, a patch program corresponding to an entry point added to the function module is a type of function of the function module. It is classified by and described in each function group unit (details will be described later).

パッチパラメータ350は、少なくとも、パッチ有無フラグと、パッチ機能フラグと、パッチ領域先頭アドレスとである。パッチパラメータ350は、EEPROM132における予め設定されたアドレスが既知のパッチパラメータ領域に書き込まれている。
図2は、EEPROM132のパッチパラメータ領域に書き込まれるパッチパラメータ350の構成例を示す図である。
The patch parameter 350 is at least a patch presence / absence flag, a patch function flag, and a patch area start address. In the patch parameter 350, a preset address in the EEPROM 132 is written in a known patch parameter area.
FIG. 2 is a diagram showing a configuration example of the patch parameter 350 written in the patch parameter area of the EEPROM 132.

パッチ有無フラグ301は、エントリポイントが付加された関数モジュールの各々において、置き換えるパッチが存在する関数モジュールが少なくとも1個以上あるか否かを示すフラグである。パッチ有無フラグは、例えば、置き換えるパッチが存在する関数モジュールが少なくとも1個以上ある場合「ON」であり、一方、置き換えるパッチが存在する関数モジュールが無い場合「OFF」である。 The patch presence / absence flag 301 is a flag indicating whether or not there is at least one function module in which a patch to be replaced exists in each of the function modules to which the entry point is added. The patch presence / absence flag is, for example, "ON" when there is at least one function module having a patch to be replaced, and "OFF" when there is no function module having a patch to be replaced.

パッチ機能フラグ302、303及び304の各々は、関数モジュールの機能の種類毎に分類した機能グループにおいて、置き換えるパッチが存在する関数モジュールが少なくとも1個以上あるか否かを示すフラグである。パッチ機能フラグ302、303及び304の各々は、例えば、それぞれに対応する機能グループ毎に置き換えるパッチが存在する関数モジュールが少なくとも1個以上ある場合「ON」であり、一方、置き換えるパッチが存在する関数モジュールが全く無い場合「OFF」である。例えば、パッチ機能フラグ302は、機能番号00hの示す、例えばメイン機能の機能グループに対応したフラグである。パッチ機能フラグ303は、機能番号01hの示す、例えば通信機能の機能グループに対応したフラグである。パッチ機能フラグ304は、機能番号02hの示す、例えば暗号機能の機能グループに対応したフラグである。 Each of the patch function flags 302, 303, and 304 is a flag indicating whether or not there is at least one function module in which the patch to be replaced exists in the function group classified according to the function type of the function module. Each of the patch function flags 302, 303 and 304 is, for example, "ON" when there is at least one function module having a patch to be replaced for each function group corresponding to each, while a function having a patch to be replaced. If there are no modules, it is "OFF". For example, the patch function flag 302 is a flag corresponding to, for example, the function group of the main function indicated by the function number 00h. The patch function flag 303 is a flag corresponding to, for example, the function group of the communication function indicated by the function number 01h. The patch function flag 304 is a flag corresponding to, for example, a function group of a cryptographic function, which is indicated by the function number 02h.

パッチ領域先頭アドレス305は、EEPROM132におけるパッチモジュール250が書き込まれた記憶領域の先頭アドレスを示している。 The patch area start address 305 indicates the start address of the storage area in which the patch module 250 in the EEPROM 132 is written.

RAM133は、制御部11がプログラム150を実行する際のメインメモリとして用いられる。 The RAM 133 is used as the main memory when the control unit 11 executes the program 150.

図3は、プログラム150におけるエントリポイントの付加された関数モジュールの記述例を示す図である。
図3において、プログラム150は、例えば、メイン関数モジュール500、関数モジュール600、エントリポイントモジュール700などを備えている。
メイン関数モジュール500には、所定のアプリケーションの機能を実行するために必要な関数501や502などの複数の関数が記述されている。
関数モジュール600は、制御部11が実際に実行する関数501の機能に対応した処理を示す実体のコードが記述されている。
FIG. 3 is a diagram showing a description example of a function module to which an entry point is added in the program 150.
In FIG. 3, the program 150 includes, for example, a main function module 500, a function module 600, an entry point module 700, and the like.
In the main function module 500, a plurality of functions such as functions 501 and 502 necessary for executing the function of a predetermined application are described.
In the function module 600, an entity code indicating a process corresponding to the function of the function 501 actually executed by the control unit 11 is described.

関数501にエントリポイントが設定されている場合、メイン関数モジュール600には、エントリポイント関数601のコードが付加されている。
エントリポイント関数601は、エントリポイントモジュール700を呼び出して実行させる関数である。
エントリポイントモジュール700には、制御部11が実際に実行するエントリポイント関数601の機能に対応した処理を示す実体のコードが記述されている。エントリポイントモジュール700には、第1分岐処理701、機能番号抽出処理702、第2分岐処理703が記述されている。ここで、第1分岐処理701は、パッチ有無フラグがONか否かを判定する処理である。機能番号抽出処理702は、エントリポイント識別情報から機能番号を抽出する処理である。第2分岐処理703は、パッチ機能フラグがONか否かを判定する処理である。
第2分岐処理703には、パッチ機能フラグがONの場合に、パッチモジュール800(図4参照)を実行させるパッチ関数704が記述されている。
When an entry point is set in the function 501, the code of the entry point function 601 is added to the main function module 600.
The entry point function 601 is a function that calls and executes the entry point module 700.
In the entry point module 700, the code of the entity indicating the processing corresponding to the function of the entry point function 601 actually executed by the control unit 11 is described. In the entry point module 700, the first branch processing 701, the function number extraction processing 702, and the second branch processing 703 are described. Here, the first branch processing 701 is a processing for determining whether or not the patch presence / absence flag is ON. The function number extraction process 702 is a process of extracting the function number from the entry point identification information. The second branch processing 703 is a processing for determining whether or not the patch function flag is ON.
In the second branch processing 703, a patch function 704 that executes the patch module 800 (see FIG. 4) when the patch function flag is ON is described.

図1に戻り、制御部11は、関数501を実行する際、関数501に記述されている関数501の実体である関数モジュール600の記憶されたアドレス(マスクROM131におけるアドレス)を読み込み、関数モジュール600を実行する。ここで、実体とは、制御部11が実際に実行する関数501の機能が記述されたROMコードを示している。
そして、制御部11は、関数モジュール600がエントリポイント関数601を含む場合、エントリポイント関数601に記述されたエントリポイントモジュール700を呼び出すアドレスを読み込み、エントリポイントモジュール700のROMコードの処理を実行する。
Returning to FIG. 1, when executing the function 501, the control unit 11 reads the stored address (address in the mask ROM 131) of the function module 600, which is the entity of the function 501 described in the function 501, and the function module 600. To execute. Here, the entity indicates a ROM code in which the function of the function 501 actually executed by the control unit 11 is described.
Then, when the function module 600 includes the entry point function 601, the control unit 11 reads the address for calling the entry point module 700 described in the entry point function 601 and executes the processing of the ROM code of the entry point module 700.

このとき、制御部11は、エントリポイントモジュール700に記述された第1分岐処理701の記述の処理により、EEPROM132のパッチパラメータ領域におけるパッチパラメータ350のパッチ有無フラグを参照する。
そして、制御部11は、パッチ有無フラグがONであるか否かの判定を行い、ONであれば機能番号抽出処理702の記述の処理を実行し、一方、パッチ有無フラグがOFFであれば、関数モジュール600に戻る処理(リターン処理)を行い、関数モジュール600に記述された処理を実行する。
At this time, the control unit 11 refers to the patch presence / absence flag of the patch parameter 350 in the patch parameter area of the EEPROM 132 by the process of the description of the first branch process 701 described in the entry point module 700.
Then, the control unit 11 determines whether or not the patch presence / absence flag is ON, and if it is ON, executes the process of describing the function number extraction process 702. On the other hand, if the patch presence / absence flag is OFF, the control unit 11 executes the description. The process of returning to the function module 600 (return process) is performed, and the process described in the function module 600 is executed.

また、制御部11は、パッチ有無フラグがONである場合、エントリポイントモジュール700に記述された機能番号抽出処理702の処理により、エントリポイント識別情報から機能番号を抽出する。
そして、制御部11は、EEPROM132におけるパッチパラメータ領域に記憶されているパッチパラメータ350において、抽出した機能番号に対応するパッチ機能フラグを参照する。
制御部11は、参照したパッチ機能フラグがONであるか否かの判定を行い、ONであればパッチ関数704に対応してパッチモジュール800の処理を実行し、一方、パッチ機能フラグがOFFであれば、関数モジュール600に戻り、関数モジュール600に記述された処理を実行する。
Further, when the patch presence / absence flag is ON, the control unit 11 extracts the function number from the entry point identification information by the process of the function number extraction process 702 described in the entry point module 700.
Then, the control unit 11 refers to the patch function flag corresponding to the extracted function number in the patch parameter 350 stored in the patch parameter area in the EEPROM 132.
The control unit 11 determines whether or not the referenced patch function flag is ON, and if it is ON, executes the processing of the patch module 800 corresponding to the patch function 704, while the patch function flag is OFF. If there is, it returns to the function module 600 and executes the process described in the function module 600.

制御部11は、EEPROM132において、パッチモジュール800が記憶された記憶領域の先頭アドレスであるパッチ領域先頭アドレス305を、パッチパラメータ350から読み出す。
そして、制御部11は、パッチ領域先頭アドレス305の領域に記憶されているパッチモジュール800に記述された処理を実行する。
In the EEPROM 132, the control unit 11 reads the patch area start address 305, which is the start address of the storage area in which the patch module 800 is stored, from the patch parameter 350.
Then, the control unit 11 executes the process described in the patch module 800 stored in the area of the patch area start address 305.

図4は、エントリポイントモジュールにおけるパッチ関数により実行されるパッチモジュールの記述例を示す図である。パッチモジュールは、プログラム150の不具合を修正する必要が生じた際、制御部11が外部装置からパッチモジュール800(パッチモジュール250)のコードをロードして、EEPROM132に、パッチパラメータ350とともに書き込んで記憶させる。
図4において、パッチモジュール800には、制御部11が実際に実行するパッチ関数704の入れ替えるべき関数モジュールに対するパッチ処理を示す実体のコードが記述されている。すなわち、パッチモジュール800には、機能番号及び個別番号抽出処理801、パッチ機能フラグ確認処理802、第3分岐処理803、エントリポイント修正処理804、第3分岐処理805、エントリポイント修正処理806、パッチ機能フラグ確認処理807などが記述されている。
FIG. 4 is a diagram showing a description example of a patch module executed by a patch function in the entry point module. When it becomes necessary for the patch module to correct a defect in the program 150, the control unit 11 loads the code of the patch module 800 (patch module 250) from an external device, writes it in the EEPROM 132 together with the patch parameter 350, and stores it. ..
In FIG. 4, the patch module 800 describes the actual code indicating the patch processing for the function module to be replaced of the patch function 704 actually executed by the control unit 11. That is, the patch module 800 includes a function number and individual number extraction process 801 and a patch function flag confirmation process 802, a third branch process 803, an entry point correction process 804, a third branch process 805, an entry point correction process 806, and a patch function. The flag confirmation process 807 and the like are described.

機能番号及び個別番号抽出処理801は、エントリポイント識別情報から、エントリポイントに付与されている機能番号及び個別番号の各々を抽出する処理である。
パッチ機能フラグ確認処理802及び807の各々は、それぞれ機能番号02h、06hのパッチ機能フラグがONであるか否かの判定を行う。このパッチ機能フラグ確認処理は、関数モジュールを置き換えるパッチが少なくとも1個が存在する機能グループに対応して設けられている。
The function number and individual number extraction process 801 is a process of extracting each of the function number and the individual number assigned to the entry point from the entry point identification information.
Each of the patch function flag confirmation processes 802 and 807 determines whether or not the patch function flags of the function numbers 02h and 06h are ON, respectively. This patch function flag confirmation process is provided corresponding to a function group in which at least one patch that replaces a function module exists.

第3分岐処理803及び805の各々は、それぞれエントリー識別情報から抽出された個別番号が01h、03hであるか否かを判定している。この第3分岐処理は、機能ブロックにおける関数モジュールと置き換えるパッチに対応した個数が設けられている。
エントリポイント修正処理804及び806の各々は、それぞれエントリー識別情報から抽出された個別番号が01h、03hであった場合に、関数モジュールとパッチとを置き換えるパッチ処理として記述されている。
Each of the third branch processing 803 and 805 determines whether or not the individual numbers extracted from the entry identification information are 01h and 03h, respectively. In this third branch processing, the number corresponding to the patch to be replaced with the function module in the functional block is provided.
Each of the entry point correction processes 804 and 806 is described as a patch process that replaces the function module and the patch when the individual numbers extracted from the entry identification information are 01h and 03h, respectively.

図1に戻り、制御部11は、機能番号及び個別番号抽出処理801の記述に対応して、引数として得られたエントリポイント識別情報から、対応するエントリポイントの機能番号及び個別番号の各々を抽出する。
次に、制御部11は、EEPROM132のパッチパラメータ領域におけるパッチパラメータ350において、抽出した機能番号に対応するパッチ機能フラグを参照する。
そして、制御部11は、抽出した機能番号に対応したパッチ機能フラグ確認処理、例えば、機能番号が02hである場合、パッチ機能フラグ確認処理802を実行する。一方、制御部11は、抽出し機能番号が06hである場合にパッチ機能フラグ確認処理807を実行する。
Returning to FIG. 1, the control unit 11 extracts each of the function number and the individual number of the corresponding entry point from the entry point identification information obtained as an argument corresponding to the description of the function number and the individual number extraction process 801. To do.
Next, the control unit 11 refers to the patch function flag corresponding to the extracted function number in the patch parameter 350 in the patch parameter area of the EEPROM 132.
Then, the control unit 11 executes the patch function flag confirmation process corresponding to the extracted function number, for example, when the function number is 02h, the patch function flag confirmation process 802. On the other hand, the control unit 11 executes the patch function flag confirmation process 807 when the extraction function number is 06h.

制御部11は、抽出した機能番号に対応するパッチ機能フラグ確認処理を実行し、抽出した機能番号の示すパッチ機能フラグがONであるか否かの判定を行う。
そして、制御部11は、抽出した機能番号の示すパッチ機能フラグがONである場合、第3分岐処理803、805、…などを順次実行し、抽出した個別番号に対応する第3分岐処理の有無を判定する。例えば、抽出した機能番号が02hであり、機能番号02hのパッチ機能フラグがONである場合、制御部11は、順次、第3分岐処理803、805、…において、抽出した個別番号と一致する第3分岐処理があるか否かの判定を行う。
The control unit 11 executes the patch function flag confirmation process corresponding to the extracted function number, and determines whether or not the patch function flag indicated by the extracted function number is ON.
Then, when the patch function flag indicated by the extracted function number is ON, the control unit 11 sequentially executes the third branch processing 803, 805, ..., And the presence or absence of the third branch processing corresponding to the extracted individual number. To judge. For example, when the extracted function number is 02h and the patch function flag of the function number 02h is ON, the control unit 11 sequentially matches the extracted individual number in the third branch processing 803, 805, .... It is determined whether or not there is a 3-branch process.

このとき、制御部11は、個別番号が01hか否かの判定を行う第3分岐処理803において、抽出した個別番号が01hである場合、第3分岐処理803に記述されたエントリポイント修正処理804を実行する。
また、制御部11は、個別番号が03hか否かの判定を行う第3分岐処理805において、抽出した個別番号が03hである場合、第3分岐処理805に記述されたエントリポイント修正処理806を実行する。
一方、制御部11は、抽出した個別番号に対応する第3分岐処理が存在しない場合、関数モジュール600に戻り、当該関数モジュール600の機能処理をコード記述に対応して実行する。
At this time, when the extracted individual number is 01h in the third branch processing 803 for determining whether or not the individual number is 01h, the control unit 11 describes the entry point correction process 804 in the third branch processing 803. To execute.
Further, in the third branch processing 805 for determining whether or not the individual number is 03h, when the extracted individual number is 03h, the control unit 11 performs the entry point correction process 806 described in the third branch processing 805. Execute.
On the other hand, when the third branch processing corresponding to the extracted individual number does not exist, the control unit 11 returns to the function module 600 and executes the functional processing of the function module 600 corresponding to the code description.

上記構成により、本実施形態によれば、第1分岐処理により、メイン関数モジュール500においてエントリポイントが付加された関数の関数モジュールの中に、パッチと置き換える関数モジュールが少なくとも1個以上あるか否かをパッチ有無フラグで確認するため、置き換えを行う関数モジュールが無い場合、従来のようにテーブルを参照してエントリポイントに対応するパッチの有無を、テーブルのエントリポイント毎に確認する必要が無く、プログラムの処理速度を向上させることができる。 With the above configuration, according to the present embodiment, whether or not there is at least one function module to be replaced with the patch in the function module of the function to which the entry point is added in the main function module 500 by the first branch processing. If there is no function module to replace, there is no need to check the existence of the patch corresponding to the entry point by referring to the table as in the past, and the program does not need to confirm the existence of the patch corresponding to the entry point of the table. Processing speed can be improved.

また、本実施形態によれば、関数モジュールの機能の種類毎の機能グループに分類する機能番号と、機能グループ内におけるパッチを識別する個別番号とを組み合わせ、各エントリポイントを識別するエントリポイント識別情報を構成しているため、エントリポイント毎にそれぞれの属する機能グループに対応するパッチ機能フラグにより、パッチと置き換える関数モジュールが少なくとも1個以上あるか否かを判定するため、エントリポイントの属する機能ブロックの機能番号に対応したパッチ機能フラグがOFFである場合、従来のようにテーブルを参照してエントリポイントに対応するパッチの有無を、テーブルのエントリポイント毎に確認する必要が無く、プログラムの処理速度を向上させることができる。一方、エントリポイントの属する機能ブロックの機能番号に対応したパッチ機能フラグがONである場合、機能ブロックに属するパッチと置き換える関数モジュールに対応した個数の第3分岐処理により、エントリポイントの個別番号に対応するパッチ処理を検索する。 Further, according to the present embodiment, the entry point identification information for identifying each entry point by combining the function number classified into the function group for each function type of the function module and the individual number for identifying the patch in the function group. Therefore, in order to determine whether or not there is at least one function module to replace the patch by the patch function flag corresponding to each function group to which the entry point belongs, the function block to which the entry point belongs When the patch function flag corresponding to the function number is OFF, it is not necessary to refer to the table and check the presence or absence of the patch corresponding to the entry point for each entry point in the table as in the past, and the processing speed of the program can be increased. Can be improved. On the other hand, when the patch function flag corresponding to the function number of the function block to which the entry point belongs is ON, the individual number of the entry point is supported by the third branch processing of the number corresponding to the function module to be replaced with the patch belonging to the function block. Search for patching to do.

上述したように、本実施形態によれば、上記第1分岐処理、第2分岐処理及び第3分岐処理により、従来のようにエントリポイントに対するパッチの有無を、エントリポイントが存在する毎に、このエントリポイントと、テーブルにおける全てのエントリポイントの各々とを比較し、関数モジュールと置き換えるパッチを検索する処理を行わないため、プログラムにおける関数モジュールにおいてエントリポイントが付加された全ての関数モジュールと、当該関数モジュールと置き換えるパッチとの対応を示すテーブルを設ける必要がなくなり、エントリポイントが増加しても、従来のようにパッチのコード以外のパッチ処理に必要な記憶領域の増加が抑制することが可能となり、EEPROMなどの書き換え可能なメモリからなる記憶部における利用可能領域の圧迫を防止することができる。 As described above, according to the present embodiment, the presence or absence of the patch for the entry point is determined by the first branch processing, the second branch processing, and the third branch processing, each time the entry point exists, as in the conventional case. Since the process of comparing the entry point with each of all the entry points in the table and searching for the patch to be replaced with the function module is not performed, all the function modules to which the entry point is added in the function module in the program and the function concerned. It is no longer necessary to provide a table showing the correspondence between the module and the patch to be replaced, and even if the entry point increases, it is possible to suppress the increase in the storage area required for patch processing other than the patch code as in the past. It is possible to prevent pressure on the available area in the storage unit including the rewritable memory such as the EEPROM.

以下、図5、図6及び図7を用いて、本実施形態における第1分岐処理及び第2分岐処理の動作を説明する、図5は、プログラム150における第1分岐処理及び第2分岐処理の動作例を説明するフローチャートである。図6は、関数モジュールにおけるエントリポイントに対応したパッチが存在しない場合の第1分岐処理及び第2分岐処理の動作を説明する概念図である。図6(a)は、パッチパラメータにおけるパッチ有無フラグ、パッチ先頭アドレス及びパッチ機能フラグの設定を示している。図6(b)は、メイン関数モジュール500、関数モジュール600及びエントリポイントモジュール700のコードの記述例を示している。図7は、関数モジュールにおけるエントリポイントに対応したパッチが存在する場合の第1分岐処理及び第2分岐処理の動作を説明する概念図である。図7(a)は、パッチパラメータにおけるパッチ有無フラグ、パッチ先頭アドレス及びパッチ機能フラグの設定を示している。図7(b)は、メイン関数モジュール500、関数モジュール600、エントリポイントモジュール700及びパッチモジュール800のコードの記述例を示している。 Hereinafter, the operations of the first branch processing and the second branch processing in the present embodiment will be described with reference to FIGS. 5, 6 and 7. FIG. 5 shows the first branch processing and the second branch processing in the program 150. It is a flowchart explaining an operation example. FIG. 6 is a conceptual diagram illustrating the operation of the first branch processing and the second branch processing when there is no patch corresponding to the entry point in the function module. FIG. 6A shows the settings of the patch presence / absence flag, the patch start address, and the patch function flag in the patch parameters. FIG. 6B shows a description example of the code of the main function module 500, the function module 600, and the entry point module 700. FIG. 7 is a conceptual diagram illustrating the operation of the first branch processing and the second branch processing when a patch corresponding to the entry point in the function module exists. FIG. 7A shows the setting of the patch presence / absence flag, the patch start address, and the patch function flag in the patch parameters. FIG. 7B shows a description example of the code of the main function module 500, the function module 600, the entry point module 700, and the patch module 800.

制御部11は、プログラム150を実行し、メイン関数モジュール500における関数501の実体である関数モジュール600を呼び出して処理を行う。このとき、制御部11は、エントリポイント関数601(エントリポイント)の検出を行う(ステップS1)。
制御部11は、エントリポイント関数601の処理において、エントリポイントモジュール700を呼び出す。制御部11は、EEPROM132におけるパッチパラメータ350を参照し、パッチ有無フラグを読み込む(ステップS2)。
The control unit 11 executes the program 150 and calls the function module 600, which is an entity of the function 501 in the main function module 500, to perform processing. At this time, the control unit 11 detects the entry point function 601 (entry point) (step S1).
The control unit 11 calls the entry point module 700 in the processing of the entry point function 601. The control unit 11 refers to the patch parameter 350 in the EEPROM 132 and reads the patch presence / absence flag (step S2).

制御部11は、読み込んだパッチ有無フラグがONであるか否かの判定を行う(ステップS3)。このとき、制御部11は、読み込んだパッチ有無フラグがONである(図7(a)の記載、パッチ領域先頭アドレスとして、例えば、012345hが記述されている)場合、処理をステップS4へ進める。
一方、制御部11は、読み込んだパッチ有無フラグがOFFである(図6(a)の記載、パッチ領域先頭アドレスが記述されていない)場合、処理を終了する。すなわち、制御部11は、関数モジュール600に戻り、関数モジュール600における関数501の処理を行う。
上述したステップS2及びステップS3が第1分岐処理である。
The control unit 11 determines whether or not the read patch presence / absence flag is ON (step S3). At this time, when the read patch presence / absence flag is ON (the description in FIG. 7A, for example, 012345h is described as the patch area start address), the control unit 11 proceeds to the process in step S4.
On the other hand, when the read patch presence / absence flag is OFF (the description in FIG. 6A and the patch area start address are not described), the control unit 11 ends the process. That is, the control unit 11 returns to the function module 600 and processes the function 501 in the function module 600.
The above-mentioned steps S2 and S3 are the first branch processing.

制御部11は、エントリポイント関数601から引数として与えられるエントリポイント識別情報、例えばエントリポイント識別情報0201hから、2バイトにおける上位1バイトの機能番号02hを抽出する(ステップS4)。
制御部11は、EEPROM132におけるパッチパラメータ350を参照し、機能番号に対応する、すなわち機能番号02hに対応するパッチ機能フラグを読み込み、機能グループにパッチがある(関数モジュールに対してパッチが適用されている)ことを確認する(ステップS5)。
The control unit 11 extracts the function number 02h of the upper 1 byte in 2 bytes from the entry point identification information given as an argument from the entry point function 601 such as the entry point identification information 0201h (step S4).
The control unit 11 refers to the patch parameter 350 in the EEPROM 132, reads the patch function flag corresponding to the function number, that is, corresponds to the function number 02h, and has a patch in the function group (the patch is applied to the function module). (Yes) (step S5).

制御部11は、パッチ機能フラグがONか否かにより、処理中の関数モジュールの属する機能グループ内にパッチが適用されている関数モジュールが有るか否かの判定を行う(ステップS6)。このとき、制御部11は、パッチ機能フラグがONである(機能番号の示す機能グループ内の関数モジュールにパッチが適用されている)場合、処理をステップS7へ進める。一方、制御部11は、パッチ機能フラグがOFFである(機能番号の示す機能グループ内の関数モジュールにパッチが適用されていない)場合、処理を終了する。すなわち、制御部11は、エントリポイントモジュール700から関数モジュール600に戻り、関数モジュール600における関数501の処理を行う。
上述したステップS5及びステップS6が第2分岐処理である。
The control unit 11 determines whether or not there is a function module to which the patch is applied in the function group to which the function module being processed belongs, depending on whether or not the patch function flag is ON (step S6). At this time, if the patch function flag is ON (the patch is applied to the function module in the function group indicated by the function number), the control unit 11 proceeds to step S7. On the other hand, when the patch function flag is OFF (the patch is not applied to the function module in the function group indicated by the function number), the control unit 11 ends the process. That is, the control unit 11 returns from the entry point module 700 to the function module 600, and processes the function 501 in the function module 600.
The above-mentioned steps S5 and S6 are the second branch processing.

制御部11は、パッチ関数704を実行し、EEPROM132におけるパッチパラメータ350を参照し、パッチ領域先頭アドレス(012345h)を読み込み、このパッチ先頭アドレスによりパッチモジュール800を呼び出して、パッチ処理(第3分岐処理を含む)を行う(ステップS7)。 The control unit 11 executes the patch function 704, refers to the patch parameter 350 in the EEPROM 132, reads the patch area start address (012345h), calls the patch module 800 by this patch start address, and performs patch processing (third branch processing). Including) (step S7).

以下、図8及び図7を用いて、本実施形態における第3分岐処理の動作を説明する、図8は、エントリポイントモジュール700から読み出されるパッチモジュール800における第3分岐処理の動作例を説明するフローチャートである。 Hereinafter, the operation of the third branch processing in the present embodiment will be described with reference to FIGS. 8 and 7. FIG. 8 describes an operation example of the third branch processing in the patch module 800 read from the entry point module 700. It is a flowchart.

制御部11は、エントリポイントモジュール700において、機能番号及び個別番号抽出処理801により、エントリポイントモジュール700から引数として与えられるエントリポイント識別情報0201hから、上位1バイトの02hを機能番号として、下位1バイトの01hを個別番号として抽出する(ステップS11)。
制御部11は、EEPROM132におけるパッチパラメータ350を参照し、抽出した機能番号02hに対応するパッチ機能フラグを読み込む。制御部11は、抽出した機能フ番号02hに対応するパッチ機能フラグ確認処理802を行う(ステップS12)。
In the entry point module 700, the control unit 11 uses the upper 1 byte 02h as the function number and the lower 1 byte from the entry point identification information 0201h given as an argument from the entry point module 700 by the function number and individual number extraction process 801. 01h is extracted as an individual number (step S11).
The control unit 11 refers to the patch parameter 350 in the EEPROM 132 and reads the patch function flag corresponding to the extracted function number 02h. The control unit 11 performs the patch function flag confirmation process 802 corresponding to the extracted function number 02h (step S12).

制御部11は、機能番号02hに対応するパッチ機能フラグがONであるか否かにより、分岐がある(機能番号02hに対応する機能グループにおいて関数モジュールと置き換えるパッチがあり、個別番号を検索するという分岐がある)か否かの判定を行う(ステップS13)。このとき、制御部11は、機能番号02hに対応するパッチ機能フラグがONである(個別番号を検索するという分岐がある)場合、処理をステップS13へ進める。一方、制御部11は、パッチ機能フラグがOFFである(個別番号を検索するという分岐がない)場合、処理を終了する。すなわち、制御部11は、パッチモジュール800から、エントリポイントモジュール700を介して関数モジュール600に戻り、関数モジュール600における関数501の処理を行う。 The control unit 11 has a branch depending on whether or not the patch function flag corresponding to the function number 02h is ON (there is a patch to replace the function module in the function group corresponding to the function number 02h, and the individual number is searched. It is determined whether or not there is a branch (step S13). At this time, if the patch function flag corresponding to the function number 02h is ON (there is a branch to search for an individual number), the control unit 11 advances the process to step S13. On the other hand, when the patch function flag is OFF (there is no branch to search for an individual number), the control unit 11 ends the process. That is, the control unit 11 returns from the patch module 800 to the function module 600 via the entry point module 700, and processes the function 501 in the function module 600.

制御部11は、パッチ機能フラグ確認処理802における第3分岐処理を順次行い、抽出した個別番号01hの第3分岐処理803の有無、すなわちパッチを適用するという分岐が有るかを確認する(ステップS14及びステップS15)。このとき、制御部11は、パッチを適用するという分岐としての第3分岐処理803が有る場合、処理をステップS16へ進める。一方、制御部11は、パッチを適用するという分岐としての第3分岐処理803が有る場合、処理を終了する。すなわち、制御部11は、パッチモジュール800から、エントリポイントモジュール700を介して関数モジュール600に戻り、関数モジュール600における関数501の処理を行う。
制御部11は、エントリポイント識別情報0201hの関数モジュールに対する修正処理(エントリポイント修正処理804)を行う(ステップS16)。
The control unit 11 sequentially performs the third branch processing in the patch function flag confirmation processing 802, and confirms whether or not there is the extracted third branch processing 803 of the individual number 01h, that is, whether there is a branch to apply the patch (step S14). And step S15). At this time, if there is a third branch process 803 as a branch to apply the patch, the control unit 11 advances the process to step S16. On the other hand, the control unit 11 ends the process when there is a third branch process 803 as a branch to apply the patch. That is, the control unit 11 returns from the patch module 800 to the function module 600 via the entry point module 700, and processes the function 501 in the function module 600.
The control unit 11 performs a correction process (entry point correction process 804) for the function module of the entry point identification information 0201h (step S16).

以上、この発明の実施形態を図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計等も含まれる。 Although the embodiment of the present invention has been described in detail with reference to the drawings, the specific configuration is not limited to this embodiment, and the design and the like within a range not deviating from the gist of the present invention are also included.

1…半導体装置
11…制御部
12…データ入出力部
13…記憶部
111…CPU
131…マスクROM
132…EEPROM
133…RAM
150…プログラム
250,800…パッチモジュール
350…パッチパラメータ
600…関数モジュール
700…エントリポイントモジュール
1 ... Semiconductor device 11 ... Control unit 12 ... Data input / output unit 13 ... Storage unit 111 ... CPU
131 ... Mask ROM
132 ... EEPROM
133 ... RAM
150 ... Program 250, 800 ... Patch module 350 ... Patch parameter 600 ... Function module 700 ... Entry point module

Claims (10)

プログラムが記憶された、記憶されたデータの書き換えが不可能な第1記憶部と、
前記プログラムを実行する制御部と、
記憶されたデータの書き換えが可能であり、前記プログラムにおける前記関数モジュールと置き換えるモジュールであるパッチが記憶される第2記憶部と、
前記第2記憶部に設けられており、前記プログラムにおける関数モジュールに付加されたエントリポイントの全てにおいて、前記パッチが用意されたエントリポイントが、少なくとも一つ以上存在するか否かを示すパッチ有無フラグを含むパッチデータを記憶するパッチパラメータ領域と
を備えることを特徴とする半導体装置。
The first storage unit where the program is stored and the stored data cannot be rewritten,
A control unit that executes the program and
A second storage unit that can rewrite the stored data and stores a patch that is a module that replaces the function module in the program, and
A patch presence / absence flag provided in the second storage unit and indicating whether or not at least one entry point for which the patch is prepared exists in all the entry points added to the function module in the program. A semiconductor device including a patch parameter area for storing patch data including.
関数モジュールに配置された前記エントリポイントの各々を、当該関数モジュールの機能の種類に対応した機能グループそれぞれに分類しており、
前記パッチデータが、前記機能グループに含まれる前記エントリポイントにおいて、前記パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグを含む
ことを特徴とする請求項1に記載の半導体装置。
Each of the entry points placed in the function module is classified into each function group corresponding to the type of function of the function module.
The first aspect of the present invention is characterized in that the patch data includes a patch function flag indicating whether or not at least one or more prepared entry points of the patch exist at the entry point included in the function group. The described semiconductor device.
前記エントリポイントを識別するエントリポイント識別情報が、前記機能グループを示すグループ情報と、当該機能グループにおける前記エントリポイントに対応するパッチを示すパッチ情報とが組み合わされて生成されている
ことを特徴とする請求項2に記載の半導体装置。
The entry point identification information for identifying the entry point is generated by combining group information indicating the function group and patch information indicating a patch corresponding to the entry point in the function group. The semiconductor device according to claim 2.
前記第2記憶部に対して自身の製造後に書き込まれた、前記関数モジュールと置き換えるパッチを含むパッチモジュールをさらに備え、
前記制御部が、前記関数モジュールを実行する際、当該関数モジュールが前記エントリポイントを有する場合、前記パッチ有無フラグが前記パッチが用意されたエントリポイントがあることを示し、かつ当該関数モジュールのグループ情報が示す前記機能グループの前記パッチ機能フラグが当該機能グループに前記パッチが用意されたエントリポイントがあることを示す場合、前記パッチモジュールを実行する
ことを特徴とする請求項3に記載の半導体装置。
It further comprises a patch module containing a patch to replace the function module written to the second storage after its manufacture.
When the control unit executes the function module, if the function module has the entry point, the patch presence / absence flag indicates that there is an entry point for which the patch is prepared, and the group information of the function module. The semiconductor device according to claim 3, wherein the patch module is executed when the patch function flag of the function group indicated by indicates that the function group has an entry point in which the patch is prepared.
前記パッチモジュールにおいて、
前記エントリポイントのパッチ情報に対応した前記パッチの各々が、前記機能グループ単位に分類されている
ことを特徴とする請求項4に記載の半導体装置。
In the patch module
The semiconductor device according to claim 4, wherein each of the patches corresponding to the patch information of the entry point is classified into the functional group unit.
前記制御部が、
前記パッチモジュールに記載された機能グループにおける前記パッチのなかから前記パッチ情報に対応するパッチを、前記関数モジュールに代えて実行する
ことを特徴とする請求項5に記載の半導体装置。
The control unit
The semiconductor device according to claim 5, wherein a patch corresponding to the patch information is executed in place of the function module from the patches in the functional group described in the patch module.
少なくとも、請求項1から請求項6のいずれか一項に記載の半導体装置が搭載されている
ことを特徴とするICカード。
An IC card characterized in that at least the semiconductor device according to any one of claims 1 to 6 is mounted.
記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイントが付加された関数モジュールを含むプログラムを制御部が実行する際、
前記エントリポイントを識別するエントリポイント識別情報が、前記関数モジュールの機能の種類に対応した機能グループを示すグループ情報と、当該機能グループにおける前記関数モジュールに対応するパッチを示すパッチ情報とが含まれており、
前記制御部が、第2記憶部に記憶されている前記プログラムにおけるエントリポイントの全てにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ有無フラグと、前記関数モジュールの機能の種類に対応した機能グループに含まれる前記エントリポイントにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグとを参照する過程と、
前記制御部が、前記パッチ有無フラグが前記パッチが有ることを示し、かつ前記エントリポイントが含まれるパッチ機能フラグがパッチが有ることを示した場合、記憶されたデータの書き換えが可能な第2記憶部から、エントリポイントのパッチのプログラムを有するパッチモジュールを読出す過程と、
前記制御部が、前記パッチモジュールにおいて前記機能グループに前記パッチが用意された前記エントリポイントがある場合、当該機能グループにおける前記パッチのなかから前記パッチ情報に対応するパッチを、前記関数モジュールに代えて実行する過程と
を含むことを特徴とする制御方法。
When the control unit executes a program containing a function module with an entry point added, which is stored in the first storage unit in which the stored data cannot be rewritten.
The entry point identification information that identifies the entry point includes group information indicating a function group corresponding to the type of function of the function module and patch information indicating a patch corresponding to the function module in the function group. Ori,
The control unit has a patch presence / absence flag indicating whether or not at least one patch-prepared entry point exists in all the entry points in the program stored in the second storage unit, and the function module. In the process of referring to the patch function flag indicating whether or not at least one patch-prepared entry point exists in the entry point included in the function group corresponding to the function type of
When the control unit indicates that the patch presence / absence flag indicates that the patch is present, and the patch function flag that includes the entry point indicates that the patch is present, the stored data can be rewritten. The process of reading the patch module with the entry point patch program from the section,
When the control unit has the entry point in which the patch is prepared in the function group in the patch module, the patch corresponding to the patch information from the patches in the function group is replaced with the function module. A control method characterized by including a process to be performed.
記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイント識別情報に識別されるエントリポイントが付加された関数モジュールを含むプログラムをコンピュータに実行させる際、
前記コンピュータを、
第2記憶部に記憶されている前記プログラムにおけるエントリポイントの全てにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ有無フラグと、前記関数モジュールを機能別に分類した機能グループに含まれる前記エントリポイントにおいて、パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグとを参照する手段、
前記パッチ有無フラグが前記パッチが有ることを示し、かつ前記エントリポイントが含まれるパッチ機能フラグがパッチが有ることを示した場合、記憶されたデータの書き換えが可能な第2記憶部から、エントリポイントのパッチのプログラムを有するパッチモジュールを実行する手段
として機能させるプログラム。
When a computer is made to execute a program including a function module in which an entry point identified in the entry point identification information is added, which is stored in the first storage unit in which the stored data cannot be rewritten.
The computer
The patch presence / absence flag indicating whether or not at least one patch-prepared entry point exists in all the entry points in the program stored in the second storage unit, and the function module are classified by function. A means for referring to a patch function flag indicating whether or not at least one patch-prepared entry point exists in the entry point included in the function group.
When the patch presence / absence flag indicates that the patch is present and the patch function flag including the entry point indicates that the patch is present, the entry point is transmitted from the second storage unit capable of rewriting the stored data. A program that acts as a means of executing a patch module that has a patch program for.
記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイント識別情報に識別されるエントリポイントが付加された関数モジュールを含むプログラムをコンピュータに実行させる際、
前記コンピュータを、
前記エントリポイントのパッチのプログラムを有するパッチモジュールにおいて、前記関数モジュールを機能別に分類した機能グループに前記パッチが用意された前記エントリポイントがある場合、当該機能グループにおける前記パッチのなかから、前記エントリポイントに対応するパッチを示すパッチ情報に対応するパッチを、前記関数モジュールに代えて実行する手段、
として機能させ、前記エントリポイント識別情報が、前記関数モジュールの機能の種類に対応した機能グループを示すグループ情報と、当該機能グループにおける前記関数モジュールに対応するパッチを示す前記パッチ情報とが含まれている
プログラム。
When a computer is made to execute a program including a function module in which an entry point identified in the entry point identification information is added, which is stored in the first storage unit in which the stored data cannot be rewritten.
The computer
In a patch module having a patch program for the entry point, if the entry point for which the patch is prepared is in a function group in which the function module is classified by function, the entry point is selected from the patches in the function group. A means for executing a patch corresponding to the patch information indicating the patch corresponding to the above function module in place of the function module.
The entry point identification information includes group information indicating a function group corresponding to the type of function of the function module and patch information indicating a patch corresponding to the function module in the function group. Program.
JP2019121185A 2019-06-28 2019-06-28 Semiconductor device, IC card, control method and program Active JP7284003B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019121185A JP7284003B2 (en) 2019-06-28 2019-06-28 Semiconductor device, IC card, control method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019121185A JP7284003B2 (en) 2019-06-28 2019-06-28 Semiconductor device, IC card, control method and program

Publications (2)

Publication Number Publication Date
JP2021006973A true JP2021006973A (en) 2021-01-21
JP7284003B2 JP7284003B2 (en) 2023-05-30

Family

ID=74174482

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019121185A Active JP7284003B2 (en) 2019-06-28 2019-06-28 Semiconductor device, IC card, control method and program

Country Status (1)

Country Link
JP (1) JP7284003B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6355631A (en) * 1986-08-27 1988-03-10 Fujitsu Ltd Patch control method for program
JPH03269726A (en) * 1990-03-20 1991-12-02 Fujitsu Ltd Patch system for rom program
JPH0452834A (en) * 1990-06-15 1992-02-20 Mitsubishi Electric Corp Electronic computer
US20040107416A1 (en) * 2002-12-02 2004-06-03 Microsoft Corporation Patching of in-use functions on a running computer system
JP2010113549A (en) * 2008-11-06 2010-05-20 Dainippon Printing Co Ltd Ic card and method for execution of patch code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6355631A (en) * 1986-08-27 1988-03-10 Fujitsu Ltd Patch control method for program
JPH03269726A (en) * 1990-03-20 1991-12-02 Fujitsu Ltd Patch system for rom program
JPH0452834A (en) * 1990-06-15 1992-02-20 Mitsubishi Electric Corp Electronic computer
US20040107416A1 (en) * 2002-12-02 2004-06-03 Microsoft Corporation Patching of in-use functions on a running computer system
JP2010113549A (en) * 2008-11-06 2010-05-20 Dainippon Printing Co Ltd Ic card and method for execution of patch code

Also Published As

Publication number Publication date
JP7284003B2 (en) 2023-05-30

Similar Documents

Publication Publication Date Title
US7424570B2 (en) Method for patching ROM instructions in an electronic embedded system including at least a further memory portion
JP2017027625A (en) Writing data in non-volatile memory of smart card
US6483746B2 (en) Electronic apparatus
CN106709386B (en) Smart card data writing method and device
JP7284002B2 (en) Semiconductor device, control method and program
CN108170456B (en) Firmware upgrading method and device for electronic equipment
JP2021006973A (en) Semiconductor device, ic card, control method, and program
JP2010113549A (en) Ic card and method for execution of patch code
KR20230019032A (en) Pre-personalized secure element and embedded personalization
US7684992B2 (en) Remote application correction
JP2017228222A (en) Electronic information storage medium, abnormality detection method and abnormality detection program
EP3023925B1 (en) Secure element with applications
JP2018136835A (en) IC card and IC card issuing system, IC card issuing method
JP7468765B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, ALL-IN-ONE DATA UPDATE METHOD, AND PROGRAM
CN111090542A (en) Abnormal block identification method and device based on abnormal power failure and computer equipment
CN101667130A (en) Embedded system with authentication, and associated authentication method
JP5708228B2 (en) IC card and IC card refresh method
JP4863058B2 (en) IC card and application writing method
EP4145271A1 (en) Methods and terminal for updating converted applet file, and java card device
JP2007034434A (en) Ic card, method for writing data to ic card, and ic card program
EP4024254A1 (en) Method and device for updating data
JP6915338B2 (en) IC card
JP2005301657A (en) Ic card having multiple command tables stored in rewritable memory and executing method for command
JP7322923B2 (en) Secure element, transaction control method and device
CN104657185A (en) Java code patching method of Java card

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190726

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20220513

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20230208

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230214

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230412

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: 20230425

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230518

R150 Certificate of patent or registration of utility model

Ref document number: 7284003

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313115

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350