CN105224309A - A kind of method and apparatus transferring function - Google Patents

A kind of method and apparatus transferring function Download PDF

Info

Publication number
CN105224309A
CN105224309A CN201510554917.0A CN201510554917A CN105224309A CN 105224309 A CN105224309 A CN 105224309A CN 201510554917 A CN201510554917 A CN 201510554917A CN 105224309 A CN105224309 A CN 105224309A
Authority
CN
China
Prior art keywords
function
executable code
spread function
original
original function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510554917.0A
Other languages
Chinese (zh)
Other versions
CN105224309B (en
Inventor
孔英祁
何超
徐林伟
王欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing xijueshuo Information Technology Co., Ltd
Original Assignee
QINGDAO VIMICRO ELECTRONICS CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by QINGDAO VIMICRO ELECTRONICS CO Ltd filed Critical QINGDAO VIMICRO ELECTRONICS CO Ltd
Priority to CN201510554917.0A priority Critical patent/CN105224309B/en
Publication of CN105224309A publication Critical patent/CN105224309A/en
Application granted granted Critical
Publication of CN105224309B publication Critical patent/CN105224309B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a kind of method and apparatus transferring function, described method comprises: compile for the newly-increased spread function of original function, obtain the executable code of described spread function, load the executable code of the described spread function obtained, upgrade function corresponding to described original function and perform sequence, based on the call request of function, perform the order of the executable code of each function recorded in sequence according to the function after renewal, transfer described original function and described spread function successively.According to the executable code that the solution of the present invention is write in advance without the need to global revision, without the need to changing original function executable code, namely realize the renewal to function, thus reduce cost and the time of Modification growth function process consumes.

Description

A kind of method and apparatus transferring function
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of method transferring function, and a kind of device transferring function.
Background technology
In intelligent system, the executable code for required function that record programming personnel writes in advance, generates executable file according to the executable code write in advance, can perform corresponding function according to the executable file generated.
For the Single Chip Microcomputer (SCM) system without operating system management, owing to lacking the management of operating system and the support of scheduling, the execution of function substantially relies on static compilation and realizes.Such as, the executable code that the programming personnel based on record has write, generates executable file by compiler, because the executable code of the executable file generated is changeless, so the process that function performs can not be changed.Because the executable code of the function recorded is write as a whole, so the executable code needing global revision to write, and need to recompilate amended executable code.Therefore, utilize without operating system management Single Chip Microcomputer (SCM) system execution function process without any extensibility, the cost of the process consumes of Modification growth function is very high, and the time expended is longer.
Summary of the invention
In view of the above problems, propose the present invention to provide a kind of method dynamically transferring spread function overcoming the problems referred to above or solve the problem at least in part, and a kind of device transferring function.
According to one aspect of the present invention, provide a kind of method transferring function, comprising:
Compile for the newly-increased spread function of original function, obtain the executable code of described spread function;
Load the executable code of the described spread function obtained, upgrade function corresponding to described original function and perform sequence;
Based on the call request of function, perform the order of the executable code of each function recorded in sequence according to the function after renewal, transfer described original function and described spread function successively.
Alternatively, the spread function that described compiling increases newly for original function, the executable code obtaining described spread function comprises:
Receive for the newly-increased spread function of original function;
Compile described spread function, obtain the list of corresponding executable code sum functions entrance;
With executable code and described function entrance list described in the supervisory format record preset, generate extended data structure table.
Alternatively, be provided with multiple message identification in described extended data structure table, the executable code of the described spread function that described loading obtains, the function execution sequence upgrading described original function corresponding comprises:
Message identification corresponding to described executable code is searched in described extended data structure table;
Message identification according to described executable code extracts corresponding executable code;
According to the executable code of the described spread function extracted, upgrade function corresponding to described original function and perform sequence, generate the function comprising described spread function and described original function and perform sequence table.
Alternatively, described spread function is all or part of is different from described original function;
When the part that described spread function is different from described original function is made up of multiple original function, the Serial Relation parameter of spread function and described original function incidence relation described in record identification in described extended data structure table, and the original function pointer that stylus point is arranged respectively to each original function;
When the part that described spread function is different from described original function is not made up of multiple original function, in described extended data structure table, record the executable code of described spread function.
Alternatively, when the part that described spread function is different from described original function is made up of multiple original function, the described message identification according to described executable code extracts corresponding executable code and comprises:
According to the message identification of described executable code, extract the Serial Relation parameter of described spread function and described original function;
According to Serial Relation parameter and the described original function pointer of described spread function, extract the executable code of the original function that described spread function comprises, obtain the executable code of described spread function.
Alternatively, the described call request based on function, performs in sequence the order of the executable code of each function recorded according to the function after upgrading, and transfers described original function successively and described spread function is:
The order of the executable code of each function recorded in sequence is performed according to the function after renewal, utilize described function to perform the function pointer chain of sequence table correspondence setting, perform sequence table from described function and transfer described original function and described spread function successively.
Alternatively, be provided with check information mark in described default supervisory format, the function of described check information mark correspondence is verifying function;
After the described message identification according to described executable code extracts corresponding executable code, described method also comprises:
The correctness of the executable code of a certain original function that verification is extracted;
If check results is correct, then perform the leaching process of the executable code of next original function;
If check results is mistake, then stop the leaching process of the executable code performing next original function, feedback check result.
Alternatively, at the spread function that described compiling increases newly for original function, after obtaining the executable code of described spread function, described method also comprises:
The described extended data structure table generated is stored to growth data district;
Described extended data structure table is called from described growth data district.
Alternatively, described function entrance list records runs through the mode of the described executable code that the described spread function of compiling obtains;
Described growth data district is at least one in the region reserved of the region reserved of flash memory and static RAM, the mode that described growth data district adopts section to add by USB (universal serial bus) external interface or universal asynchronous receiving-transmitting transmitter external interface, expansion structure tables of data described in unloading is to actual amount of physical memory;
The executable code of described spread function is to have the normal form function prototype record of extensibility and polymorphic support.
According to another aspect of the present invention, provide a kind of device transferring function, comprising:
Spread function collector, for compiling for the newly-increased spread function of original function, obtains the executable code of described spread function;
Function performs sequence update module, for loading the executable code of the described spread function of acquisition, upgrading function corresponding to described original function and performing sequence;
Function transfers module, for the call request based on function, performs the order of the executable code of each function recorded in sequence, transfer described original function and described spread function successively according to the function after renewal.
According to the embodiment of the present invention, receive the spread function that compiling increases newly for original function, obtain the executable code of described spread function, under the constant prerequisite of the executable code of described original function, the executable code of the described spread function obtained is joined the executable code of described original function, upgrade function corresponding to described original function and perform sequence, complete the loading procedure to newly-increased spread function, based on the call request of function, the order of the executable code of each function recorded in sequence is performed according to the function after renewal, transfer described original function and described spread function successively.Therefore, the executable code that the scheme according to the embodiment of the present invention is write in advance without the need to global revision, without the need to changing original function executable code, namely realizes the renewal to function, thus reduces cost and the time of Modification growth function process consumes.
Further, the embodiment of the present invention compiles the executable code of described spread function acquisition with supervisory format record, follow-up can from the executable code of extracting directly spread function the extended data structure table of described supervisory format record, without the need to carrying out format conversion to the executable code recorded in extended data structure table, shorten the time of the whole process consumption transferring spread function.
Further, the growth data district of the embodiment of the present invention adopts region reserved in flash memory and/or static RAM, by the mode that USB (universal serial bus) external interface or universal asynchronous receiving-transmitting transmitter external interface adopt section to add, unloading expansion structure tables of data fills in the amount of physical memory to reality, achieve growth data district to be in external interface and to may have access to, and be positioned at nonoverlapping region with the feasible code of original function.
In addition, check information mark can also be provided with in the supervisory format that the embodiment of the present invention adopts, for verifying the correctness of the executable code of the described spread function of extraction.Based on the check results of feedback, user can adjust in time to the executable code after loading, thus improves the stability of the executable code after loading.
In order to technological means of the present invention can be better understood, and can be implemented according to the content of instructions, and in order to above and other objects of the present invention, feature and advantage can be become apparent, below especially exemplified by the specific embodiment of the present invention.
Accompanying drawing explanation
By reading hereafter detailed description of the preferred embodiment, various other advantage and benefit will become cheer and bright for those of ordinary skill in the art.Accompanying drawing only for illustrating the object of preferred implementation, and does not think limitation of the present invention.And in whole accompanying drawing, represent identical parts by identical reference symbol.In the accompanying drawings:
Fig. 1 is a kind of according to an embodiment of the invention flow chart of steps transferring the method for function;
Fig. 2 is a kind of in accordance with another embodiment of the present invention flow chart of steps transferring the method for function;
Fig. 3 is the schematic flow sheet according to the generation extended data structure table in an example of the embodiment of the present invention;
Fig. 4 is the structural representation in growth data district according to an embodiment of the invention;
Fig. 5 performs from described function the schematic flow sheet transferring described original function and described spread function sequence table according to an embodiment of the invention;
Fig. 6 is according to the schematic flow sheet transferring the method for function in an example of the embodiment of the present invention;
Fig. 7 is a kind of according to an embodiment of the invention structured flowchart transferring the device of function;
Fig. 8 is a kind of in accordance with another embodiment of the present invention structured flowchart transferring the device of function.
Embodiment
Below with reference to accompanying drawings exemplary embodiment of the present disclosure is described in more detail.Although show exemplary embodiment of the present disclosure in accompanying drawing, however should be appreciated that can realize the disclosure in a variety of manners and not should limit by the embodiment set forth here.On the contrary, provide these embodiments to be in order to more thoroughly the disclosure can be understood, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
With reference to Fig. 1, show a kind of according to an embodiment of the invention flow chart of steps transferring the method for function, specifically can comprise the following steps:
Step 101, compiles for the newly-increased spread function of original function, obtains the executable code of described spread function.
Spread function is the newly-increased function for original function.The value volume and range of product of the original function of having edited is fixing, and when existing original function can not meet the actual demand of user, user can increase corresponding spread function according to actual needs.After receiving the spread function increased, utilize compiler to compile the described spread function received, thus obtain the executable code of described spread function.
In the embodiment of the present invention, described spread function can be same as any one or more original function, also all or part ofly can be different from described original function.Wherein, the part that described spread function is different from described original function can be made up of multiple original function, or the part that described spread function is different from described original function is not made up of multiple original function.
In specific implementation, the executable code of described spread function adopts functional usually, and functional (functionparadigms) can have extensibility and polymorphic, emphasizes how with unified pattern handling function and code.The object selecting functional is easy to be mapped to concrete function prototype get on.Such as, code voidfunc (void*p1, size) voidfunc (int*p1)/voidfunc (char*p1)/voidfunc (float*p1) can be mapped to, for voidfunc (void*p1,2)/voidfunc (voidp1,1)/voidfunc (voidp1,4) etc., in order to the extensibility in later stage, the application supporting functionparadigms during early development function, can be adopted.
Step 102, loads the executable code of the described spread function obtained, and upgrades function corresponding to described original function and performs sequence.
The executable code of described spread function step 101 obtained is added into function corresponding to described original function and performs sequence, upgrades function corresponding to described original function and performs sequence, generate new function and perform sequence.
In specific implementation, the executable code of the described spread function of new interpolation can be listed in after described original function, also can the executable code of the described spread function newly added be listed in before described original function, for the new executable code of described spread function of interpolation and the position relationship of the executable code of described original function, can set according to the actual requirements, the present invention does not limit at this.
Step 103, based on the call request of function, performs the order of the executable code of each function recorded in sequence, transfers described original function and described spread function successively according to the function after renewal.
After the request receiving call function, perform the order of the executable code of each function recorded in sequence according to the function that step 102 is newly-generated, call all functions comprising newly-increased described spread function successively.
According to the embodiment of the present invention, receive the spread function that compiling increases newly for original function, obtain the executable code of described spread function, under the constant prerequisite of the executable code of described original function, the executable code of the described spread function obtained is joined the executable code of described original function, upgrade function corresponding to described original function and perform sequence, complete the loading procedure to newly-increased spread function, based on the call request of function, the order of the executable code of each function recorded in sequence is performed according to the function after renewal, transfer described original function and described spread function successively.Therefore, the executable code that the scheme according to the embodiment of the present invention is write in advance without the need to global revision, without the need to changing original function executable code, namely realizes the renewal to function, thus reduces cost and the time of Modification growth function process consumes.
With reference to Fig. 2, show a kind of in accordance with another embodiment of the present invention flow chart of steps transferring the method for function, specifically can comprise the following steps:
Step 201, receives for the newly-increased spread function of original function.
Step 202, compiles described spread function, obtains the list of corresponding executable code sum functions entrance.
Utilize compiler to compile the described spread function obtained, obtain the executable code sum functions entrance list of described function.Wherein, the entry address that described function entrance list records operation described spread function is corresponding and parameter information.
Step 203, with executable code and described function entrance list described in the supervisory format record preset, generates extended data structure table.
In the embodiment of the present invention, described supervisory format, as a kind of table data store lattice, adopts described supervisory format record data, and obtains the extended data structure table according to supervisory format record in multiple steps of the embodiment of the present invention.Follow-up can from the executable code of extracting directly spread function the extended data structure table of described supervisory format record, without the need to carrying out format conversion to the executable code recorded in extended data structure table, shorten the time of the whole process consumption transferring spread function.
In the embodiment of the present invention, newly-increased described spread function all or part ofly can be different from described original function.
Specifically, when the part that described spread function is different from described original function is not made up of multiple original function, in described extended data structure table, the executable code of described spread function can also be recorded.
When the part that described spread function is different from described original function is made up of multiple original function, the Serial Relation parameter of spread function and described original function incidence relation described in all right record identification in described extended data structure table, and the original function pointer that stylus point is arranged respectively to each original function that described spread function comprises.The information such as described Serial Relation parameter can comprise the number of the original function that described spread function comprises, the ordinal relation between each original function that the described spread function that can also comprise serial recording comprises.
With reference to Fig. 3, show the schematic flow sheet according to the generation extended data structure table in an example of the embodiment of the present invention, as shown in Figure 3, the list of corresponding executable code sum functions entrance will be obtained after compiling described spread function, according to the supervisory format preset, compiling generates extended data structure table automatically.Wherein, each spread function correspondingly can generate an extended data structure table, also can jointly generate an extended data structure table by multiple spread function.
Table 1 is the extended data structure table in an example of the embodiment of the present invention, and the spread function that the spread function table shown in table 1 is corresponding is made up of multiple original function.As shown in Table 1, for the spread function be made up of multiple original function, in described extended data structure table, the number of the described original function that the described spread function of " Ext_funcnum " corresponding record comprises, the original function that " LengthofExt_func1 " corresponding record is extracted be numbered 1, namely first original function extracted is original function 1.In table 1, the data of record have omission, if have recorded " LengthofExt_func3 " in " Checksum " back of " LengthofExt_func1 ", then the original function to extract of described " LengthofExt_func3 " corresponding record be numbered 3, namely second original function extracted is original function 3, thus the order between each original function of comprising of the described spread function of serial recording.
Table 1
Address Supervisory format
Plot+0000 Total length
Plot+0001 Ext_func num
Plot+0002 Length of Ext_func1
Plot+0003 Ext_func1 (see example 1)
End of data
Ext_func1code
checksum Checksum
Ext_funcn code
Checksum Checksum
End of func
In the following example 1:
Example 1
Structext_func{
Void*ext_func1
IntParameter_size,
Intp1,
Intp2
Charparamtersize,
Charc1,
Charc2,
..
Floatparamtersize,
Floatf1,
Floatf2,
String*p1
String*p2
Void*next_cmd,
}
The code wherein recorded be in table 1 " Ext_func1 " message identification corresponding record comprise Serial Relation parameter, function entrance address, parameter type, original function pointer and other parameter one section of code." Void*next_cmd " that record in described one section of code is original function pointer.
Step 204, is stored to growth data district by the described extended data structure table generated.
The extended data structure table that described growth data district generates for storing newly-increased spread function correspondence, described growth data district is the logical extension district of spread function, be provided with at least one external interface, the amount of physical memory that the extended data structure table unloading for recording in described growth data district is extremely actual.Wherein, the amount of physical memory of described reality can be hard disk, ID card or other any suitable form, and the present invention does not limit at this.
In specific implementation, described growth data district can be at least one in the reserved region of the reserved region of flash memory (flash) and static RAM (sram), described growth data district can pass through the mode that USB (universal serial bus) (usb) external interface or universal asynchronous receiving-transmitting transmitter (uart) external interface adopt section to add, expansion structure tables of data described in unloading is to actual amount of physical memory, achieve described growth data district to be in external interface and to may have access to, and with original function can the nonoverlapping region of line code.
With reference to Fig. 4, show the structural representation according to the growth data district in an example of the present invention, as shown in Figure 4, there are two types in growth data district, one is the reserved region of flash memory (flash), and another kind is the reserved region of static RAM (sram); Growth data district is provided with multiple external interface, be respectively external interface one, external interface two ... external interface n, external interface be used for will the extended data structure table unloading that record in described growth data district to actual amount of physical memory; The extended data structure table of storage specifically can be transferred from described growth data district.
With reference to Fig. 3, extended data structure table step 203 obtained is stored to growth data district.The intelligent extraction of function structure shown in Fig. 3 module, described function structure intelligent extraction module correspondence performs embodiment of the present invention step 201-step 204, specifically, receives for the newly-increased spread function of original function; Compile described spread function, obtain the list of corresponding executable code sum functions entrance; With executable code and described function entrance list described in the supervisory format record preset, generate extended data structure table; The described extended data structure table generated is stored to growth data district.
At least one in the region that the growth data district of the embodiment of the present invention adopts flash memory to reserve and the region that static RAM is reserved, by the mode that USB (universal serial bus) external interface or universal asynchronous receiving-transmitting transmitter external interface adopt section to add, described in unloading, expansion structure tables of data fills in the amount of physical memory to reality, achieve described growth data district to be in external interface and to may have access to, and with original function can the nonoverlapping region of line code.
Step 205, calls described extended data structure table from described growth data district.
The described extended data structure table stored with the supervisory format preset is called from described growth data district.
Step 206, is provided with multiple message identification in described extended data structure table, searches message identification corresponding to described executable code in described extended data structure table.
Described message identification plays the effect of mark in described extended data structure table, can search the relevant information of the spread function corresponding with described message identification of record in the association hurdle of described message identification.
With reference to table 1, be provided with multiple message identification in described extended data structure table, the information of multiple message identification and corresponding record is listed on the right side of described extended data structure table.Such as, growth data total length message identification " Totallength ", the number message identification " Ext_funcnum " of the original function that described spread function comprises, number information mark " LengthofExt_func1 " of original function and the pointer address message identification " Ext_func1 " etc. of original function.According to the information of " LengthofExt_func1 " message identification with " Ext_func1 " message identification corresponding record, extract the Serial Relation parameter of described spread function and described original function.According to the original function pointer of " Ext_func1 " message identification corresponding record, the executable code of at least one original function that described spread function comprises can be extracted, the final executable code obtaining described spread function.Therefore, " LengthofExt_func1 " message identification and " Ext_func1 " message identification can be searched in described extended data structure table.
Step 207, the message identification according to described executable code extracts corresponding executable code.
When the part that described spread function is different from described original function is not made up of multiple original function, in described extended data structure table, in the association hurdle of corresponding message identification, record the executable code of described spread function.Therefore, for the extended data structure table of executable code that have recorded spread function, corresponding executable code can be extracted according to the message identification of described executable code.
When the part that described spread function is different from described original function is made up of multiple original function, in described extended data structure table, in the association hurdle of corresponding message identification, the Serial Relation parameter of spread function described in record identification and described original function incidence relation, and the original function pointer that stylus point is arranged respectively to each original function.Therefore, for the extended data structure table of Serial Relation parameter that have recorded spread function, the detailed process extracting corresponding executable code according to the message identification of described executable code comprises: according to the message identification of described executable code, can extract the Serial Relation parameter of described spread function and described original function; According to the Serial Relation parameter of described spread function and described original function pointer, the executable code of the original function that described spread function comprises can be extracted, obtains the executable code of described spread function.
With reference to table 1, the described extended data structure table left side lists the memory address of the relevant information of the spread function corresponding with the identification information on the right.Search " LengthofExt_func1 " message identification, determine first original function of described spread function record, i.e. original function 1.Search " Ext_func1 " message identification, by searching described Ext_func1 " memory address of corresponding record in the association hurdle on the message identification left side, determine the memory address (plot+0003) of the executable code of original function 1.Search one section of code (reference example 1) of described " Ext_func1 " message identification corresponding record, the original function pointer (Void*next_cmd) recorded in described one section of code can be utilized, transfer the executable code of original function 1 from the memory address of specifying (plot+0003).For other original function that described spread function comprises, said method serial all can be adopted to extract corresponding executable code, and according to the sequencing extracted, all executable codes obtained are merged, using the executable code of the executable code after merging as described spread function.
Be described below by way of the leaching process of executable code of example 2 to the spread function comprising original function.Example 2:
Compilation process will provide the entry address of all functions as 00001000print_f_i (p1, p2, p3), F0000000print_f_e (p1, p2, p3).
Expansion area data
{
00001000,
20,
0,
0,
0,
3,
Vimicro
Print_f_e
Ok
}
{
F0000000,
0,
0,
0,
2,
Vimicro
Print_f_i
Ok
00001000
}
Execution result: VimicroPrint_f_iOKVimicroprint_f_eOK
Wherein, i and 00001000 represents original function and relevant information thereof, e and F0000000 represents spread function and relevant information thereof.
In the corresponding code of spread function that example 2 records, record F0000000 at the beginning, because newly-increased spread function e is identical with original function i, so the code record of ending place Print_f_i and 00001000.Illustrate for the spread function e situation identical with original function i, the executable code of spread function can be recorded, the executable code of corresponding original function can be extracted according to the relevant parameter of record.
Step 208, the correctness of the executable code of a certain original function that verification is extracted.
Be provided with check information mark in described default supervisory format, described check information mark is to being applied to verification.With reference to the extended data structure table shown in table 1, described check information mark can be " Checksum ".
When extracting the executable code of described spread function, or after the executable code extracting any one original function that described spread function comprises, whether the executable code that verification is extracted is correct, whether the executable code namely verifying extraction is identical with the executable code of original description, if check results is correct, then perform the leaching process of the executable code of next original function; If check results is mistake, then stop the leaching process of the executable code performing next original function, feedback check result.
Check information mark can be provided with, for verifying the correctness of the executable code of the described spread function of extraction in the supervisory format that the embodiment of the present invention adopts.Based on the check results of feedback, user can adjust in time to the executable code after loading, thus improves the stability of the executable code after loading.
Step 209, according to the executable code of the described spread function extracted, upgrades function corresponding to described original function and performs sequence, generate the function comprising described spread function and described original function and perform sequence table.
The executable code of described spread function step 207 extracted is added into function corresponding to described original function and performs in sequence, have updated function corresponding to described original function and performs sequence, generate new function and perform sequence table.Wherein, newly-generated function performs sequence table and contains described spread function and described original function.
In specific implementation, transfer in process at multiple spread function, can according to the order transferring described spread function, perform sequence table at described function and add multiple spread function successively, the present invention does not limit at this.
Step 210, based on the call request of function, performs the order of the executable code of each function recorded in sequence, transfers described original function and described spread function successively according to the function after renewal.
In the embodiment of the present invention, the order of the executable code of each function recorded in sequence is performed according to the function after renewal, described function can be utilized to perform the function pointer chain of sequence table correspondence setting, perform sequence table from described function, transfer described original function and described spread function successively.
With reference to Fig. 5, show the schematic flow sheet transferring described original function and described spread function from described function execution sequence table according to the embodiment of the present invention, as shown in Figure 5, according to the newly-increased spread function received, have updated described function and perform sequence table, described function performs in sequence table and includes described original function and described spread function.Wherein, described original function 1-n n altogether, described spread function 1-n n altogether.Utilize described function to perform the function pointer chain arranged in structure corresponding to sequence table, adjust the position of described function pointer chain in order, perform sequence table from described function, transfer described original function and described spread function successively.
The Intelligent management module of function shown in Fig. 5, described function Intelligent management module correspondence performs the function of the step 206-step 210 of the embodiment of the present invention, specifically, be provided with multiple message identification in extended data structure table, in described extended data structure table, search message identification corresponding to described executable code; Message identification according to described executable code extracts corresponding executable code; The correctness of the executable code of a certain original function that verification is extracted; According to the executable code of the described spread function extracted, upgrade function corresponding to described original function and perform sequence, generate the function comprising described spread function and described original function and perform sequence table; Based on the call request of function, perform the order of the executable code of each function recorded in sequence according to the function after renewal, transfer described original function and described spread function successively.
According to the embodiment of the present invention, receive the spread function that compiling increases newly for original function, obtain the executable code of described spread function, under the constant prerequisite of the executable code of described original function, the executable code of the described spread function obtained is joined the executable code of described original function, upgrade function corresponding to described original function and perform sequence, complete the loading procedure to newly-increased spread function, based on the call request of function, the order of the executable code of each function recorded in sequence is performed according to the function after renewal, transfer described original function and described spread function successively.Therefore, the executable code that the scheme according to the embodiment of the present invention is write in advance without the need to global revision, without the need to changing original function executable code, namely realizes the renewal to function, thus reduces cost and the time of Modification growth function process consumes.
For making those skilled in the art more clearly understand the present invention, enumerating an example below and feasible embodiment of the present invention is described in detail.
With reference to Fig. 6, show a kind of procedure Procedure figure transferring the method for function of an example according to the embodiment of the present invention, as shown in Figure 6, the original function of writing has three, is original function 1, original function 2 and original function 3 respectively.
The newly-increased spread function for original function, function structure intelligent extraction instrument is after receiving newly-increased spread function, described spread function is compiled, based on the performed list sum functions entrance list obtained, according to the supervisory format preset, generate extended data structure table, and be stored to growth data district.Function Intelligent management module transfers the extended data structure table of the described spread function of storage from described intelligent expansion district, extract the executable code of described spread function, according to the executable code of the described spread function extracted, upgrade function corresponding to described original function and perform sequence, generate the function comprising described spread function and described original function and perform sequence table, add the number that described function performs the function recorded in sequence table.After the call request of function Intelligent management module receiver function, perform the order of the executable code of each function recorded in sequence according to the function after renewal, transfer described original function and described spread function successively.By the static compilation of corresponding compiler, obtain executable file.
Embodiment 3
With reference to Fig. 7, show a kind of according to an embodiment of the invention structured flowchart transferring the device of function.
Spread function collector 301, for compiling for the newly-increased spread function of original function, obtains the executable code of described spread function.
Function performs sequence update module 302, for loading the executable code of the described spread function of acquisition, upgrading function corresponding to described original function and performing sequence.
Function transfers module 303, for the call request based on function, performs the order of the executable code of each function recorded in sequence, transfer described original function and described spread function successively according to the function after renewal.
According to the embodiment of the present invention, receive the spread function that compiling increases newly for original function, obtain the executable code of described spread function, under the constant prerequisite of the executable code of described original function, the executable code of the described spread function obtained is joined the executable code of described original function, upgrade function corresponding to described original function and perform sequence, complete the loading procedure to newly-increased spread function, based on the call request of function, the order of the executable code of each function recorded in sequence is performed according to the function after renewal, transfer described original function and described spread function successively.Therefore, the executable code that the scheme according to the embodiment of the present invention is write in advance without the need to global revision, without the need to changing original function executable code, namely realizes the renewal to function, thus reduces cost and the time of Modification growth function process consumes.
Embodiment 4
With reference to Fig. 8, show a kind of in accordance with another embodiment of the present invention structured flowchart transferring the device of function.
Spread function collector 401, for compiling for the newly-increased spread function of original function, obtains the executable code of described spread function.
Extended data structure table memory module 402, for being stored to growth data district by the described extended data structure table generated.
Extended data structure table calling module 403, for calling described extended data structure table from described growth data district.
Function performs sequence update module 404, for loading the executable code of the described spread function of acquisition, upgrading function corresponding to described original function and performing sequence.
Function transfers module 405, for the call request based on function, performs the order of the executable code of each function recorded in sequence, transfer described original function and described spread function successively according to the function after renewal.
Described spread function collector 401 comprises:
Spread function receives submodule 4011, for receiving for the newly-increased spread function of original function;
Executable code obtains submodule 4012, for compiling described spread function, obtains the list of corresponding executable code sum functions entrance;
Extended data structure table generates submodule 4013, for executable code and described function entrance list described in the supervisory format record preset, generates extended data structure table.
Be provided with multiple message identification in described extended data structure table, described function performs sequence update module 404 and comprises:
Message identification searches submodule 4041, for searching message identification corresponding to described executable code in described extended data structure table;
Executable code extracts submodule 4042, extracts corresponding executable code for the message identification according to described executable code;
Function performs sequence table and generates submodule 4043, for the executable code according to the described spread function extracted, upgrades function corresponding to described original function and performs sequence, generate the function comprising described spread function and described original function and perform sequence table.
In the embodiment of the present invention, preferably, described spread function is all or part of is different from described original function;
When the part that described spread function is different from described original function is made up of multiple original function, the Serial Relation parameter of spread function and described original function incidence relation described in record identification in described extended data structure table, and the original function pointer that have recorded that each original function of comprising for described spread function arranges respectively;
When the part that described spread function is different from described original function is not made up of multiple original function, in described extended data structure table, have recorded the executable code of described spread function.
In the embodiment of the present invention, preferably, when the part that described spread function is different from described original function is made up of multiple original function, described executable code extracts submodule and comprises:
Serial Relation parameter extraction subelement, for the message identification according to described executable code, extracts the Serial Relation parameter of described spread function and described original function;
Executable code obtains subelement, for according to the Serial Relation parameter of described spread function and described original function pointer, extracts the executable code of the original function that described spread function comprises, obtains the executable code of described spread function.
In the embodiment of the present invention, preferably, described function transfers module 405, specifically for performing the order of the executable code of each function recorded in sequence according to the function after renewal, described function is utilized to perform the function pointer chain of sequence table correspondence setting, perform sequence table from described function, transfer described original function and described spread function successively.
In the embodiment of the present invention, preferably, be provided with check information mark in described default supervisory format, the function of described check information mark correspondence is verifying function;
After described executable code extracts submodule 4042, described function performs sequence update module 404 and also comprises:
Executable code syndrome module 4044, for verifying the correctness of the executable code of a certain original function of extraction,
If check results is correct, then perform the leaching process of the executable code of next original function;
If check results is mistake, then stop the leaching process of the executable code performing next original function, feedback check result.
In the embodiment of the present invention, preferably, described function entrance list records runs through the mode of the described executable code that the described spread function of compiling obtains;
Described growth data district is at least one in the region reserved of the region reserved of flash memory and static RAM, the mode that described growth data district adopts section to add by USB (universal serial bus) external interface or universal asynchronous receiving-transmitting transmitter external interface, expansion structure tables of data described in unloading is to actual amount of physical memory;
The executable code of described spread function is to have the normal form function prototype record of extensibility and polymorphic support.
According to the embodiment of the present invention, receive the spread function that compiling increases newly for original function, obtain the executable code of described spread function, under the constant prerequisite of the executable code of described original function, the executable code of the described spread function obtained is joined the executable code of described original function, upgrade function corresponding to described original function and perform sequence, complete the loading procedure to newly-increased spread function, based on the call request of function, the order of the executable code of each function recorded in sequence is performed according to the function after renewal, transfer described original function and described spread function successively.Therefore, the executable code that the scheme according to the embodiment of the present invention is write in advance without the need to global revision, without the need to changing original function executable code, namely realizes the renewal to function, thus reduces cost and the time of Modification growth function process consumes.
The embodiment of the present invention compiles the executable code of described spread function acquisition with supervisory format record, follow-up can from the executable code of extracting directly spread function the extended data structure table of described supervisory format record, without the need to carrying out format conversion to the executable code recorded in extended data structure table, shorten the time of the whole process consumption transferring spread function.
The growth data district of the embodiment of the present invention adopts region reserved in flash memory and/or static RAM, by the mode that USB (universal serial bus) external interface or universal asynchronous receiving-transmitting transmitter external interface adopt section to add, unloading expansion structure tables of data fills in the amount of physical memory to reality, achieve growth data district to be in external interface and to may have access to, and be positioned at nonoverlapping region with the feasible code of original function.
Check information mark can be provided with, for verifying the correctness of the executable code of the described spread function of extraction in the supervisory format that the embodiment of the present invention adopts.Based on the check results of feedback, user can adjust in time to the executable code after loading, thus improves the stability of the executable code after loading.
For above-mentioned a kind of device embodiment transferring function, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.
Those skilled in the art are easy to it is envisioned that: the combination in any application of each embodiment above-mentioned is all feasible, therefore the combination in any between each embodiment above-mentioned is all embodiment of the present invention, but this instructions does not just detail one by one at this as space is limited.
Intrinsic not relevant to any certain computer, virtual system or miscellaneous equipment with display at this algorithm provided.Various general-purpose system also can with use based on together with this teaching.According to description above, the structure required by system that there is the present invention program is apparent.In addition, the present invention is not also for any certain programmed language.It should be understood that and various programming language can be utilized to realize content of the present invention described here, and the description done language-specific is above to disclose preferred forms of the present invention.
In instructions provided herein, describe a large amount of detail.But can understand, embodiments of the invention can be put into practice when not having these details.In some instances, be not shown specifically known method, structure and technology, so that not fuzzy understanding of this description.
Similarly, be to be understood that, in order to simplify the disclosure and to help to understand in each inventive aspect one or more, in the description above to exemplary embodiment of the present invention, each feature of the present invention is grouped together in single embodiment, figure or the description to it sometimes.But, the method for the disclosure should be construed to the following intention of reflection: namely the present invention for required protection requires feature more more than the feature clearly recorded in each claim.Or rather, as the following claims reflect, all features of inventive aspect disclosed single embodiment before being to be less than.Therefore, the claims following embodiment are incorporated to this embodiment thus clearly, and wherein each claim itself is as independent embodiment of the present invention.
Those skilled in the art are appreciated that and adaptively can change the module in the equipment in embodiment and they are arranged in one or more equipment different from this embodiment.Module in embodiment or unit or assembly can be combined into a module or unit or assembly, and multiple submodule or subelement or sub-component can be put them in addition.Except at least some in such feature and/or process or unit be mutually repel except, any combination can be adopted to combine all processes of all features disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) and so disclosed any method or equipment or unit.Unless expressly stated otherwise, each feature disclosed in this instructions (comprising adjoint claim, summary and accompanying drawing) can by providing identical, alternative features that is equivalent or similar object replaces.
In addition, those skilled in the art can understand, although embodiments more described herein to comprise in other embodiment some included feature instead of further feature, the combination of the feature of different embodiment means and to be within scope of the present invention and to form different embodiments.Such as, in detail in the claims, the one of any of embodiment required for protection can use with arbitrary array mode.
All parts embodiment of the present invention with hardware implementing, or can realize with the software module run on one or more processor, or realizes with their combination.It will be understood by those of skill in the art that the some or all functions transferring the some or all parts in the scheme of function that microprocessor or digital signal processor (DSP) can be used in practice to realize according to the embodiment of the present invention.The present invention can also be embodied as part or all equipment for performing method as described herein or device program (such as, computer program and computer program).Realizing program of the present invention and can store on a computer-readable medium like this, or the form of one or more signal can be had.Such signal can be downloaded from internet website and obtain, or provides on carrier signal, or provides with any other form.
The present invention will be described instead of limit the invention to it should be noted above-described embodiment, and those skilled in the art can design alternative embodiment when not departing from the scope of claims.In the claims, any reference symbol between bracket should be configured to limitations on claims.Word " comprises " not to be got rid of existence and does not arrange element in the claims or step.Word "a" or "an" before being positioned at element is not got rid of and be there is multiple such element.The present invention can by means of including the hardware of some different elements and realizing by means of the computing machine of suitably programming.In the unit claim listing some devices, several in these devices can be carry out imbody by same hardware branch.Word first, second and third-class use do not represent any order.Can be title by these word explanations.

