JP2005284963A - Method and system for loading program - Google Patents
Method and system for loading program Download PDFInfo
- Publication number
- JP2005284963A JP2005284963A JP2004100763A JP2004100763A JP2005284963A JP 2005284963 A JP2005284963 A JP 2005284963A JP 2004100763 A JP2004100763 A JP 2004100763A JP 2004100763 A JP2004100763 A JP 2004100763A JP 2005284963 A JP2005284963 A JP 2005284963A
- Authority
- JP
- Japan
- Prior art keywords
- relocatable
- storage device
- file
- program
- section
- 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.)
- Pending
Links
Images
Abstract
Description
本発明は、リロケータブルオブジェクトファイル形式のプログラムをロードするプログラムローディング装置およびプログラムローディング方法に関する。 The present invention relates to a program loading apparatus and a program loading method for loading a relocatable object file format program.
従来のプログラムローディング装置は、ホストシステムでプログラムのロードアドレス情報とフック(設定)情報とをシンボルテーブルに追加してリロケータブルオブジェクトファイルを作成し、ターゲットシステムへリロケータブルオブジェクトファイルを転送し、ターゲットシステム上で、そのロードアドレス情報に従ってシンボル配置アドレスを決定し、また、フック情報に従ってシンボルのフック処理を実行し、プログラムのシンボル毎にユーザが指定したターゲットシステム上のアドレスへシンボルを配置していた(特許文献1参照。)。
しかしながら、リロケータブルオブジェクトファイルは、オブジェクト中でアドレス未解決セクションや、未解決シンボルを参照する度に計算式で表現されるため、アブソリュートオブジェクトファイルに比べてオブジェクトファイルの容量が大きくなり、ターゲットシステムへの転送時間又はプログラムローダの実行処理サイクル期間が増大するという課題が存在していた。 However, since the relocatable object file is expressed by a calculation formula each time an address unresolved section or unresolved symbol is referenced in the object, the capacity of the object file becomes larger than the absolute object file, and There has been a problem that the transfer time or the execution cycle period of the program loader increases.
そこで、ターゲットシステムへのファイルの転送時間又はプログラムローダの実行処理サイクル期間を短縮するプログラムローディング装置およびプログラムローディング方法を提供することを目的とする。 Accordingly, an object of the present invention is to provide a program loading apparatus and a program loading method for shortening the file transfer time to the target system or the execution cycle period of the program loader.
上記目的を達成するために、本発明の第1の特徴は、例えば、プログラムのリロケータブルオブジェクトファイルを記憶するリロケータブルファイル記憶装置と、リロケータブルファイル記憶装置から読出したリロケータブルオブジェクトファイルをターゲットシステムに転送するデータ出力部と、ターゲットシステムからデータ入力部を通して転送されるセクションテーブルデータを記憶するセクションデータ記憶装置と、リロケータブルファイル記憶装置及びセクションデータ記憶装置に接続し、リロケータブルオブジェクトファイルとセクションテーブルデータを読出して、プログラムのアブソリュートオブジェクトファイルを生成するリンカと、リンカで生成されたアブソリュートオブジェクトファイルを記憶するアブソリュートファイル記憶装置と、リロケータブルファイル記憶装置、セクションデータ記憶装置、及びアブソリュートファイル記憶装置とリンカを制御する中央処理装置と、を備えるプログラムローディング装置であることを要旨とする。 In order to achieve the above object, the first feature of the present invention is, for example, a relocatable file storage device that stores a relocatable object file of a program, and data that transfers a relocatable object file read from the relocatable file storage device to a target system. Connected to the output unit, the section data storage device for storing the section table data transferred from the target system through the data input unit, the relocatable file storage device and the section data storage device, and read the relocatable object file and the section table data, A linker that generates an absolute object file of the program and an absolute file that stores the absolute object file generated by the linker And yl storage device, relocatable file storage device, section data storage device, and summarized in that a program loading device comprising a central processing unit for controlling the absolute file storage and linker, a.
上記目的を達成するために、本発明の第2の特徴は、例えば、プログラムのリロケータブルオブジェクトファイルを記憶するリロケータブルファイル記憶装置と、リロケータブルファイル記憶装置から読出したリロケータブルオブジェクトファイルをターゲットシステムに送信するデータ出力部と、ターゲットシステムからデータ入力部を通して転送されるプログラムのアブソリュートオブジェクトファイルを記憶するアブソリュートファイル記憶装置と、アブソリュートファイル記憶装置から読出したアブソリュートオブジェクトファイルをデータ出力部を経由してターゲットシステムに転送させるロードパスと、リロケータブルファイル記憶装置及びアブソリュートファイル記憶装置を制御する中央処理装置と、を備えるプログラムローディング装置であることを要旨とする。 In order to achieve the above object, the second feature of the present invention is, for example, a relocatable file storage device that stores a relocatable object file of a program, and data that transmits a relocatable object file read from the relocatable file storage device to a target system. Absolute file storage device that stores the absolute object file of the program transferred from the output unit and the target system through the data input unit, and the absolute object file read from the absolute file storage device is transferred to the target system via the data output unit And a central processing unit for controlling a relocatable file storage device and an absolute file storage device. And summarized in that a Ingu device.
上記目的を達成するために、本発明の第3の特徴は、例えば、中央処理装置がプログラムのソースファイルをソースファイル記憶装置に記憶するソースファイル記憶工程と、中央処理装置がソースファイル記憶装置からソースファイルを読出してコンパイルしたプログラムのリロケータブルオブジェクトファイルをリロケータブルファイル記憶装置に記憶するリロケータブルファイル記憶工程と、中央処理装置がリロケータブルファイル記憶装置からターゲットシステムへリロケータブルオブジェクトファイルを転送し、リロケータブルオブジェクトファイルのテスト及びデバッグを実行するデバッグ工程と、中央処理装置がデバッグ工程でリロケータブルオブジェクトファイルのテストを完了させた段階で、ターゲットシステム側で生成されるプログラムのアブソリュートオブジェクトファイルをアブソリュートファイル記憶装置に記憶するアブソリュートファイル記憶工程と、中央処理装置がアブソリュートファイル記憶装置からアブソリュートオブジェクトファイルを読出して、ターゲットシステムへ転送しプログラムのテストをするテスト工程と、を備えるプログラムローディング方法であることを要旨とする。 In order to achieve the above object, the third feature of the present invention is that, for example, a central processing unit stores a source file of a program in a source file storage device, and a central processing unit from the source file storage device. Relocatable file storage process that stores the relocatable object file of the program compiled by reading the source file in the relocatable file storage device, and the central processing unit transfers the relocatable object file from the relocatable file storage device to the target system, and tests the relocatable object file Generated on the target system side when the central processing unit completes the test of the relocatable object file in the debugging process. An absolute file storage process for storing the absolute object file of the program to be stored in the absolute file storage device, a test process for the central processing unit to read the absolute object file from the absolute file storage device, transfer it to the target system, and test the program; A program loading method comprising:
本発明のプログラムローディング装置およびプログラムローディング方法は、ターゲットシステムへのファイルの転送時間又はプログラムローダの実行処理サイクル期間を短縮するという格別な効果を奏する。 The program loading apparatus and the program loading method of the present invention have a special effect of shortening the file transfer time to the target system or the execution period of the program loader.
(第1の実施の形態)
図1は、本発明の第1の実施形態に係るプログラムローディング装置のブロック図である。
(First embodiment)
FIG. 1 is a block diagram of a program loading apparatus according to the first embodiment of the present invention.
プログラムローディング装置は、ホストシステム1とターゲットシステム47を備え、ホストシステム1で作成したリロケータブルオブジェクトファイルを、ターゲットシステム47に設けたランダムアクセスメモリ10(以下、「RAM」と略記する)に転送し、プログラムローダ12を動作させて、未解決アドレスを決定する。
The program loading apparatus includes a
ターゲットシステム47は、ホストシステム1からの指令に従いプログラムローダ12で作成したセクション・シンボルテーブル16をホストシステム1へ転送するように構成している。
The target system 47 is configured to transfer the section / symbol table 16 created by the
ホストシステム1は、リロケータブルファイル記憶装置2、セクションデータ記憶装置3、アブソリュートファイル記憶装置4、リンカ5、中央処理装置33(以下、「CPU」と略記する)を備え、CPU33は、入力部8と出力部7に接続し、命令(コマンド)入力やデバッグ処理やプログラムのテスト状況を入出力する。
The
また、ホストシステム1は、データ通信部9、データ出力部18、データ入力部19を通してターゲットシステム47と接続し、ファイルやデータやコマンドの送受信を実行する。
The
ここで、入力部8の形態としては、キーボード、マウスポインタ、テンキー、タッチパネルを採用することができ、出力部7の形態としては、ディスプレイ装置や印刷装置を採用することができる。
Here, a keyboard, a mouse pointer, a numeric keypad, and a touch panel can be adopted as the form of the
ターゲットシステム47は、RAM10とCPU34を備え、RAM10内にリロケータブルオブジェクトセクションデータロード部11と、プログラムローダ12と、セクション・シンボルテーブル16と、プログラムのロード後のセクションデータ記憶装置15を備えている。
The target system 47 includes a
プログラムローダ12は、未解決アドレス決定部13とセクションデータロード部14を備え、リロケータブルオブジェクトセクションデータロード部11を解析し、ロード後のセクションデータを生成するように構成されている。
The
ここで、リロケータブルファイル記憶装置2に記憶するリロケータブルオブジェクト形式のプログラムは、リロケータブルオブジェクトがプログラムの最終的な実行可能形式ではなく、セクション配置アドレスやシンボル値を未解決にして、ターゲットシステム47のRAM10の空き状態に対応させたアドレスにシンボルを配置する自由度の高いプログラムである。
Here, the relocatable object format program stored in the relocatable
CPU33は、入力部8からのコマンドに応答し、リロケータブルファイル記憶装置2からデータ出力部18を通して、ターゲットシステム47側のRAM10にリロケータブルオブジェクトファイル(プログラム)を転送する。
In response to the command from the
ホストシステム1側のCPU33からリロケータブルオブジェクトファイルを転送した後に、データ通信部9を通してCPU34へプログラムローダ開始のコマンドを送信し、プログラムローダ12を起動させ、リロケータブルオブジェクトセクションデータロード部11のロード処理を実行する。
After the relocatable object file is transferred from the
ターゲットシステム47側のCPU34は、プログラムローダ12を動作させ、セクション・シンボルテーブル16にセクションテーブルデータを記憶させてから、データ入力部19へセクションテーブルデータを転送する。
The
CPU33は、転送されたセクションテーブルデータをセクションデータ記憶装置3に記憶し、リンカ5にセクションテーブルデータを与え、リロケータブルファイル記憶装置2に記憶したリロケータブルオブジェクトファイルとリンクさせたアブソリュートオブジェクトファイルをアブソリュートファイル記憶装置4に記憶する。
The
図2は、本発明の第1の実施形態に用いるプログラムローディング処理のフローチャートである。図1のブロック図及び図2のフローチャートを参照して、プログラムローディング装置の動作を説明する。 FIG. 2 is a flowchart of the program loading process used in the first embodiment of the present invention. The operation of the program loading apparatus will be described with reference to the block diagram of FIG. 1 and the flowchart of FIG.
CPU34は、セクションアドレス解析ステップ20(以下、ステップを「ST」と略記する)で未解決アドレス決定部13を動作させ、リロケータブルオブジェクトセクションデータロード部11のセクション定義部を解析する。
The
CPU34は、判定ST21でセクションアドレスが未解決と判定(YES)した場合は、ST22に分岐し、RAM10の空き領域から「サイズ」で定義されている容量をセクションデータ領域として確保し、このデータ領域の先頭アドレスを「セクションアドレス」として決定する。
If the
一方、CPU34は、判定ST21でセクションアドレス解決と判定(NO)した場合は、ST23へ分岐し、「アドレス」で指定されているRAM10の空き領域から「サイズ」で定義されている容量をセクションデータ領域として確保する。
On the other hand, if it is determined that the section address resolution is determined (NO) in determination ST21, the
次に、CPU34は、処理をST24へ移行させ、セクション定義部の解析結果をRAM10内部のセクション・シンボルテーブル16に登録し、ST25へ進ませセクション定義部解析終了か否かを判定する。判定結果が非(NO)であれば判定ST21へ復帰させ、判定結果が是(YES)であればシンブル定義解析処理ST26へ移行させる。
Next, the
CPU34は、解析処理ST26の中のST27を実行し、シンボル定義部を解析し、シンボル値が表現式で与えられる場合はセクションテーブル中のアドレスを使ってアドレス値を計算する。次に、ST28へ進みRAM10内部のセクション・シンボルテーブル16にシンボル名とシンボル値を登録(記憶)する。
The
CPU34は、処理をST48へ進ませシンボル定義部解析終了か否かを判定する。判定結果が非(NO)であればST27へ復帰させ、判定結果が是(YES)であればデータ部解析処理ST29へ移行させる。
The
CPU34は、解析処理ST29の中のST30を実行し、データ定義部(図1参照)を解析してセクション領域へデータをロードする。また、ロードデータが表現式で与えられる場合はCPU34がシンボル値を使ってデータ値を計算し、RAM10内部にロード後のセクションデータを記憶する。
The
CPU34は、ロード処理の段階で、各セクションの先頭からオフセットで指定される位置にロードデータで指定された値をロードする。ロードデータが未解決セクションアドレスあるいは未解決シンボルを参照した計算式の場合は、後述する図3のセクションテーブル110あるいは図4のセクション・シンボルテーブル114中の値を用いて計算する。
The
CPU34は、処理をST31へ進ませデータ部解析終了か否かを判定する。判定結果が非(NO)であればST30へ復帰させ、判定結果が是(YES)であればデータ転送処理ST32へ移行させる。
The
CPU34は、全セクションデータのロード終了後、データ転送処理ST32を実行し、ホストシステム1側のデータ入力部19へセクション・シンボルテーブル16のすべてのデータを転送し、プログラムローディング処理を終了する。
After loading all the section data, the
なお、セクション・シンボルテーブル16は、セクションテーブルデータ格納領域およびテーブルサイズで構成する。 The section / symbol table 16 includes a section table data storage area and a table size.
図3は、セクションテーブル110の構成図である。マトリクス状のテーブルには、セクション名欄35、セクションサイズ欄36、セクションアドレス欄37が設けられ、ST23(図2参照)の処理で算出された未解決セクションアドレスがすべて記憶されている。 FIG. 3 is a configuration diagram of the section table 110. The matrix table is provided with a section name column 35, a section size column 36, and a section address column 37, and all unresolved section addresses calculated in the process of ST23 (see FIG. 2) are stored.
図4は、セクション・シンボルテーブル114の構成図である。マトリクス状のテーブルには、シンボル名欄38、シンボル値欄39を設けて、リロケータブルオブジェクト中の未解決シンボル名(例えば、シンボルM1、シンボルM2、シンボルM3)のシンボル値(例えば、シンボル値M1、シンボル値M2、シンボル値M3)がすべて記憶されている。 FIG. 4 is a configuration diagram of the section symbol table 114. The matrix table is provided with a symbol name field 38 and a symbol value field 39, and symbol values (for example, symbol value M1, symbol M3, unresolved symbol names in the relocatable object (for example, symbol M1, symbol M2, symbol M3)). All symbol values M2 and M3) are stored.
CPU34は、例えば、図3に示すセクションアドレス欄37の「アドレス」を用いてシンボル値欄39の「シンボル値」を計算(図2のST27)し、RAM10内部のセクション・シンボルテーブル16に記憶(図2の登録処理ST24)する。
The
図5は、第1の実施の形態に用いるターゲットシステム47用のプログラム開発処理のフローチャートである。図1のブロック図及び図5のフローチャートを参照して、プログラム開発のフローを説明する。 FIG. 5 is a flowchart of a program development process for the target system 47 used in the first embodiment. The program development flow will be described with reference to the block diagram of FIG. 1 and the flowchart of FIG.
CPU33は、編集ST40で作成したプログラムソースファイルをプログラム記憶装置17から読出し、ST41でコンパイルしてリロケータブルオブジェクトファイルを作成し、リロケータブルファイル記憶装置2へ記憶する。
The
CPU33は、リロケータブルファイル記憶装置2のリロケータブルオブジェクトファイルをターゲットシステム47に転送し、プログラムローダ12を動作させて、プログラムのテスト及びデバッグを実行する(ST42)。
The
ユーザは、プログラムの修正・変更判定ST43で入力部8と出力部7を使用してCPU33に指令を送信し、ST40からST42を繰り返すように、プログラムの修正判定(NO)を実行することができる。
In the program modification / change determination ST43, the user can send a command to the
ユーザは、プログラムの修正・変更判定ST43で、プログラムの構成が固まった判定(YES)結果を、入力部8を使用してCPU33に指令を送信し、プログラムのローディング命令を与える。
In the program modification / change determination ST43, the user transmits a determination (YES) result indicating that the program configuration is fixed to the
CPU33は、ターゲットシステム47から得られるセクションテーブルデータの情報をリンカ5に与えてリロケータブルオブジェクトをリンクし直しアブソリュートオブジェクファイルをアブソリュートファイル記憶装置4に記憶させる(ST44)。
The
ユーザは、アブソリュートファイル記憶装置4に記憶したアブソリュートオブジェクトファイルを磁気記憶装置やフラッシュメモリのような記憶媒体98を使用して、ターゲットシステム47にロードし、アブソリュートオブジェクト形式のプログラムのテストやデバッグを実行する(ST45)。 The user loads the absolute object file stored in the absolute file storage device 4 to the target system 47 using a storage medium 98 such as a magnetic storage device or a flash memory, and executes a test or debug of the program in the absolute object format. (ST45).
なお、ターゲットシステム47へのロードは、データ出力部18を経由して転送してもよいことは勿論である。
Of course, the load to the target system 47 may be transferred via the
ターゲットシステム47側のCPU34は、アブソリュートオブジェクト形式のプログラムのロードを検知し、プログラムを起動させ判定ST46でプログラムのテスト・デバッグ完了判定(YES)を検出したときはプログラム開発終了に移行し、プログラムの修正・変更が必要と判定(NO)した場合は、処理をST40へ戻し、プログラムの修正又は変更をユーザへ促す。
The
図6は、第1の実施形態に用いるリロケータブルオブジェクトのフォーマットを示す図である。このリロケータブルオブジェクト50には、セクション定義部57とシンボル定義部58とデータ部64が設けられ、リロケータブルファイル記憶装置2(図1参照)に記憶されている。 FIG. 6 is a diagram showing a format of a relocatable object used in the first embodiment. The relocatable object 50 includes a section definition unit 57, a symbol definition unit 58, and a data unit 64, and is stored in the relocatable file storage device 2 (see FIG. 1).
ただし、本発明は、この構成に限定されるものではなく、3種類のパート以外にも他のパートが存在する場合もある。 However, the present invention is not limited to this configuration, and there may be other parts in addition to the three types of parts.
セクション定義部57にはプログラム中の各セクションのセクション名51、セクションのサイズ52、セクションのアドレス53が定義されている。アドレスが解決されている第2段目55の「セクションS2」は、セクションのアドレス53に絶対値アドレスが指定されている。このようなセクションをアブソリュートセクションと定義する。 In the section definition section 57, a section name 51, a section size 52, and a section address 53 of each section in the program are defined. In the “section S2” of the second stage 55 in which the address is resolved, an absolute value address is designated as the section address 53. Such a section is defined as an absolute section.
一方、アドレスが未解決なセクション(例えば、リロケータブルセクション)は、第1段目54の「セクションS1」、第3段目56の「セクションS3」が該当し、セクションアドレスの指定がなく、セクション定義「指定なし」、「指定なし」が共に記述されている。なお、リロケータブルオブジェクトにはリロケータブルセクションが定義されている場合がある。 On the other hand, a section whose address has not been resolved (for example, a relocatable section) corresponds to “section S1” in the first stage 54 and “section S3” in the third stage 56. “None” and “None” are both described. A relocatable section may be defined in the relocatable object.
シンボル定義部58は、プログラム中の各シンボルのシンボル名59、シンボル値60が定義される。リロケータブルセクション中の第1段目61の「シンボルM1」と、第3段目63の「シンボルM3」のシンボル値の定義部には共に、対応するシンボルが配置されるセクションのアドレスを表す計算式が定義されている。 The symbol definition unit 58 defines a symbol name 59 and a symbol value 60 of each symbol in the program. In the symbol value definition part of the “symbol M1” of the first stage 61 and the “symbol M3” of the third stage 63 in the relocatable section, a calculation formula representing the address of the section where the corresponding symbol is arranged Is defined.
例えば、変数R、セクションのインデックスI、及びセクション先頭からのオフセット値Vを用いて、セクションのシンボルSを、変数R(I)にオフセット値Vを加算したアドレスに配置する。 For example, using the variable R, the section index I, and the offset value V from the beginning of the section, the section symbol S is arranged at an address obtained by adding the offset value V to the variable R (I).
なお、計算式M1、M3は、
S=R(I)+V …・・ (1)
の式(1)で定義する。また、第2段目62のアブソリュートセクション中のシンボルM2のシンボル値を絶対値で定義する。
The calculation formulas M1 and M3 are
S = R (I) + V (1)
(1). Further, the symbol value of the symbol M2 in the absolute section of the second stage 62 is defined as an absolute value.
データ部64には、プログラム中の各セクションデータの定義部がセクション毎に設けられる。例えば、セクションS1の定義部65、セクションS2の定義部69、セクションS3の定義部70を設ける。 In the data part 64, a definition part for each section data in the program is provided for each section. For example, a definition unit 65 of section S1, a definition unit 69 of section S2, and a definition unit 70 of section S3 are provided.
セクションS1の定義部65は、各セクションの先頭アドレスからのオフセット66とロードデータ67で構成する。ロードデータ67の定義において、リロケータブルセクションや、未解決のシンボルを参照する場合には、セクションアドレスやシンボル値を表す変数を用いた計算式68を記述する。 The definition section 65 of the section S1 includes an offset 66 from the head address of each section and load data 67. In the definition of the load data 67, when referring to a relocatable section or an unresolved symbol, a calculation formula 68 using a variable representing a section address or a symbol value is described.
リロケータブルオブジェクトは、ターゲットシステム47のRAM10の空き状況に応じてプログラムを動作させることが可能となる。また、プログラム作成者がプログラムのコンパイル時にアドレス解決を行う必要がなくなるので、プログラム開発初期の段階でプログラムのコード、データサイズが流動的に変更される場合に有効である。
The relocatable object can operate a program according to the availability of the
(第2の実施の形態)
図7は、本発明の第2の実施形態に係るプログラムローディング装置のブロック図である。プログラムローディング装置は、第1の実施形態と同様にホストシステム1とターゲットシステム47を備え、重複する構成要素に付いては説明を省略する。
(Second Embodiment)
FIG. 7 is a block diagram of a program loading apparatus according to the second embodiment of the present invention. The program loading apparatus includes the
ホストシステム1内部にリロケータブルオブジェクト形式のプログラムファイルを記憶するリロケータブルファイル記憶装置2を設け、データ出力部18を通してターゲットシステム47のRAM10にリロケータブルオブジェクトファイルを転送する。
A relocatable
ターゲットシステム47のRAM10内部には、リロケータブルオブジェクトセクションデータロード部11が設けられ、リロケータブルオブジェクト形式のプログラムを転送した後に、データ通信部9を通してCPU34へ指令を送信し、ターゲットシステム47のプログラムローダ12aを起動しリロケータブルオブジェクト形式のプログラムをロードする。
In the
プログラムローダ12aは、内部に未解決アドレス決定部13と、セクションデータロード部14と、新たに追加したアブソリュートオブジェクト作成部72を備える。
The program loader 12a includes an unresolved
CPU34は、アブソリュートオブジェクト作成部72を動作させ、セクションデータ記憶装置15に記憶したロード後のセクションデータとセクション・シンボルテーブル16の情報を用いて、アブソリュートオブジェクトファイル73を生成する。
The
CPU34は、アブソリュートオブジェクトファイル73をホストシステム1側のデータ入力部19経由でアブソリュートファイル記憶装置4に記憶させる。
The
CPU34は、アブソリュートオブジェクトファイル73を生成させながら、同時並行的にアブソリュートオブジェクトファイル73の先頭データから順番に、アブソリュートファイル記憶装置4に記憶させることもできる。この場合、ターゲットシステム47のRAM10の容量を少なくすることができるという利点がある。
The
ホストシステム1は、CPU33を操作し、アブソリュートファイル記憶装置4に記憶したアブソリュートオブジェクト形式のプログラム全体をロードパス71及びデータ出力部18を経由させて、ターゲットシステム47のRAM10へ転送する。
The
ターゲットシステム47側のCPU34は、アブソリュートオブジェクト形式のプログラムのロードを検知し、プログラムを起動させプログラム完了判定を検出したときはプログラム開発を終了させ、プログラム不具合判定の場合は、プログラム開発のやり直しをユーザに促す。
The
図8は、第2の実施形態に用いるプログラムローダ12aの動作フローを示すフローチャートである。図7のブロック図及び図8のフローチャートを参照して、プログラムローダ12aの動作を説明する。まず、CPU34は、ST75でプログラムローダ12a中の未解決アドレス決定部13がリロケータブルオブジェクト形式のプログラム中のセクション定義部(図6参照)を解析する。
FIG. 8 is a flowchart showing an operation flow of the program loader 12a used in the second embodiment. The operation of the program loader 12a will be described with reference to the block diagram of FIG. 7 and the flowchart of FIG. First, in ST75, the unresolved
CPU34は、セクションアドレスが未解決(例えば、「セクションS1」、「セクションS3」)の場合は、RAM10の空き領域からサイズで定義されているサイズ分をセクションデータ領域として確保し、その領域の先頭アドレスをセクションアドレスに決定する。
When the section address is unresolved (for example, “section S1”, “section S3”), the
一方、CPU34は、セクションアドレスが解決されている(例えば、「セクションS2」)の場合は、RAM10の空き領域からアドレスで指定されるアドレスからサイズで指定されるサイズ分の領域をセクションデータ領域として確保する。
On the other hand, if the section address has been resolved (for example, “section S2”), the
CPU34は、ST76で、セクション定義部の解析結果をRAM上のセクションテーブル110(図3参照)に登録(又は記録)する。第2の実施形態でも図3に例示したセクションテーブル110及び図4に例示したセクション・シンボルテーブル114を使用することができるので重複する説明を省略する。
In step ST76, the
CPU34は、セクション定義部、シンボル定義部を解析した後に、プログラムローダ12a中のセクションデータロード部14が、リロケータブルオブジェクト中のデータ部を解析して各セクションのデータ領域へデータのロードを実行する(ST77)。
After analyzing the section definition portion and the symbol definition portion, the
CPU34は、ST77で、第1の実施形態と同様に、各セクションの先頭からオフセットで指定される位置にロードデータで指定された値をロードする。
In ST77, the
CPU34は、ST78で、ロードデータが未解決セクションアドレスあるいは未解決シンボルを参照した計算式の場合は、セクションテーブル若しくはシンボルテーブル中の値を用いて計算しロードデータを求めセクション定義部を作成する。
If the load data is a calculation formula referring to an unresolved section address or an unresolved symbol in ST78, the
CPU34は、ST79で、セクション定義部の情報に基づき、全セクションデータのロードを完了させ、データ定義部を完成させてから、ST80へ遷移する。
In step ST79, the
CPU34は、ST80で、アブソリュートオブジェクトファイル73の格納領域の容量を算出する。例えば、セクションテーブルデータに登録されているセクション数と全セクションサイズから算出することができる。
In ST80, the
CPU34は、ST80で、プログラムローダ12a中のアブソリュートオブジェクト作成部72がRAM10の内部にアブソリュートオブジェクトファイル73の格納領域を確保し、生成したアブソリュートオブジェクトファイル73を記憶する。
In ST80, the absolute object creation unit 72 in the program loader 12a secures a storage area for the absolute object file 73 in the
CPU34は、ST80で、セクション・シンボルテーブル16のデータ情報をアブソリュートオブジェクトファイル73内部のセクション定義部に対応するフォーマットへ変換し、アブソリュートオブジェクトファイル73の格納領域へ転送しセクション定義部を完成させる。
In ST80, the
CPU34は、セクション定義部完成後、ST80で、各セクションのロード後のセクションデータをアブソリュートオブジェクトファイル73内部のデータ部に対応するフォーマットに変換し、アブソリュートオブジェクトファイル73の格納領域へ転送してデータ定義部を完成させる。
After completion of the section definition section, the
CPU34は、ST80で、データ定義部を完成させた後に、プログラムローダ12aを動作させ。ホストシステム1側のデータ入力部19を通して、アブソリュートファイル記憶装置4へアブソリュートオブジェクトファイルを転送し記憶させることができる。
The
また、アブソリュートオブジェクトファイル73を構成するセクション定義部及びデータ部のデータ情報を分割しながらホストシステム1側へ転送してもよい。この場合、ターゲットシステム47のRAM10の容量に余裕ができるという利点がある。
Further, the data information of the section definition part and the data part constituting the absolute object file 73 may be transferred to the
すべてのアブソリュートオブジェクトファイル73を転送した段階でプログラムローディング処理を終了させることができる。 When all the absolute object files 73 have been transferred, the program loading process can be terminated.
図9は、アブソリュートオブジェクトファイル73のフォーマット変換処理のブロック図である。 FIG. 9 is a block diagram of the format conversion process of the absolute object file 73.
オブジェクトデータ85は、CPU34がセクション・シンボルテーブル16のセクションテーブルのデータをアブソリュートオブジェクトファイル73内部のセクション定義部86のフォーマットへ変換したデータであり、セクション定義部86は、セクション名87、サイズ88、アドレス89で構成されている。
The object data 85 is data obtained by the
ロード後のセクションデータ15aは、CPU34がセクションデータをアブソリュートオブジェクトファイル73内部のデータ定義部90のフォーマットへ変換したデータである。
The loaded section data 15 a is data obtained by the
セクションデータ15aは、セクションS1の先頭アドレス15bから絶対値S11、S12、S13のデータに変換され、セクションS2の先頭アドレス15cも同様に絶対値のデータに変換され、セクションS3の先頭アドレス15dも同様に絶対値のデータに変換されている。 The section data 15a is converted from the head address 15b of the section S1 to data of absolute values S11, S12, and S13. The head address 15c of the section S2 is also converted to absolute value data, and the head address 15d of the section S3 is also the same. Has been converted to absolute value data.
アブソリュートオブジェクトファイル73のデータ定義部90は、CPU34を経由してセクションデータ15aが対応する格納領域にオフセット91aとロードデータ91bが書込まれる。
The data definition unit 90 of the absolute object file 73 writes the offset 91a and the load data 91b to the storage area corresponding to the section data 15a via the
例えば、オフセット91aにセクションS1の先頭アドレス15bに対応する「オフセットS11」のロードデータ「絶対値S11」がCPU34を介して書込まれ、「オフセットS12」のロードデータ「絶対値S12」がCPU34を介して書込まれ、「オフセットS13」のロードデータ「絶対値S13」がCPU34を介して書込まれる。
For example, the load data “absolute value S11” of “offset S11” corresponding to the head address 15b of the section S1 is written to the offset 91a via the
また、「セクションS2」91cの「先頭アドレスS2」15c、「セクションS3」91dの「先頭アドレスS3」15dも同様に、オフセットと絶対値が対応つけられてCPU34によって書込まれるように構成されている。
Similarly, the “start address S2” 15c of the “section S2” 91c and the “start address S3” 15d of the “section S3” 91d are configured to be written by the
図10は、第2の実施の形態に用いるプログラム開発のフローチャートである。ST92、ST93、ST94、ST95、ST97はすべて、第1の実施形態のソースファイル編集ST40、コンパイルST41、テスト・デバッグST42、判定ST43、判定ST46と同一であり重複する説明を省略する。 FIG. 10 is a flowchart of program development used in the second embodiment. ST92, ST93, ST94, ST95, and ST97 are all the same as the source file editing ST40, compilation ST41, test / debug ST42, determination ST43, and determination ST46 of the first embodiment, and redundant description is omitted.
第2の実施形態では、アブソリュートオブジェクト形式のプログラムをアブソリュートファイル記憶装置4(図7参照)からターゲットシステム47へデータ出力部18(図7参照)を経由してロードしてから、テスト・デバッグST96でターゲットシステム47側のCPU34が、ロードしたプログラムを起動させる。
In the second embodiment, the absolute object format program is loaded from the absolute file storage device 4 (see FIG. 7) to the target system 47 via the data output unit 18 (see FIG. 7), and then the test / debug ST96 is performed. Then, the
第2の実施形態のホストシステム1は、起動したターゲットシステム47側のプログラムのテスト及びデバッグをホストシステム1側の入力部8及び出力部7を用いてデータ通信部9を経由して実行することができる点が第1の実施形態と相違するので、リンカ5(図1参照)やセクションデータ記憶装置3(図1参照)を必要としない点で第1の実施形態より有利である。
The
以上のようなプログラムローダ12又は12aによれば、ターゲットシステム47で、リロケータブルオブジェクトファイルを受け、未解決アドレスを決定することにより、ICEのような特別な装置を使用せずに、簡易デバッグを行うことができる。
According to the
また、リロケータブルオブジェクトファイルの各シンボルのロードアドレス情報よりプログラムローダ12、12aが各シンボルの配置アドレスを決定し、ロード後のセクションデータ処理を行うことができる。
Further, the
さらに、プログラムローダ12、12aが、シンボルテーブルを作成することにより、各シンボル毎のターゲットシステム47上へのきめ細かなシンボル配置や、ICEのような特別な装置を使用せずに容易に簡易デバッグが実行でき、ターゲットシステム47のデバッグ効率を向上させることができる。
Furthermore, by creating a symbol table, the
しかも、ホストシステム1から余分なデータを削除したアブソリュートオブジェクト形式のプログラムをターゲットシステム47へ転送するので、転送速度が向上し、ターゲットシステム47のRAM容量を削減することができる。
In addition, since the absolute object format program from which excess data is deleted from the
なお、本発明の実施形態に記載された、作用及び効果は、本発明から生じる最も好適な作用及び効果を列挙したに過ぎず、本発明による作用及び効果は、本発明の実施の形態に記載されたものに限定されるものではない。 Note that the actions and effects described in the embodiments of the present invention only list the most preferable actions and effects resulting from the present invention, and the actions and effects according to the present invention are described in the embodiments of the present invention. It is not limited to what was done.
1…ホストシステム
2…リロケータブルファイル記憶装置
3…セクションデータ記憶装置
4、4a…アブソリュートファイル記憶装置
5…リンカ
7…出力部
8…入力部
9…データ通信部
10…ランダムアクセスメモリ
11…リロケータブルオブジェクトセクションデータロード部
12、12a…プログラムローダ
13…未解決アドレス決定部
14…セクションデータロード部
16…セクション・シンボルテーブル
17…プログラム記憶装置
18…データ出力部
19…データ入力部
33、34…中央処理装置
47…ターゲットシステム
71…ロードパス
72…アブソリュートオブジェクト作成部
86…セクション定義部
90…データ定義部
110…セクションテーブル
114…セクション・シンボルテーブル
DESCRIPTION OF
Claims (5)
前記リロケータブルファイル記憶装置から読出したリロケータブルオブジェクトファイルをターゲットシステムに転送するデータ出力部と、
前記ターゲットシステムからデータ入力部を通して転送されるセクションテーブルデータを記憶するセクションデータ記憶装置と、
前記リロケータブルファイル記憶装置及び前記セクションデータ記憶装置に接続し、前記リロケータブルオブジェクトファイルと前記セクションテーブルデータを読出して、プログラムのアブソリュートオブジェクトファイルを生成するリンカと、
前記リンカで生成されたアブソリュートオブジェクトファイルを記憶するアブソリュートファイル記憶装置と、
前記リロケータブルファイル記憶装置、セクションデータ記憶装置、及びアブソリュートファイル記憶装置と前記リンカを制御する中央処理装置と、
を備えることを特徴とするプログラムローディング装置。 A relocatable file storage device for storing a relocatable object file of the program;
A data output unit for transferring a relocatable object file read from the relocatable file storage device to a target system;
A section data storage device for storing section table data transferred from the target system through a data input unit;
A linker that connects to the relocatable file storage device and the section data storage device, reads the relocatable object file and the section table data, and generates an absolute object file of the program;
An absolute file storage device for storing an absolute object file generated by the linker;
A central processing unit for controlling the relocatable file storage device, section data storage device, absolute file storage device and the linker;
A program loading apparatus comprising:
前記リロケータブルファイル記憶装置から読出したリロケータブルオブジェクトファイルをターゲットシステムに送信するデータ出力部と、
前記ターゲットシステムからデータ入力部を通して転送されるプログラムのアブソリュートオブジェクトファイルを記憶するアブソリュートファイル記憶装置と、
前記アブソリュートファイル記憶装置から読出した前記アブソリュートオブジェクトファイルを前記データ出力部を経由して前記ターゲットシステムに転送させるロードパスと、
前記リロケータブルファイル記憶装置及びアブソリュートファイル記憶装置を制御する中央処理装置と、
を備えることを特徴とするプログラムローディング装置。 A relocatable file storage device for storing a relocatable object file of the program;
A data output unit for transmitting a relocatable object file read from the relocatable file storage device to a target system;
An absolute file storage device for storing an absolute object file of a program transferred from the target system through a data input unit;
A load path for transferring the absolute object file read from the absolute file storage device to the target system via the data output unit;
A central processing unit for controlling the relocatable file storage device and the absolute file storage device;
A program loading apparatus comprising:
前記中央処理装置が前記ソースファイル記憶装置からソースファイルを読出してコンパイルしたプログラムのリロケータブルオブジェクトファイルをリロケータブルファイル記憶装置に記憶するリロケータブルファイル記憶工程と、
前記中央処理装置が前記リロケータブルファイル記憶装置からターゲットシステムへリロケータブルオブジェクトファイルを転送し、リロケータブルオブジェクトファイルのテスト及びデバッグを実行するデバッグ工程と、
前記中央処理装置が前記デバッグ工程で前記リロケータブルオブジェクトファイルのテストを完了させた段階で、前記ターゲットシステム側で生成されるプログラムのアブソリュートオブジェクトファイルをアブソリュートファイル記憶装置に記憶するアブソリュートファイル記憶工程と、
前記中央処理装置が前記アブソリュートファイル記憶装置からアブソリュートオブジェクトファイルを読出して、前記ターゲットシステムへ転送しプログラムのテストをするテスト工程と、
を備えることを特徴とするプログラムローディング方法。
A source file storage step in which a central processing unit stores a source file of a program in a source file storage device;
A relocatable file storage step of storing in the relocatable file storage device a relocatable object file of a program compiled by the central processing unit reading the source file from the source file storage device;
A debugging step in which the central processing unit transfers a relocatable object file from the relocatable file storage device to a target system, and tests and debugs the relocatable object file;
An absolute file storage step of storing an absolute object file of a program generated on the target system side in an absolute file storage device when the central processing unit completes the test of the relocatable object file in the debugging step;
A test step in which the central processing unit reads an absolute object file from the absolute file storage device, transfers it to the target system, and tests a program;
A program loading method comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004100763A JP2005284963A (en) | 2004-03-30 | 2004-03-30 | Method and system for loading program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004100763A JP2005284963A (en) | 2004-03-30 | 2004-03-30 | Method and system for loading program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2005284963A true JP2005284963A (en) | 2005-10-13 |
Family
ID=35183246
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004100763A Pending JP2005284963A (en) | 2004-03-30 | 2004-03-30 | Method and system for loading program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2005284963A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008158846A (en) * | 2006-12-25 | 2008-07-10 | Toshiba Mitsubishi-Electric Industrial System Corp | Plant controller |
JP2018511132A (en) * | 2015-12-25 | 2018-04-19 | バイドゥ オンライン ネットワーク テクノロジー (ベイジン) カンパニー リミテッド | Application loading method and apparatus |
-
2004
- 2004-03-30 JP JP2004100763A patent/JP2005284963A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2008158846A (en) * | 2006-12-25 | 2008-07-10 | Toshiba Mitsubishi-Electric Industrial System Corp | Plant controller |
JP2018511132A (en) * | 2015-12-25 | 2018-04-19 | バイドゥ オンライン ネットワーク テクノロジー (ベイジン) カンパニー リミテッド | Application loading method and apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6243864B1 (en) | Compiler for optimizing memory instruction sequences by marking instructions not having multiple memory address paths | |
JP5039031B2 (en) | Method and apparatus for executing native code and target code in combination during program code conversion | |
JP2000242501A (en) | Information processor, information processing method and program writing device | |
US10884715B2 (en) | Method for generating source code | |
JP4041248B2 (en) | COMPILER DEVICE, COMPUTER-READABLE RECORDING MEDIUM CONTAINING COMPILING PROGRAM, AND COMPILING METHOD | |
JP6550269B2 (en) | PROGRAM CREATION SUPPORT DEVICE, CONTROL METHOD, AND PROGRAM | |
JP6984565B2 (en) | Information processing equipment and programs | |
US20210096830A1 (en) | Incremental code generation method | |
JP2005284963A (en) | Method and system for loading program | |
JP2005174045A (en) | Source program conversion device, source program conversion method, source program conversion program and program recording medium | |
JP4503203B2 (en) | Method and apparatus for creating test program for evaluating information processing apparatus, and program describing processing for the same | |
JP5120103B2 (en) | Debugging method and debugging program | |
WO2011045949A1 (en) | Memory management method, memory management program, and information processing device | |
JP6812637B2 (en) | Programmable controller system, its development support device, target device | |
JP5067705B2 (en) | Abnormal test support device, abnormal test support method, and program | |
JPH0228174B2 (en) | ||
KR101099491B1 (en) | Method for analyzing power consumption | |
JP2005115619A (en) | Program debugger | |
JP4371000B2 (en) | IDL compiling device, IDL compiling method, and IDL compiler | |
JP2007114934A (en) | Compiler system | |
JP5109808B2 (en) | Additional executable information generating apparatus, information processing apparatus, and program | |
JP5208706B2 (en) | Code execution system, method and program | |
JP2003076547A (en) | System and method for automatically generating control software | |
JP2009515243A (en) | Method for generating a simulation program executable on a host computer | |
JPH11282693A (en) | Mcu simulation device, its simulation method and computer redable recording medium recording simulation program |