CN110737603A - method and device for replacing functions in ROM - Google Patents

method and device for replacing functions in ROM Download PDF

Info

Publication number
CN110737603A
CN110737603A CN201810792741.6A CN201810792741A CN110737603A CN 110737603 A CN110737603 A CN 110737603A CN 201810792741 A CN201810792741 A CN 201810792741A CN 110737603 A CN110737603 A CN 110737603A
Authority
CN
China
Prior art keywords
function
repaired
functions
new
group number
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
CN201810792741.6A
Other languages
Chinese (zh)
Other versions
CN110737603B (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.)
Torch (zhuhai) Microelectronics Co Ltd
Original Assignee
Torch (zhuhai) Microelectronics 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 Torch (zhuhai) Microelectronics Co Ltd filed Critical Torch (zhuhai) Microelectronics Co Ltd
Priority to CN201810792741.6A priority Critical patent/CN110737603B/en
Publication of CN110737603A publication Critical patent/CN110737603A/en
Application granted granted Critical
Publication of CN110737603B publication Critical patent/CN110737603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/78Architectures of general purpose stored program computers comprising a single central processing unit
    • G06F15/7807System on chip, i.e. computer system on a single chip; System in package, i.e. computer system on one or more chips in a single package
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to a computer technology, in particular to a method and a device for replacing functions in kinds of ROM, which are used for reducing code overhead in the function replacement process and reducing implementation complexity.

Description