Claims (10)

1. transfer a method for function, it is characterized in that, comprising:
Compile for the newly-increased spread function of original function, obtain the executable code of described spread function;
Load the executable code of the described spread function obtained, upgrade function corresponding to described original function and perform sequence;
Based on the call request of function, perform the order of the executable code of each function recorded in sequence according to the function after renewal, transfer described original function and described spread function successively.
2. method according to claim 1, is characterized in that, the spread function that described compiling increases newly for original function, and the executable code obtaining described spread function comprises:
Receive for the newly-increased spread function of original function;
Compile described spread function, obtain the list of corresponding executable code sum functions entrance;
With executable code and described function entrance list described in the supervisory format record preset, generate extended data structure table.
3. method according to claim 2, is characterized in that, is provided with multiple message identification in described extended data structure table, the executable code of the described spread function that described loading obtains, and the function execution sequence upgrading described original function corresponding comprises:
Message identification corresponding to described executable code is searched in described extended data structure table;
Message identification according to described executable code extracts corresponding executable code;
According to the executable code of the described spread function extracted, upgrade function corresponding to described original function and perform sequence, generate the function comprising described spread function and described original function and perform sequence table.
4. method according to claim 3, is characterized in that:
Described spread function is all or part of is different from described original function;
When the part that described spread function is different from described original function is made up of multiple original function, the Serial Relation parameter of spread function and described original function incidence relation described in record identification in described extended data structure table, and the original function pointer that stylus point is arranged respectively to each original function;
When the part that described spread function is different from described original function is not made up of multiple original function, in described extended data structure table, record the executable code of described spread function.
5. method according to claim 4, is characterized in that, when the part that described spread function is different from described original function is made up of multiple original function, the described message identification according to described executable code extracts corresponding executable code and comprises:
According to the message identification of described executable code, extract the Serial Relation parameter of described spread function and described original function;
According to Serial Relation parameter and the described original function pointer of described spread function, extract the executable code of the original function that described spread function comprises, obtain the executable code of described spread function.
6. method according to claim 3, is characterized in that, the described call request based on function, performs in sequence the order of the executable code of each function recorded according to the function after upgrading, and transfers described original function successively and described spread function is:
The order of the executable code of each function recorded in sequence is performed according to the function after renewal, utilize described function to perform the function pointer chain of sequence table correspondence setting, perform sequence table from described function and transfer described original function and described spread function successively.
7. method according to claim 3, is characterized in that:
Be provided with check information mark in described default supervisory format, the function of described check information mark correspondence is verifying function;
After the described message identification according to described executable code extracts corresponding executable code, described method also comprises:
The correctness of the executable code of a certain original function that verification is extracted;
If check results is correct, then perform the leaching process of the executable code of next original function;
If check results is mistake, then stop the leaching process of the executable code performing next original function, feedback check result.
8. method according to claim 2, is characterized in that, at the spread function that described compiling increases newly for original function, after obtaining the executable code of described spread function, described method also comprises:
The described extended data structure table generated is stored to growth data district;
Described extended data structure table is called from described growth data district.
9. method according to claim 8, is characterized in that:
Described function entrance list records runs through the mode of the described executable code that the described spread function of compiling obtains;
Described growth data district is at least one in the region reserved of the region reserved of flash memory and static RAM, the mode that described growth data district adopts section to add by USB (universal serial bus) external interface or universal asynchronous receiving-transmitting transmitter external interface, expansion structure tables of data described in unloading is to actual amount of physical memory;
The executable code of described spread function is to have the normal form function prototype record of extensibility and polymorphic support.
10. transfer a device for function, it is characterized in that, comprising:
Spread function collector, for compiling for the newly-increased spread function of original function, obtains the executable code of described spread function;
Function performs sequence update module, for loading the executable code of the described spread function of acquisition, upgrading function corresponding to described original function and performing sequence;
Function transfers module, for the call request based on function, performs the order of the executable code of each function recorded in sequence, transfer described original function and described spread function successively according to the function after renewal.
CN201510554917.0A 2015-09-02 2015-09-02 A kind of method and apparatus for transferring function Active CN105224309B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510554917.0A CN105224309B (en) 2015-09-02 2015-09-02 A kind of method and apparatus for transferring function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510554917.0A CN105224309B (en) 2015-09-02 2015-09-02 A kind of method and apparatus for transferring function

