CN110333885A - A kind of embedded OS patch setting method - Google Patents

A kind of embedded OS patch setting method Download PDF

Info

Publication number
CN110333885A
CN110333885A CN201910583415.9A CN201910583415A CN110333885A CN 110333885 A CN110333885 A CN 110333885A CN 201910583415 A CN201910583415 A CN 201910583415A CN 110333885 A CN110333885 A CN 110333885A
Authority
CN
China
Prior art keywords
patch
chip microcontroller
record
value
address
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
CN201910583415.9A
Other languages
Chinese (zh)
Other versions
CN110333885B (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.)
ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) Co Ltd
Original Assignee
ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) 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 ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) Co Ltd filed Critical ZHAOXUN HENGDA MICROELECTRONICS TECHNOLOGY (BEIJING) Co Ltd
Priority to CN201910583415.9A priority Critical patent/CN110333885B/en
Publication of CN110333885A publication Critical patent/CN110333885A/en
Application granted granted Critical
Publication of CN110333885B publication Critical patent/CN110333885B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present embodiments relate to a kind of embedded OS patch setting methods, which is characterized in that the described method includes: obtaining Program Type, is alternatively verified to Program Type;Program pointer address is obtained, the first source address is generated;According to the first source address, the first patch record is obtained;First patch record is disassembled, the first patch call number is generated;According to the first call number, first version record is generated;Generate first version number and first version data;Generate the first patch release and the first patch address;According to the first patch address, the first patch code is obtained, and by the first patch code copies to the first memory address;Program execution pointer is gone into the first memory address from the first source address, and executes the first patch code.The method of the present invention not only solves the patch replacement function to executable program in ROM, and the handoff functionality for additionally providing more patch releases makes operating system have more flexible patch range of choice.

Description

