Linking

Program linking apparatus for linking and executing one program and another program using a microprocessor and a program linking method thereof

6457174

Abstract

A code export symbol offset table A 1128 stores sets of the identifier and the offset of the area of a code symbol. In an export symbol import step 1160, the identifier that matches the identifier of a symbol is retrieved from the code export symbol offset table A 1128, the offset corresponding to the retrieved identifier is extracted, and a predetermined calculation is performed to create an absolute address.


Claims

What is claimed is:

1. A program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction;

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space, and for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing means for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction.

2. The program linking apparatus of claim 1,

wherein the absolute address obtaining means (a) reads the call instruction from the second program which is stored in the second storage area, and extracts the instruction identifier from the call instruction, (b) extracts the instruction address from the first program which is stored in the first storage area, the instruction address being included in the data set along with the same instruction identifier as the extracted instruction identifier, and (c) adds the extracted instruction address to the beginning location information to obtain the instruction location address.

3. The program linking apparatus of claim 1,

wherein the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; a reference table having a storage area designated for storage of a data set which includes the instruction identifier and the instruction location address;

absolute address creating means for (a) reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction, (b) extracting, from the first program stored in the first storage area, the data set that includes the same instruction identifier as the extracted instruction identifier, and extracting the instruction address from the extracted data set, and (c) adding the extracted instruction address to the beginning location information to produce the instruction location address;

reference table writing means for writing a data set which includes the extracted instruction identifier and the produced instruction location address into the reference table;

absolute address extraction means for (a) reading the call instruction from the second program stored in the second storage area, (b) extracting the instruction identifier from the call instruction, and (c) extracting, from the reference table, the instruction location address that is stored in association with the extracted instruction identifier to obtain the instruction location address.

4. The program linking apparatus of claim 1,

wherein the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a reference table having a storage area designated for storage of a data set which includes the instruction identifier and the instruction location address;

judging means for (a) reading the call instruction from the second program stored in the second storage area, (b) extracting the instruction identifier from the call instruction, and (c) judging whether the extracted instruction identifier exists in the reference table; and

registration means for, when the judging means determines that the extracted instruction identifier does not exist in the reference table, (a) extracting, from the first program stored in the first storage area, the data set that includes the same instruction identifier as the extracted instruction identifier, and extracting the instruction address from the extracted data set, (b) adding the extracted instruction address to the beginning location information to produce the instruction location address, and (c) writing a data set including the extracted instruction identifier and the produced instruction location address into the reference table;

wherein the executing means executes the executable instruction called by the call instruction, using the instruction location address produced by the registration means, and

wherein in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is executed,

the absolute address obtaining means further includes:

reading means for, when the judging means determines that the extracted instruction identifier exists in the reference table, reading the instruction location address that is in correspondence with the extracted instruction identifier from the reference table to obtain the instruction location address,

wherein the execution means further executes the executable instruction called by the call instruction, using the instruction location address obtained by the reading means.

5. The program linking apparatus of claim 1, wherein

the data set included in the first program stored in the first storage area further includes offset information, the offset information showing that the instruction address included in the data set is an offset address,

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a cache table having a storage area designated for storage of a data set which includes an address flag, the instruction identifier and the instruction address, the address flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the address flag indicates the offset address, the instruction address is the offset address, and when the address flag indicates the absolute address, the instruction address is the absolute address;

instruction identifier extracting means for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting means for judging whether the extracted instruction identifier exists in the cache table or not, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting the offset information and the instruction address from the first program stored in the first storage area, the offset information being included in the data set along with the same instruction identifier as the extracted instruction identifier;

absolute address creating means for, when the offset information extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address;

cache table writing means for, when the offset information extracted by the address extracting means indicates the offset address, writing the data set including the address flag which indicates the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the address flag, the instruction identifier and the instruction address,

wherein the executing means executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

wherein in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the address extracting means further extracts, from the cache table, the address flag and the instruction address associated with the extracted instruction identifier when it determines that the extracted instruction identifier exists in the cache table,

the absolute address creating means, when the address flag extracted by the address extracting means indicates the absolute address, further obtains the instruction location address, and

the executing means further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

6. The program linking apparatus of claim 1,

wherein the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a cache table having a storage area designated for storage of a data set including a writing flag, the instruction identifier and the instruction address, the writing flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the writing flag indicates the offset address, the instruction address is the offset address, and when the writing flag indicates the absolute address, the instruction address is the absolute address;

instruction identifier extracting means for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting means for judging whether the extracted instruction identifier exists in the cache table, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting, from the first program stored in the first storage area, the instruction address that is included in the data set along with the same instruction identifier as the extracted instruction identifier, and when it determines that the extracted instruction identifier exists in the cache table, extracting the writing flag and the instruction address that are associated with the extracted instruction identifier from the cache table;

absolute address creating means for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address; and

cache table writing means for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, writing the data set which includes the address flag indicating the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the writing flag, the instruction identifier and the instruction address,

wherein the executing means executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the absolute address creating means, when the writing flag extracted by the address extracting means indicates the absolute address, obtains the instruction location address by employing the instruction address as the instruction location address, and

the executing means further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

7. The program linking apparatus of claim 1, wherein

the second program further includes a variable instruction, the variable instruction including a variable identifier that identifies a variable and giving an instruction to perform an operation related to the variable,

the first program further has a variable area and stores a data set including the variable identifier that identifies the variable and a variable address, the data set being stored in correspondence with the variable area, the variable area being an area designated for storage of the variable, the variable address showing a location of the variable area in the first program,

the absolute address obtaining means further (a) obtains the variable identifier included in the variable instruction, (b) obtains the data set which includes the same variable identifier as the obtained variable identifier, and (c) obtains the instruction location address in the storage space of the variable area, in which the variable identified by the variable identifier included in the variable instruction is stored, using the beginning location information and the variable address included in the data set, and

the executing means further executes the variable instruction, using the variable area indicated by the obtained instruction location address, to perform the operation related to the variable.

8. A program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program liking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction;

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space, and for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing means for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction,

wherein,

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a reference table having a storage area designated for storage of a data set which includes the instruction identifier and the instruction location address;

judging means for (a) reading the call instruction from the second program stored in the second storage area, (b) extracting the instruction identifier from the call instruction, and (c) judging whether the extracted instruction identifier exists in the reference table; and

registration means for, when the judging means determines that the extracted instruction identifier does not exist in the reference table, (a) extracting, from the first program stored in the first storage area, the data set that includes the same instruction identifier as the extracted instruction identifier, and extracting the instruction address from the extracted data set, (b) adding the extracted instruction address to the beginning location information to produce the instruction location address, and (c) writing a data set including the extracted instruction identifier and the produced instruction location address into the reference table, wherein

the executing means executes the executable instruction called by the call instruction, using the instruction location address produced by the registration means, and

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is executed,

the absolute address obtaining means further includes:

reading means for, when the judging means determines that the extracted instruction identifier exists in the reference table, reading the instruction location address that is in correspondence with the extracted instruction identifier from the reference table to obtain the instruction location address,

wherein the execution means further executes the executable instruction called by the call instruction, using the instruction location address obtained by the reading means.

9. A program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction;

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space, and for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing means for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction,

wherein

the data set included in the first program stored in the first storage area further includes offset information, the offset information showing that the instruction address included in the data set is an offset address,

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a cache table having a storage area designated for storage of a data set which includes an address flag, the instruction identifier and the instruction address, the address flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the address flag indicates the offset address, the instruction address is the offset address, and when the address flag indicates the absolute address, the instruction address is the absolute address;

instruction identifier extracting means for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting means for judging whether the extracted instruction identifier exists in the cache table or not, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting the offset information and the instruction address from the first program stored in the first storage area, the offset information being included in the data set along with the same instruction identifier as the extracted instruction identifier;

absolute address creating means for, when the offset information extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address;

cache table writing means for, when the offset information extracted by the address extracting means indicates the offset address, writing the data set including the address flag which indicates the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the address flag, the instruction identifier and the instruction address, wherein

the executing means executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the address extracting means further extracts, from the cache table, the address flag and the instruction address associated with the extracted instruction identifier when it determines that the extracted instruction identifier exists in the cache table,

the absolute address creating means, when the address flag extracted by the address extracting means indicates the absolute address, further obtains the instruction location address, and

