JP7284003B2 - Semiconductor device, IC card, control method and program - Google Patents

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

Info

Publication number
JP7284003B2
JP7284003B2 JP2019121185A JP2019121185A JP7284003B2 JP 7284003 B2 JP7284003 B2 JP 7284003B2 JP 2019121185 A JP2019121185 A JP 2019121185A JP 2019121185 A JP2019121185 A JP 2019121185A JP 7284003 B2 JP7284003 B2 JP 7284003B2
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.)
Active
Application number
JP2019121185A
Other languages
Japanese (ja)
Other versions
JP2021006973A (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.)
NTT Data Corp
Toppan Inc
Original Assignee
NTT Data Corp
Toppan Inc
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 Inc 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

Description

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

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

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

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

このとき、プログラムのROMコードに対してパッチ処理を行う際、エントリポイントに対応したパッチプログラムが用意されているか否かの検索を行う。
ここで、特許文献1においては、エントリポイントの各々にパッチが用意されているか否かを示すエントリポイントテーブルを設けておき、エントリポイント毎に付番した番号によりこのエントリポイントテーブルを検索する。
At this time, when patching the ROM code of the program, it is searched whether a patch program corresponding to the entry point is prepared.
Here, in Patent Document 1, an entry point table is provided to indicate whether or not a patch is prepared for each entry point, and this 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 entry point number extracted as a result of the search.
When patch processing is required, the address of the patch program described corresponding to the entry point in the entry point table is read, 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 the patch processing for each entry point in the ROM code of the program also increases, causing the program execution speed to decrease. Become.
Also, as in Cited Document 1, when the address of the patch program is described for each entry point in the entry point table, at least the number of entry points, the ID of the entry point, the presence or absence of the patch corresponding to the entry point, the patch A storage area is required to write the address of the ROM code, which reduces the usable area in the flash memory and EEPROM.

本発明は、このような状況に鑑みてなされたもので、プログラムに付加されているエントリポイント毎にエントリポイントテーブルを用意することなくパッチプログラムを実行することにより、プログラムに記憶されたROMコードの実行時間の増加を抑制し、かつパッチ処理に必要な情報を記憶させるための記憶領域の増加を抑制し、フラッシュメモリやEEPROMなどの書き換え可能なメモリからなる記憶部における利用可能領域を低減させることがない半導体装置、ICカード、制御方法およびプログラムを提供する。 SUMMARY OF THE INVENTION The present invention has been made in view of such circumstances. To suppress an increase in execution time, suppress an increase in a storage area for storing information necessary for patch processing, and reduce a usable area in a storage section composed of rewritable memory such as flash memory and EEPROM. A semiconductor device, an IC card, a control method, and a program are provided.

上述した課題を解決するために、本発明の一態様は、プログラムが記憶され、記憶されたデータの書き換えが不可能な第1記憶部と、前記プログラムを実行する制御部と、記憶されたデータの書き換えが可能であり、前記プログラムにおける前記関数モジュールと置き換えるモジュールであるパッチが記憶される第2記憶部と、前記第2記憶部に設けられており、前記プログラムにおける関数モジュールに付加されたエントリポイントの全てにおいて、前記パッチが用意されたエントリポイントが、少なくとも一つ以上存在するか否かを示すパッチ有無フラグを含むパッチデータを記憶するパッチパラメータ領域とを備え
関数モジュールに配置された前記エントリポイントの各々を、当該関数モジュールの機能の種類に対応した機能グループそれぞれに分類しており、前記パッチデータが、前記機能グループに含まれる前記エントリポイントにおいて、前記パッチの用意されたエントリポイントが少なくとも一つ以上存在するか否かを示すパッチ機能フラグを含み、前記エントリポイントを識別するエントリポイント識別情報が、前記機能グループを示すグループ情報と、当該機能グループにおける前記エントリポイントに対応するパッチを示すパッチ情報とが組み合わされて生成されていることを特徴とする半導体装置である。
In order to solve the above-described problems, one aspect of the present invention provides a first storage unit that stores a program and in which the stored data cannot be rewritten, a control unit that executes the program, and a storage unit that stores the stored data. and an entry added to the function module in the program, which is provided in the second storage unit and stores a patch that is a module that replaces the function module in the program. 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 in all of the points ;
Each of the entry points arranged in a function module is classified into a function group corresponding to a type of function of the function module, and the patch data is stored in the patch at the entry point included in the function group. includes a patch function flag indicating whether or not there is at least one prepared entry point, entry point identification information identifying the entry point includes group information indicating the function group, and the The semiconductor device is characterized in that it is generated in combination with patch information indicating a patch corresponding to the entry point .