A kind of embedded OS patch setting method
Technical field
The present invention relates to computer field of embedded software, are related specifically to a kind of embedded OS patch setting side Method.
Background technique
The operating system COS (Chip Operation System chip operating system) of single-chip microcontroller is stored in ROM medium In, ROM medium is not revisable after once loading.During daily production application, if ROM burning There is BUG ROM program and needs upgraded version in ROM code, then to replace to single-chip microcontroller.User must purchase again It buys, fire single-chip microcontroller, on the one hand influence application efficiency, on the other hand also increase an additional maintenance cost for user.
Summary of the invention
The purpose of the present invention is exactly to provide a kind of embedded OS patch setting side to solve above-mentioned technological deficiency Method not only solves the patch replacement function to executable program in ROM, is also switched by setting patch release so that single-chip microcontroller Has the ability that multi version patch flexibly switches;User's updating apparatus no longer needs to purchase monolithic again and burns as a result, Record can also dispose multiple version patch and switch in a equipment according to use environment demand difference.
To achieve the above object, the present invention provides a kind of embedded OS patch setting methods, comprising:
Single-chip microcontroller obtains the Program Type of (i.e. by be performed) first executable program, and carries out to described program type Replaceable checking treatment;
When it is described it is replaceable verify successfully after, the single-chip microcontroller is with obtaining the program pointer of first executable program Location generates the first source address;
The single-chip microcontroller carries out query processing according to first source address, to patch index file, generates the first patch Record;
The single-chip microcontroller disassembles first patch record, generates the first patch call number;
The single-chip microcontroller carries out effective index-check processing to the first patch call number;
After effective index-check success, the single-chip microcontroller is according to the first patch call number, to patch version This document carries out query processing, generates the first patch release record;
The single-chip microcontroller disassembles first patch release record, generates first version number and first version number According to;
The single-chip microcontroller disassembles the first version data according to the first version number, generates the first patch Address;
The single-chip microcontroller carries out effective address checking treatment to first patch address;
The single-chip microcontroller obtains the first patch code according to first patch address, and by first patch Program code is copied to the first memory address;
Program execution pointer is gone to the first memory address from first source address by the single-chip microcontroller, and executes described One patch code.
Further, the single-chip microcontroller obtains the Program Type of (i.e. by be performed) first executable program, and to institute It states Program Type and carries out replaceable checking treatment, specifically include:
It is when described program type, which is, to be replaced program, then described replaceable to verify successfully.
Further, the single-chip microcontroller carries out query processing to patch index file, generates according to first source address First patch record, specifically includes:
Step 31, the single-chip microcontroller obtains the record sum of the patch index file, generates the first record sum;
Step 32, it is 0 that the value of the first record queries result, which is arranged, in the single-chip microcontroller, and the value of the first recording indexes of setting is 1;
Step 33, the single-chip microcontroller obtains the first recording indexes patch and records word according to the patch index file Section generates the first temporary patch record;
Step 34, the single-chip microcontroller disassembles first temporary patch record, obtains first temporary patch First interim source address byte of record generates the first interim source address;
Step 35, the single-chip microcontroller judges whether the described first interim source address is equal with first source address, if The first interim source address is equal with first source address, then the value that the first record queries result is arranged is 1, goes to Step 38;If the first interim source address and first source address are unequal, step 36 is gone to;
Step 36, the value that first recording indexes are arranged in the single-chip microcontroller adds 1;
Step 37, the monolithic judges whether the value of first recording indexes is greater than the first record sum, if The value of first recording indexes is greater than the first record sum, goes to step 38;If the value of first recording indexes No more than the first record sum, then step 33 is gone to;
Step 38, the single-chip microcontroller judges whether the value of the first record queries result is 1, if first record The value of query result is 1, then the whole bytes for extracting first blotter generate the first patch record;If described The value of first record queries result is 0, then first patch is arranged and is recorded as sky.
Further, the single-chip microcontroller disassembles first patch record, generates the first patch call number, specifically Include:
The single-chip microcontroller disassembles first patch record, obtains the first patch rope of the first patch record Quotation marks byte generates the first patch call number.
Further, the single-chip microcontroller carries out effective index-check processing to the first patch call number, specifically includes:
When the value of the first patch call number is not sky, then effective index-check success.
Further, the single-chip microcontroller carries out query processing to patch release file according to the first patch call number, The first patch release record is generated, is specifically included:
Step 61, the single-chip microcontroller obtains the record sum of the patch release file, generates the second record sum;
Step 62, it is 0 that the value of the second record queries result, which is arranged, in the single-chip microcontroller, and the value of the second recording indexes of setting is 1;
Step 63, the single-chip microcontroller obtains the second recording indexes patch release note according to the patch release file Byte is recorded, first temporary patch's colophon is generated;
Step 64, the single-chip microcontroller disassembles first temporary patch colophon, and it is interim to obtain described first First temporary patch's call number byte of patch release record, generates first temporary patch's call number;
Step 65, the single-chip microcontroller judges whether the value of first temporary patch call number indexes with first patch Number value it is equal, if the value of first temporary patch call number is equal with the value of the first patch call number, be arranged The value of the second record queries result is 1, goes to step 68;If the value of first temporary patch call number and described the The value of one patch call number is unequal, then goes to step 66;
Step 66, the value that second recording indexes are arranged in the single-chip microcontroller adds 1;
Step 67, the monolithic judges whether the value of second recording indexes is greater than the second record sum, if The value of second recording indexes is greater than the second record sum, goes to step 68;If the value of second recording indexes No more than the second record sum, then step 63 is gone to;
Step 68, the single-chip microcontroller judges whether the value of the second record queries result is 1, if second record The value of query result is 1, then extracts whole bytes of first temporary patch colophon, generates first patch release Record;If the value of the second record queries result is 0, first patch release is set and is recorded as sky.
Further, the single-chip microcontroller disassembles first patch release record, generates first version number and the One edition data, specifically includes:
The single-chip microcontroller disassembles first patch release record, obtains the of first patch release record One version number byte generates the first version number;And the first version data byte of the first patch release record is obtained, Generate the first version data.
Further, the single-chip microcontroller disassembles the first version data according to the first version number, generates First patch address, specifically includes:
Step 81, the single-chip microcontroller generates the first field sum according to the first version number;
Step 82, it is 0 that the value of the first Field Inquiry result, which is arranged, in the single-chip microcontroller, and the value of the first field index of setting is 1;
Step 83, the single-chip microcontroller obtains the first field index patch release word according to the first version data Section byte, generates first temporary patch's version field;
Step 84, the single-chip microcontroller disassembles first temporary patch version field, obtains the first temporary patch Byte is switched, the first temporary patch switch is generated;
Step 85, the single-chip microcontroller judges whether the value of the first temporary patch switch is out, if described first faces When patch switch value be open, then be arranged the first Field Inquiry result value be 1, go to step 88;If described first The value of temporary patch's switch is to close, then goes to step 86;
Step 86, the value that first field index is arranged in the single-chip microcontroller adds 1;
Step 87, the monolithic judges whether the value of first field index is greater than the first field sum, if The value of first field index is greater than the first field sum, goes to step 88;If the value of first field index No more than the first field sum, then step 83 is gone to;
Step 88, the single-chip microcontroller judges whether the value of the first Field Inquiry result is 1, if first field The value of query result is 1, then extracts the first patch address byte of first temporary patch version field, generates described first Patch address;If the value of the first Field Inquiry result is 0, first patch address is set for sky.
Further, the single-chip microcontroller carries out effective address checking treatment to first patch address, specifically includes:
It is described to have when first patch address being not sky and within the scope of the patch address as defined in the single-chip microcontroller Imitate address check success.
By aforesaid operations, a kind of embedded OS patch setting method provided by the invention by using two with The relevant configuration file of patch (patch index file and patch release file) not only solves the benefit to executable program in ROM Fourth replacement function also switchs the handoff functionality for solving multi version patch by the way that patch is arranged in patch release file, thus So that operating system has the ability for configuring different patches to the same execution program according to external condition.
Detailed description of the invention
Fig. 1 is patch index file schematic diagram provided in an embodiment of the present invention;
Fig. 2 is patch release file schematic diagram provided in an embodiment of the present invention;
Fig. 3 is a kind of schematic diagram for embedded OS patch setting method that the embodiment of the present invention one provides;
Fig. 4 is a kind of schematic diagram of embedded OS patch setting method provided by Embodiment 2 of the present invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into It is described in detail to one step, it is clear that the described embodiments are only some of the embodiments of the present invention, rather than whole implementation Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts All other embodiment, shall fall within the protection scope of the present invention.
Existing operating system of single-chip microcomputer program can not be modified after being burned into ROM, this to use such list The equipment of piece lacks flexibility in the environment of applying frequent switching more, and the maintenance cost of equipment is also higher.
In view of the above technical defects, a kind of embedded OS patch setting method provided in an embodiment of the present invention, will The executable program of embedded OS is divided into two classes: can not be replaced program and can be replaced program.
It is replaced program for all, has a unique record to be corresponding to it in patch index file, the record To be replaced initial address (i.e. source address) of the program in ROM as record head, using patch index as record tail.For institute There is patch index, there is a unique record to be corresponding to it in patch release file, which is indexed using patch as record Head, the multiple patch release fields of heel are as record body information.
Logical construction in relation to patch index file is shown in that Fig. 1 is patch index file schematic diagram provided in an embodiment of the present invention It is shown.Patch index file is made of the total several patch records of patch record.Every patch record is indexed by source address and patch Numbers two compositions.Wherein, source address is that can be replaced initial address of the program in ROM, namely in patch index file, institute The value of the source address of patch record is unique;Patch call number can be inquired according to the call number in patch release file The corresponding patch data for being replaced program is recorded to this patch, when the value of patch call number is empty, indicates this Patch, which records corresponding executable program, does not have patch alternatively to execute.
When single-chip microcontroller execute can be replaced program when, first inquiry patch index file, looked in patch index file It is recorded to unique patch corresponding with the program.If the patch index of this patch record is that invalid patch indexes, monolithic The program execution pointer of machine does not jump, and still executes the source program in ROM.If the patch index of this patch record is to have Patch index is imitated, then single-chip microcontroller is indexed using patch as querying condition, is inquired patch release file, is obtained the patch rope Draw corresponding all patch release field informations;The version being uniquely activated is obtained in all version information fields obtained Field;Patch storage address (i.e. patch address) is further extracted in the version field that this is uniquely activated;It is single Piece machine obtains patch from the patch address and is copied to memory address;Finally, operating system is by program execution pointer It jumps to the memory address and executes the patch for having called in the address.
Logical construction in relation to patch release file is shown in 2 for patch release file schematic diagram provided in an embodiment of the present invention institute Show.Patch release file is made of the total several patch release records of patch release record.Every patch release record is by patch rope Quotation marks, version number, edition data composition.Patch call number is corresponding with the patch call number in patch record file and keeps Consistent, single-chip microcontroller obtains the value of patch call number from patch record file and search index number is joined in patch release file Consistent patch release records number therewith, to further obtain information related with patch.Version number is to identify in version The sum for the patch version field for including in total in notebook data.Edition data is made of the several patch release fields of version.Patch version This field is made of patch release, patch address and patch switch.Single-chip microcontroller gets patch data according to patch call number, and The patch release field in patch data is polled according to version number;Polling purpose is to look for patch switch and is arranged to The patch field uniquely activated opened.Single-chip microcontroller gets according to the patch field of the activation found and is currently active use Patch patch address, finally according to the address single-chip microcontroller obtain patch and complete memory copying execution patch Operational process.
The embodiment of the present invention one, if Fig. 3 is a kind of embedded OS patch setting that the embodiment of the present invention one provides Shown in the schematic diagram of method, method the following steps are included:
Step 11, single-chip microcontroller obtains the Program Type of the first executable program that will be performed, and to Program Type into The replaceable checking treatment of row,
It specifically includes: when Program Type, which is, to be replaced program, then alternatively verifying successfully.
Step 12, after alternatively verifying successfully, single-chip microcontroller obtains the program pointer address of the first executable program, raw At the first source address.
Step 13, single-chip microcontroller carries out query processing to patch index file according to the first source address, obtains the first patch note Record.
Step 14, single-chip microcontroller disassembles the first patch record, generates the first patch call number,
Specifically include: single-chip microcontroller disassembles the first patch record, obtains the first patch index of the first patch record Number byte generates the first patch call number.
Step 15, single-chip microcontroller carries out effective index-check processing to the first patch call number,
It specifically includes: when the value of the first patch call number is not sky, then effective index-check success.
Step 16, after the success of effective index-check, single-chip microcontroller is according to the first patch call number, to patch release file Query processing is carried out, the first patch release record is generated,
Specifically include: single-chip microcontroller successively records patch release in patch release file according to the value of the first call number Processing is compared in patch call number byte, when the patch call number byte and the first call number of the patch release record being queried Value it is equal when, then recorded according to the patch release when prelocalization, extract its all byte, generate first version record.
Step 17, single-chip microcontroller disassembles the first patch release record, generates first version number and first version data,
Specifically include: step 171, single-chip microcontroller disassembles the first patch release record, extracts the first patch release note The first version number section of record generates first version number;
Step 172, single-chip microcontroller disassembles the first patch release record, extracts the first edition of the first patch release record Notebook data byte, raw first version data.
Step 18, single-chip microcontroller disassembles first version data according to first version number, generates the first patch address,
Specifically include: step 181, single-chip microcontroller disassembles first version data according to first version number, generates first The several patch release fields of version;
Step 182, single-chip microcontroller successively carries out patch switch state inquiry to the several patch release fields of first version;
Step 183, when the patch switch state for being queried patch release field is to open, then current patch release word is extracted The patch address byte of section generates the first patch address.
Step 19, single-chip microcontroller carries out effective address checking treatment to the first patch address,
It specifically includes: when the effective address range that the first patch address is not empty or is limited without departing from single-chip microcontroller, then having Imitate address check success.
Step 20, single-chip microcontroller is according to the first patch address, obtains the first patch code, and by the first patch generation Code is copied to the first memory address.
Step 21, program execution pointer is gone to the first memory address from the first source address by single-chip microcontroller, and is executed first and mended Fourth program code;After the first patch code runs succeeded, then it represents that single-chip microcontroller successfully uses the first executable journey The patch of first patch release of sequence itself completes replacement processing to the first executable program.
The embodiment of the present invention two, if Fig. 4 is a kind of embedded OS patch setting provided by Embodiment 2 of the present invention Shown in the schematic diagram of method, method the following steps are included:
Step 111, single-chip microcontroller obtains the Program Type for the first executable program that will be performed.
Step 112, whether determining program type is that can be replaced program, if Program Type is can be replaced program, It alternatively verifies successfully, goes to step 113;If Program Type is not that can be replaced program, replaceable verification failure is gone to Step 410.
Step 113, after alternatively verifying successfully, single-chip microcontroller obtains the program pointer address of the first executable program, Generate the first source address.
Step 114, single-chip microcontroller carries out query processing to patch index file, obtains the first patch according to the first source address Record.
Step 115, single-chip microcontroller disassembles the first patch record, generates the first patch call number,
Specifically include: single-chip microcontroller disassembles the first patch record, obtains the first patch index of the first patch record Number byte generates the first patch call number.
Step 116, judge whether the first patch call number is empty, if the first patch call number is not empty, effective rope Draw and verify successfully, goes to step 117;If the first patch call number is sky, effective index-check failure goes to step 420.
Step 117, after the success of effective index-check, single-chip microcontroller is according to the first patch call number, to patch release text Part carries out query processing, generates the first patch release record,
Specifically include: single-chip microcontroller successively records patch release in patch release file according to the value of the first call number Processing is compared in patch call number byte, when the patch call number byte and the first call number of the patch release record being queried Value it is equal when, then recorded according to the patch release when prelocalization, extract its all byte, generate the first patch release record.
Step 118, single-chip microcontroller disassembles the first patch release record, generates first version number and first version number According to,
Specifically include: step 1181, single-chip microcontroller disassembles the first patch release record, extracts the first patch release note The first version number section of record generates first version number;
Step 1182, single-chip microcontroller disassembles the first patch release record, extracts the first of the first patch release record Edition data byte, raw first version data.
Step 119, single-chip microcontroller disassembles first version data according to first version number, generates the first patch address,
Specifically include: step 1191, single-chip microcontroller disassembles first version data according to first version number, generates the The several patch release fields of one version;
Step 1192, single-chip microcontroller successively carries out patch switch state inquiry to the several patch release fields of first version;
Step 1193, when the patch switch state for being queried patch release field is to open, then current patch release is extracted The patch address byte of field generates the first patch address.
Step 120, judge whether the first patch address is sky, if the first patch address is not empty, goes to step 121;Such as The first patch address of fruit is sky, then effective address verification failure, goes to step 430.
Step 121, judge whether the first patch address exceeds the effective address range that system defines, if the first patch Location is without departing from the effective address range that system defines, then effective address verifies successfully, goes to step 122;If the first patch Location exceeds the effective address range that system defines, then effective address verification failure, goes to step 440.
Step 122, single-chip microcontroller is according to the first patch address, obtains the first patch code, and by the first patch Code copies are to the first memory address.
The first memory address herein is that single-chip microcontroller fixed is exclusively used in placing patch code for one in memory Address.
Step 123, program execution pointer is gone to the first memory address from the first source address by single-chip microcontroller, and is executed first and mended Fourth program code;After the first patch code runs succeeded, then it represents that single-chip microcontroller successfully uses the first executable journey The patch of first patch release of sequence itself completes replacement processing to the first executable program.
Step 410, single-chip microcontroller exits process flow, returns to error message: Program Type mistake.
Cause the main reason for such mistake occurs to be, the current needs for executing Program Type are done in patch process and are sentenced It is disconnected, if the type checking of current executable program is not the program that can be replaced, patch cannot be started to it and execute process, Program Type mistake should be returned and exit patch process.
Step 420, single-chip microcontroller exits process flow, and return to error message: patch indexes empty mistake.
Leading to the main reason for such mistake occurs is to be inquired and mended according to the source address of executable program in patch process When fourth index file, the patch call number data item in corresponding patch record does not do effective setting.
Step 430, single-chip microcontroller exits process flow, returns to error message: address blank mistake.
Leading to the main reason for such mistake occurs is to be looked into patch process according to the patch call number of executable program When asking patch release file, the patch address activated in patch release field in corresponding patch release record is not done effectively Setting.
Step 440, single-chip microcontroller exits process flow, returns to error message: address overrun error.
Leading to the main reason for such mistake occurs is to be looked into patch process according to the patch call number of executable program When asking patch release file, the patch address activated in patch release field in corresponding patch release record exceeds system Effective address setting.
A kind of embedded OS patch setting method provided in an embodiment of the present invention passes through to two parts of configuration files: mending The setting of fourth index file and patch release file not only plays the role of allocation activation patch, can also be by configuring Mode flexible choice patch release.Using the equipment of the method for the present invention, on the one hand, because having diversified patch mechanism, save Installation cost;On the one hand, after upgrading failure, still there are multiple versions available;In addition, being based on this function, may be used also To combine with host computer application, the usage experience intelligently switched is provided to user.
Professional should further appreciate that, described in conjunction with the examples disclosed in the embodiments of the present disclosure Unit and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, hard in order to clearly demonstrate The interchangeability of part and software generally describes each exemplary composition and step according to function in the above description. 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 It should not be considered as beyond the scope of the present invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can be executed with hardware, processor The combination of software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field In any other form of storage medium well known to interior.
Above-described specific embodiment has carried out further the purpose of the present invention, technical scheme and beneficial effects It is described in detail, it should be understood that being not intended to limit the present invention the foregoing is merely a specific embodiment of the invention Protection scope, all within the spirits and principles of the present invention, any modification, equivalent substitution, improvement and etc. done should all include Within protection scope of the present invention.