the executing means further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

10. A program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program lining apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction;

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space, and for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing means for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction,

wherein

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a cache table having a storage area designated for storage of a data set including a writing flag, the instruction identifier and the instruction address, the writing flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the writing flag indicates the offset address, the instruction address is the offset address, and when the writing flag indicates the absolute address, the instruction address is the absolute address;

instruction identifier extracting means for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting means for judging whether the extracted instruction identifier exists in the cache table, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting, from the first program stored in the first storage area, the instruction address that is included in the data set along with the same instruction identifier as the extracted instruction identifier, and when it determines that the extracted instruction identifier exists in the cache table, extracting the writing flag and the instruction address that are associated with the extracted instruction identifier from the cache table;

absolute address creating means for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address; and

cache table writing means for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, writing the data set which includes the address flag indicating the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the writing flag, the instruction identifier and the instruction address, wherein

the executing means executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the absolute address creating means, when the writing flag extracted by the address extracting means indicates the absolute address, obtains the instruction location address by employing the instruction address as the instruction location address, and

the executing means further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

11. A program linking method used in a program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction; and

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space, the program linking method, comprising:

an absolute address obtaining step for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing step for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction.

12. The program liking method of claim 11,

wherein the absolute address obtaining step (a) reads the call instruction from the second program which is stored in the second storage area, and extracts the instruction identifier from the call instruction, (b) extracts the instruction address from the first program which is stored in the first storage area, the instruction address being included in the data set along with the same instruction identifier as the extracted instruction identifier, and (c) adds the extracted instruction address to the beginning location information to obtain the instruction location address.

13. The program lining method of claim 11, wherein

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space;

a reference table having a storage area designated for storage of a data set which includes the instruction identifier and the instruction location address;

the absolute address obtaining step includes:

absolute address creating step for (a) reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction, (b) extracting, from the first program stored in the first storage area, the data set that includes the same instruction identifier as the extracted instruction identifier, and extracting the instruction address from the extracted data set, and (c) adding the extracted instruction address to the beginning location information to produce the instruction location address;

reference table writing step for writing a data set which includes the extracted instruction identifier and the produced instruction location address into the reference table;

absolute address extraction step for (a) reading the call instruction from the second program stored in the second storage area, (b) extracting the instruction identifier from the call instruction, and (c) extracting, from the reference table, the instruction location address that is stored in association with the extracted instruction identifier to obtain the instruction location address.

14. The program linking method of claim 11, wherein

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; and

a reference table having a storage area designated for storage of a data set which includes the instruction identifier and the instruction location address,

the absolute address obtaining step includes:

judging step for (a) reading the call instruction from the second program stored in the second storage area, (b) extracting the instruction identifier from the call instruction, and (c) judging whether the extracted instruction identifier exists in the reference table; and

registration step for, when the judging means determines that the extracted instruction identifier does not exist in the reference table, (a) extracting, from the first program stored in the first storage area, the data set that includes the same instruction identifier as the extracted instruction identifier, and extracting the instruction address from the extracted data set, (b) adding the extracted instruction address to the beginning location information to produce the instruction location address, and (c) writing a data set including the extracted instruction identifier and the produced instruction location address into the reference table, wherein

the executing step executes the executable instruction called by the call instruction, using the instruction location address produced by the registration means, and

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is executed,

the absolute address obtaining step further includes:

reading step for, when the judging means determines that the extracted instruction identifier exists in the reference table, reading the instruction location address that is in correspondence with the extracted instruction identifier from the reference table to obtain the instruction location address,

wherein the execution step further executes the executable instruction called by the call instruction, using the instruction location address obtained by the reading means.

15. The program lining apparatus of claim 11, wherein

the data set included in the first program stored in the first storage area further includes offset information, the offset information showing that the instruction address included in the data set is an offset address,

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; and

a cache table having a storage area designated for storage of a data set which includes an address flag, the instruction identifier and the instruction address, the address flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the address flag indicates the offset address, the instruction address is the offset address, and when the address flag indicates the absolute address, the instruction address is the absolute address,

the absolute address obtaining step includes:

instruction identifier extracting step for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting step for judging whether the extracted instruction identifier exists in the cache table or not, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting the offset information and the instruction address from the first program stored in the first storage area, the offset information being included in the data set along with the same instruction identifier as the extracted instruction identifier;

absolute address creating step for, when the offset information extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address; and

cache table writing step for, when the offset information extracted by the address extracting means indicates the offset address, writing the data set including the address flag which indicates the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the address flag, the instruction identifier and the instruction address,

wherein the executing step executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

wherein in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the address extracting step further extracts, from the cache table, the address flag and the instruction address associated with the extracted instruction identifier when it determines that the extracted instruction identifier exists in the cache table,

the absolute address creating step, when the address flag extracted by the address extracting means indicates the absolute address, further obtains the instruction location address, and

the executing step further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

16. The program linking method of claim 11,

wherein the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; and

a cache table having a storage area designated for storage of a data set including a writing flag, the instruction identifier and the instruction address, the writing flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the writing flag indicates the offset address, the instruction address is the offset address, and when the writing flag indicates the absolute address, the instruction address is the absolute address,

the absolute address obtaining step includes:

instruction identifier extracting step for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting step for judging whether the extracted instruction identifier exists in the cache table, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting, from the first program stored in the first storage area, the instruction address that is included in the data set along with the same instruction identifier as the extracted instruction identifier, and when it determines that the extracted instruction identifier exists in the cache table, extracting the writing flag and the instruction address that are associated with the extracted instruction identifier from the cache table;

absolute address creating step for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address; and

cache table writing step for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, writing the data set which includes the address flag indicating the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the writing flag, the instruction identifier and the instruction address,

wherein the executing step executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the absolute address creating step, when the writing flag extracted by the address extracting means indicates the absolute address, obtains the instruction location address by employing the instruction address as the instruction location address, and

the executing step further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

17. The program linking method of claim 11, wherein

the second program further includes a variable instruction, the variable instruction including a variable identifier that identifies a variable and giving an instruction to perform an operation related to the variable,

the first program further has a variable area and stores a data set including the variable identifier that identifies the variable and a variable address, the data set being stored in correspondence with the variable area, the variable area being an area designated for storage of the variable, the variable address showing a location of the variable area in the first program,

the absolute address obtaining step further (a) obtains the variable identifier included in the variable instruction, (b) obtains the data set which includes the same variable identifier as the obtained variable identifier, and (c) obtains the instruction location address in the storage space of the variable area, in which the variable identified by the variable identifier included in the variable instruction is stored, using the beginning location information and the variable address included in the data set, and

the executing step further executes the variable instruction, using the variable area indicated by the obtained instruction location address, to perform the operation related to the variable.

18. A program linking method used in a program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction; and

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space,

the program linking method, comprising:

an absolute address obtaining step for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing step for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction,

wherein

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; and

a reference table having a storage area designated for storage of a data set which includes the instruction identifier and the instruction location address,

the absolute address obtaining step includes:

judging step for (a) reading the call instruction from the second program stored in the second storage area, (b) extracting the instruction identifier from the call instruction, and (c) judging whether the extracted instruction identifier exists in the reference table; and

registration step for, when the judging means determines that the extracted instruction identifier does not exist in the reference table, (a) extracting, from the first program stored in the first storage area, the data set that includes the same instruction identifier as the extracted instruction identifier, and extracting the instruction address from the extracted data set, (b) adding the extracted instruction address to the beginning location information to produce the instruction location address, and (c) writing a data set including the extracted instruction identifier and the produced instruction location address into the reference table, wherein

the executing means executes the executable instruction called by the call instruction, using the instruction location address produced by the registration means, and

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is executed,

the absolute address obtaining step further includes:

reading step for, when the judging means determines that the extracted instruction identifier exists in the reference table, reading the instruction location address that is in correspondence with the extracted instruction identifier from the reference table to obtain the instruction location address,

wherein the execution step further executes the executable instruction called by the call instruction, using the instruction location address obtained by the reading means.

19. A program linking method used in a program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction; and

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space,

the program linking method, comprising:

an absolute address obtaining step for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing step for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction,

wherein

the data set included in the first program stored in the first storage area further includes offset information, the offset information showing that the instruction address included in the data set is an offset address,

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; and