method and device for replacing functions in ROM
Technical Field
The invention relates to a computer technology, in particular to a method and a device for replacing functions in a ROM (read only memory) by types.
Background
Generally, the ROM is arranged inside a System On Chip (SOC) and used for storing data and codes, and after SOC streaming is finished (namely production is finished), the data and the codes stored in the ROM cannot be modified any more , the hidden danger of the data or the codes stored in the ROM is discovered, when the hidden danger of the data or the codes is needed to be modified, the SOC streaming needs to be carried out again, and the cost are high.
Referring to fig. 1, for each potentially risky function recorded in the ROM, an access address of each function is defined and stored in the form of a function table (function table) defined in a Random-access memory (RAM). While other functions call potentially risky functions recorded in the ROM, not directly but via pointers.
For example: assuming that there are three functions, namely function 1(function1), function 2(function2) and function 3(function3), when function1, function2 and function3 need to call function a in ROM, function a is not called directly, but access address a of function a is obtained from function table, and then jump to ROM according to access address a to read a to run.
Then, when the code of the function a has hidden danger and needs to be repaired for the function a, new functions a1 need to be designed, the access address a of the function a in the function table is modified to the access address a1, the pointer is made to point to the call interface of the function a1 again, and the function a is discarded and is not used any more.
Therefore, the calling function A can be changed into the calling function A1 without modifying the code in the ROM, and the repairing requirement of the function in the ROM is completed.
However, the above solution has the following drawbacks:
new pointer call interfaces need to be implemented for every functions to be repaired in ROM to replace the original interfaces, thereby increasing implementation complexity.
In addition, , in the ROM code development stage, when the common function in the ROM code needs to be changed to the function to be repaired, defining a new function pointer and modifying all the codes calling the function to be repaired into the calling function pointer;
for example, a new function pointer, called pointer a1, is defined for function a, then assuming function1, function2, and function3 require calling function a, the code in function1, function2, and function3 that calls function a needs to be modified to call pointer a 1.
Such modifications, referred to as "intrusive modifications," increase code overhead and also increase implementation complexity.
Disclosure of Invention
The embodiment of the invention provides methods and devices for replacing functions in a ROM, which are used for reducing code overhead in the function replacement process and reducing implementation complexity.
The embodiment of the invention provides the following specific technical scheme:
A method for replacing functions in a read only memory ROM, comprising:
determining a function index of a function to be repaired, wherein the function index is at least used for indicating a group number of the function to be repaired;
finding a function table corresponding to the function to be repaired in a ROM according to the group number, wherein the function table records the access address of each function to be repaired in the function group to which the function to be repaired belongs;
copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
and acquiring a pointer set corresponding to the group number in an RAM (random access memory), and pointing the pointer to the new function table.
Optionally, in the preprocessing stage, step includes:
determining all functions to be written to the ROM;
dividing each function designated in the ROM into a plurality of groups based on a preset rule;
corresponding to each function groups, setting corresponding function tables in ROM;
a corresponding group number is set for each function tables.
Optionally, step includes:
and respectively setting corresponding interface functions corresponding to the appointed functions, wherein when functions are called by other functions, the functions are indirectly called through the interface functions corresponding to the functions.
Optionally, the functions specified in the ROM are divided into a plurality of groups based on preset rules, including:
the function that the difference between the risk levels is below the th set limit is divided into groups or,
the functions having differences between repair difficulty ratings below the second set limit are divided into groups, or,
and dividing functions with the difference of real-time requirements in the running process of the functions lower than the limit value of the third set into groups.
Optionally, step includes:
setting a RAM pointer table in a RAM, wherein each pointers recorded in the RAM pointer table point to each function tables respectively;
the group number of the corresponding pointer is set for each function table to which pointers point.
Optionally, determining a function index of the function to be repaired includes:
calling an interface function set corresponding to the function to be repaired according to the instruction;
and determining a function index of the function to be repaired based on the interface function.
Optionally, obtaining the pointer set corresponding to the group number in the RAM includes:
based on the interface function, adopting a direct skip mode or an abnormal skip mode to skip to a preset distribution function;
and searching a corresponding pointer in the RAM through the distribution function based on the group number contained in the function index.
Optionally, the distribution function is set by the system , or the distribution function is set corresponding to a function group to which the function to be repaired belongs, or the distribution function is set corresponding to the function to be repaired.
Optionally, copying the function table to a specified storage location, generating a corresponding new function table, and updating the access address of the function to be repaired to the access address of the set new function in the new function table, including:
copying the function table into an RAM (random access memory) to generate a corresponding new function table;
determining a generated new function for replacing the function to be repaired;
assigning the group number of the function to be repaired to the new function;
and based on the in-group number of the function to be repaired contained in the step of function indexing, finding the access address of the function to be repaired in the new function table, and replacing the access address of the function to be repaired with the access address of the new function.
apparatus for replacing functions in a ROM, comprising at least:
the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining a function index of a function to be repaired, and the function index is at least used for indicating the group number of the function to be repaired;
an processing unit, configured to find a function table corresponding to the function to be repaired in a ROM based on the group number, where the function table records an access address of each function to be repaired in a function group to which the function to be repaired belongs;
the second processing unit is used for copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
and the third processing unit is used for acquiring a pointer set corresponding to the group number in the RAM and pointing the pointer to the new function table.
Optionally, step includes a preprocessing unit for performing the following operations during a preprocessing phase:
determining all functions to be written to the ROM;
dividing each function designated in the ROM into a plurality of groups based on a preset rule;
corresponding to each function groups, setting corresponding function tables in ROM;
a corresponding group number is set for each function tables.
Optionally, the preprocessing unit is further configured to:
and respectively setting corresponding interface functions corresponding to the appointed functions, wherein when functions are called by other functions, the functions are indirectly called through the interface functions corresponding to the functions.
When the functions specified in the ROM are divided into a plurality of groups based on a preset rule, the preprocessing unit is configured to:
the function that the difference between the risk levels is below the th set limit is divided into groups or,
the functions having differences between repair difficulty ratings below the second set limit are divided into groups, or,
and dividing functions with the difference of real-time requirements in the running process of the functions lower than the limit value of the third set into groups.
Optionally, the preprocessing unit, further , is configured to:
setting a RAM pointer table in a RAM, wherein each pointers recorded in the RAM pointer table point to each function tables respectively;
the group number of the corresponding pointer is set for each function table to which pointers point.
Optionally, when determining the function index of the function to be repaired, the determining unit is configured to:
calling an interface function set corresponding to the function to be repaired according to the instruction;
and determining a function index of the function to be repaired based on the interface function.
Optionally, when acquiring the pointer set corresponding to the group number in the RAM, the th processing unit is configured to:
based on the interface function, adopting a direct skip mode or an abnormal skip mode to skip to a preset distribution function;
and searching a corresponding pointer in the RAM through the distribution function based on the group number contained in the function index.
Optionally, the distribution function is set by the system , or the distribution function is set corresponding to a function group to which the function to be repaired belongs, or the distribution function is set corresponding to the function to be repaired.
Optionally, the function table is copied to a specified storage location, a corresponding new function table is generated, and when the access address of the function to be repaired is updated to the access address of the set new function in the new function table, the second processing unit is configured to:
copying the function table into an RAM (random access memory) to generate a corresponding new function table;
determining a generated new function for replacing the function to be repaired;
assigning the group number of the function to be repaired to the new function;
and based on the in-group number of the function to be repaired contained in the step of function indexing, finding the access address of the function to be repaired in the new function table, and replacing the access address of the function to be repaired with the access address of the new function.
storage medium storing a program for implementing functions in a replacement read only memory ROM, said program when executed by a processor performing the steps of:
determining a function index of a function to be repaired, wherein the function index is at least used for indicating a group number of the function to be repaired;
finding a function table corresponding to the function to be repaired in a ROM based on the group number, wherein the function table records the access address of each function to be repaired in the function group to which the function to be repaired belongs;
copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
and acquiring a pointer set corresponding to the group number in an RAM (random access memory), and pointing the pointer to the new function table.
communication devices comprising or more processors, and
, or a plurality of computer readable media having instructions stored thereon that, when executed by the or plurality of processors, cause the apparatus to perform the method of any of above.
In the embodiment of the invention, each function in a ROM is grouped in advance, then after the group number of the function to be repaired is determined, a function table corresponding to the function to be repaired is found in the ROM based on the group number, the function table is copied to a specified storage position to generate a corresponding new function table, the access address of the function to be repaired is updated to the access address of the set new function in the new function table, and finally, a pointer set corresponding to the group number points to the new function table. Therefore, functions in the ROM are grouped, when the functions are repaired, only each function in the function group to which the functions to be repaired belong is influenced, the modification influence range is small, resource expenditure of the RAM in the repair process is reduced, meanwhile, in the repair process, the repair can be completed only by repositioning the pointer corresponding to the function group to which the functions to be repaired belong, and other functions can be called to the new functions through the original calling mode.
Drawings
FIG. 1 is a diagram illustrating a function calling method in a ROM according to the prior art;
FIG. 2 is a diagram illustrating grouping of functions to be repaired in ROM according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating indirect invocation of a function to be repaired according to an embodiment of the present invention;
FIG. 4 is a flowchart of replacing a function to be repaired according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a function to be repaired replaced according to an embodiment of the present invention;
FIG. 6 is a functional structure diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to reduce the code overhead in the function replacement process in the ROM and reduce the implementation complexity, in the embodiment of the invention, the functions are grouped in advance, then, after the group number of the function to be repaired is determined, the function table corresponding to the group number is searched in the ROM, and only the function table is copied, modified and redirected by a pointer, so the implementation complexity is effectively reduced.
Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
In the embodiment of the invention, in the preprocessing stage, before the SOC is subjected to tape casting, each function in the ROM needs to be marked and grouped, and the method specifically comprises the steps of determining each function to be written into the ROM, grouping each function based on a preset rule, respectively corresponding to each function groups, setting a corresponding function table in the ROM, setting a corresponding group number corresponding to each function table, and setting a corresponding group number and an intra-group number corresponding to each function.
For example, referring to fig. 2, assuming that each designated function in the ROM is divided into N groups, the designated functions refer to functions that may be at risk and may need to be repaired in a subsequent process, each function groups correspond to function tables, access addresses of each function included in function groups are recorded in the function tables, each function tables is provided with a corresponding group number (e.g., 0, 1, 2 … … N), and steps, each functions is provided with a corresponding group number (e.g., 0, 1, 2 … … N) and an intra-group number (e.g., 0, 1, 2 … … M).
The preset rules referred to when grouping the functions can be flexibly set by the administrator according to the specific application environment, and optionally, any of the following ways can be adopted.
Manner a function having a difference between risk levels below the setting limit (i.e., the risk levels are similar) is divided into groups.
In practical application, the probability of hidden dangers occurring in different functions is different, so different risk levels can be set for different functions according to experience, for example, functions which frequently occur problems can be divided into groups, functions which do not frequently occur problems can be divided into groups, and thus, related operations can be effectively avoided being executed on the function groups which do not frequently occur problems, and execution complexity in the repairing process is effectively reduced.
In the second mode, the functions with the difference between the repair difficulty grades lower than the second set limit (i.e. the repair difficulty grades are similar) are divided into groups.
In practical application, the source code magnitudes of different functions are different, so that different repair difficulty levels can be set for the functions of different source code magnitudes according to experience, the functions with high repair difficulty can be divided into groups, the functions with medium repair difficulty can be divided into groups, and the functions with low repair difficulty can be divided into groups.
And thirdly, dividing the functions with the difference of the real-time requirements in the running process of the functions lower than a third preset limit value (namely, the real-time requirements are similar) into groups.
The real-time requirement may be various, such as the running duration of the function, the number of resources occupied by the function during running, and the like.
, RAM pointer tables are generated in the RAM, pointers corresponding to function tables are recorded in the RAM pointer tables, and group numbers are corresponding to pointers, so that the corresponding function tables can be accessed in the ROM through pointers in the RAM pointer tables, and then the access addresses of the functions to be called can be found through the function tables.
As shown in fig. 3, assuming that each function in the ROM is divided into N groups, N pointers are correspondingly recorded in the RAM pointer table for pointing to the start positions of the corresponding function tables, respectively.
, in the embodiment of the present invention, for each function specified in the ROM, a corresponding small jump code, also called an interface function (e.g., a fix function), is also generated, respectively, for setting a function index (index) of the function, where the function index is used to implement indirect invocation of the function.
As shown in fig. 3, function1, function2 and function3 are called directly when calling function a, but the call to a is modified to call function a _ fix by using a linking technique, that is, modified to a function index of calling function a, so that indirect call of function a is realized.
Optionally, the fix function should conform to the format of system :
and setting a function index, wherein the function index at least comprises a group number and an intra-group number of the function to be contained, for example, (2, 8) can represent an 8 th function in the 2 nd group function table.
Through a fix function, the system can jump to an entry of a preset distribution function (distribution) to realize a subsequent function, optionally, the system can jump to the distribution function in an abnormal jump mode (such as interrupt exception and instruction exception), or jump to the distribution function in a direct jump mode (namely, a common jump function is written in a ROM), wherein after the SOC stream slice is completed, when the abnormal jump mode is adopted, the system can directly jump to a source code of the distribution function written in the RAM to execute related operations.
In the embodiment of the invention, the distribution function of the system is set for a plurality of functions, and the distribution function has the following functions that by calling the distribution function, the initial address of the corresponding function table can be found according to the group number contained in the function index, then the access address of the corresponding function is found by starting from the initial address and shifting in the group based on the group number contained in the function index, and the corresponding function is operated by jumping to the access address.
Optionally, the global system may set distribution functions, distribution functions may be set for each groups of functions to be repaired, and distribution functions may be set for each functions to be repaired.
Further , the functions of the distribution function and the fix function may also be combined to balance RAM and CPU resources.
Further , the distribution function may be implemented by hardware circuitry to speed up execution.
Based on the above configuration, referring to fig. 4, in the embodiment of the present invention, a specific process for replacing a function in a ROM is as follows:
step 400: and determining a function index of the function to be repaired, wherein the function index is at least used for indicating the group number of the function to be repaired.
Specifically, the system may call a fix function of the function to be repaired according to an instruction of the administrator, so as to obtain a function index of the function to be repaired.
In the embodiment of the present invention, it is assumed that the group number in the fix function index is 0.
Further , the fix function may further include the intra-group number of the target function to be modified, which is not described herein again.
Step 410: and searching a function table corresponding to the function to be repaired in a ROM based on the group number, wherein the function table records the access address of each function in the function group to which the function to be repaired belongs.
For example, still referring to fig. 2, it is assumed that the group number 0 corresponds to function table function _0 in the ROM, and the access addresses of the function groups to which the function to be repaired belongs, that is, the access addresses of F _0, F _1, and F _ i are recorded in the function table function _ 0.
Step 420: and copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the access address of the set new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function.
Specifically, the system may generate new functions for replacing the functions to be repaired (the new functions may be generated at any time point, in this embodiment, only generation before step 400 is taken as an example), assign the group number of the functions to be repaired to the new functions, and then, based on the group number of the functions to be repaired included in the step by the function index, find the access address of the functions to be repaired in the new function table, and replace the access address of the functions to be repaired with the access address of the new functions, of course, after the access addresses are replaced, assign the group number of the functions to be repaired to the new functions again.
In the embodiment of the present invention, the function table is copied to the RAM, and in practical applications, depending on the data amount of the function table, the function table may be copied to any storage location in the computer device other than the ROM, such as a hard disk, a flash memory, and the like, and only the function table needs to be copied to the specified storage location and can be modified accordingly.
Step 430: and acquiring a pointer set corresponding to the group number in an RAM (random access memory), and pointing the pointer to the new function table.
Specifically, the system may jump to a preset distribution function by using a direct jump manner or an abnormal jump manner based on a fix function corresponding to the function to be repaired, and then search a corresponding pointer in the RAM based on a group number included in the function index through the distribution function, where the distribution function is set by the system , or the distribution function is set corresponding to a function group to which the function to be repaired belongs, or the distribution function is set corresponding to the function to be repaired.
Specifically, the system searches a pointer set corresponding to the group number in the RAM pointer table through the distribution function, and the pointer points to a function table corresponding to a function group to which the function to be repaired belongs in the ROM.
For example, referring to fig. 2, assuming that the group number of the function to be repaired is 0, the pointer set corresponding to the group number 0 can be found in the RAM pointer table to be function _ table _0_ pointer.
Then, the system points the pointer (e.g., function _ table _0_ pointer) pointing to the function table corresponding to the function to be repaired in the ROM from the RAM pointer table to the new function table (e.g., function table _0_ fix) from the function table pointing to the original function table (e.g., function table _ 0). Thus, when there are other functions to call the function to be repaired next time, the system does not read the function table _0, but when the distribution function is called, the function _ table _0_ pointer is found according to the group number, and then the function _ table _0_ pointer finds the function table _0_ fix in the RAM, so that the access address of the new function is found in the function table _0_ fix according to the group number (given to the new function) of the function to be repaired, and finally the new function is called to complete the related operation.
For example, referring to fig. 5, after comparing the modified code with the original code (the original code is in ROM and is not changeable), the system determines that all functions to be modified are function a, function C and function D as shown in fig. 5, meanwhile, as shown in fig. 5, in ROM, it is assumed that function a, function B, function C and function D belong to the same function groups.
Then, the system stores the newly generated function a1, function C1 and function D1 in the RAM, and generates new function tables N _ fix (i.e., function _ table N _ fix) based on the original function table N (i.e., function _ table N), where the access addresses of the original function a, function C and function D in the ROM are replaced with the access addresses of the new function a1, function C1 and function D1, respectively, and the function B does not need to be repaired, so that the access address of the function B remains unchanged and points to the function B in the ROM in the function _ table N _ fix.
Then, the pointer table _ pointer _ N in the RAM pointer table to the function _ table N points to the function _ table N _ fix.
When another function calls the function a, the function B, and the function D, new functions a1, C1, and D1 are called, and thus, the function replacement in the ROM is successfully completed.
Based on the above embodiments, referring to fig. 6, in an embodiment of the present invention, an apparatus (e.g., computer apparatuses) for replacing a function in a ROM at least includes:
a determining unit 60, configured to determine a function index of a function to be repaired, where the function index is at least used to indicate a group number of the function to be repaired;
is a processing unit 61, configured to search, based on the group number, a function table corresponding to the function to be repaired in a ROM, where the function table records an access address of each function to be repaired in a function group to which the function to be repaired belongs;
the second processing unit 62 is configured to copy the function table to a specified storage location, generate a corresponding new function table, and update an access address of the function to be repaired to a set access address of a new function in the new function table, where the new function is used to replace the function to be repaired to execute a corresponding function;
and a third processing unit 63, configured to obtain a pointer set corresponding to the group number in the RAM, and point the pointer to the new function table.
Optionally, step includes a preprocessing unit 64 for performing the following operations during a preprocessing phase:
determining all functions to be written to the ROM;
dividing each function designated in the ROM into a plurality of groups based on a preset rule;
corresponding to each function groups, setting corresponding function tables in ROM;
a corresponding group number is set for each function tables.
Optionally, the preprocessing unit 64 is further configured to:
and respectively setting corresponding interface functions corresponding to the appointed functions, wherein when functions are called by other functions, the functions are indirectly called through the interface functions corresponding to the functions.
Optionally, when the functions specified in the ROM are divided into a plurality of groups based on a preset rule, the preprocessing unit 64 is configured to:
the function that the difference between the risk levels is below the th set limit is divided into groups or,
the functions having differences between repair difficulty ratings below the second set limit are divided into groups, or,
and dividing functions with the difference of real-time requirements in the running process of the functions lower than the limit value of the third set into groups.
Optionally, the preprocessing unit 64, further , is configured to:
setting a RAM pointer table in a RAM, wherein each pointers recorded in the RAM pointer table point to each function tables respectively;
the group number of the corresponding pointer is set for each function table to which pointers point.
Optionally, when determining the function index of the function to be repaired, the determining unit 60 is configured to:
calling an interface function set corresponding to the function to be repaired according to the instruction;
and determining a function index of the function to be repaired based on the interface function.
Optionally, when acquiring the pointer set corresponding to the group number in the RAM, the -th processing unit 61 is configured to:
based on the interface function, adopting a direct skip mode or an abnormal skip mode to skip to a preset distribution function;
and searching a corresponding pointer in the RAM through the distribution function based on the group number contained in the function index.
Optionally, the distribution function is set by the system , or the distribution function is set corresponding to a function group to which the function to be repaired belongs, or the distribution function is set corresponding to the function to be repaired.
Optionally, the function table is copied to a specified storage location, a corresponding new function table is generated, and when the access address of the function to be repaired is updated to the set access address of the new function in the new function table, the second processing unit 62 is configured to:
copying the function table into an RAM (random access memory) to generate a corresponding new function table;
determining a generated new function for replacing the function to be repaired;
assigning the group number of the function to be repaired to the new function;
and based on the in-group number of the function to be repaired contained in the step of function indexing, finding the access address of the function to be repaired in the new function table, and replacing the access address of the function to be repaired with the access address of the new function.
Based on the same inventive concepts, storage media are provided in the embodiments of the present invention, which store programs for implementing functions in a replacement read only memory ROM, and when the programs are executed by a processor, the following steps are performed:
determining a function index of a function to be repaired, wherein the function index is at least used for indicating a group number of the function to be repaired;
finding a function table corresponding to the function to be repaired in a ROM based on the group number, wherein the function table records the access address of each function to be repaired in the function group to which the function to be repaired belongs;
copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
and acquiring a pointer set corresponding to the group number in an RAM (random access memory), and pointing the pointer to the new function table.
Based on the same inventive concepts, the embodiment of the invention provides communication devices, which comprise or more processors, and
one or more computer-readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform the method of any of claims 1-9 .
In summary, in the embodiment of the present invention, each function in the ROM is grouped in advance, then after the group number of the function to be repaired is determined, the function table corresponding to the function to be repaired is found in the ROM based on the group number, and after the function table is copied to a specified storage location to generate a corresponding new function table, in the new function table, the access address of the function to be repaired is updated to the access address of the set new function, and finally, a pointer set corresponding to the group number is obtained in the RAM, and the pointer points to the new function table.
Therefore, the functions in the ROM are grouped, when the functions are repaired, only each function in the function group to which the functions to be repaired belong is influenced, the modification influence range is small, the resource expense of the RAM in the repair process is reduced, meanwhile, in the repair process, the repair can be completed only by repositioning the pointer corresponding to the function group to which the functions to be repaired belong, and other functions can be called to a new function through the original calling mode.
, in the embodiment of the present invention, in the stage of ROM code development, corresponding interface functions are defined for each specified function (i.e., a function that may need to be modified) respectively, so as to implement indirect call of the function, and meanwhile, direct call of other functions to each function is converted into indirect call of a corresponding interface function, so that source codes of other functions do not need to be modified in an intrusive manner, and therefore, the cost for modifying codes is reduced in step , and the implementation complexity is effectively reduced in step ,
furthermore, the present invention may take the form of a computer program product embodied on or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
It is to be understood that each flow and/or block in the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions which can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flow diagram flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Having described preferred embodiments of the invention, further alterations and modifications may be effected to these embodiments by those skilled in the art having the benefit of the basic inventive concepts .
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.

