The ' In System Reconfiguration Method and embedded system of embedded system
Technical field
The present invention relates to a kind of ' In System Reconfiguration Method of embedded system and embedded systems.
Background technique
Embedded system is the equipment of control, monitoring or auxiliary machinery.In embedded systems, especially in the communications industry
Embedded system in, embedded system can reliably run the system firstly the need of embedded system and can reliably transport
Row.In order to guarantee embedded system system can reliability service, embedded system in the prior art be frequently necessary to backup system
System, if embedded system, which can not normally start, to carry out system starting using the backup file of system.But in the prior art
Backup file have the defects that frequent failure, mistake is more when leading to embedded system using backup file start, to make
Embedded system cannot start completely.
Summary of the invention
The technical problem to be solved by the present invention is in order to overcome the backup file of embedded system in the prior art often to lose
Effect, a kind of poor defect of the system reliability of embedded system, the system for providing more reliable embedded system of system are matched
Set method and embedded system.
The present invention is to solve above-mentioned technical problem by following technical proposals: a kind of system configuration side of embedded system
Method, the embedded system include the configuration file of two system starting configurations for embedded system, each configuration file
With carry out that system starting is corresponding with the system postponed, and the configuration file includes for indicating using this configuration file
The first state that system starting configuration successful is carried out using the configuration file is had neither part nor lot in for indicating using the configuration file
Cross the second state of system starting configuration and the third for indicating to carry out system starting configuration failure using the configuration file
State, the ' In System Reconfiguration Method include:
S1, judge the configuration file whether be the third state configuration file, if then process terminates, if otherwise holding
Row step S2;
S2, judge whether the configuration file has the configuration file of the third state, if so then execute step S3If otherwise holding
Row step S4;
S3, system starting configuration is carried out using the configuration file of first state or the second state, then terminate process;
S4, utilize any one in two configuration files to carry out the starting configuration of described system.
In the prior art, the system backup of embedded system is often failed, and when embedded system cannot normally start, is led to
Crossing backup file can not recovery system.The reason of causing such case can be backup file and be rarely used after generation,
It will not more be upgraded.If some new functions are crossed or be added to the configuration change of embedded system, backup file is possible to nothing
Method adapts to the change of embedded system and causes to fail.
Embedded system does not include backup file in the present invention, and two configuration files for system starting configuration are regardless of master
Secondary, a possibility that two configuration files are utilized, is not much different.The configuration file refers to file relevant to system configuration, described
Configuration file can be the image file or system starting file used where system.Three kinds of states of the ' In System Reconfiguration Method
Indicate that the situation that is utilized of the configuration file, system can carry out the system using the configuration file of first state or the second state
System starting configuration.It, will if this subsystem starts configuration successful when system carries out system starting configuration using a configuration file
This configuration file is set as first state, this configuration file is set as the third state if failure.Three kinds of shapes of configuration file
Mark can be arranged to complete to configuration file in state, these are deposited with the static state that tagged configuration file is stored in embedded system
In the memory space of reservoir.In the ' In System Reconfiguration Method, two configuration files can be by cross-reference, to make two configurations
The state of file is close, is not in the case where backup file often fails in the prior art, embedded system is more stable.
Preferably, step S4Are as follows:
S41, judge the configuration file whether be the second state configuration file, if so then execute step S44, if not
Then follow the steps S42;
S42, judge whether the configuration file has the configuration file of the second state, if so then execute step S43If otherwise
Execute step S44;
S43, system starting configuration is carried out using the configuration file of the second state, then terminate process;
S44, utilize any one in two configuration files to carry out the starting configuration of described system.
Above system configuration method is by former step S4Optimize, system can preferentially using the second state configuration file into
The starting configuration of row system, system just uses the configuration file of first state when without the configuration file of the second state, matches in this way
Setting file can be in newer state, and mistake, which occurs, in configuration file timely to be found, keep embedded system more reliable.
Preferably, configuration file includes a version number, step S4Are as follows:
S41, compare the version numbers of two configuration files;
S42, utilize the higher or lower configuration file of version number to carry out the system starting configuration.
Configuration file includes a version number, since configuration file carries out the system that system starting configures with configuration file
Corresponding, the version number can equally indicate the version of system.When there is no the configuration file of the third state in two configuration files
When, system can default the specified preferential configuration file using higher-version and carry out system starting configuration, can also default specified
The preferential configuration file using compared with lowest version carries out system starting configuration or user to be arranged and which configuration text preferentially specified
Part carries out system starting configuration.
Preferably, step S3Are as follows:
Step S1Are as follows:
S1, judge the configuration file whether be the third state configuration file, if so then execute step S5If otherwise
Execute step S2;
S3, system starting configuration is carried out using the configuration file of first state or the second state, then execute step
S5;
Step S4Afterwards comprising steps of
S5, judge in the configuration file whether be first state configuration file, if so then execute step S6, if not
Then follow the steps S9;
S6, judge whether the higher configuration file of upgraded version number, if so then execute step S7, S is thened follow the steps if not8;
S7, the higher configuration file of version number replaced with into new configuration file, it is the second shape that new configuration file, which is arranged,
Then state terminates process;
S8, the lower configuration file of version number replaced with into new configuration file, it is the second shape that new configuration file, which is arranged,
Then state terminates process;
S9, the configuration file of the second state or the third state is replaced with to new configuration file, new configuration file is set
For the second state.
Above-mentioned steps can upgrade configuration file, be repaired the configuration file of the third state, above-mentioned to configuration text
The configuration file of part second state of preferential upgrading during upgrading or the third state, configuration file only include the second state or the third state
Configuration file when, system can specify the configuration file of the preferential upgrading third state.Configuration file is replaced by new configuration file
(upgrade) second state that is set as after generation, new configuration file waits the verification of next subsystem starting.Above-mentioned steps can
The case where guarantee is not in two configuration files while failing, the starting of embedded system will be relatively reliable.
Preferably, the configuration file is stored in the static memory of the embedded system.The configuration file is deposited
It is stored in static memory, configuration file will not be lost embedded system after a loss of power.
The present invention also provides a kind of embedded system, the embedded system includes two systems for being used for embedded system
Start the configuration file of configuration, each configuration file carries out the system starting with the system postponed with using this configuration file
Corresponding, the configuration file includes the first shape for indicating to carry out system starting configuration successful using the configuration file
State, for indicating that having neither part nor lot in system using the configuration file starts the second state of configuration and for indicating to match described in utilization
The third state that file carries out system starting configuration failure is set, the embedded system includes: a first judgment module, and one second
Judgment module, one first execution module and one second execution module,
The first judgment module be used for judge the configuration file whether be the third state configuration file, if otherwise
Call second judgment module;
Second judgment module is for judging whether the configuration file has the configuration file of the third state, if then adjusting
With first execution module, if otherwise calling second execution module;
First execution module is used to carry out the system starting using the configuration file of first state or the second state
Configuration;
Second execution module is used to carry out the system starting configuration using any one in two configuration files.
Above-mentioned ' In System Reconfiguration Method can be completed using the embedded system.The configuration text is indicated with three kinds of states
Part is utilized situation, and system can carry out the system starting configuration using the configuration file of first state or the second state, together
When system when carrying out system starting configuration using configuration file, by this configuration text if this subsystem starts configuration successful
Part is set as first state, this configuration file is set as the third state if failure.In the embedded system, two configuration texts
Part can by cross-reference, to keep the state of two configuration files close, be not in the prior art backup file often lose
The case where effect, embedded system are more stable.
Preferably, the embedded system includes a first choice module, one second selecting module and one first processing mould
Block,
The first choice module is used for judging whether the configuration file is equal after second execution module is called
For the configuration file of the second state, if then second execution module is using described in any one progress in two configuration files
System starting configuration, if otherwise calling second selecting module;
Second selecting module is for judging whether the configuration file has the configuration file of the second state, if then adjusting
System starting configuration is carried out using the configuration file of the second state with the first processing module, if otherwise calling described the
Two execution modules carry out the system starting configuration using any one in two configuration files.
Above-mentioned embedded system preferentially can carry out system starting configuration using the configuration file of the second state, when no second
System just uses the configuration file of first state when the configuration file of state, is configured so that file can match in newer state
Setting file and mistake occur timely to be found, keep embedded system more reliable.
Preferably, configuration file includes a version number, the embedded system includes: a comparison module, in institute
The version number for comparing two configuration files after the second execution module is called is stated, then second execution module utilizes version
This number higher or lower configuration file carries out the system starting configuration.
Configuration file includes a version number, due to configuration file and the system pair for carrying out system starting configuration with configuration file
It answers, the version number can equally indicate the version of system.When there is no the configuration file of the third state in two configuration files,
System can specify the preferential configuration file using higher-version and carry out system starting configuration, also can specify preferentially using lower
The configuration file of version carries out system starting configuration.
Preferably, the embedded system includes: a third judgment module, one the 4th judgment module, one first upgrading mould
Block, one second upgraded module and a third upgraded module,
The first judgment module be used for judge the configuration file whether be the third state configuration file, if otherwise
Second judgment module is called, if otherwise calling the third judgment module;
The third judgment module is used to after system starting matches and postpones or be called judge in the configuration file
Whether it is the configuration file of first state, if then calling the 4th judgment module, if the third is otherwise called to upgrade
Module;
4th judgment module is for judging whether the higher configuration file of upgraded version number, if then calling described the
One upgraded module, if otherwise calling second upgraded module;
First upgraded module is used to the higher configuration file of version number replacing with new configuration file, is arranged new
Configuration file is the second state;
Second upgraded module is used to the lower configuration file of version number replacing with new configuration file, is arranged new
Configuration file is the second state;
The third upgraded module is used to replacing with the configuration file of the second state or the third state into new configuration file,
It is the second state that new configuration file, which is arranged,.
Above-mentioned embedded system can upgrade configuration file, and the configuration file of the third state is made to be possible to be repaired,
The configuration file of the second state of above-mentioned preferential upgrading during upgrading to configuration file or the third state, configuration file only include the second shape
When the configuration file of state or the third state, system can specify the configuration file of the preferential upgrading third state.Configuration file is new
Configuration file substitution after (upgrade) be set as the second state, new configuration file waits the verification of next subsystem starting.
The embedded system can guarantee that the case where failure will not occur simultaneously in two configuration files, and the starting of embedded system will more
Add reliable.
Preferably, the configuration file is stored in the static memory of the embedded system.The configuration file is deposited
It is stored in static memory, configuration file will not be lost embedded system after a loss of power.
The positive effect of the present invention is that: the present invention is able to solve the backup file of embedded system in the prior art
The defect often to fail starts the system of embedded system more reliable and more stable.
Detailed description of the invention
Fig. 1 is the flow chart of the embodiment 1 of the ' In System Reconfiguration Method of embedded system of the present invention.
Fig. 2 is the structural schematic diagram of the embodiment 1 of embedded system of the present invention.
Fig. 3 is the flow chart of the embodiment 2 of the ' In System Reconfiguration Method of embedded system of the present invention.
Specific embodiment
Present pre-ferred embodiments are provided with reference to the accompanying drawing, in order to explain the technical scheme of the invention in detail.
Embodiment 1
Referring to Fig. 1, in the present embodiment, a kind of ' In System Reconfiguration Method of embedded system, the embedded system includes
The configuration file of two system starting configurations for embedded system, the configuration file refer to the relevant file of system configuration,
The configuration file can be the mirror image or system starting file used where system.Each configuration file is configured with using this
File carries out the system starting and corresponds to the system postponed, and the configuration file includes for indicating to utilize the configuration text
Part carries out the first state of system starting configuration successful, and system starting configuration was had neither part nor lot in using the configuration file for indicating
The second state and the third state for indicating to carry out system starting configuration failure using the configuration file, the system matches
The method of setting includes:
Step 100, judge the configuration file whether be the third state configuration file, if then process terminates, if
It is no to then follow the steps 101.
Step 101 judges whether the configuration file has the configuration file of the third state, if so then execute step 102, if
It is no to then follow the steps 103.
Step 102 carries out the system starting configuration using the configuration file of first state or the second state, then terminates
Process.
Step 103, judge the configuration file whether be the second state configuration file, if so then execute step 106,
104 are thened follow the steps if not.
Step 104 judges whether the configuration file has the configuration file of the second state, if so then execute step 105, if
It is no to then follow the steps 106.
Step 105 carries out the system starting configuration using the configuration file of the second state, then terminates process.
Step 106 carries out the system starting configuration using any one in two configuration files.
The configuration file is stored in the static memory of embedded system.
In the ' In System Reconfiguration Method, two configuration files can be by cross-reference, to make the state of two configuration files
It is close, it is not in the case where backup file often fails in the prior art, embedded system is more stable.
The present embodiment also provides a kind of embedded system, and referring to fig. 2, the embedded system includes two for embedded
The configuration file of the system starting configuration of system, each configuration file are matched with using this configuration file progress system starting
The system postponed is corresponding, and the configuration file includes for indicating to carry out system starting configuration successful using the configuration file
First state, for indicating to have neither part nor lot in the second state of system starting configuration using the configuration file and for indicating benefit
The third state of system starting configuration failure is carried out with the configuration file, the embedded system includes: one first to judge mould
Block 11, one second judgment module 12, one first execution module 13, one second execution module 14, a first choice module 15, one
Two selecting modules 16 and a first processing module 17.
The first judgment module 11 judges whether the configuration file is the configuration file of the third state, if otherwise adjusting
With second judgment module 12;Second judgment module 12 judges whether the configuration file has the configuration text of the third state
Part, if then calling first execution module 13, if otherwise calling the first choice module 15;First execution module
13 carry out the system starting configuration using the configuration file of first state or the second state.
Judge after the first choice module 15 is called the configuration file whether be the second state configuration file,
If then second execution module 14 carries out the system starting configuration using any one in two configuration files, if otherwise
Call second selecting module 16;Second selecting module 16 judges whether the configuration file has the configuration of the second state
File, if the first processing module 17 is then called to carry out the system starting configuration using the configuration file of the second state,
If second execution module 14 is otherwise called to carry out the system starting configuration using any one in two configuration files.
The configuration file is stored in the static memory of embedded system.
In the embedded system, two configuration files can be by cross-reference, to make the state phase of two configuration files
It closely, is not in the case where backup file often fails in the prior art, embedded system is more stable.
Embodiment 2
Referring to Fig. 3, in the present embodiment, a kind of ' In System Reconfiguration Method of embedded system, the embedded system includes
The configuration file of two system starting configurations for embedded system, each configuration file are carried out with using this configuration file
The system starting is corresponding with the system postponed, and the configuration file includes for indicating to utilize the configuration file system
The first state of system starting configuration successful, the second shape for indicating to have neither part nor lot in system starting configuration using the configuration file
State and for indicate using the configuration file carry out system starting configuration failure the third state, configuration file includes one edition
This number, the ' In System Reconfiguration Method includes:
Step 1000, judge the configuration file whether be the third state configuration file, if so then execute step
1005,1001 are thened follow the steps if not.
Step 1001 judges whether the configuration file has the configuration file of the third state, if so then execute step 1002,
1003 are thened follow the steps if not.
Step 1002 carries out the system starting configuration using the configuration file of first state or the second state, then holds
Row step 1005.
Step 1003, the version number for comparing two configuration files.
Step 1004 carries out the system starting configuration using the higher configuration file of version number.
The configuration file of selection higher-version can be set by user in step 1004, be also possible to system default selection
's.
Step 1005, judge in the configuration file whether be first state configuration file, if so then execute step
1006,1009 are thened follow the steps if not.
Step 1006 judges whether the higher configuration file of upgraded version number, if so then execute step 1007, if otherwise holding
Row step 1008.
The higher configuration file of version number is replaced with new configuration file by step 1007, and new configuration file, which is arranged, is
Second state, then terminates process.
The lower configuration file of version number is replaced with new configuration file by step 1008, and new configuration file, which is arranged, is
Second state, then terminates process.
The configuration file of second state or the third state is replaced with new configuration file by step 1009, and new match is arranged
Setting file is the second state.
In the ' In System Reconfiguration Method, two configuration files can be by cross-reference, to make the state of two configuration files
It is close, it is not in the case where backup file often fails in the prior art, and can be protected after the step of document upgrading is added
The case where failure will not be occurred simultaneously by demonstrate,proving two configuration files, and the starting of embedded system will be relatively reliable.
The present embodiment provides a kind of embedded system again, and the embedded system includes two for embedded system
The configuration file of system starting configuration, each configuration file carry out system starting with postponing with using this configuration file
System is corresponding, and the configuration file includes for indicating to carry out the first of system starting configuration successful using the configuration file
State had neither part nor lot in the second state of system starting configuration using the configuration file and for indicating described in utilization for indicating
Configuration file carries out the third state of system starting configuration failure, and configuration file includes a version number, the embedded system
Include: a first judgment module, one second judgment module, a comparison module, a third judgment module, one the 4th judgment module,
One first upgraded module, one second upgraded module and a third upgraded module.
The first judgment module judges whether the configuration file is the configuration file of the third state, if otherwise calling
Second judgment module;Second judgment module judges whether the configuration file has the configuration file of the third state, if
It is to call first execution module, if otherwise calling second comparison module;First execution module utilizes first
The configuration file of state or the second state carries out the system starting configuration.
The embedded system includes: the version that the comparison module compares two configuration files after called
Number, then second execution module carries out the system starting configuration using the higher configuration file of version number.The third
Judgment module system starting with postpone judge in the configuration file whether be first state configuration file, if
The 4th judgment module is then called, if otherwise calling the third upgraded module;4th judgment module judges whether to rise
The higher configuration file of grade version number, if then calling first upgraded module, if otherwise calling second upgraded module;
The higher configuration file of version number is replaced with new configuration file by first upgraded module, and it is that new configuration file, which is arranged,
Two-state;The lower configuration file of version number is replaced with new configuration file by second upgraded module, and new configuration is arranged
File is the second state;The configuration file of second state or the third state is replaced with new configuration text by the third upgraded module
Part, it is the second state that new configuration file, which is arranged,.
In the embedded system, two configuration files can be by cross-reference, to make the state phase of two configuration files
Closely, be not in the case where backup file often fails in the prior art, enough guarantee that two configuration files will not lose simultaneously
The starting of the case where effect, embedded system will be relatively reliable.
Although specific embodiments of the present invention have been described above, it will be appreciated by those of skill in the art that these
It is merely illustrative of, protection scope of the present invention is defined by the appended claims.Those skilled in the art is not carrying on the back
Under the premise of from the principle and substance of the present invention, many changes and modifications may be made, but these are changed
Protection scope of the present invention is each fallen with modification.