Claims (9)

1. a kind of embedded OS patch setting method, which is characterized in that the described method includes:
Single-chip microcontroller obtains the Program Type of (i.e. by be performed) first executable program, and can replace to the progress of described program type Change checking treatment;
When it is described it is replaceable verify successfully after, the single-chip microcontroller obtains the program pointer address of first executable program, Generate the first source address;
The single-chip microcontroller carries out query processing according to first source address, to patch index file, generates the first patch record;
The single-chip microcontroller disassembles first patch record, generates the first patch call number;
The single-chip microcontroller carries out effective index-check processing to the first patch call number;
After effective index-check success, the single-chip microcontroller is according to the first patch call number, to patch release text Part carries out query processing, generates the first patch release record;
The single-chip microcontroller disassembles first patch release record, generates first version number and first version data;
The single-chip microcontroller disassembles the first version data according to the first version number, generates the first patch address;
The single-chip microcontroller carries out effective address checking treatment to first patch address;
The single-chip microcontroller obtains the first patch code according to first patch address, and by first patch Code copies are to the first memory address;
Program execution pointer is gone to the first memory address from first source address by the single-chip microcontroller, and is executed described first and mended Fourth program code.
2. method according to claim 1, which is characterized in that it is executable that the single-chip microcontroller obtains (i.e. by be performed) first The Program Type of program, and replaceable checking treatment is carried out to described program type, it specifically includes:
It is when described program type, which is, to be replaced program, then described replaceable to verify successfully.
3. method according to claim 1, which is characterized in that the single-chip microcontroller is according to first source address, to patch rope Quotation part carries out query processing, generates the first patch record, specifically includes:
Step 31, the single-chip microcontroller obtains the record sum of the patch index file, generates the first record sum;
Step 32, it is 0 that the value of the first record queries result, which is arranged, in the single-chip microcontroller, and the value of the first recording indexes of setting is 1;
Step 33, the single-chip microcontroller obtains the first recording indexes patch and records byte according to the patch index file, raw It is recorded at the first temporary patch;
Step 34, the single-chip microcontroller disassembles first temporary patch record, obtains the first temporary patch record The first interim source address byte, generate the first interim source address;
Step 35, the single-chip microcontroller judges whether the described first interim source address is equal with first source address, if described First interim source address is equal with first source address, then the value that the first record queries result is arranged is 1, goes to step 38;If the first interim source address and first source address are unequal, step 36 is gone to;
Step 36, the value that first recording indexes are arranged in the single-chip microcontroller adds 1;
Step 37, the monolithic judges whether the value of first recording indexes is greater than the first record sum, if described The value of first recording indexes is greater than the first record sum, goes to step 38;If the value of first recording indexes is little In the first record sum, then step 33 is gone to;
Step 38, the single-chip microcontroller judges whether the value of the first record queries result is 1, if first record queries As a result value is 1, then the whole bytes for extracting first blotter generate the first patch record;If described first The value of record queries result is 0, then first patch is arranged and is recorded as sky.
4. method according to claim 1, which is characterized in that the single-chip microcontroller disassembles first patch record, The first patch call number is generated, is specifically included:
The single-chip microcontroller disassembles first patch record, obtains the first patch call number of the first patch record Byte generates the first patch call number.
5. method according to claim 1, which is characterized in that the single-chip microcontroller carries out the first patch call number effective Index-check processing, specifically includes:
When the value of the first patch call number is not sky, then effective index-check success.
6. method according to claim 1, which is characterized in that the single-chip microcontroller is according to the first patch call number, to benefit Fourth version file carries out query processing, generates the first patch release record, specifically includes:
Step 61, the single-chip microcontroller obtains the record sum of the patch release file, generates the second record sum;
Step 62, it is 0 that the value of the second record queries result, which is arranged, in the single-chip microcontroller, and the value of the second recording indexes of setting is 1;
Step 63, the single-chip microcontroller obtains the second recording indexes patch release and records word according to the patch release file Section generates first temporary patch's colophon;
Step 64, the single-chip microcontroller disassembles first temporary patch colophon, obtains first temporary patch First temporary patch's call number byte of colophon generates first temporary patch's call number;
Step 65, the single-chip microcontroller judge first temporary patch call number value whether with the first patch call number Be worth it is equal, if the value of first temporary patch call number is equal with the value of the first patch call number, setting described in The value of second record queries result is 1, goes to step 68;If the value of first temporary patch call number and described first is mended The value of fourth call number is unequal, then goes to step 66;
Step 66, the value that second recording indexes are arranged in the single-chip microcontroller adds 1;
Step 67, the monolithic judges whether the value of second recording indexes is greater than the second record sum, if described The value of second recording indexes is greater than the second record sum, goes to step 68;If the value of second recording indexes is little In the second record sum, then step 63 is gone to;
Step 68, the single-chip microcontroller judges whether the value of the second record queries result is 1, if second record queries As a result value is 1, then extracts whole bytes of first temporary patch colophon, generates the first patch release note Record;If the value of the second record queries result is 0, first patch release is set and is recorded as sky.
7. method according to claim 1, which is characterized in that the single-chip microcontroller tears first patch release record open Solution generates first version number and first version data, specifically includes:
The single-chip microcontroller disassembles first patch release record, obtains the first edition of the first patch release record This number section, generates the first version number;And the first version data byte of the first patch release record is obtained, it generates The first version data.
8. method according to claim 1, which is characterized in that the single-chip microcontroller is according to the first version number, to described One edition data is disassembled, and is generated the first patch address, is specifically included:
Step 81, the single-chip microcontroller generates the first field sum according to the first version number;
Step 82, it is 0 that the value of the first Field Inquiry result, which is arranged, in the single-chip microcontroller, and the value of the first field index of setting is 1;
Step 83, the single-chip microcontroller obtains the first field index patch release field word according to the first version data Section generates first temporary patch's version field;
Step 84, the single-chip microcontroller disassembles first temporary patch version field, obtains the first temporary patch switch Byte generates the first temporary patch switch;
Step 85, the single-chip microcontroller judges whether the value of the first temporary patch switch is out, if the described first interim benefit The value of fourth switch is to open, then the value that the first Field Inquiry result is arranged is 1, goes to step 88;If described first is interim The value of patch switch is to close, then goes to step 86;
Step 86, the value that first field index is arranged in the single-chip microcontroller adds 1;
Step 87, the monolithic judges whether the value of first field index is greater than the first field sum, if described The value of first field index is greater than the first field sum, goes to step 88;If the value of first field index is little In the first field sum, then step 83 is gone to;
Step 88, the single-chip microcontroller judges whether the value of the first Field Inquiry result is 1, if first Field Inquiry As a result value is 1, then extracts the first patch address byte of first temporary patch version field, generates first patch Address;If the value of the first Field Inquiry result is 0, first patch address is set for sky.
9. method according to claim 1, which is characterized in that the single-chip microcontroller carries out effectively first patch address Location checking treatment, specifically includes:
When first patch address being not sky and within the scope of the patch address as defined in the single-chip microcontroller, it is described effectively Location verifies successfully.
CN201910583415.9A 2019-06-28 2019-06-28 Method for setting patch of embedded operating system Active CN110333885B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910583415.9A CN110333885B (en) 2019-06-28 2019-06-28 Method for setting patch of embedded operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910583415.9A CN110333885B (en) 2019-06-28 2019-06-28 Method for setting patch of embedded operating system

