Embodiment
Below in conjunction with accompanying drawing, embedded system setting value initialization system, method and electronic installation method in the present invention are described in further detail.
Please refer to Fig. 1, embedded system setting value initialization system 100(in the present invention's one better embodiment hereinafter referred to as: initialization system 100), be applied to one and have in the electronic installation 200 of embedded system, this electronic installation 200 comprises storage unit 10 and processor 20.
The initial set value of acquiescence when the default value that need to load when storing the start files such as memory mapping (image) file of this electronic installation 200 in this storage unit 10 and starting shooting and this system are dispatched from the factory, wherein, this default value comprises that user carries out the setting value of inputting when system arranges.In this storage unit 10, also set up and have one or more subregions for storage and backup system setting value, this standby system setting value is for backing up this default value, under system normal operation, when this default value has renewal, this standby system setting value is synchronizeed and is upgraded with this main system setting value.The difference of the service that in this storage unit 10, the version number of image file of storage provides to electronic installation 200 according to service provider and difference.Wherein in this image file, also comprise a reference settings value, this reference settings value is because of version number's difference difference of image file, that is to say, every kind of reference settings value that service correspondence one is unique that service provider provides, service provider can provide corresponding service for user according to reference settings value, for example, reference settings value in the image file that, image file corresponding to wireless service is corresponding from cable service is different.
In the present embodiment, in this default value and this standby system setting value, include a cyclic redundancy check (CRC) code (Cyclic Redundancy Check, CRC), be used for doing error detection,, when crc value in this default value is correct, illustrate that this default value is normal, the crc value mistake in this default value illustrates that this default value is abnormal.In other embodiments, this cyclic redundancy check (CRC) code can be also the check code of other types.In the present embodiment, the storer that this storage unit 10 comprises at least comprises Flash storer, RAM storer, and the start files such as this memory mapped file are stored in this Flash storer.
This initialization system 100 comprises judge module 11, module 12 and starting up's module 13 is set.In the present embodiment, this initialization system 100 runs on this processor 20.In other embodiments, this judge module 11, module 12 is set and starting up's module 13 can be also the ingredient of processor 20, is solidificated in the hardware cell on processor 20.
In the present embodiment, when this starting up's module 13 is started shooting for have the electronic installation 200 of embedded system at this, the start files such as memory mapped file that are stored in Flash storer are copied, unzip in RAM storer from Flash storer, from RAM, start again this boot program, the operation of starting shooting of loading system setting value.
This judge module 11 in starting up's module 13 unzips to RAM storer by start file after, first judge that whether CRC in this default value is correct and judge that whether this default value is consistent with this standby system setting value, this arranges module 12 and according to the judged result of this judge module 11, this default value and/or this standby system setting value is arranged, and then starts follow-up boot program.
Particularly, the course of work of this initialization system 100 can be divided into following several situation:
The first situation: determine that when this judge module 11 crc value in this default value is correct and this default value is consistent with standby system setting value, module 12 is set and keeps the current setting to this default value and this standby system setting value.
The second situation: when this judge module 11 determines that crc value in this default value correct but this default value and standby system setting value are inconsistent, this judge module 11 continues to judge that whether this default value is identical with initial set value, when this judge module 11 determines that this default value and initial set value are when inconsistent, when this default value is user's setting value, this arranges this default value of module 12 use and replaces this standby system setting value and this standby system setting value is upgraded.; above-mentioned situation explanation is that default value is normal; but in this default value this standby system setting value after user sets, do not synchronize with this default value, so this arranges module 12 and this default value is replaced to this standby system setting value standby system setting value is synchronizeed with default value.
The third situation: when this judge module 11 determines that the crc value of these default values is correct when this default value and initial set value are consistent but this default value is inconsistent with standby system setting value, this judge module 11 continues to judge that whether the crc value of this standby system setting value is normal, when the crc value of this standby system setting value is normal, this arranges module 12 this standby system setting value is replaced to this default value and default value is upgraded.; although the crc value of above-mentioned situation explanation default value is normal, has been resumed as initial value, so inconsistent with standby system setting value; therefore by standby system setting value, replace and reverted to the default value of initial value, thereby can protect user's setting value can not lose.
The 4th kind of situation: when this judge module 11 determines that the crc value of these default values is correct when this default value and initial set value are consistent but this default value is inconsistent with standby system setting value, if the crc value of this standby system setting value is abnormal, this arranges module 12 this standby system setting value is reverted to initial set value.That is, above-mentioned situation illustrative system setting value has reverted to initial set value and standby system setting value is abnormal, therefore standby system setting value also can only be reverted to initial set value.
The 5th kind of situation: when this judge module 11 determines that the crc value of these default values is abnormal, continue to judge that whether the crc value of this standby system setting value is normal, when the CRC of this standby system setting value is normal, this judge module 11 continues to judge that whether this standby system setting value is identical with initial set value, when this standby system setting value is different from initial set value, this arranges this standby system setting value of module 12 use and replaces this default value, , above-mentioned situation illustrative system setting value occurs abnormal, and standby system setting value is normal, by this standby system setting value, replacing this default value loses to prevent user's setting value.
The 6th kind of situation: the crc value crc value abnormal and this standby system setting value of determining this default value when this judge module 11 is normal, when this standby system setting value is identical with initial set value simultaneously, this arranges module 12 this default value is reverted to initial set value.
The 7th kind of situation: the crc value of standby system setting value is also abnormal when the abnormal while of crc value of these judge module 11 definite these default values, and this arranges module 12 this default value and standby system setting value are all reverted to initial set value.
After this arranges module 12 and according to the judged result of this judge module 11, this default value and/or this standby system setting value setting is completed, this judge module 11 also compares this reference settings value and this default value, this starting up's module 13 is selected to be worth corresponding service with this reference settings according to the comparative result of judge module 11 and is loaded and complete follow-up start operation, thus the required service of selection user that system can be correct.
In the present embodiment, this initialization system 100 also comprises a central control module 14, and this central control module 14 is controlled for all processes of this embedded system being accessed to the process of this default value or initialization system setting value.This central control module 14 can only have a process to access this default value by protection lock mechanism control of the prior art is interior at one time.Because protection lock mechanism is the common technology in this area, therefore do not repeat them here.In the present embodiment, in this storage unit 10, also comprise a common memory (not shown), for storing all processes data that obtained by default value or that default value is arranged.First this central control module 14 judges that whether this modification setting value can clash with the modification of other processes, if clash, gives up this modification setting value; If not conflict, this central control module 14 continues to judge the whether available free time of this Flash storer, when determining the normal operation that available free time of Flash storer that this stores this default value and this modification setting value can interrupt systems, this central control module 14 is revised default value and the standby system setting value of storing in this Flash storer according to this modification setting value.When the free time of this Flash storer is not enough to this default value and standby system setting value and all revises, first this central control module 14 revises this default value according to this modification setting value, and this standby system setting value is synchronizeed with this default value when system starts again.
Fig. 2 is the establishing method process flow diagram of embedded system setting value in an embodiment of the present invention, and the method is applied in the electronic installation 200 shown in Fig. 1.
Step S201: this judge module 11 is carried out in start process in starting up's module 13, before carrying out the step of loading system setting value, first this judge module 11 judges that whether the CRC of this default value is correct, if correct, perform step S202, if incorrect, perform step S209.
Step S202: this judge module 11 judges that whether this default value is consistent with this standby system setting value, if so, performs step S203, if not, performs step S204.
Step S203: this starting up's module 13 loads this default value and carries out follow-up start operation (being the first situation).
Step S204: this judge module 11 continues to judge that whether this default value is consistent with initial set value, if this default value and this initial set value are inconsistent, performs step S205, otherwise execution step S206.
Step S205: this arranges module 12 this default value is replaced to this standby system setting value (being the second situation).
Step S206: this judge module 11 continues to judge that whether the crc value of this standby system setting value is correct, if correct, performs step S207, performs step S208 if incorrect.
Step S207: this arranges this standby system setting value of module 12 use and replaces this default value (being the third situation).
Step S208: this arranges module 12 this standby system setting value is reverted to initial set value (i.e. the 4th kind of situation).
Step S209: this judge module 11 judges that whether the crc value of this standby system setting value is correct, if correct, performs step S210, otherwise execution step S213.
Step S210: this judge module 11 judges that whether this standby system setting value is consistent with initial set value, if inconsistent, performs step S211, if unanimously perform step S212.
Step S211: this arranges this standby system setting value of module 12 use and replaces this default value (i.e. the 5th kind of situation).
Step S212: this starting up's module 13 reverts to initial set value (i.e. the 6th kind of situation) by this default value.
Step S213: this arranges module 12 this default value and standby system setting value are all reverted to initial set value (i.e. the 7th kind of situation).
In the present embodiment, the establishing method of this default value, after the step shown in Fig. 2, also comprises step: this central control module 14 judges whether this modification setting value can clash with the modification of other processes.If clash, give up this modification setting value; If not conflict, this central control module 14 continues to judge the whether available free time of this Flash storer, when determining the normal operation that available free time of Flash storer that this stores this default value and this modification setting value can interrupt systems, this central control module 14 is revised default value and the standby system setting value of storing in this Flash storer according to this modification setting value; When the free time of this Flash storer is not enough to this default value and standby system setting value and all revises, first this central control module 14 revises this default value according to this modification setting value, and this standby system setting value is synchronizeed with this default value when system starts again.
Although the preferred embodiment of the present invention is illustrated and is described, but those skilled in the art will realize, the explanation of above embodiment is just for helping to understand the present invention, for a person skilled in the art, according to thought of the present invention, can make various changes and modifications in specific embodiments and applications, these do not exceed true scope of the present invention.Therefore expectation, the present invention is not limited to the embodiment that disclosed conduct realizes the contemplated optimal mode of the present invention, and all embodiments that the present invention includes are all in the protection domain of appended claims.