Claims (12)

  1. A method of replacing a function in a read only memory ROM of the type 1, , comprising:
    determining a function index of a function to be repaired, wherein the function index is at least used for indicating a group number of the function to be repaired;
    finding a function table corresponding to the function to be repaired in a ROM based on the group number, wherein the function table records the access address of each function to be repaired in the function group to which the function to be repaired belongs;
    copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
    and acquiring a pointer set corresponding to the group number in an RAM (random access memory), and pointing the pointer to the new function table.
  2. 2. The method of claim 1, wherein during the preprocessing stage, step comprises:
    determining all functions to be written to the ROM;
    dividing each function designated in the ROM into a plurality of groups based on a preset rule;
    corresponding to each function groups, setting corresponding function tables in ROM;
    a corresponding group number is set for each function tables.
  3. 3. The method of claim 2, wherein step comprises:
    and respectively setting corresponding interface functions corresponding to the appointed functions, wherein when functions are called by other functions, the functions are indirectly called through the interface functions corresponding to the functions.
  4. 4. The method of claim 2, wherein dividing the functions specified in the ROM into groups based on a predetermined rule comprises:
    the function that the difference between the risk levels is below the th set limit is divided into groups or,
    the functions having differences between repair difficulty ratings below the second set limit are divided into groups, or,
    and dividing functions with the difference of real-time requirements in the running process of the functions lower than the limit value of the third set into groups.
  5. 5. The method of claim 2, wherein step comprises:
    setting a RAM pointer table in a RAM, wherein each pointers recorded in the RAM pointer table point to each function tables respectively;
    the group number of the corresponding pointer is set for each function table to which pointers point.
  6. 6. The method of any of claims 1-5 and , wherein determining a function index for a function to be repaired comprises:
    calling an interface function set corresponding to the function to be repaired according to the instruction;
    and determining a function index of the function to be repaired based on the interface function.
  7. 7. The method of claim 6, wherein obtaining a pointer in RAM that is set corresponding to the group number comprises:
    based on the interface function, adopting a direct skip mode or an abnormal skip mode to skip to a preset distribution function;
    and searching a corresponding pointer in the RAM through the distribution function based on the group number contained in the function index.
  8. 8. The method of claim 7, wherein the distribution function is set by the system , or the distribution function is set corresponding to a function group to which the function to be repaired belongs, or the distribution function is set corresponding to the function to be repaired.
  9. 9. The method of any of claims 1-5, wherein copying the function table to a specified storage location, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table comprises:
    copying the function table into an RAM (random access memory) to generate a corresponding new function table;
    determining a generated new function for replacing the function to be repaired;
    assigning the group number of the function to be repaired to the new function;
    and based on the in-group number of the function to be repaired contained in the step of function indexing, finding the access address of the function to be repaired in the new function table, and replacing the access address of the function to be repaired with the access address of the new function.
  10. 10, apparatus for replacing functions in a ROM, comprising at least:
    the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining a function index of a function to be repaired, and the function index is at least used for indicating the group number of the function to be repaired;
    an processing unit, configured to find a function table corresponding to the function to be repaired in a ROM based on the group number, where the function table records an access address of each function to be repaired in a function group to which the function to be repaired belongs;
    the second processing unit is used for copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
    and the third processing unit is used for acquiring a pointer set corresponding to the group number in the RAM and pointing the pointer to the new function table.
  11. Storage medium , characterized in that a program for implementing functions in a replacement read only memory ROM is stored, which program, when executed by a processor, performs the steps of:
    determining a function index of a function to be repaired, wherein the function index is at least used for indicating a group number of the function to be repaired;
    finding a function table corresponding to the function to be repaired in a ROM based on the group number, wherein the function table records the access address of each function to be repaired in the function group to which the function to be repaired belongs;
    copying the function table to a specified storage position, generating a corresponding new function table, and updating the access address of the function to be repaired to the set access address of the new function in the new function table, wherein the new function is used for replacing the function to be repaired to execute a corresponding function;
    and acquiring a pointer set corresponding to the group number in an RAM (random access memory), and pointing the pointer to the new function table.
  12. 12, communication device, comprising or more processors, and
    one or more computer-readable media having instructions stored thereon that, when executed by the one or more processors, cause the apparatus to perform the method of any of claims 1-9 .
CN201810792741.6A 2018-07-18 2018-07-18 Method and device for replacing functions in ROM Active CN110737603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810792741.6A CN110737603B (en) 2018-07-18 2018-07-18 Method and device for replacing functions in ROM

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810792741.6A CN110737603B (en) 2018-07-18 2018-07-18 Method and device for replacing functions in ROM

Publications (2)

Publication Number Publication Date
CN110737603A true CN110737603A (en) 2020-01-31
CN110737603B CN110737603B (en) 2023-08-01

Family

ID=69234989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810792741.6A Active CN110737603B (en) 2018-07-18 2018-07-18 Method and device for replacing functions in ROM

Country Status (1)

Country Link
CN (1) CN110737603B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463230A (en) * 2020-11-23 2021-03-09 浙江地芯引力科技有限公司 Program operation method and device, electronic equipment and storage medium
CN113342555A (en) * 2020-02-18 2021-09-03 炬芯科技股份有限公司 Method and device for repairing ROM and storage medium
CN117743011A (en) * 2023-12-20 2024-03-22 无锡众星微系统技术有限公司 RomCode operation error repairing method and device

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5757690A (en) * 1997-04-23 1998-05-26 Exponential Technology, Inc. Embedded ROM with RAM valid bits for fetching ROM-code updates from external memory
US20020120810A1 (en) * 2001-02-28 2002-08-29 Brouwer Roger J. Method and system for patching ROM code
CN1862510A (en) * 2005-05-10 2006-11-15 展讯通信(上海)有限公司 Method for correcting ROM code in embedded system
US20100153619A1 (en) * 2008-12-16 2010-06-17 Mediatek Inc. Data processing and addressing methods for use in an electronic apparatus
CN101976211A (en) * 2010-09-26 2011-02-16 北京握奇数据系统有限公司 Method, device and system for replacing function in CAP file
JP2014063350A (en) * 2012-09-21 2014-04-10 Hitachi Automotive Systems Ltd Automotive electronic control device
CN103885807A (en) * 2014-04-03 2014-06-25 四川九成信息技术有限公司 Equipment program updating method
CN105792751A (en) * 2013-11-27 2016-07-20 雅培糖尿病护理公司 Systems and methods for revising permanent ROM-based programming
CN106507371A (en) * 2015-09-07 2017-03-15 富士通株式会社 The method and apparatus for determining object of planning function
CN107145362A (en) * 2016-03-01 2017-09-08 瑞萨电子株式会社 Embedded device and method for updating program

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5757690A (en) * 1997-04-23 1998-05-26 Exponential Technology, Inc. Embedded ROM with RAM valid bits for fetching ROM-code updates from external memory
US20020120810A1 (en) * 2001-02-28 2002-08-29 Brouwer Roger J. Method and system for patching ROM code
CN1862510A (en) * 2005-05-10 2006-11-15 展讯通信(上海)有限公司 Method for correcting ROM code in embedded system
US20100153619A1 (en) * 2008-12-16 2010-06-17 Mediatek Inc. Data processing and addressing methods for use in an electronic apparatus
CN101976211A (en) * 2010-09-26 2011-02-16 北京握奇数据系统有限公司 Method, device and system for replacing function in CAP file
JP2014063350A (en) * 2012-09-21 2014-04-10 Hitachi Automotive Systems Ltd Automotive electronic control device
CN105792751A (en) * 2013-11-27 2016-07-20 雅培糖尿病护理公司 Systems and methods for revising permanent ROM-based programming
CN103885807A (en) * 2014-04-03 2014-06-25 四川九成信息技术有限公司 Equipment program updating method
CN106507371A (en) * 2015-09-07 2017-03-15 富士通株式会社 The method and apparatus for determining object of planning function
JP2017055395A (en) * 2015-09-07 2017-03-16 富士通株式会社 Method and device for determining plan object function
CN107145362A (en) * 2016-03-01 2017-09-08 瑞萨电子株式会社 Embedded device and method for updating program

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342555A (en) * 2020-02-18 2021-09-03 炬芯科技股份有限公司 Method and device for repairing ROM and storage medium
CN113342555B (en) * 2020-02-18 2024-01-09 炬芯科技股份有限公司 ROM repairing method, device and storage medium
CN112463230A (en) * 2020-11-23 2021-03-09 浙江地芯引力科技有限公司 Program operation method and device, electronic equipment and storage medium
CN112463230B (en) * 2020-11-23 2023-08-25 浙江地芯引力科技有限公司 Program running method and device, electronic equipment and storage medium
CN117743011A (en) * 2023-12-20 2024-03-22 无锡众星微系统技术有限公司 RomCode operation error repairing method and device