Publications (2)

Publication Number Publication Date
CN110333885A true CN110333885A (en) 2019-10-15
CN110333885B CN110333885B (en) 2022-11-01

Family

ID=68143769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910583415.9A Active CN110333885B (en) 2019-06-28 2019-06-28 Method for setting patch of embedded operating system

Country Status (1)

Country Link
CN (1) CN110333885B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030084229A1 (en) * 2001-10-23 2003-05-01 Ho Tat N. Methods and apparatus for modifying programs stored in read only memory
CN103412779A (en) * 2013-08-14 2013-11-27 浙江大学 Patch file system implementation method of embedded real-time operating system
CN109522042A (en) * 2018-12-27 2019-03-26 深信服科技股份有限公司 A kind of patch update method, system and associated component

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030084229A1 (en) * 2001-10-23 2003-05-01 Ho Tat N. Methods and apparatus for modifying programs stored in read only memory
CN103412779A (en) * 2013-08-14 2013-11-27 浙江大学 Patch file system implementation method of embedded real-time operating system
CN109522042A (en) * 2018-12-27 2019-03-26 深信服科技股份有限公司 A kind of patch update method, system and associated component

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姜文等: "基于VXWORKS***的热补丁技术研究", 《计算机技术与发展》 *

Also Published As

Publication number Publication date
CN110333885B (en) 2022-11-01