Publications (2)

Publication Number Publication Date
CN105224309A true CN105224309A (en) 2016-01-06
CN105224309B CN105224309B (en) 2019-03-19

Family

ID=54993307

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510554917.0A Active CN105224309B (en) 2015-09-02 2015-09-02 A kind of method and apparatus for transferring function

Country Status (1)

Country Link
CN (1) CN105224309B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740028A (en) * 2016-03-03 2016-07-06 北京金山安全软件有限公司 Access control method and device
CN107346255A (en) * 2017-05-18 2017-11-14 国网浙江省电力公司电力科学研究院 A kind of electric energy meter system upgrade method and electric energy meter system
CN110187920A (en) * 2019-04-01 2019-08-30 深圳市德名利电子有限公司 The BOOT code extensions method of main control chip based on OTP
CN110275792A (en) * 2019-03-05 2019-09-24 华为技术有限公司 The abnormality eliminating method of high-level language, device and system
WO2023051832A1 (en) * 2021-09-28 2023-04-06 山东程序元软件有限公司 Method and apparatus for constructing composite function block, composite function block, and storage medium
WO2023165307A1 (en) * 2022-03-01 2023-09-07 阿里巴巴(中国)有限公司 Function calling method and apparatus

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1971519A (en) * 2005-11-24 2007-05-30 富士施乐株式会社 Storage medium, method, and apparatus for creating a protected executable program
US20130024854A1 (en) * 2011-07-21 2013-01-24 Canon Kabushiki Kaisha Information processing apparatus and controlling method thereof
CN104699503A (en) * 2015-02-28 2015-06-10 深圳市同洲电子股份有限公司 Method and device for replacing function execution logic in Android system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1971519A (en) * 2005-11-24 2007-05-30 富士施乐株式会社 Storage medium, method, and apparatus for creating a protected executable program
US20130024854A1 (en) * 2011-07-21 2013-01-24 Canon Kabushiki Kaisha Information processing apparatus and controlling method thereof
CN104699503A (en) * 2015-02-28 2015-06-10 深圳市同洲电子股份有限公司 Method and device for replacing function execution logic in Android system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
周密等: "PFC事件和函数执行顺序分析", 《计算机时代》 *
熊华等: "Windows动态链接库原理分析及其应用", 《北京化工大学学报(自然科学版)》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740028A (en) * 2016-03-03 2016-07-06 北京金山安全软件有限公司 Access control method and device
CN105740028B (en) * 2016-03-03 2019-07-12 珠海豹趣科技有限公司 A kind of access control method and device
CN107346255A (en) * 2017-05-18 2017-11-14 国网浙江省电力公司电力科学研究院 A kind of electric energy meter system upgrade method and electric energy meter system
CN110275792A (en) * 2019-03-05 2019-09-24 华为技术有限公司 The abnormality eliminating method of high-level language, device and system
CN110187920A (en) * 2019-04-01 2019-08-30 深圳市德名利电子有限公司 The BOOT code extensions method of main control chip based on OTP
CN110187920B (en) * 2019-04-01 2022-06-10 深圳市德明利技术股份有限公司 BOOT code expansion method of OTP-based main control chip
WO2023051832A1 (en) * 2021-09-28 2023-04-06 山东程序元软件有限公司 Method and apparatus for constructing composite function block, composite function block, and storage medium
WO2023165307A1 (en) * 2022-03-01 2023-09-07 阿里巴巴(中国)有限公司 Function calling method and apparatus