a cache table having a storage area designated for storage of a data set which includes an address flag, the instruction identifier and the instruction address, the address flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the address flag indicates the offset address, the instruction address is the offset address, and when the address flag indicates the absolute address, the instruction address is the absolute address,

the absolute address obtaining step includes:

instruction identifier extracting step for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting step for judging whether the extracted instruction identifier exists in the cache table or not, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting the offset information and the instruction address from the first program stored in the first storage area, the offset information being included in the data set along with the same instruction identifier as the extracted instruction identifier;

absolute address creating step for, when the offset information extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address; and

cache table writing step for, when the offset information extracted by the address extracting means indicates the offset address, writing the data set including the address flag which indicates the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the address flag, the instruction identifier and the instruction address,

wherein the executing step executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

wherein in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the address extracting step further extracts, from the cache table, the address flag and the instruction address associated with the extracted instruction identifier when it determines that the extracted instruction identifier exists in the cache table,

the absolute address creating step, when the address flag extracted by the address extracting means indicates the absolute address, further obtains the instruction location address, and

the executing step further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

20. A program linking method used in a program linking apparatus for linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction; and

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space, the program linking method, comprising:

an absolute address obtaining step for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing step for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction,

wherein

the absolute address obtaining means includes:

location information storing means for storing the beginning location information that shows the absolute address of the beginning location of the first program in the storage space; and

a cache table having a storage area designated for storage of a data set including a writing flag, the instruction identifier and the instruction address, the writing flag showing whether the instruction address is the offset address or the absolute address, the instruction identifier identifying the executable instruction, the instruction address showing the location of the executable instruction in the first program, wherein when the writing flag indicates the offset address, the instruction address is the offset address, and when the writing flag indicates the absolute address, the instruction address is the absolute address,

the absolute address obtaining step includes:

instruction identifier extracting step for reading the call instruction from the second program stored in the second storage area, and extracting the instruction identifier from the call instruction;

address extracting step for judging whether the extracted instruction identifier exists in the cache table, and when it determines that the extracted instruction identifier does not exist in the cache table, extracting, from the first program stored in the first storage area, the instruction address that is included in the data set along with the same instruction identifier as the extracted instruction identifier, and when it determines that the extracted instruction identifier exists in the cache table, extracting the writing flag and the instruction address that are associated with the extracted instruction identifier from the cache table;

absolute address creating step for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, adding the extracted instruction address to the beginning location information to obtain the instruction location address; and

cache table writing step for, when the address extracting means determines that the extracted instruction identifier does not exist in the cache table or when the writing flag extracted by the address extracting means indicates the offset address, writing the data set which includes the address flag indicating the absolute address, the extracted instruction identifier and the instruction location address, into the cache table, as the data set of the writing flag, the instruction identifier and the instruction address,

wherein the executing step executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means,

in the program linking apparatus, after the executable instruction is executed, the executable instruction called by the call instruction is further executed,

the absolute address creating step, when the writing flag extracted by the address extracting means indicates the absolute address, obtains the instruction location address by employing the instruction address as the instruction location address, and

the executing step further executes the executable instruction called by the call instruction, using the instruction location address obtained by the absolute address creating means.

21. A computer program that is recorded on a computer-readable recording medium for use in a program linking apparatus, the program linking apparatus linking and executing one program with another program using a microprocessor, the program linking apparatus comprising:

a first read only semiconductor memory having a first storage area which stores a first program, the first storage area being located in a storage space within the program linking apparatus, the storage space being represented by an absolute address system, wherein the first program includes an executable instruction and a data set associated with the executable instruction, the data set consisting of an instruction identifier which identifies the executable instruction and an instruction address which shows a location of the executable instruction in the first program, the instruction address being an offset address showing a location of the executable instruction relative to a beginning location of the first program;

a second read only semiconductor memory having a second storage area which stores a second program, the second storage area being located in the storage space so as not to overlap the first storage area, wherein the second program includes a call instruction which calls the executable instruction, the call instruction including an instruction identifier that identifies the executable instruction; and

absolute address obtaining means for storing beginning location information that shows an absolute address of the beginning location of the first program in the storage space,

the computer program comprising:

absolute address obtaining step for having the microprocessor (a) obtain the instruction identifier which is included in the call instruction in the second program, (b) obtain the data set in the first program that includes the same instruction identifier as the obtained instruction identifier, and (c) obtain an instruction location address that shows a location of the executable instruction in the storage space, using the instruction address included in the obtained data set and the beginning location information; and

executing step for having the microprocessor execute the executable instruction stored in the location shown by the obtained instruction location address, to execute the executable instruction called by the call instruction.


Description

This application is based on an application No. 10-302998 filed in Japan, the content of which is hereby incorporated by reference.

BACKGROUND OF THE INVENTION

(1) Field of the Invention

The present invention relates to a program linking apparatus and a program linking method for linking a plurality of programs that are stored in a plurality of read only semiconductor memories and for referring to subroutines and data.

(2) Description of the Related Art

It has been necessary for embedded microcomputer control systems that store program instructions in read only semiconductor memories (referred to "ROMs" in this specification) to add and partially replace software after sale due to the complication of the systems.

In this case, the size of the program to be added or replaced, or the size of the data to be used by the program changes, so that the addresses of subroutines in the program and the data that are to be used by the program also change. As a result, when subroutines and export symbols of the program to be added or replaced and remaining programs are referred to each other, the export symbols need to be linked.

Conventionally, programs recorded in ROMs are linked by indicating the locations of the export symbols in a reference table that has been fixedly allocated in a ROM or a RAM using absolute addresses.

The structure of a conventional apparatus that links programs recorded in ROMs is shown in FIG. 48. The apparatus in FIG. 48 includes a ROM-A 101, a ROM-B 102, a RAM 103, a CPU bus 104, and a CPU 105. The ROM-A 101, the ROM-B 102, the RAM 103, and the CPU 105 are connected with each other by the CPU bus 104.

The ROM-A 101 stores a main step 110 and a program A 120. The ROM-B 102 stores a program B 130. The RAM 103 stores data A 140 and data B 150. The CPU 105 executes the programs stored in the ROM-A 101 and the ROM-B 102.

The memory map and the contents of the program A 120 and the data A 140 that is used by the program A 120 are shown in FIG. 49. As shown in FIG. 49, the program A 120 includes a symbol table A 121 and a program instruction part A 122. The symbol table A 121 stores absolute addresses 123, 124, 125, and 126. The absolute addresses 123 and 124 indicate the locations of code export symbols, symbols A 127 and B 128, respectively. The absolute addresses 125 and 126 indicate the locations of data export symbols, symbols C 141 and 0142, respectively. The absolute addresses that indicate the locations of the absolute addressed 123, 124, 125, and 126 are "0X01000", "0X010004", "0X010008", and "0X01000C", respectively. The program instruction part A 122 stores a program block that is identified by the symbol A 127 and another program block that is identified by the symbol B 128. The absolute addresses that indicate the locations of the symbols A 127 and B 128 are "0X010010" and "0X010200", respectively. The data A 140 stores a data block that is identified by the symbol C 141 and another data block that is identified by the symbol D 142. The absolute address that indicates the location of the leading data of the data A 140 is "0X11000". The absolute addresses of the locations of the symbols C 141 and D 142 are "0X110500" and "0X110600", respectively. In this specification, the character string "0X" indicates that the following character string is a hexadecimal numeral.

The memory map and the contents of the program B 130 and the data B 150 that is used by the program B 130 are shown in FIG. 50. As shown in FIG. 50, the program B 130 includes a symbol table B 131 and a program instruction part B 132. The symbol table B 131 stores absolute addresses 133, 134, 135, and 136. The program instruction part B 132 stores program blocks that are identified by symbols E 137 and F 138. The data B 150 stores data blocks that are identified by symbols G 151 and H 152. Note that the structure of the program B 130 is the same as the program A 120 and the structure of the data B 150 is the same as the data A 140. More detailed explanation of the program B 130 and the data B 150 will not be given here.

An explanation of operations by the program stored in the main step 110 will be given with reference to the flowchart in FIG. 51. The principle objective of the main step 110 is to control the program block that is identified by the symbol A 127 and the program block that is identified by the symbol E 137 so that the program blocks are executed in this order.