Similar Documents

Publication Publication Date Title
US20020194535A1 (en) Backup of a computer
TWI314703B (en) Using system bios to update embedded controller firmware
US8561194B2 (en) Memory storage device and memory controller and virus scanning method thereof
US7334157B1 (en) Restore of data to a computer system having different hardware
Woodhouse JFFS: The journalling flash file system
US6996706B1 (en) Booting an operating system or running other pre-boot code from a file stored under a different operating system
US20060150037A1 (en) Methods and systems for operating system recovery
US6535977B1 (en) Replacing a unique identifier in a cloned computer system using program module that runs only once during the next boot sequence
KR100233178B1 (en) Method and system for updating mass storage device configuration records
TW200414041A (en) Method and system for maintaining firmware versions in a data processing system
GB2408359A (en) Controlling upgrade of firmware
US20080270677A1 (en) Safe software revision for embedded systems
EP4012554B1 (en) Chip patching method and chip
US7188235B2 (en) Method for booting computer system with memory card
US8275980B2 (en) Server computer, computer system, and file management method
US20100037042A1 (en) System for switching bios set-values
US20150370653A1 (en) Replacement of a corrupt driver variable record
CN106776133A (en) A kind of system and method for operating system recovery
CN111258666A (en) Reading method and device of computer file, computer system and storage medium
US20130185549A1 (en) Electronic device and bios updating device thereof
US6523103B2 (en) Disablement of a write filter stored on a write-protected partition
CN107220071A (en) A kind of method for guiding electronic equipment activation system
CN110333885A (en) A kind of embedded OS patch setting method
CN110597781B (en) Flash deleting method and system for database
US20080201572A1 (en) Method and system for uniformizing product data embedded in a computer platform

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

Address after: 100080, Beijing, Suzhou Street, Haidian District No. 20, building 2, on the north side of the four floor

Applicant after: Zhaoxun Hengda Technology Co.,Ltd.

Address before: 100080, Beijing, Suzhou Street, Haidian District No. 20, building 2, on the north side of the four floor

Applicant before: MEGAHUNT MICROELECTRONIC TECH. (BEIJING) Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant