CN110192178A - Method, apparatus, micro-control unit and the terminal device of program patch installing - Google Patents

Method, apparatus, micro-control unit and the terminal device of program patch installing Download PDF

Info

Publication number
CN110192178A
CN110192178A CN201780001062.6A CN201780001062A CN110192178A CN 110192178 A CN110192178 A CN 110192178A CN 201780001062 A CN201780001062 A CN 201780001062A CN 110192178 A CN110192178 A CN 110192178A
Authority
CN
China
Prior art keywords
function
patch
memory
current
return value
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
CN201780001062.6A
Other languages
Chinese (zh)
Other versions
CN110192178B (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.)
Shenzhen Goodix Technology Co Ltd
Original Assignee
Shenzhen Goodix Technology 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 Shenzhen Goodix Technology Co Ltd filed Critical Shenzhen Goodix Technology Co Ltd
Publication of CN110192178A publication Critical patent/CN110192178A/en
Application granted granted Critical
Publication of CN110192178B publication Critical patent/CN110192178B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Abstract

A kind of method, apparatus, micro-control unit and the terminal device of program patch installing, this method comprises: when executing the program in MASK ROM according to the first corresponding relationship, determine whether the current function in program needs patch installing, first corresponding relationship is corresponding relationship of the first identifier patch function corresponding with current function between the initial address in extension read-only memory, and the first identifier is for identifying current function (310);In the case where current function is to need patch installing, according to initial address, the first patch function is executed, which is the corresponding patch function of current function (320).This method can be improved the flexibility of program, improve user experience.

Description