Also Published As

Publication number Publication date
CN110737603B (en) 2023-08-01

Similar Documents

Publication Publication Date Title
CN106933733B (en) Method and device for determining memory leak position
CN110737603B (en) Method and device for replacing functions in ROM
CN113641701B (en) Data query method, system, heterogeneous acceleration platform and storage medium
CN111813805A (en) Data processing method and device
CN107577697B (en) Data processing method, device and equipment
CN112015491B (en) Method, device and computer storage medium for realizing function jump
CN110647562B (en) Data query method and device, electronic equipment and storage medium
US10338910B2 (en) Multi-tenant upgrading
CN111443912A (en) Page rendering method and device based on components, computer equipment and storage medium
US8769498B2 (en) Warning of register and storage area assignment errors
CN107491700B (en) Data access method and equipment
GB2504122A (en) Locating software units of a software module to facilitate software refactoring
CN117196850A (en) Method and device for determining financial product combination, electronic equipment and storage medium
CN110688320B (en) Global variable detection method and device and terminal equipment
CN114564228A (en) Application program updating method and device, computer equipment and storage medium
CN111339371A (en) Data processing method and device
WO2017088547A1 (en) Data upgrading method and apparatus
US9483241B2 (en) Method ranking based on code invocation
CN113111072A (en) Business data file generation method and device
JP2018022433A (en) Control program, apparatus, and method
CN111428209B (en) Application program confusion method, device and storage medium
CN110019436B (en) Data import \ export method and device and data table processing method and device
CN107451201B (en) Data access method and equipment
JP5517904B2 (en) Data access processing management / generation system
CN114168275B (en) Task scheduling method, system, terminal device and storage medium

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Room 105-1023, No.6 Baohua Road, Hengqin New District, Zhuhai City, Guangdong Province

Applicant after: Ju Li (Zhuhai) Microelectronics Co.,Ltd.

Address before: 519085 Guangdong city of Zhuhai province Hengqin Baohua Road No. 6, room 105 -1023

Applicant before: JUXIN (ZHUHAI) MICROELECTRONICS Co.,Ltd.

GR01 Patent grant
GR01 Patent grant