In the main step 110, the content of the address "0X010000", where the absolute address of the symbol A 127 is stored, is extracted and the extracted content is substituted into a variable "ptra" (step s401) The content of the address "0X020000", where the absolute address of the symbol E 137 is stored, is extracted and the extracted content is substituted into a variable "ptre" (step s402). Then, the address that the variable "ptra" indicates is called (step s403), and the address that the variable "ptre" indicates is called (step s404).

FIG. 52 shows a program that is stored in the program block indicated by the symbol A 127 in the C language. The principle objective of this program is to execute the program block that is identified by the symbol F 138, to substitute a variable "XXXXX" into the data block that is identified by the symbol G 151, and to substitute a variable "YYYYY" into the data block that is identified by the symbol H 152.

In FIG. 52, the symbol A is defined in a line 501, the content of the address "0X020004", where the absolute address of the symbol F is stored, is substituted into a variable "ptrf" in a line 502, the content of the address "0X020008", where the absolute address of the symbol G is stored, is substituted into a variable "ptrg" in a line 503, the content of the address "0X02000C", where the absolute address of the symbol H is stored, is substituted into a variable "ptrh" in a line 504, the address that the variable "ptrf" indicates is called in a line 505, the variable "XXXXX" is substituted into the address that the variable "ptrg" indicates in a line 506, the variable "YYYYY" is substituted into the address that the variable "ptrh" indicates in a line 507, and a return is performed in a line 508.

FIG. 53 shows a program that is stored in the program block indicated by the symbol E 137 in the C language. The principle objective of this program is to execute the program block that is identified by the symbol B 128, to substitute a variable "ZZZZZ" into the data block that is identified by the symbol C 141, and to substitute a variable "OOOOO" into the data block that is identified by the symbol D 142. The structure of the program in FIG. 53 is the same as the program in FIG. 52. More detailed explanation will not be given here.

As has been described, the export symbols in programs can be linked to each other by indicating the locations of the export symbols using the absolute addresses in a reference table that has been fixedly allocated in a ROM or a RAM.

According to the aforementioned conventional linking method of programs in a ROM, the export symbols can be statically linked to each other. On the other hand, the locations of the export symbols for mutual reference among programs are indicated using absolute addresses in a reference table that is allocated in a ROM or a RAM, and the absolute addresses of the symbols of a program on the export end are embedded in a program on the import end. As a result, the arrangement of the program on the export end needs to be fixed in the memory space. Meanwhile, the addresses corresponding to symbols are stored using absolute addresses in the reference table, so that the arrangement of the program on the import end needs to be fixed in the memory space. Under the circumstances, a program that is recorded in a ROM is dependent on the memory map of one embedded microcomputer control system, and a program that has been recorded in a ROM in one system cannot be shared by another system having a different memory map.

SUMMARY OF THE INVENTION

It is accordingly the object of the present invention to provide a program linking apparatus, a program linking method, and a storage medium that stores a program linking program that enable the content of a program recorded in a ROM to be independent of the memory map of an embedded microcomputer control system and to be shared by another system having a different memory map.

The above-mentioned object may be achieved by a program linking apparatus that includes a plurality of read only semiconductor memories, the read only semiconductor memories having storage areas, which are located in one storage space indicated with one address system, a storage area including at least one program, the program linking apparatus that links and executes a program in one storage area and a program in another storage area, the program linking apparatus that may include: a first semiconductor memory for including a first storage area, which is located in the storage space, the first storage area storing a first program, which has at least one executable instruction and at least one set, each of which corresponds to a different executable instruction and includes an instruction identifier, which identifies a corresponding executable instruction, and an instruction address, which shows a location in the first program of an area where the corresponding executable instruction is stored and is an offset address indicating a relative location with reference to a beginning location of the first program; a second semiconductor memory for including a second storage area, which is located in the storage space and does not overlap the first storage area, the second storage area storing a second program, which has at least one call instruction, each of which calls an executable instruction and includes an instruction identifier for identifying the executable instruction to be called; an absolute address obtaining unit for storing location information, which indicates the beginning location of the first program in the storage space using an absolute address, and for obtaining an absolute address in the storage space where an executable instruction identified by an instruction identifier in a call instruction is stored using the location information and an instruction address that forms one set with the instruction identifier in the call instruction, wherein an absolute address is an address indicated with the first address system; and an executing unit for executing the executable instruction that has been called with the call instruction by executing an executable instruction that is stored in an area indicated by the absolute address that has been obtained.

In the program linking apparatus, a program containing at least one executable instruction and an offset addresses storing the executable instruction are stored in a predetermined location of the first ROM, and another program containing a call instruction that calls the executable instruction is stored in a predetermined location of the second ROM. In addition, whenever the executable instruction is called by the call instruction, an absolute address where the executable instruction is stored is obtained using the offset address and the location information on the location of the first ROM, and the executable instruction is executed using the absolute address, so that symbols can be linked between the programs. As a result, the programs need not to store the absolute addresses in themselves, and the programs recorded in a ROM are independent of the memory map of an embedded microcomputer control system and can be shared by another system having a different memory map.

The above-mentioned object may be also achieved by the program linking apparatus, wherein the absolute address obtaining unit (1) reads the call instruction from the second storage area and extracts the instruction identifier in the read call instruction, (2) extracts the instruction address from the first storage area that forms one set with an instruction identifier in the first storage area matching the extracted instruction identifier, and (3) adds the location information and the extracted instruction address together to obtain the absolute address in the storage space.

In the program linking apparatus, the offset address and the location information on the location of the first ROM are added together, and the addition result is set as the absolute address. As a result, the absolute address can be obtained by a simple calculation.

The above-mentioned object may be also achieved by the program linking apparatus, wherein the absolute address obtaining unit includes: a reference table;

an absolute address creating unit for reading one call instruction from the second storage area, extracting an instruction identifier in the read call instruction, extracting an instruction address from the first storage area that forms one set with an instruction identifier in the first storage area matching the extracted instruction identifier, and adding the location information and the extracted instruction address together to create an absolute address in the storage space; a reference table writing unit for writing a set of the extracted instruction identifier and the created absolute address in the reference table; a repetition control unit for controlling the absolute address creating unit and the reference table writing unit for the call instructions in the second storage area so that extraction of an instruction identifier, creation of an absolute address, and writing in the reference table are repeated; and an absolute address extraction unit for reading a call instruction from the second storage area, extracting an instruction identifier in the read call instruction, and obtaining an absolute address in the storage space by extracting an absolute address that corresponds to the extracted instruction identifier from the reference table.

In the program linking apparatus, the absolute address of the areas where the executable instructions are stored have been calculated, the reference table has stored all the sets of an instruction identifier and an absolute addresses, and whenever the executable instruction is called by the call instruction, a corresponding absolute address is read from the reference table and the executable instruction is executed using the read absolute address. As a result, the offset address needs not to be converted into an absolute address whenever the executable instruction is called, and the obtainment of the absolute address can be sped up.

The above-mentioned object may be also achieved by the program linking apparatus, wherein the absolute address obtaining unit includes: a reference table that includes an area for storing a predetermined number of sets of an instruction identifier and an absolute address; a judging unit for reading a call instruction from the second storage area, extracting an instruction identifier from the read call instruction, and judging whether the extracted instruction identifier is included in the reference table; a registration unit for extracting an instruction address that forms one set with an instruction identifier in the first storage area matching the extracted instruction identifier from the first storage. area, adding the location information and the extracted instruction address to obtain the absolute address in the storage space, and for writing a set of the extracted instruction identifier and the created absolute address in the reference table when the judging unit judges that the extracted instruction identifier is not included in the reference table; and a reading unit for obtaining the absolute address in the storage space by reading an absolute address that corresponds to the extracted instruction identifier from the reference table when the judging unit judges that the extracted instruction identifier is included in the reference table.

The program linking apparatus is provided with the reference table that has the area for storing a predetermined number of sets of an instruction identifier and an absolute address, and whenever the executable instruction is called by the call instruction, it is judged whether the instruction identifier that identifies the executable instruction is included in the reference table. When the instruction identifier is not included in the reference table, the offset address and the location information on the location of the first ROM are added together to obtain the absolute address, and the set of the instruction identifier and the absolute address is written in the reference table. When the instruction identifier is included in the reference table, the absolute address is read from the reference table, and the executable instruction is executed using the obtained, absolute address As a result, all the sets of an instruction identifier and an absolute address need not to be stored in the memory, so that the conversion from an offset address into an absolute address can be sped up and the necessary memory size can be reduced.

The above-mentioned object may be also achieved by the program linking apparatus, wherein each of the sets that are stored in the first storage area further includes an address flag, which indicates that an instruction address in the same set is an offset address, and the absolute address obtaining unit includes: a cache table that has an area for storing a predetermined number of sets of an address flag, an instruction identifier, and an instruction address, wherein an address flag indicates whether an instruction address in the same set is an offset address or an absolute address, an instruction identifier identifies an executable instruction, an instruction address indicates a location of an area where a corresponding executable instruction is stored in the first program, and an instruction address is an offset address when a corresponding address flag indicates an offset address, and an instruction address is an absolute address when a corresponding address flag indicates an absolute address; an instruction identifier extracting unit for reading a call instruction from the second storage area and extracting an instruction identifier in the read call instruction; an address extracting unit for (1) judging whether the extracted instruction identifier is included in the cache table, (2) extracting an address flag and an instruction address that form one set with an instruction identifier matching the extracted instruction identifier from the first storage area when the extracted instruction identifier is not included in the cache table, and (3) extracting an address flag and an instruction address that correspond to the extracted instruction identifier from the cache table when the extracted instruction identifier is included in the cache table; an absolute address creating unit for (1) obtaining the absolute address in the storage space by adding the location information and the extracted instruction address together when the address flag that has been extracted by the address extracting unit indicates an offset address, and (2) obtaining the absolute address in the storage space by setting the extracted instruction address as the absolute address in the storage space when the address flag that has been extracted by the address extracting unit indicates an absolute address; and a cache table writing unit for writing an address flag that indicates an absolute address, the extracted instruction identifier, and the created absolute address in the cache table when the address flag that has been extracted by the address extracting unit indicates an offset address.

In the program linking apparatus, a program stored in the first ROM contains at least one executable instruction, instruction address that stores the executable instruction, and address flag, is provided with a cache table that has an area for storing a predetermined number of sets of an address flag, an instruction identifier, and an instruction address, and whenever the executable instruction is called by the call instruction, it is judged whether the instruction identifier that identifies the executable instruction is included in the cache table. When the instruction identifier is not included in the cache table, the offset address and the location information on the location of the first ROM are added together to obtain the absolute address. When the instruction identifier is included in the cache table, the corresponding address flag and instruction address are extracted from the cache table, it is judged whether the extracted address flag indicates absolute address or offset address. When the extracted instruction address is an offset address, the extracted instruction address and the location information on the location of the first ROM are added together to obtain the absolute address, and the address flag, instruction identifier, and instruction address are written in the cache table. When the extracted instruction address is an absolute address,,the extracted instruction address is used as the absolute address to be obtained. Since the executable instruction is executed using the obtained absolute address, the absolute address of the area of the executable instruction that has been converted in the previous reference may remain in the cache at the time of a following reference even though the sets of the export symbols and the corresponding addresses are not stored in the memory. As a result, the conversion from an offset address into an absolute address can be sped up.

The above-mentioned object may be also achieved by the program linking apparatus, wherein the absolute address obtaining unit includes: a cache table that has an area for storing a predetermined number of sets of a writing flag, an instruction identifier, and an instruction address, wherein a writing flag indicates whether an instruction address in the same set is an offset address or an absolute address, an instruction identifier identifies an executable instruction, an instruction address indicates a location of an area where a corresponding executable instruction is stored in the first program, and an instruction address is an offset address when a corresponding writing flag indicates an offset address, and an instruction address is an absolute address when a corresponding writing flag indicates an absolute address; an instruction identifier extracting unit for reading a call instruction from the second storage area and extracting an instruction identifier in the read call instruction; an address extracting unit for (1) judging whether the extracted instruction identifier is included in the cache table, (2) extracting an instruction address that forms one set with an instruction identifier matching the extracted instruction identifier from the first storage area when the extracted instruction identifier is not included in the cache table, and (3) extracting a writing flag and an instruction address that correspond to the extracted instruction identifier from the cache table when the extracted instruction identifier is included in the cache table; an absolute address creating unit for (1) obtaining the absolute address in the storage space by adding the location information and the extracted instruction address together one of when the extracted instruction identifier is not included in the cache table and when the writing flag that has been extracted by the address extracting unit indicates an offset address, and (2) obtaining the absolute address in the storage space by setting the extracted instruction address as the absolute address in the storage space when the writing flag that has been extracted by the address extracting unit indicates an absolute address; and a cache table writing unit for writing an address flag that indicates an absolute address, the extracted instruction identifier, and the created absolute address in the cache table one of when the extracted instruction identifier is not included in the cache table and when the writing flag that has been extracted by the address extracting unit indicates an offset address.

The program linking apparatus is provided with a cache table having an area for storing a predetermined number of sets of a writing flag, an instruction identifier, and an instruction address, and judges whether the instruction identifier that identifies the executable instruction is included in the cache table whenever the executable instruction is called by the call instruction. When the instruction identifier is not included in the cache table, the offset address and the location information on the location of the first ROM are added together to obtain the absolute address. When the instruction identifier is included in the cache table, the corresponding writing flag and instruction address are extracted from the cache table, and it is judged whether the extracted writing flag indicates absolute address or offset address. When the extracted instruction address is an offset address, the extracted instruction address and the location information on the location of the first ROM are added together to obtain the absolute address, and the writing flag, instruction identifier, and instruction address are written in the cache table. When the extracted instruction address is an absolute address, the extracted instruction address is used as the absolute address to be obtained. Since the executable instruction is executed using the obtained absolute address, the absolute address of the area of the executable instruction that has been converted in the previous reference may remain in the cache at the time of a following reference even though the sets of the export symbols and the corresponding addresses are not stored in the memory. As a result, the conversion from an offset address into an absolute address can be sped up. In addition, the writing flag in the cache table shows whether the address information on the area of the executable instruction is an offset address or an absolute address, so that the export symbol table can be simplified and the export symbol table used in the system that is provided with no cache device can be used. As a result, the same programs can be used regardless of whether a system is provided with a cache device.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other objects, advantages and features of the invention will become apparent from the following description thereof taken in conjunction with the accompanying drawings which illustrate a specific embodiment of the invention. In the Drawings;

FIG. 1 is a block diagram showing the structure of a program linking apparatus 1000 according to the first embodiment of the present invention;

FIG. 2 is a flowchart illustrating the procedure of operations in the main step by the program linking apparatus 1000;

FIG. 3 shows the structure of a program A and data A in the program linking apparatus 1000;

FIG. 4 shows a program block that is part of the program A in the program linking apparatus 1000;

FIG. 5 shows the structure of a program B and data B in the program linking apparatus 1000;

FIG. 6 shows a program block that is part of the program B in the program linking apparatus 1000;

FIG. 7 shows the arrangement of a jump table and an export symbol import step by the program linking apparatus 1000;

FIG. 8 is a flowchart illustrating operations by a CPU in the program linking apparatus 1000;

FIG. 9 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 1000;

FIG. 10 is a block diagram showing the structure of a program linking apparatus 2000 according to the second embodiment of the present invention;

FIG. 11 is a flowchart illustrating the procedure of operations in the main step by the program linking apparatus 2000;

FIG. 12 shows the arrangement of a jump table and an export symbol import step by the program linking apparatus 2000;

FIG. 13 shows the structure of an export symbol reference table in the program linking apparatus 2000;

FIG. 14 is a flowchart illustrating operations in an export symbol registration step by the program linking apparatus 2000;

FIG. 15 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 2000;

FIG. 16 is a block diagram showing the structure of a program linking apparatus 3000 according to the third embodiment of the present invention;

FIG. 17 is a flowchart illustrating the procedure of operations in the main step by the program linking apparatus 3000;

FIG. 18 shows the arrangement of a jump table and an export symbol import step by the program linking apparatus 3000;

FIG. 19 shows an example of the structure of an export symbol reference cache in the program linking apparatus 3000;

FIG. 20 shows an example of the structure of the export symbol reference cache in the program linking apparatus 3000 when the export symbol reference cache is initialized;

FIG. 21 shows an example of the structure of the export symbol reference cache in the program linking apparatus 3000 when data is written in the export symbol reference cache;