Method, apparatus, micro-control unit and the terminal device of program patch installing Technical field
The present embodiments relate to computer fields, and more specifically, are related to method, apparatus, micro-control unit and the terminal device of a kind of program patch installing.
Background technique
Read-only memory can substantially be divided into mask ROM (Mask Read Only Memory, MASK ROM), burning read-only memory (One Time Programable Read Only Memory, OTP ROM), multiple burning read-only memory (Multi Time Programable Read Only Memory, MTP ROM) and Erasable Programmable Read Only Memory EPROM (FLASH ROM) etc., wherein MASK ROM due to its manufacturing cost it is low, program has been cured in chip generation phase, it can not be modified after factory, it is in order fixed occasion, therefore, it is examined for cost and power consumption Consider, in the case where program is by modification repeatedly and tests highly stable, it is contemplated that program is written in MASK ROM during chip production, then, program is once written into MASK ROM, it not can be carried out any modification later, therefore cause the flexibility of program insufficient, user experience is not high.
Summary of the invention
The embodiment of the present invention provides method, apparatus, micro-control unit and the terminal device of a kind of program patch installing, can be improved the flexibility of program, improves the Experience Degree of user.
In a first aspect, providing a kind of method of program patch installing, described program is stored in mask ROM MASK ROM, which comprises
When executing the described program in the MASK ROM according to the first corresponding relationship, determine whether the current function in described program needs patch installing, first corresponding relationship is corresponding relationship of the first identifier patch function corresponding with the current function between the initial address in extension read-only memory, and the first identifier is for identifying the current function;In the case where the current function needs patch installing, according to the initial address, the first patch function is executed, first patch function is the corresponding patch function of the current function.
In embodiments of the present invention, patch function is stored in extension read-only memory, when carrying out patch installing to the current function in MASK ROM, the corresponding first patch function storage address of current function is determined by the first corresponding relationship, and the first patch function is run, the spirit of program can be improved Activity improves the Experience Degree of user.
With reference to first aspect, in the first implementation of first aspect, when executing the described program in the MASK ROM according to the first corresponding relationship, determine whether the current function in described program needs patch installing, it include: to determine whether the initial address of the corresponding patch function of the current function is located in the address space of the extension read-only memory according to first corresponding relationship;In the case where the initial address of the corresponding patch function of the current function is located at the address space of the extension read-only memory, determine that the current function needs patch installing.
In embodiments of the present invention, since patch function is stored in extension read-only memory, therefore, by determining whether the initial address of the corresponding patch function of current function is located in extension read-only memory, it can whether easy determination current function needs patch installing.
With reference to first aspect, or the first implementation of first aspect, in second of implementation of first aspect, it is described in the case where the current function needs patch installing, according to the initial address, execute the first patch function, comprising: using the parameter of the current function as the parameter of first patch function;According to the parameter of initial address and first patch function of first patch function in the extension read-only memory, first patch function is executed.
With reference to first aspect, or any one of the first of first aspect and second of implementation, in the third implementation of first aspect, the extension read-only memory is also used to store patch function structural body, it include parametric variable in the patch function structural body, return value variable and array of function pointer, the parametric variable is used to transmit the parameter of the current function, the return value variable is used to transmit the return value for executing and obtaining after any one patch function, each of array of function pointer function pointer is used to indicate initial address of each patch function in extension read-only memory, the patch function structural body is located in the lowest address space in the extension read-only memory.
With reference to first aspect, or the first of first aspect is any one of to the third implementation, in the 4th kind of implementation of first aspect, it is described using the parameter of the current function as the parameter of the first patch function, comprising: by the parameter assignment of the current function to the parametric variable in the patch function structural body;Parameter of the parameter of the current function as the first patch function is obtained from the parametric variable in the patch function structural body.
With reference to first aspect or first aspect the first any one of to the 4th kind of implementation, in the 5th kind of implementation of first aspect, the method also includes: determine whether the current function needs return value;In the case where the current function needs return value, the return value variable that the return value that first patch function obtains will be executed is assigned in the patch function structural body;From the patch Return value of the return value as the current function is obtained in the return value variable in function structure body.
With reference to first aspect, or the first of first aspect is any one of to the 5th kind of implementation, in the 6th kind of implementation of first aspect, the method also includes: before executing described program, the example of the patch function structural body is copied in random access memory ram.
With reference to first aspect, or the first of first aspect is any one of to the 6th kind of implementation, in the 7th kind of implementation of first aspect, the extension read-only memory includes at least one of burning read-only memory OTP ROM, multiple burning read-only memory MTP ROM and Erasable Programmable Read Only Memory EPROM FLASH ROM.
Second aspect provides a kind of device of program patch installing, including one or more components for executing each method embodiment in first aspect.
The third aspect provides a kind of micro-control unit, the device of any optional program patch installing including second aspect or second aspect.
Fourth aspect provides a kind of terminal device, the device of any optional program patch installing including second aspect or second aspect.
5th aspect, a kind of computer-readable medium is provided, the program code that the device that the computer-readable medium is analyzed for storing data executes, said program code includes the instruction for executing the method in each implementation of above-mentioned first aspect and the first aspect.
6th aspect, a kind of System on Chip/SoC is provided, the System on Chip/SoC includes input/output interface, at least one processor, at least one processor and bus, the at least one processor is used for store code, at least one processor is used to call the code of at least one processor, to carry out the operation of the method for above-mentioned various aspects.
Detailed description of the invention
Fig. 1 is the system framework figure of the micro-control unit of the embodiment of the present invention.
Fig. 2 is the mapping relations figure of the memory address space of the embodiment of the present invention.
Fig. 3 is the schematic flow chart of the method for the program patch installing of the embodiment of the present invention.
Fig. 4 is another schematic flow chart of the method for the program patch installing of the embodiment of the present invention.
Fig. 5 is the schematic block diagram of the device of the program patch installing of the embodiment of the present invention.
Fig. 6 is the schematic block diagram of the device of the program patch installing of the embodiment of the present invention.
Specific embodiment
Below in conjunction with attached drawing, the technical solution of the embodiment of the present invention is described.
The embodiment of the present invention is with micro-control unit (Microcontroller Unit, MCU mask ROM (the Mask Read Only Memory in), MASK ROM) in the program that stores need to be illustrated the method for the program patch installing of the embodiment of the present invention for patch installing, but it's not limited to that for the embodiment of the present invention.
Fig. 1 show MCU system frame diagram, is wherein stored with cured program in MASK ROM, and default brings into operation program from the initial address of MASK ROM after central processing unit (Central Processing Unit, CPU) powers on.Burning read-only memory (One Time Programable Read Only Memory, OTP ROM), multiple burning read-only memory (Multi Time Programable Read Only Memory, MTP ROM) and Erasable Programmable Read Only Memory EPROM (FLASH ROM) be optional read-only memory, it can be according to application scenarios in real system, the one or more above-mentioned optional read-only memory of the combined factors such as cost and the architecture design of MCU selection, random access memory (Random Access Memory, RAM) for storing variable and program data etc. in program operation process.
The system framework of MCU based on foregoing description, patch function is stored in extension read-only memory (OTP ROM, MTP ROM, FLASH ROM) in the embodiment of the present invention, after determining current function to need patch installing, according to address of its corresponding patch function in extension read-only memory, execute patch function, patch installing is carried out to the function in MASK ROM to realize, the flexibility of program is improved, improves user experience.
Assuming that the processor that the processor used in the embodiment of the present invention is 16, the address space of memory is 0x0000-0xFFFF, a kind of mapping relations of memory address space are as shown in Figure 2, wherein, 0x0000-0x4000 is the address space of register and random access memory, 0x4000-0x8000 is the memory space of extended menory, 0x8000-0xFFFF is the memory space of MASK ROM, as shown in Figure 2, the corresponding patch function of program in MASK ROM is stored in the address space 0x4000-0x8000 of extension read-only memory by the embodiment of the present invention, patch function structural body is stored in the lowest address space in extension read-only memory.
Fig. 3 show a kind of schematic flow chart of the method 300 of program patch installing of the embodiment of the present invention, as shown in figure 3, this method 300 include the following steps in some or all of.
310, when executing the program in MASK ROM according to the first corresponding relationship, determine whether the current function in program needs patch installing, the first corresponding relationship is first identifier benefit corresponding with current function Corresponding relationship of the fourth function between the initial address in extension read-only memory, the first identifier is for identifying current function.
320, in the case where current function needs patch installing, according to initial address, the first patch function is executed, which is the corresponding patch function of current function.
In embodiments of the present invention, the address according to the first patch function in extension read-only memory, calls the first patch function, carries out patch installing to current function, improves the flexibility of program, improve user experience.
Optionally, current function is stored in MASK ROM in the embodiment of the present invention, i.e., the current function in the embodiment of the present invention is one or more functions in the program stored in MASK ROM.
Optionally, the corresponding patch function of current function is stored in extension read-only memory.
Optionally, which may include at least one of OTP ROM, MTP ROM and FLASH ROM.
It should be understood that first identifier is the label that user needs the function of patch installing to carry out the possibility in the program in MASK ROM according to preset rules, which can have multiple.Such as, user by the program stored in MASK ROM common Key Functions or common important function be numbered, any one number in number all can serve as first identifier, and Key Functions or important function can be what user determined according to different assessment rules.
Optionally, the first corresponding relationship is corresponding relationship of the first identifier patch function corresponding with current function between the initial address in extension read-only memory.
It should be understood that, the current function can be any one function in the program stored in MASK ROM, the first identifier is used to identify current function and can be understood as when current function is any one function in MASK ROM, identifier for identifying the current function is first identifier, such as, there are 5 functions in the program stored in MASK ROM, wherein, third function has a number, when program runs to third function, using third function as current function, the number of third function is considered as first identifier.
Optionally, whether current function described in the embodiment of the present invention can be understood as the function to patch installing, patch installing should be needed really also to need to be determined according to the first corresponding relationship to the function of patch installing.
That is, can have to the function of patch installing multiple in the program of MASK ROM, when determining that some function needs patch installing, the mark of this corresponding function can serve as first identifier.
For example, there is 10 functions in the program stored in MASK ROM, wherein second function, third function, the 5th function, the 7th function and the corresponding number of the tenth function be 1., 2., 3., 4., 5., in this case, can be using second function as current function when program runs to second function, 1. the number of corresponding second function is used as first identifier, determine whether second function needs patch installing;When program runs to the 5th function, it can be using the 5th function as current function, 3. the number of corresponding 5th function is used as first identifier, determine whether the 5th function needs patch installing, and so on, when which program runs to numbered function, both can using this with numbered function as current function, the number is as first identifier.
Optionally, it when current function needs patch installing, according to initial address, can determine corresponding first patch function of the current function, after the parameter for obtaining the first patch function, execute first patch function.
Optionally, after determining that current function needs patch installing, the parameter of the available current function, and using the parameter of the current function as the parameter of the first patch function, when running the first patch function to current function progress patch installing, the parameter of current function is the parameter of the first patch function.
Specifically, a patch function structural body is arranged in the embodiment of the present invention, the patch function structural body can store in the lowest address space of extension read-only memory, the patch function structural body includes parametric variable, return value variable and array of function pointer, wherein, parametric variable is used to transmit the parameter of any one current function at least one current function, return value variable is used to transmit the return value for executing and obtaining after any one patch function, each of array of function pointer function pointer is used to indicate initial address of each patch function in extension read-only memory.
Program described below is a kind of patch function structural body.
It can be seen that from procedure above, this patch function structural body defines 64 patch functions, wherein, parameter [] is parametric variable, ret_val [] is return value variable, func_patch_addr [] is array of function pointer, and in the function structure body, func_patch_addr [] array of function pointer includes 64 A function pointer, each function pointer indicate the initial address of a patch function.
Due to that can indicate the initial address of patch function with function pointer, then the first corresponding relationship can be understood as the corresponding relationship of first identifier Yu first function pointer, which is used to indicate the initial address of the corresponding patch function of current function.
Optionally, which can store in patch function structural body.
After defining patch function structural body, it can be by the parameter assignment of current function to the parametric variable parameter [] in patch function structural body, when running the first patch function, parameter of the parameter of current function as the first patch function can be taken out from parametric variable parameter [].
After the first patch function obtains parameter of the parameter of current function as first patch function, run first patch function, at the end of running the first patch function, whether return value is needed according to current function, determine whether the return value variable the ret_val [] return value after the first patch function of operation being assigned in patch function structural body, i.e. in the case where current fourth function needs return value, after having run the first patch function, the return value variable the ret_val [] return value obtained after the first patch function of operation being assigned in patch function structural body.
It should be understood that, the patch function structural body one and only one, i.e. no matter how many patch function, the patch function structural body only one, it include the address of current all patch functions in array of function pointer in patch function structural body, parametric variable parameter [] and return value variable ret_val [] is sky in the initial stage, when carrying out patch installing to a function, by the parameter assignment of the function to parametric variable parameter [], after running the corresponding patch function of the function, the numerical value that operation obtains is assigned to return value variable ret_val [], when carrying out patch installing to another function next time, numerical value in parametric variable parameter [] is the parameter that this needs the function of patch installing, return value variable ret_val Numerical value in [] is to run this return value for needing the corresponding patch function of the function of patch installing to obtain, therefore, parametric variable parameter [] and return value variable ret_val [] in patch function structural body are the differences with current function and change, however array of function pointer func_patch_addr [] is then remained unchanged.
Due in patch function structural body parametric variable parameter [] and return value variable ret_val [] change with the operation of program, so in initial phase, needing the example duplication portion by the patch function structural body, all operations subsequently with respect to patch function structural body are run in RAM into RAM.
Fig. 4 show the schematic flow chart of the method 400 of the program patch installing of the embodiment of the present invention, as shown in figure 4, this method 400 include the following steps in some or all of.
405, according to first identifier and the first corresponding relationship, determines whether the address of first function pointer instruction corresponding with first identifier is address blank, be empty situation in the address of first function pointer instruction Under, step 410 is executed, in the case where the address of first function pointer instruction is not sky, executes step 415.
Optionally, first identifier is for identifying current function.
Optionally, first function pointer is used to indicate the initial address of the corresponding patch function of current function.
Optionally, the first corresponding relationship is the corresponding relationship of initial address of the first identifier patch function corresponding with current function in extension read-only memory, the i.e. corresponding relationship of first identifier and first function pointer.
Optionally, which is stored in the pointer function array of patch function structural body.
Optionally, the corresponding patch function of current function is also stored in extension read-only memory.
410, continue to execute the function in MASK ROM after current function.
415, whether it is located in the memory space of extension read-only memory according to the address that first function pointer indicates, determine whether current function needs patch installing, it is not located in the memory space of extension read-only memory in the address of first function pointer instruction, execute step 420, when current function needs patch installing, step 425 is executed.
Optionally, since patch function being stored in extension read-only memory in the embodiment of the present invention, so determining whether the address of first function pointer instruction is located in extension read-only memory, it can determine whether current function needs patch installing.
420, return to error message, the end of the program.
It should be understood that, since patch function is stored in extension read-only memory, when the address of first function pointer instruction is not located at the memory space of extension read-only memory, show that the current function does not have corresponding patch function, cannot then patch installing be carried out to the current function, then the end of the program.
425, by the parameter assignment of the current function to the parametric variable parameter [] in patch function structural body.
430, on programming jump to corresponding first patch function of current function, execute the first patch function.
435, parameter of the parameter as the first patch function is taken out from the parametric variable parameter [] in patch function structural body.
It should be understood that at this point, the first patch function parametric variable parameter [] parameter be current function parameter, i.e., the parameter assignment of current function has been given in the patch parametric variable parameter [] in patch function structural body in step 425.
440, after the execution of the first patch function terminates, whether return value is needed according to current function, it is determined whether return value is assigned to the return value variable ret_val [] in patch function structural body, in current letter When number needs return value, step 445 is executed, when current function does not need return value, executes step 450.
445, when current function needs return value, return value is assigned to return value variable ret_val [].
Optionally, after return value is assigned to return value variable ret_val [], first patch function end of run, continue to execute the function after current function, and continue to determine whether the function after current function needs patch installing, in the function after current function when the function of patch installing in need, method 400 is repeated.
450, when current function does not need return value, the first patch function end of run continues to execute the function after current function.
In embodiments of the present invention, the address according to the first patch function in extension read-only memory, calls the first patch function, carries out patch installing to current function, improves the flexibility of program, improve user experience.
The embodiment of the method for the embodiment of the present invention is described in detail above in association with Fig. 3 and Fig. 4, below in conjunction with Fig. 5 and Fig. 6, the Installation practice of the present invention is described in detail embodiment, it should be understood that, Installation practice is corresponded to each other with embodiment of the method, and similar description is referred to embodiment of the method.
Fig. 5 show a kind of schematic block diagram of the device 500 of program patch installing of the embodiment of the present invention, as shown in figure 5, the device 500 is including some or all of in following component block.
Mask ROM (MASK ROM) 510, for storing program.
Read-only memory 520 is extended, for storing corresponding patch function in program.
Processor 530, for execute MASK ROM in program when according to the first corresponding relationship, determine whether the current function in program needs patch installing, first corresponding relationship is corresponding relationship of the first identifier patch function corresponding with current function between the initial address in extension read-only memory, and first identifier is for identifying current function.
Processor 530 is also used in the case where current function needs patch installing, according to initial address, executes the first patch function, the first patch function is the corresponding patch function of current function.
It should be understood that current function can be a function, it can also be multiple functions.
Optionally, which can be at least one of OTP ROM, MTP ROM and FLASH ROM.
It should be understood that first identifier is the label that user needs the function of patch installing to carry out the possibility in the program in MASK ROM according to preset rules, which can have multiple.For example, user by the program stored in MASK ROM common Key Functions or common important function be numbered, any one in number all can serve as first identifier, and Key Functions or important function can be User determines according to different assessment rules.
Optionally, processor 530 is also used to determine whether the initial address of the first patch function is located in the address space of the extension read-only memory according to the first corresponding relationship.
Optionally, processor 530 is also used to determine that current function needs patch installing in the case where the initial address of the first patch function is located at the address space of extension read-only memory.
It should be understood that in embodiments of the present invention, since patch function is stored in extension read-only memory, it is located in extension read-only memory in the initial address of the first patch function, current function is the function for needing patch installing.
Optionally, processor 530 is also used to the storage address according to the first patch function in extension read-only memory, determines corresponding first patch function of current function.
Optionally, processor 530 is also used to the parameter according to the first patch function, executes the first patch function.
Optionally, processor 530 is also used to obtain the parameter of current function.
Optionally, processor 530 is also used to using the parameter of current function as the parameter of the first patch function.
Specifically, a patch function structural body is arranged in the embodiment of the present invention, the patch function structural body can store in the lowest address space of extension read-only memory, the patch function structural body includes parametric variable, return value variable and array of function pointer, wherein, parametric variable is used to transmit the parameter of current function, return value variable is used to transmit the return value for executing and obtaining after any one patch function, and each of array of function pointer function pointer is used to indicate initial address of each patch function in extension read-only memory.
Due to that can indicate the initial address of patch function with function pointer, then the first corresponding relationship can be understood as the corresponding relationship of first identifier and function pointer, which is used to indicate the initial address of the corresponding patch function of current function.
Optionally, which can store in patch function structural body.
Therefore, processor 530 can obtain parameter of the parameter of current function as the first patch function by the parameter assignment of current function to the parametric variable in patch function structural body, when running the first patch function from the parametric variable in patch function structural body.
Optionally, processor 530 is also used to determine whether current function needs return value.
Optionally, processor 530 is also used in the case where current function needs return value, will be run in the return value variable that the return value that the corresponding patch function of current function obtains is assigned in patch function structural body.
Optionally, processor 530 is also used to copy to the example of patch function structural body in random access memory ram.
It should be understood that, the device 500 of program patch installing in the embodiment of the present invention can correspond to the device of the program patch installing in embodiment of the method, the above and other operation and/or function of all parts in the device 500 of the program patch installing realizes the corresponding process in each method in Fig. 3 and Fig. 4 respectively, for sake of simplicity, details are not described herein.
Fig. 6 is the schematic diagram of the device 600 of program patch installing according to an embodiment of the present invention.As shown in fig. 6, the device 600 of the program patch installing includes memory 610 and processor 620, communicated with each other between the memory 610 and processor 620 by internal connecting path, transmitting control and/or data-signal.
The memory 610 is for storing program code;
The processor 620 is for calling said program code to realize the method in the various embodiments described above of the embodiment of the present invention.
In embodiments of the present invention, processor 620 can be central processing unit (Central Processing Unit, CPU), the combination of network processing unit (Network Processor, NP) or CPU and NP.Processor can further include hardware chip.Above-mentioned hardware chip can be specific integrated circuit (Application-Specific Integrated Circuit, ASIC), programmable logic device (Programmable Logic Device, PLD) or combinations thereof.
The embodiment of the invention provides a kind of computer-readable mediums, and for storing computer program code, which includes the instruction for the method for executing the program patch installing of the embodiment of the present invention in above-mentioned Fig. 3 and Fig. 4.The readable medium can be read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM), and the embodiment of the present invention is without limitation.
It should be understood that, the device 600 of program patch installing according to an embodiment of the present invention can correspond to the device of the program patch installing in embodiment of the method, and the above and other operation and/or function of all parts in the device 600 of program patch installing realizes the corresponding process of each method in Fig. 3 and Fig. 4 respectively, for sake of simplicity, details are not described herein.
The embodiment of the invention also provides a kind of System on Chip/SoC, the System on Chip/SoC includes input/output interface, at least one processor, at least one processor and bus, the at least one processor is for storing instruction, at least one processor is used to call the instruction of at least one processor, to carry out the operation of the method for above-mentioned various aspects.
The embodiment of the present invention also provides a kind of MCU, which includes the device 600 of program patch installing described above.
The embodiment of the present invention also provides a kind of terminal device, which includes the device 600 of program patch installing described above.
It should be understood that the terms "and/or" is only a kind of incidence relation for describing affiliated partner, indicate may exist three kinds of relationships, for example, A and/or B, can indicate: individualism A exists simultaneously A and B, these three situations of individualism B.In addition, character "/" herein, typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Those of ordinary skill in the art may be aware that unit described in conjunction with the examples disclosed in the embodiments of the present disclosure and algorithm steps, can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Professional technician can use different methods to achieve the described function each specific application, but this realization is it is not considered that exceed the range of the embodiment of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, system, the specific work process of device and unit of foregoing description can refer to corresponding processes in the foregoing method embodiment, details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods may be implemented in other ways.Such as, the apparatus embodiments described above are merely exemplary, such as, the division of the unit, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed mutual coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, and component shown as a unit may or may not be physical unit, it can and it is in one place, or may be distributed over multiple network units.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
In addition, the functional units in various embodiments of the present invention may be integrated into one processing unit, it is also possible to each unit and physically exists alone, can also be integrated in one unit with two or more units.
It in the above-described embodiments, can be wholly or partly by software, hardware, firmware or it is any Combination is to realize.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program product includes one or more computer instructions.When loading on computers and executing the computer program instructions, entirely or partly generate according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, special purpose computer, computer network or other programmable devices.The computer instruction may be stored in a computer readable storage medium, or it is transmitted from a computer readable storage medium to another computer readable storage medium, for example, the computer instruction can be transmitted from a web-site, computer, server or data center by wired (such as coaxial cable, optical fiber, digital user wire DSL) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or data center.The computer readable storage medium can be any usable medium that computer can access or include the data storage devices such as one or more usable mediums integrated server, data center.The usable medium can be magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk Solid State Disk, SSD) etc..
It is described above; the only specific embodiment of the embodiment of the present invention; but the protection scope of the embodiment of the present invention is not limited thereto; anyone skilled in the art is in the technical scope that the embodiment of the present invention discloses; it can easily think of the change or the replacement, should all cover within the protection scope of the embodiment of the present invention.Therefore, the protection scope of the embodiment of the present invention shall be subject to the protection scope of the claim.