Also Published As

Publication number Publication date
CN105224309B (en) 2019-03-19

Similar Documents

Publication Publication Date Title
CN105224309A (en) A kind of method and apparatus transferring function
CN107291480B (en) Function calling method and device
CN103955363B (en) A kind of manufacture method of program upgrade installation package
JP5208350B2 (en) Self-describing software image update component
US8566372B2 (en) Method and device for dynamically loading relocatable file
CN104239082B (en) The hot patch implementation method of embedded system
US9519466B2 (en) Executable code for constrained computing environments
CN106843842B (en) Method and device for updating application program configuration file
CN101002174B (en) Method for loading software with an intermediate object oriented language in a portable device
CN110162306B (en) Advanced compiling method and device of system
US20080005728A1 (en) Methods, systems, and computer program products for enabling cross language access to an addressable entity in an execution environment
CN102103481A (en) Endian conversion tool
CN102364433B (en) Method for realizing Wine construction tool transplanting on ARM (Advanced RISC Machines) processor
CN101346693A (en) Methods of generating, linking, and updating component-based software and information storage medium having such software recorded thereon
CN102331920B (en) Data processing method and device
CN110659088B (en) Method and system for expanding program under embedded environment
CN101334737A (en) Embedded equipment start-up or reset method
CN108694049B (en) Method and equipment for updating software
CN103645888A (en) System and method for automatically building operation system
CN109558121A (en) Development approach, device, equipment and the storage medium of interface drive program
CN113835620A (en) Method and system for improving application execution efficiency of security chip
CN106354624B (en) Automatic testing method and device
CN101770508B (en) Data access method in mobile communication terminal and equipment thereof
CN101739404A (en) Bytecode-optimized database and establishing method thereof and bytecode optimizing mehtod
CN100426233C (en) Method for automatically configurating programmable device by inlaid CPU

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200327

Address after: 211500 room 616, block B, Chuangzhi building, No.17, Xinghuo Road, Jiangbei new district, Nanjing City, Jiangsu Province

Patentee after: Nanjing xijueshuo Information Technology Co., Ltd

Address before: 266109, No. 6, building C, building 1, intellectual Island Road, hi tech Zone, Shandong, Qingdao

Patentee before: VIMICRO QINGDAO Corp.