FIG. 22 is a flowchart illustrating operations in an export symbol reference cache initialization step by the program linking apparatus 3000;

FIG. 23 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 3000;

FIG. 24 is a block diagram showing the structure of a program linking apparatus 4000 according to the fourth embodiment of the present invention;

FIG. 25 is a flowchart illustrating the procedure of operations in the main step by the program linking apparatus 4000;

FIG. 26 shows the structure of a program A and data A in the program linking apparatus 4000;

FIG. 27 shows the structure of a program B and data B in the program linking apparatus 4000;

FIG. 28 shows the internal state of a cache device in the program linking apparatus 4000;

FIG. 29 shows the internal state of a cache device in the program linking apparatus 4000 when data is written in the cache device;

FIG. 30 shows the internal state of a cache device in the program linking apparatus 4000 when data is further written in the cache device;

FIG. 31 shows the arrangement of a jump table and an export symbol import step by the program linking apparatus 4000;

FIG. 32 is a flowchart illustrating operations in a cache initialization step by the program linking apparatus 4000;

FIG. 33 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 4000;

FIG. 34 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 4000 following the operations in FIG. 33;

FIG. 35 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 4000;

FIG. 36 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 4000 following the operations in FIG. 35;

FIG. 37 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 4000;

FIG. 38 is a block diagram showing the structure of a program linking apparatus 5000 according to the fifth embodiment of the present invention;

FIG. 39 shows the structure of a program A and data A in the program linking apparatus 5000;

FIG. 40 shows the structure of a program B and data B in the program linking apparatus 5000;

FIG. 41 shows the internal state of a cache device in the program linking apparatus 5000 when data is written in the cache device;

FIG. 42 shows the internal state of a cache device in the program linking apparatus 5000 when data is further written in the cache device;

FIG. 43 shows the arrangement of a jump table and an export symbol import step by the program linking apparatus 5000;

FIG. 44 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 5000;

FIG. 45 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 5000 following the operations in FIG. 44;

FIG. 46 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 5000;

FIG. 47 is a flowchart illustrating operations in the export symbol import step by the program linking apparatus 5000 following the operations in FIG. 46;

FIG. 48 is a block diagram showing the structure of a conventional program linking apparatus;

FIG. 49 shows the structure of a program A and data A in the conventional program linking apparatus;

FIG. 50 shows the structure of a program B and data B in the conventional program linking apparatus;

FIG. 51 is a flowchart illustrating the procedure of operations in the main step by the conventional program linking apparatus;

FIG. 52 shows a program block that is part of the program A in the conventional program linking apparatus; and

FIG. 53 shows a program block that is part of the program B in the conventional program linking apparatus.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

Explanations of the embodiments of the present invention will be given below.

1. The First Embodiment

An explanation of a program linking apparatus 1000 as an embodiment of the present invention will be given below.

1.1. Structure of Program Linking apparatus 1000

The programs linking apparatus 1000 includes a CPU 1105, a ROM-A 1101, a ROM-B 1102, and a RAM 1103.

The ROM-A 1101, the ROM-B 1102, the RAM 1103, and the CPU 1105 are connected with each other by a CPU bus 1104.

The storage areas of the ROM-A 1101, the ROM-81102, and the RAM 1103 are located in one address space (storage space) that is addressed in one address system. As a result, the CPU 1105 can access to data stored in the ROM-A 1101, the ROM-B 1102, and the RAM 1103 using one kind of address, which is called "absolute address".

1.1.1. CPU 1105

The CPU 1105 is a semiconductor device that includes a register,. an arithmetic circuit, and a control circuit. The CPU 1105 decodes commands, performs arithmetic, communicates data between storage devices, performs control, and the like.

The CPU 1105 reads commands stored in the ROM-A 1101, the ROM-B 1102, and the RAM 1103, decodes the read commands, and executes the decoded commands. The CPU 1105 reads data stored in the ROM-A 1101, the ROM-B 1102, and the RAM 1103, and writes data in the RAM 1103.

1.1.2. ROM-A 1101

The ROM-A 1101 is composed of a read only semiconductor memory. In the storage space of the ROM-A 1101, a main step 1110, an export symbol import step 1160, and a program A 1120 are recorded.

1.1.2.1. Main Step 1110

The main step 1110 is located in the address space from the area indicated by an absolute address "0X000000".

As shown by the flowchart in FIG. 2, the main step 1110 includes procedures given below. A jump command to the export symbol import step 1160 is stored in a jump table 1170 (step s1201). The export symbol import step 1160 is called with the identifier "ID-A" of a symbol A as the argument, the absolute address where the symbol A is stored is calculated, the absolute address where the symbol A is stored is stored in a variable "ptra" (step s1202), and the symbol A is called using the variable "ptra" (step s1203). The export symbol import step 1160 is called with the identifier "ID-E" of a symbol E as the argument, the absolute address where the symbol E is stored is calculated, the absolute address where the symbol E is stored is stored in a variable "ptre" (step s1204), and the symbol E is called using the variable "ptre" (step s1205).

The main step 1110 aims to execute program blocks that are identified with the symbols A and E.

Note that more detailed explanations of the symbols A and E, identifiers "ID-A" and "ID-E", and program blocks that are identified with symbols A and E will be given later.

1.1.2.2. Export Symbol Import Step 1160

The export symbol import step 1160 is located in the address space from the area indicated by an absolute address "0X002000".

The export symbol import step 1160 is called from another program with the identifier of a symbol as the argument. When the export symbol import step 1160 is called from another program with the identifier of a symbol as the argument, in the export symbol import step 1160, the identifier of the symbol is received from the other program, an identifier that matches the received identifier is retrieved from an export symbol offset table A 1123 or an export symbol offset table B 1133. Then, the offset corresponding to the retrieved identifier is fetched, predetermined arithmetic is executed on the fetched offset, an absolute address is created, and the created absolute address is output to the other program.

Note that a more detailed explanation of the export symbol offset table A 1123 and the export symbol offset table B 1133 will be given later.

Symbols come in code symbols for identifying commands and data symbols for identifying data. When a symbol is a code symbol, an absolute address is created using a code export symbol offset table A 1128 or a code export symbol offset table B 1138 in the export symbol import step 1160. When a symbol is a data symbol, an absolute address is created using a data export symbol offset table A 1129 or a data export symbol offset table B 1139 in the export symbol import step 1160.

Note that as described later, the code export symbol offset table A 1128 and the data export symbol offset table A 1129 are included in the export symbol offset table A 1123, and the code export symbol offset table B 1138 and the data export symbol offset table B 1139 are included in the export symbol offset table B 1133.

Here, the predetermined arithmetic for creating an absolute address from an offset corresponding to an identifier will be given.

When a symbol is a code symbol, the absolute address is calculated using an Expression 1.

absolute address=fetched offset+0X010000*k+0X010000 (Expression 1)

Here, the coefficient "k" is the number identifying a program. The coefficient "k" is "0" for the program A and "1" for program B.

An absolute address can be calculated according to the arithmetic shown in the Expression 1 because the program A and the program B are stored in the areas started from the absolute addresses "0X010000" and "0X020000" in the address space, respectively. In other words, this is because the first program is stored in a predetermined absolute address and the following program is stored at a predetermined interval.

When a symbol is a data symbol, the absolute address is calculated using an Expression 2.

absolute address fetched offset+0X010000* k+0X110000 (Expression 2)

Here, as in the case of the Expression 1, the coefficient "k" is the number identifying a program. The coefficient "k" is "0" for the program A and "1" for program B.

An absolute address can be calculated according to the arithmetic shown in the Expression 2 because the data A and the data B are stored in the areas started from the absolute addresses "0X110000" and "0X120000" in the address space, respectively. In other words, this is because the first data is stored in a predetermined absolute address and the following data is stored at a predetermined interval.

1.1.2.3. Program A 1120

The program A 1120 includes a program header A 1121, a program instruction part A 1122, and the export symbol offset table A 1123 as shown in FIG. 1.

The program A 1120 is located in the address space from the area indicated by the absolute address "0X010000".

(1) Program Header A 1121

The program header A 1121 is located from the top of the program A 1120, and includes an offset 1124, which indicates the location where the code export symbol offset table A 1128 starts, and an offset 1125, which indicates the location where the data export symbol offset table A 1129 starts, as shown in FIG. 3. Here, an offset is an address with reference to the location where the program A 1120 starts.

As shown in FIG. 3, the offset 1124 is "0X001000", which is the address indicating the starting location of the code export symbol offset table A 1128 in the program A 1120, and the offset 1125 is "0X001010", which is the address indicating the starting location of the data export symbol offset table A 1129 in the program A 1120.

(2) Program Instruction Part A 1122

As shown in FIG. 3, the program instruction part A 1122 is located in the area following the program header A 1121, and includes at least one program block composed of at least one command. In FIG. 3, the program instruction part A 1122 includes two program blocks, which each are identified by symbols A 1126 and B 1127, respectively.

The symbol A 1126 is stored in the area indicated by the absolute address "0X010008", and the symbol B 1127 is stored in the area indicated by an absolute address "0X010200".

(Program Block Identified by Symbol A 1126)

An example of the program block that is identified by the symbol A 1126 is shown in FIG. 4. In FIG. 4, a program block identified by the symbol A 1126 is expressed in the language C.

The program block includes lines 1309, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, and other lines that are not illustrated.

In a line 1309, the symbol A is described.

The line 1301 shows that an absolute address "0X100000" is substituted into a varible "import". The address "0X100000" is the absolute address of the jump table 1170.

The line 1302 shows that a function indicated by the variable "import" is called using the identifier "ID-F" as the argument, the absolute address of the symbol F is obtained as the returned value, and the obtained returned value is substituted into the variable "ptrf".

The line 1303 shows that the address indicated by the variable "ptrf", into which the returned value has been substituted, is called.

The line 1304 shows that the function indicated by the variable "import" is called using the identifier "ID-G" as the argument, the absolute address of the symbol G is obtained as the returned value, and the returned value is substituted into the variable "ptrg".

The line 1305 shows that the variable "XXXXX" is substituted into the area represented by the address that is indicated by the varible "ptrg", into which the returned value has been substituted.

The line 1306 shows that the function indicated by the variable "import" is called using the identifier "ID-H" as the argument, the absolute address of the symbol H is obtained as the returned value, and the returned value is substituted into the variable "ptrh".

The line 1307 shows that the variable "YYYYY" is substituted into the area represented by the address that is indicated by the varible "ptrh", into which the returned value has been substituted.

The line 1308 shows that the control is returned to the program block that has called this program block.

As has been described, when the program block that is identified by the symbol A 1126 is executed, the program block identified by the symbol F is called and executed, the value of the variable "XXXXX" is substituted into the data block identified by the symbol C, and the value of the variable "YYYYY" is substituted into the data block identified by the symbol H.

(Program Block Identified by Symbol B 1127)

Not illustrated, the program block that is identified by the symbol B 1127 includes a plurality of commands as in the case of the program block that is identified by the symbol A 1126.

(3) Export Symbol Offset Table A 1123

The export symbol offset table A 1123 includes the code export symbol offset table A 1128 and the data export symbol offset table A 1129.

The export symbol offset table A 1123 is located in the address space from the area indicated by an absolute address "0X011000".

(Code Export Symbol Offset Table A 1128)

The code export symbol offset table A 1128 is located in the address space from the area indicated by the absolute address "0X011000".

The code export symbol offset table A 1128 stores sets of the identifiers of code symbols and offsets of the areas where the code symbols are stored.

More specifically, the code export symbol offset table A 1128 stores a set of the identifier 1181 "ID-A" and the offset 1186 "0X000008" of the symbol A and a set of the identifier 1182 "ID-B" and the offset 1187 "0X000200" of the symbol B as shown in FIG. 3.

(Data Export Symbol Offset Table A 1129)

The data export symbol offset table A 1129 is located in the address space from the area indicated by an absolute address "0X011010".

The data export symbol offset table A 1129 stores sets of the identifiers of data symbols and offsets of the areas where the data symbols are stored.

Here, an offset is an address with reference to the location where the data A starts.

More specifically, the data export symbol offset table A 1129 stores a set of the identifier 1183 "ID-C" and the offset 1188 "0X000500" of the symbol C and a set of the identifier 1184 "ID-D" and the offset 1189 "0X000600" of the symbol D as shown in FIG. 3.

1.1.3. ROM-B 1102

The ROM-B 1102 is composed of a read only semiconductor memory. In the storage area of the ROM-B 1102, a program B 1130 is recorded.

1.1.3.1. Program B 1130

The program B 1130 includes a program header B 1131, a program instruction part B 1132, and the export symbol offset table B 1133 as shown in FIG. 1.

The program B 1130 is located in the address space from the area indicated by the absolute address "0X020000".

(1) Program Header B 1131

The program header B 1131 is located from the top of the, program B 1130, and includes an offset 1134, which indicates the location where the code export symbol offset table B 1138 starts, and an offset 1155, which indicates the location where the data export symbol offset table B 1139 starts, as shown in FIG. 5. Here, an offset is an address with reference to the location where the program B 1130 starts.

As shown in FIG. 5, the offset 1123 is "0X002000", which is the address indicating the starting location of the code export symbol offset table B 1138 in the program B 1130, and the offset 1135 is "0X002010", which is the address indicating the starting location of the data export symbol offset table B 1139 in the program B 1130.

(2) Program Instruction Part B 1132

As shown in FIG. 5, the program instruction part B 1132 is located in the area following the program header B 1131, and includes at least one program block composed of at least one command. In FIG. 5, the program instruction part B 1132 includes two program blocks, which each are identified by symbols E 1136 and F 1137, respectively.

The symbol E 1136 is stored in the area indicated by the absolute address "0X020008", and the symbol F 1137 is stored in the area indicated by an absolute address "0X020400".

(Program Block Identified by Symbol E 1136)

An example of the program block that is identified by the symbol E 1136 is shown in FIG. 6. In FIG. 6, a program block identified by the symbol E 1136 is expressed in the language C.

The program block includes lines 1409, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, and other lines that are not illustrated.

The content indicated by each of the lines is the same as the content indicated by each of the lines in the program block that is identified by the symbol A 1126, and more detailed explanation will not be given here.

When the program block that is identified by the symbol E 1136 is executed, the program block identified by the symbol B is called and executed, the value of the variable "ZZZZZ" is substituted into the data block identified by the symbol C, and the value of the variable "OOOOO" is substituted into the data block identified by the symbol D.

(Program Block Identified by Symbol F 1137)

Not illustrated, the program block that is identified by the symbol F 1137 includes a plurality of commands as in the case of the program block that is identified by the symbol E 1136.

(3) Export Symbol Offset Table B 1133

The export symbol offset table B 1133 includes the code export symbol offset table B 1138 and the data export symbol offset table B 1139.

(Code Export Symbol Offset Table B 1138)

The code export symbol offset table B 1138 stores sets of the identifiers of code symbols and offsets of the areas where the code symbols are stored.

More specifically, the code export symbol offset table B 1138 stores a set of the identifier 1191 "ID-E" and the offset 1196 "0X000008" of the symbol E and a set of the identifier 1192 "ID-F" and the offset 1197 "0X000400" of the symbol F as shown in FIG. 5.

(Data Export Symbol Offset Table B 1139)

The data export symbol offset table B 1139 stores sets of the identifiers of data symbols and offsets of the areas where the data symbols are stored.

Here, an offset is an address with reference to the location where the data B starts.

More specifically, the data export symbol offset table B 1139 stores a set of the identifier 1193 "ID-G" and the offset 1198 "0X000700" of the symbol G and a set of the identifier 1194 "ID-H" and the offset 1199 "0X000800" of the symbol H as shown in FIG. 5.

1.1.4. RAM 1103

The RAM 1103 is composed of a readable/writeable semiconductor memory. In the storage area of the RAM 1103, the jump table 1170, data A 1140, and data B 1150 are stored.

1.1.4.1. Jump Table 1170

The jump table 1170 is stored in the address space from the area indicated by the absolute address

In the jump table 1170, a jump command to the export symbol import step.1160 is stored.

The arrangement of the jump table 1170 and the, export symbol import step 1160 in the address space is shown in FIG. 7.

As shown in FIG. 7, a jump command "JMP 0X002000" is stored in the jump table 1170. Here, the character string "0X002000" indicates the absolute address of the area where the export symbol import step 1160 is stored.

The jump table 1170 is stored so that the export symbol import step 1160 could be called using a certain absolute address even if the location of the export symbol import step 1160 changes in the address space.