Claims (18)

  1. A kind of method of program patch installing, which is characterized in that described program is stored in mask ROM MASK ROM, which comprises
    When executing the described program in the MASK ROM according to the first corresponding relationship, determine whether the current function in described program needs patch installing, first corresponding relationship is corresponding relationship of the first identifier patch function corresponding with the current function between the initial address in extension read-only memory, and the first identifier is for identifying the current function;
    In the case where the current function needs patch installing, according to the initial address, the first patch function is executed, first patch function is the corresponding patch function of the current function.
  2. The method according to claim 1, wherein determining whether the current function in described program needs patch installing according to the first corresponding relationship when executing the described program in the MASK ROM, comprising:
    According to first corresponding relationship, determine whether the initial address of the corresponding patch function of the current function is located in the address space of the extension read-only memory;
    In the case where the initial address of the corresponding patch function of the current function is located at the address space of the extension read-only memory, determine that the current function needs patch installing.
  3. Method according to claim 1 or 2, which is characterized in that it is described in the case where the current function needs patch installing, according to the initial address, execute the first patch function, comprising:
    Using the parameter of the current function as the parameter of the first patch function;
    According to the parameter of initial address and first patch function of first patch function in the extension read-only memory, first patch function is executed.
  4. According to the method for claim 3, it is characterized in that, the extension read-only memory is also used to store patch function structural body, it include parametric variable in the patch function structural body, return value variable and array of function pointer, the parametric variable is used to transmit the parameter of the current function, the return value variable is used to transmit the return value for executing and obtaining after any one patch function, each of array of function pointer function pointer is used to indicate initial address of each patch function in extension read-only memory, the patch function structural body is located in the lowest address space in the extension read-only memory.
  5. According to the method described in claim 4, it is characterized in that, described using the parameter of the current function as the parameter of the first patch function, comprising:
    By the parameter assignment of the current function to the parametric variable in the patch function structural body;
    Parameter of the parameter of the current function as the first patch function is obtained from the parametric variable in the patch function structural body.
  6. Method according to claim 4 or 5, which is characterized in that the method also includes:
    Determine whether the current function needs return value;
    In the case where the current function needs return value, the return value variable that the return value that first patch function obtains will be executed is assigned in the patch function structural body;
    Return value of the return value as the current function is obtained from the return value variable in the patch function structural body.
  7. The method according to any one of claim 4 to 6, which is characterized in that the method also includes:
    Before executing described program, the example of the patch function structural body is copied in random access memory ram.
  8. Method according to any one of claim 1 to 7, it is characterized in that, the extension read-only memory includes at least one of burning read-only memory OTP ROM, multiple burning read-only memory MTP ROM and Erasable Programmable Read Only Memory EPROM FLASH ROM.
  9. A kind of device of program patch installing, which is characterized in that described device includes:
    Mask ROM MASK ROM is used for storing said program;
    Read-only memory is extended, for corresponding patch function in storing said program;
    Processor, for when executing the described program in the MASK ROM according to the first corresponding relationship, determine whether the current function in described program needs patch installing, first corresponding relationship is corresponding relationship of the first identifier patch function corresponding with the current function between the initial address in the extension read-only memory, and the first identifier is for identifying the current function;
    The processor is also used in the case where the current function needs patch installing, according to the initial address, executes the first patch function, first patch function is the corresponding patch function of the current function.
  10. Device according to claim 9, which is characterized in that the processor is also used to determine whether the initial address of the corresponding patch function of the current function is located in the address space of the extension read-only memory according to first corresponding relationship;
    The processor is also used to determine that the current function needs patch installing in the case where the initial address of the corresponding patch function of the current function is located at the address space of the extension read-only memory.
  11. Device according to claim 9 or 10, which is characterized in that the processor is also used In using the parameter of the current function as the parameter of the first patch function;
    The processor is also used to the parameter of the initial address and first patch function according to first patch function in the extension read-only memory, executes first patch function.
  12. Device according to claim 11, it is characterized in that, the extension read-only memory is also used to store patch function structural body, it include parametric variable in the patch function structural body, return value variable and array of function pointer, the parametric variable is used to transmit the parameter of the current function, the return value variable is used to transmit the return value for executing and obtaining after any one patch function, each of array of function pointer function pointer is used to indicate initial address of each patch function in extension read-only memory, the patch function structural body is located in the lowest address space in the extension read-only memory.
  13. Device according to claim 12, which is characterized in that the processor is also used to the parameter assignment of the current function to the parametric variable in the patch function structural body;
    The processor is also used to obtain parameter of the parameter of the current function as the first patch function from the parametric variable in the patch function structural body.
  14. Device according to claim 12 or 13, which is characterized in that the processor is also used to determine whether the current function needs return value;
    The processor is also used in the case where the current function needs return value, the return value variable that will be executed the return value that first patch function obtains and be assigned in the patch function structural body;
    The processor is also used to obtain return value of the return value as the current function from the return value variable in the patch function structural body.
  15. Device described in any one of 2 to 14 according to claim 1, which is characterized in that the processor is also used to copy to the example of the patch function structural body in random access memory ram.
  16. Device according to any one of claims 9 to 15, it is characterized in that, the extension read-only memory includes at least one of burning read-only memory OTP ROM, multiple burning read-only memory MTP ROM and Erasable Programmable Read Only Memory EPROM FLASH ROM.
  17. A kind of micro-control unit MCU, which is characterized in that the MCU includes the device of the program patch installing as described in any one of claim 9 to 16.
  18. A kind of terminal device, which is characterized in that the terminal device includes the device of the program patch installing as described in any one of claim 9 to 16.