また、本発明の一態様は、上記半導体装置であって、前記第2記憶部に対して自身の製造後に書き込まれた、前記関数モジュールと置き換えるパッチを含むパッチモジュールをさらに備え、前記制御部が、前記関数モジュールを実行する際、当該関数モジュールが前記エントリポイントを有する場合、前記パッチ有無フラグが前記パッチの用意されたエントリポイントがあることを示し、かつ当該関数モジュールのグループ情報が示す前記機能グループの前記パッチ機能フラグが当該機能グループに前記パッチが用意されたエントリポイントがあることを示す場合、前記パッチモジュールを実行する。 In one aspect of the present invention, the semiconductor device further includes a patch module that includes a patch that replaces the function module and is written in the second storage unit after the semiconductor device is manufactured, and the control unit , when executing 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 function indicated by the group information of the function module; If the patch feature flag for a group indicates that the feature group has the patch ready entry point, execute the patch module.

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

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

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

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

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

また、本発明の一態様は、記憶されたデータの書き換えが不可能な第1記憶部に記憶された、エントリポイント識別情報に識別されるエントリポイントが付加された関数モジュールを含むプログラムをコンピュータに実行させる際、前記コンピュータを、前記エントリポイントのパッチのプログラムを有するパッチモジュールにおいて、前記関数モジュールを機能別に分類した機能グループに前記パッチが用意された前記エントリポイントがある場合、当該機能グループにおける前記パッチのなかから、前記エントリポイントに対応するパッチを示すパッチ情報に対応するパッチを、前記関数モジュールに代えて実行する手段、として機能させ、前記エントリポイント識別情報が、前記関数モジュールの機能の種類に対応した機能グループを示すグループ情報と、当該機能グループにおける前記関数モジュールに対応するパッチを示す前記パッチ情報とが含まれているプログラムである。 According to another aspect of the present invention, a program including a function module added with an entry point identified by entry point identification information stored in a first storage unit in which stored data cannot be rewritten is stored in a computer. When executing the computer, if a patch module having a patch program of the entry point has the entry point for which the patch is prepared in a functional group that classifies the function modules according to function, the patch module in the functional group A patch corresponding to patch information indicating a patch corresponding to the entry point from among the patches functions as means for executing instead of the function module, and the entry point identification information is the function type of the function module. 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 a 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 control method that suppresses the increase in the storage area for storing information necessary for patch processing and suppresses the reduction in the usable area in the storage section composed of a rewritable memory such as an EEPROM. and provide programs.

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

以下、本発明の一実施形態について、図面を参照して説明する。
図1は、本発明の一実施形態による半導体装置1の構成例を示すブロック図である。
図1において、半導体装置1は、CPU(central processing unit)、メモリなどを構成する半導体素子を用いたIC(integrated circuit)を備え、情報を処理および記憶する装置である。
半導体装置1は、ICカード、SIM(subscriber identity module)カードなどである。図1に示す半導体装置1は、制御部11とデータ入出力部12と記憶部13とを備える。
An embodiment of the present invention will be described below with reference to the drawings.
FIG. 1 is a block diagram showing a configuration example of a semiconductor device 1 according to one embodiment of the present invention.
In FIG. 1, a semiconductor device 1 is a device that includes a CPU (central processing unit), an IC (integrated circuit) using semiconductor elements that form 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. A semiconductor device 1 shown in FIG. 1 includes a control section 11 , a data input/output section 12 and a storage section 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, an application program or a program such as a module described later) to perform predetermined processing.
The data input/output unit 12 transmits and receives data to and 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 ROM code, which is written when the semiconductor device 1 is manufactured. This program 150 is, for example, an application program for processing services to be used with IC cards provided by industries or groups such as public, financial, and transportation. Since the program 150 is written in ROM code in the ROM 131, it cannot be rewritten even if it contains a defective function module. In this embodiment, the mask ROM 131 is used as a non-rewritable ROM in which a program is written in 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 entry points for function modules that are expected to be corrected in the event of a problem or that are rewritten depending on the application.
In this embodiment, 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 for identifying a function group in which each function module in the program 150 is classified by function (for example, various functions such as encryption function, communication function, and numerical calculation function).
The individual number is patch information that individually identifies each patch included in each functional group indicated by the functional number.

本実施形態において、エントリポイント識別情報は2バイト(xxyyh)で記述されており、機能番号がxxhの1バイト、個別番号がyyhの1バイトである。
例えば、暗号機能の機能番号が01hであり、暗号機能の機能グループにおける個別番号が02hである場合、エントリポイント識別情報は、0102hで表される。
また、本実施形態においては、1バイトの機能番号と1バイトの個別番号とで、エントリポイント識別情報が2バイトとして説明している。しかしながら、プログラムに含まれる関数モジュール(エントリポイントが付加される関数モジュール)の機能の種類の数と、機能グループにおけるパッチの数とにより、エントリポイント識別情報のバイト数を任意に設定する。
In this embodiment, the entry point identification information is written in 2 bytes (xxyyh), 1 byte for the function number xxh, and 1 byte for the individual number yyh.
For example, if 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.
Also, in the present embodiment, it is assumed that the entry point identification information is 2 bytes consisting of a 1-byte function number and a 1-byte individual number. However, the number of bytes of the entry point identification information is arbitrarily set according to the number of types of functions of function modules (function modules to which entry points are 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 EEPROM 132 stores patch modules 250 and patch parameters 350 . The EEPROM 132 may be any rewritable nonvolatile memory, such as a flash memory.
Here, when the patch module 250 is supplied from an external device via the data input/output unit 12, the control unit 11 writes the patch module 250 and the patch parameter 350 corresponding to this patch module 250 to the EEPROM 132 and stores it. Let

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

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

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

パッチ機能フラグ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 for which a patch to be replaced exists in the function group classified by 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 for which a patch to be replaced exists for each corresponding function group. It is "OFF" if there is no module at all. 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, a communication function function group indicated by the function number 01h. The patch function flag 304 is a flag corresponding to, for example, the function group of the encryption function indicated by the function number 02h.

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

RAM133は、制御部11がプログラム150を実行する際のメインメモリとして用いられる。 The RAM 133 is used as a main memory when the control section 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. As shown in FIG.
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.
A main function module 500 describes a plurality of functions such as functions 501 and 502 required to execute the functions of a given application.
The function module 600 describes an actual code indicating processing corresponding to the function of the function 501 actually executed by the control unit 11 .

関数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 the entry point module 700 and causes it to be executed.
The entry point module 700 describes an actual code indicating processing corresponding to the function of the entry point function 601 actually executed by the control unit 11 . The entry point module 700 describes first branch processing 701 , function number extraction processing 702 and second branch processing 703 . Here, the first branch processing 701 is processing for determining whether or not the patch presence/absence flag is ON. Function number extraction processing 702 is processing for extracting a function number from the entry point identification information. The second branch processing 703 is processing for determining whether or not the patch function flag is ON.
The second branch processing 703 describes a patch function 704 that causes the patch module 800 (see FIG. 4) to be executed when the patch function flag is ON.

図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 (the address in the mask ROM 131) of the function module 600, which is the substance of the function 501 described in the function 501, and reads the function module 600. to run. Here, the substance indicates 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 ROM code processing 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 described in 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 processing described in the function number extraction processing 702. Processing to return to the function module 600 (return processing) is performed, and the processing 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 parameters 350 stored in the patch parameter area of the EEPROM 132 .
The control unit 11 determines whether or not the referenced patch function flag is ON. 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に記述された処理を実行する。
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 in the EEPROM 132 .
Then, the control unit 11 executes the process described in the patch module 800 stored in the area of the patch area head 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 an entry point module. The patch module loads the code of the patch module 800 (patch module 250) from an external device by the control unit 11 when it becomes necessary to correct a problem in the program 150, and writes and stores it in the EEPROM 132 together with the patch parameters 350. .
In FIG. 4, the patch module 800 describes the actual code indicating the patch processing for the function module to be replaced in the patch function 704 actually executed by the control unit 11 . That is, the patch module 800 includes function number and individual number extraction processing 801, patch function flag confirmation processing 802, third branch processing 803, entry point correction processing 804, third branch processing 805, entry point correction processing 806, patch function A flag confirmation process 807 and the like are described.

機能番号及び個別番号抽出処理801は、エントリポイント識別情報から、エントリポイントに付与されている機能番号及び個別番号の各々を抽出する処理である。
パッチ機能フラグ確認処理802及び807の各々は、それぞれ機能番号02h、06hのパッチ機能フラグがONであるか否かの判定を行う。このパッチ機能フラグ確認処理は、関数モジュールを置き換えるパッチが少なくとも1個が存在する機能グループに対応して設けられている。
Function number and individual number extraction processing 801 is processing for extracting each of the function number and 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 function numbers 02h and 06h, respectively, are ON. 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 processes 803 and 805 determines whether the individual numbers extracted from the entry identification information are 01h and 03h. The third branch processing is provided in the number corresponding to the patches to be replaced with the function modules in the functional block.
Each of the entry point correction processes 804 and 806 is described as a patch process that replaces the function module with 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 the argument, corresponding to the description of the function number and individual number extraction process 801. do.
Next, the control section 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 patch function flag confirmation processing corresponding to the extracted function number, for example, patch function flag confirmation processing 802 when the function number is 02h. On the other hand, the control unit 11 executes patch function flag confirmation processing 807 when the extracted 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 patch function flag confirmation processing 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 branching processes 803, 805, . . . judge. For example, when the extracted function number is 02h and the patch function flag for the function number 02h is ON, the control unit 11 sequentially performs third branch processing 803, 805, . . . It is determined whether or not there is 3-branch processing.

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

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

また、本実施形態によれば、関数モジュールの機能の種類毎の機能グループに分類する機能番号と、機能グループ内におけるパッチを識別する個別番号とを組み合わせ、各エントリポイントを識別するエントリポイント識別情報を構成しているため、エントリポイント毎にそれぞれの属する機能グループに対応するパッチ機能フラグにより、パッチと置き換える関数モジュールが少なくとも1個以上あるか否かを判定するため、エントリポイントの属する機能ブロックの機能番号に対応したパッチ機能フラグがOFFである場合、従来のようにテーブルを参照してエントリポイントに対応するパッチの有無を、テーブルのエントリポイント毎に確認する必要が無く、プログラムの処理速度を向上させることができる。一方、エントリポイントの属する機能ブロックの機能番号に対応したパッチ機能フラグがONである場合、機能ブロックに属するパッチと置き換える関数モジュールに対応した個数の第3分岐処理により、エントリポイントの個別番号に対応するパッチ処理を検索する。 Further, according to the present embodiment, entry point identification information for identifying each entry point is obtained by combining a function number for classifying a function module into a function group for each type of function and an individual number for identifying a patch within the function group. is configured, in order to determine whether or not there is at least one function module to be replaced with a patch by the patch function flag corresponding to the function group to which each entry point belongs, the function block to which the entry point belongs When the patch function flag corresponding to the function number is OFF, there is no need to refer to the table to confirm the presence or absence of the patch corresponding to the entry point for each entry point of the table as in the conventional case, 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 number of third branch processes corresponding to the number of function modules to be replaced with the patch belonging to the function block corresponds to the individual number of the entry point. Find the patch process to do.

上述したように、本実施形態によれば、上記第1分岐処理、第2分岐処理及び第3分岐処理により、従来のようにエントリポイントに対するパッチの有無を、エントリポイントが存在する毎に、このエントリポイントと、テーブルにおける全てのエントリポイントの各々とを比較し、関数モジュールと置き換えるパッチを検索する処理を行わないため、プログラムにおける関数モジュールにおいてエントリポイントが付加された全ての関数モジュールと、当該関数モジュールと置き換えるパッチとの対応を示すテーブルを設ける必要がなくなり、エントリポイントが増加しても、従来のようにパッチのコード以外のパッチ処理に必要な記憶領域の増加が抑制することが可能となり、EEPROMなどの書き換え可能なメモリからなる記憶部における利用可能領域の圧迫を防止することができる。 As described above, according to the present embodiment, the presence or absence of a patch for an entry point is determined by the first branch process, the second branch process, and the third branch process each time an entry point exists, as in the conventional art. Since the entry point is compared with each of all the entry points in the table and the process of searching for a patch to replace the function module is not performed, all function modules in the program to which the entry point is added and the function It is no longer necessary to provide a table showing the correspondence between modules and patches to be replaced, and even if the number of entry points increases, it is possible to suppress an increase in the storage area required for patch processing other than the patch code, as in the past. It is possible to prevent the available area from being squeezed in the storage unit made up of rewritable memory such as 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のコードの記述例を示している。 The operations of the first branch processing and the second branch processing in this embodiment will be described below with reference to FIGS. 5, 6 and 7. FIG. 4 is a flowchart for explaining an operation example; FIG. 6 is a conceptual diagram illustrating operations 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. 6(a) shows the setting of the patch presence/absence flag, the patch top address, and the patch function flag in the patch parameters. FIG. 6B shows an example of code descriptions of the main function module 500 , the function module 600 and the entry point module 700 . FIG. 7 is a conceptual diagram explaining the operation of the first branch processing and the second branch processing when there is a patch corresponding to the entry point in the function module. FIG. 7(a) shows the setting of the patch presence/absence flag, the patch top address, and the patch function flag in the patch parameters. FIG. 7B shows examples of code descriptions of the main function module 500, the function module 600, the entry point module 700, and the patch module 800. FIG.

制御部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 the 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 processing 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, if the read patch existence flag is ON (described in FIG. 7A, for example, 012345h is described as the top address of the patch area), the control unit 11 advances the process to step S4.
On the other hand, if the read patch presence/absence flag is OFF (described in FIG. 6A, the patch area top address is 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 .
Steps S2 and S3 described above are the first branch processing.

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

制御部11は、パッチ機能フラグがONか否かにより、処理中の関数モジュールの属する機能グループ内にパッチが適用されている関数モジュールが有るか否かの判定を行う(ステップS6)。このとき、制御部11は、パッチ機能フラグがONである(機能番号の示す機能グループ内の関数モジュールにパッチが適用されている)場合、処理をステップS7へ進める。一方、制御部11は、パッチ機能フラグがOFFである(機能番号の示す機能グループ内の関数モジュールにパッチが適用されていない)場合、処理を終了する。すなわち、制御部11は、エントリポイントモジュール700から関数モジュール600に戻り、関数モジュール600における関数501の処理を行う。
上述したステップS5及びステップS6が第2分岐処理である。
Based on whether the patch function flag is ON, the control unit 11 determines whether there is a patched function module in the function group to which the function module being processed belongs (step S6). At this time, if the patch function flag is ON (a patch is applied to the function module within the function group indicated by the function number), the control unit 11 advances the process to step S7. On the other hand, if the patch function flag is OFF (no patch is applied to the function module within 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 .
Steps S5 and S6 described above 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 head address (012345h), calls the patch module 800 with this patch head address, and performs patch processing (third branch processing). including) is performed (step S7).

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

制御部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 entry point identification information 0201h given as an argument from the entry point module 700 is extracted from the entry point identification information 0201h by function number and individual number extraction processing 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 patch function flag confirmation processing 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 branches depending on whether the patch function flag corresponding to the function number 02h is ON (that is, 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 for). It is determined whether or not there is a branch (step S13). At this time, if the patch function flag corresponding to function number 02h is ON (there is a branch to search for an individual number), control unit 11 advances the process to step S13. On the other hand, if the patch function flag is OFF (there is no branch to search for the individual number), the control unit 11 terminates 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 performs 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 a third branch processing 803 for the extracted individual number 01h, that is, whether or not 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 a patch, the control unit 11 advances the process to step S16. On the other hand, if there is a third branch process 803 as a branch to apply a patch, 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 performs the function 501 in the function module 600 .
The control unit 11 performs correction processing (entry point correction processing 804) for the function module of the entry point identification information 0201h (step S16).

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

1…半導体装置
11…制御部
12…データ入出力部
13…記憶部
111…CPU
131…マスクROM
132…EEPROM
133…RAM
150…プログラム
250,800…パッチモジュール
350…パッチパラメータ
600…関数モジュール
700…エントリポイントモジュール
DESCRIPTION OF SYMBOLS 1... Semiconductor device 11... Control part 12... Data input-output part 13... Storage part 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 (8)

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

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (3)

* 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

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
JP2021006973A (en) 2021-01-21

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
KR20040076589A (en) Memory card
CN115543487A (en) OTP-based boot code expansion method in read-only memory and chip
JP7284002B2 (en) Semiconductor device, control method and program
US6779732B2 (en) Method and apparatus for linking converted applet files
JP7284003B2 (en) Semiconductor device, IC card, control method and program
JP2010113549A (en) Ic card and method for execution of patch code
US6275982B1 (en) Method and device enabling a fixed program to be developed
JP5301018B2 (en) Portable electronic device
CN101667130B (en) Embedded system with authentication, and associated authentication method
JP6798157B2 (en) Electronic information storage medium, anomaly detection method, and anomaly detection program
JP2008146343A (en) Ic card, and method for calling update program
US7353348B2 (en) Nonvolatile memory and card reader provided with the same
EP3023925B1 (en) Secure element with applications
JP7468765B1 (en) ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, ALL-IN-ONE DATA UPDATE METHOD, AND PROGRAM
US7684992B2 (en) Remote application correction
CN111090542A (en) Abnormal block identification method and device based on abnormal power failure and computer equipment
JP5998767B2 (en) IC card system and IC card
EP4145271A1 (en) Methods and terminal for updating converted applet file, and java card device
JP5786702B2 (en) Security token, instruction execution method in security token, and computer program
JP6915338B2 (en) IC card
JP2005301657A (en) Ic card having multiple command tables stored in rewritable memory and executing method for command
JP5983349B2 (en) IC card, data read / write method, and data read / write program
JP6015461B2 (en) Information recording medium, data read / write method, and data read / write program

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