1.1.4.2. Data A 1140

The data A 1140 is stored in the address space from the area indicated by the absolute address "0X110000" as shown in FIG. 3.

The data A 1140 includes the data blocks that are identified by the symbols C 1141 and D 1142, respectively. These data blocks are used by the program B 1130.

The symbols C 1141 and D 1142 are stored in the areas indicated by the absolute addresses "0X110500" and "0X110600", respectively.

1.1.4.3. Data B 1150

The data B 1150 is stored in the address space from the area indicated by the absolute address "0X120000" as shown in FIG. 5.

The data B 1150 includes the data blocks that are identified by the symbols G 1151 and H 1152, respectively. These data blocks are used by the program A 1120.

The symbols G 1151 and H 1152 are stored in the areas indicated by the absolute addresses "0X120700" and "0X120800", respectively.

1.2. Operations by Program Linking Apparatus 1000

1.2.1. Operations by CPU 1105

An explanation of operations by the CPU 1105 will be given with reference to the flowchart shown in FIG. 8.

The CPU 1105 reads the commands in the program instruction part A 1122, the main step 1110, and the export symbol import step 1160, which each are recorded in the ROM-A 1101, and the commands in the program instruction part B 1132, which is recorded in the ROM-B 1102 (step s1501). When all the commands have been read (step s1502), the processing ends. When not all the commands have been read (step s1502), the CPU 1105 executes the command that has been read (step s1503). Then, the processing returns to step s1501, and commands are read and executed until all the commands have been read.

1.2.2. Operation in Export Symbol Import Step 1160

An explanation of operations in the export symbol import step 1160 will be given with reference to the flowchart shown in FIG. 9.

In the export symbol import step 1160, the processing described below is performed. The value "0" is substituted into a number "k" that identifies a program (step s1601), and the number "k" is compared with the number of all the programs. When the number "k" is equal to or larger than the number of the programs (step s1602), no identifier was found, an error arises, and the processing ends.

On the other hand, when the number "k" is no greater than the number of the programs (step s1602), the value "0" is substituted into a number "i" that identifies a symbol (step s1603), and the number "i" is compared with the number of all the code symbols. When the number "i" is equal to or larger than the number of the code symbols (step s1604), the control is transferred to step s1611.

On the other hand, when the number "i" is no greater than the number of code symbols (step s1604), the "i"th identifier in the code export symbol offset table is compared with the identifier that is to be retrieved. when the "i"th identifier is the same as the identifier to be retrieved (step s1605), the "i"th offset in the code export symbol offset table, a value "0X010000*k", and a value "0X010000" are added together, and the result of the addition is substituted into a variable "ret" (step s1606). Then, the variable "ret" and the control are returned to the caller program.

On the other hand, when the "i"th identifier is not the same as the identifier to be retrieved (step s1605), the value "1" is added to the number "i" (step s1607), the control is returned to step s1604, and the comparison between the "i"th identifier and the identifier to be retrieved is repeated.

Meanwhile, when the number "i" is equal to or greater than the number of all the code symbols at step s1604, the value "0" is substituted into the number "i" (step s1611). At step s1612, when the number "i" is equal to or greater than the number of all the code symbols, the value "1" is added to the number of "k" (step s1616), the control is returned to step s1602, and the symbol is retrieved for the number of the next program.

On the other hand, when the number "i" is no greater than the number of the code symbols (step s1612), the "i"th identifier in the data export symbol offset table is compared with the identifier to be retrieved. When the "i"th identifier is the same as the identifier to be retrieved (step s1613), the "i"th offset in the data export symbol offset table, a value "0X010000*k", and a value "0X110000" are added together, the result of the addition is substituted into the variable "ret" (step s1615), and the variable "ret" and the control are returned to the caller program.

On the other hand, when the "i"th identifier is not the same as the identifier to be retrieved (step s1613), the value "1" is added to the number "i" (step s1614), the control is returned to step s1612, and the "i"th identifier and the identifier to be retrieved is compared.

1.3. Summary

As has been described, each of the programs and the data is stored in a predetermined location, the offsets of the symbols are stored in the programs, and the absolute address of one symbol is calculated by converting the stored corresponding offset into an absolute address using a predetermined standard when the symbol is called, so that linkage between programs can be realized via the symbol according to the present embodiment

As a result, programs need not to store the absolute addresses in themselves, so that the programs recorded in a ROM are independent of the memory map of an embedded microcomputer control system and can be shared by another system having a different memory map.

2. The Second Embodiment

An explanation of a program linking apparatus 2000 as another embodiment of the present invention will be given below.

2.1. Structure of Program Linking Apparatus 2000

As shown in FIG. 10, the program linking apparatus 2000 includes a CPU 2105, a ROM-A 2101, a ROM-B 1102, and a RAM 2103.

The ROM-A 2101, the ROM-B 1102, the RAM 2103, and the CPU 2105 are connected with each other by a CPU bus 2104.

The storage areas of the ROM-A 2101, the ROM-B 1102, and the RAM 2103 are located in one address space as in the case of the first embodiment. As a result, the CPU 2105 can access to data stored in the ROM-A 2101, the ROM-B 1102, and the RAM 2103 using one kind of address.

The elements given the same reference numbers as in the first embodiment have the same functions as in the first embodiment. For these elements, no more explanations will given below. The descriptions given below will focus on differences from the first embodiment.

2.1.1. CPU 2105

As in the case of the CPU 1105, the CPU 2105 is a semiconductor device that includes a register, an arithmetic circuit, and a control circuit, and the CPU 2105 decodes commands, performs arithmetic, communicates data between storage devices, performs control, and the like.

The CPU 2105 reads commands stored in the ROM-A 2101, the ROM-B 1102, and the RAM 2103, decodes the read commands, and executes the decoded commands. The CPU 2105 reads data stored in the ROM-A 2101, the ROM-B 1102, and the RAM 2103, and writes data in the RAM 2103.

2.1.2. ROM-A 2101

The ROM-A 2101 is composed of a read only semiconductor memory. In the storage space of the ROM-A 2101, a main step 2110, an export symbol registration step 2120, an export symbol import step 2130, and a program A 120 are recorded.

2.1.2.1. Main Step 2110

The main step 2110 is located in the address space rom the area indicated by the absolute address

As shown by the flowchart in FIG. 11, the main step 2110 includes procedures given below. A jump command to the export symbol import step 2130 is stored in a jump table 1170 (step s2111). The export symbol registration step 2120 is called and executed (step s2112). The export symbol import step 2130 is called with the identifier "ID-A" of a symbol A as the argument, the absolute address where the symbol A is stored is calculated, the absolute address where the symbol A is stored is stored in a variable "ptra" (step s2113), and the symbol A is called using the variable "ptra" (step s2114). The export symbol import step 2130 is called with the identifier "ID-E" of a symbol E as the argument, the absolute address where the symbol E is stored is calculated, the absolute address where the symbol E is stored is stored in a variable "ptre" (step s2115), and the symbol E is called using the variable "ptre" (step s2116).

As in the case of the first embodiment, the main step 2110 aims to execute program blocks that are identified with the symbols A and E.

Given in the first embodiment, more detailed explanations of the symbols A and E, identifiers "ID-A" and "ID-E", and program blocks that are identified with symbols A and E will not be given in the present embodiment.

2.1.2.2. Export Symbol Registration Step 2120

The export symbol registration step 2120 is located in the address space from the area indicated by an absolute address "0X001000".

The export symbol registration step 2120 is called from the main step 2110 only once.

When the export symbol registration step 2120 is called from the main step 2110, in the export symbol registration step 2120, sets of identifiers of symbols and the offsets corresponding to the identifiers, which are stored in the export symbol offset table, are extracted for each program. Then, predetermined arithmetic is executed on the extracted offsets, absolute addresses are created, and the created absolute addresses are written in an export symbol reference table 2140.

In the export symbol registration step 2120, an absolute address is created and the created absolute address is written in the export symbol reference table 2140 for each set of symbol identifier and corresponding offset included in each program.

As in the case of the first embodiment, symbols come in code symbols for identifying commands and data symbols for identifying data. In the export symbol registration step 2120, when a symbol is a code symbol, an absolute address is created using a code export symbol offset table A 1128 or a code export symbol offset table B 1138. On the other hand, when a symbol is a data symbol, an absolute addre