CN201780001062.6A 2017-09-08 2017-09-08 Program patching method and device, micro control unit and terminal equipment Active CN110192178B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/100987 WO2019047142A1 (en) 2017-09-08 2017-09-08 Method for program patching, device, micro control unit, and terminal device

Publications (2)

Publication Number Publication Date
CN110192178A true CN110192178A (en) 2019-08-30
CN110192178B CN110192178B (en) 2023-03-10

Family

ID=65635137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201780001062.6A Active CN110192178B (en) 2017-09-08 2017-09-08 Program patching method and device, micro control unit and terminal equipment

Country Status (2)

Country Link
CN (1) CN110192178B (en)
WO (1) WO2019047142A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111399892A (en) * 2020-03-18 2020-07-10 深圳Tcl数字技术有限公司 Middleware program repairing method and device and computer readable storage medium
CN113094071A (en) * 2021-04-25 2021-07-09 珠海市一微星科技有限公司 Micro control unit, control method thereof and firmware upgrading method thereof

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050257208A1 (en) * 2004-05-11 2005-11-17 Microsoft Corporation Efficient patching
US20060174226A1 (en) * 2005-02-03 2006-08-03 Sytex, Inc. Methods, Test Systems And Computer-Readable Medium For Dynamically Modifying Flow Of Executable Code
CN101334734A (en) * 2007-06-27 2008-12-31 北京中电华大电子设计有限责任公司 Scheme for electric communication card dynamically downloading patch program
CN101561764A (en) * 2009-05-18 2009-10-21 华为技术有限公司 Patching method and patching device under multi-core environment
CN102479265A (en) * 2010-11-25 2012-05-30 上海华虹集成电路有限责任公司 Method for modifying wrong function of firmware of hard mask product
CN103309683A (en) * 2012-03-07 2013-09-18 京信通信系统(中国)有限公司 Software patch embedding method and device for hardware equipment
CN103677933A (en) * 2013-12-19 2014-03-26 大唐微电子技术有限公司 Patching method and system for smart card
CN106055979A (en) * 2016-05-24 2016-10-26 百度在线网络技术(北京)有限公司 Kernel fixing method and apparatus
CN106598667A (en) * 2016-12-12 2017-04-26 百度在线网络技术(北京)有限公司 Method and device used for restoring kernel vulnerability

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927189B (en) * 2013-01-11 2017-10-31 上海华虹集成电路有限责任公司 The implementation method of intelligent cards internal operating system patch
CN103530184B (en) * 2013-10-24 2017-04-12 华为技术有限公司 Method and device for online patch activation
CN104636161B (en) * 2013-11-15 2018-06-19 华为技术有限公司 The online patch method and system of a kind of multiple nucleus system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050257208A1 (en) * 2004-05-11 2005-11-17 Microsoft Corporation Efficient patching
US20060174226A1 (en) * 2005-02-03 2006-08-03 Sytex, Inc. Methods, Test Systems And Computer-Readable Medium For Dynamically Modifying Flow Of Executable Code
CN101334734A (en) * 2007-06-27 2008-12-31 北京中电华大电子设计有限责任公司 Scheme for electric communication card dynamically downloading patch program
CN101561764A (en) * 2009-05-18 2009-10-21 华为技术有限公司 Patching method and patching device under multi-core environment
CN102479265A (en) * 2010-11-25 2012-05-30 上海华虹集成电路有限责任公司 Method for modifying wrong function of firmware of hard mask product
CN103309683A (en) * 2012-03-07 2013-09-18 京信通信系统(中国)有限公司 Software patch embedding method and device for hardware equipment
CN103677933A (en) * 2013-12-19 2014-03-26 大唐微电子技术有限公司 Patching method and system for smart card
CN106055979A (en) * 2016-05-24 2016-10-26 百度在线网络技术(北京)有限公司 Kernel fixing method and apparatus
CN106598667A (en) * 2016-12-12 2017-04-26 百度在线网络技术(北京)有限公司 Method and device used for restoring kernel vulnerability

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111399892A (en) * 2020-03-18 2020-07-10 深圳Tcl数字技术有限公司 Middleware program repairing method and device and computer readable storage medium
CN113094071A (en) * 2021-04-25 2021-07-09 珠海市一微星科技有限公司 Micro control unit, control method thereof and firmware upgrading method thereof
CN113094071B (en) * 2021-04-25 2023-06-09 珠海市一微星科技有限公司 Micro control unit, control method thereof and firmware upgrading method thereof

Also Published As

Publication number Publication date
CN110192178B (en) 2023-03-10
WO2019047142A1 (en) 2019-03-14

Similar Documents

Publication Publication Date Title
CN107896162B (en) Deployment method and device of monitoring system, computer equipment and storage medium
CN110780890B (en) System upgrading method, device, electronic equipment and medium
US10789112B2 (en) Device lifespan estimation method, device design method, and computer readable storage medium
CN109995805B (en) Intelligent robot management method, terminal device and medium
CN110830234B (en) User traffic distribution method and device
CN108776587B (en) Data acquisition method and device, computer equipment and storage medium
US10210296B2 (en) Adaptive bug-search depth for simple and deep counterexamples
CN113504918A (en) Equipment tree configuration optimization method and device, computer equipment and storage medium
CN111262753B (en) Method, system, terminal and storage medium for automatically configuring number of NUMA nodes
CN110192178A (en) Method, apparatus, micro-control unit and the terminal device of program patch installing
CN106873970A (en) The installation method and device of a kind of operating system
US9716625B2 (en) Identifying compatible system configurations
CN116467061A (en) Task execution method and device, storage medium and electronic equipment
CN109542462B (en) System environment deployment method, storage medium and server
CN109491909A (en) A kind of CPLD refreshes verification method, device, terminal and storage medium
CN113821439A (en) Method, device, storage medium and terminal for registering function to probe point
CN107911816A (en) Startup method, multimode IoT equipment and storage medium for multimode IoT equipment
CN116049000A (en) Environment parameter configuration method, device, equipment, storage medium and product
CN112997156A (en) Dynamic allocation of computing resources for electronic design automation operations
CN109857474A (en) Start the method and apparatus of application program
CN109558565B (en) Operation method, device and related product
CN114579499A (en) Control method, device, equipment and storage medium of processor communication interface
CN111078596A (en) Flash chip control method, device and system and readable storage medium
CN113791869A (en) Method for acquiring shell permission of terminal equipment based on android system
CN106155731B (en) System and method for automatically replacing peripheral device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant