A kind of self-healing over-the-air upgrade method of power-off and device
Technical field
The present invention relates to field of wireless communication devices, particularly relate to a kind of self-healing over-the-air upgrade method of power-off and dress
Put.
Background technology
In the application scenarios of Wireless Telecom Equipment, frequently need module firmware therein is upgraded, and rise in the air
Level, with the advantage of its convenience and high-efficiency, becomes the top-priority upgrading scheme of increasing module manufacturers.
In existing aerial upgrade technology, typically download from the air and the Code region directly writing flash is risen
Level, but likely occur during upgrading unexpected power down, unexpected go offline, the situation such as module exception deadlock, these feelings occur
During condition, upgrade unsuccessfully, and the Upgrade process before cannot returning to after turning back on.
Summary of the invention
Present invention is primarily targeted at a kind of self-healing over-the-air upgrade method of power-off of proposition and device, it is possible to be guaranteed in
Run into data service exception during aerial upgrade, unexpected power down, module surprisingly crash when stability, and after power-off
Can automatically recover, continue upgrading.
For achieving the above object, the self-healing over-the-air upgrade method of a kind of power-off that the present invention provides, including:
S20, the storage cell that the ascending series downloaded in the air is preset according to this write backup area;
S30, read described upgrading data from described backup area with described default storage cell, and by described upgrading data
It is written to code segment upgrade;
Wherein, the write state of each described default storage cell uses the mode of bitmask to be identified.
Alternatively, also include before described step S20:
S10, in a flash memory definition flash mark region field, described flash mark region field includes update phase mark
Will, backup area write index record and code segment are written into index record.
Alternatively, described step S20 includes:
S21, described update phase mark is designated will to backup area fill upgrading data;
S22, cache bag data, and whether the length detecting the data of caching reaches default length, or detection institute
State last bag data whether bag data are upgrading data;
S23, the most then described bag data with default storage cell write backup area, and the storage that this is preset
The write state of unit is saved in described backup area write index record;
S24, when having cached all described upgrading data, described update phase mark is designated the success of upgrading data from
Download to backup area in the air.
Alternatively, described step S30 includes:
S31, read bag data from described backup area, and whether the length detecting described bag data reaches described and preset
Length, or detect last bag data whether described bag data are upgrading data;
S32, the most then described bag data with default storage cell write code segment, and the storage that this is preset
The write state of unit is saved in described code segment and is written in index record;
S33, when having read all described upgrading data, described update phase mark is designated code segment and has updated
Finish.
Alternatively, in escalation process, upgrade method after power-off restarting is:
S41, the update phase mark read in flash mark region field;
S42, judge the progress of aerial upgrade according to described update phase mark;
If S43 described update phase mark is designated code segment and has updated complete, then directly initiate execution code;
If S44 described update phase mark is designated the success of upgrading data and downloads to backup area from the air, but code segment
Also do not update complete, be then written into index record according to described code segment and enter step S30;
If S45 described update phase mark is designated will fill upgrading data to backup area, but has not yet been downloaded complete,
Then enter step S20 according to described backup area write index record.
According to another aspect of the present invention, it is provided that a kind of power-off self-healing aerial upgrade device, including:
Download module, for the storage cell write backup area preset according to this by the ascending series downloaded in the air;
Upgraded module, for reading described upgrading data from described backup area with described default storage cell, and by institute
State upgrading data to be written to code segment and upgrade;
Mark module, for using the mode of bitmask to mark by the write state of each described default storage cell
Know.
Alternatively, also include:
Definition module, for definition flash mark region field in a flash memory, described flash mark region field includes
Update phase mark, backup area write index record and code segment are written into index record.
Alternatively, described download module includes:
First mark unit, will fill upgrading data to backup area for being designated by described update phase mark;
Buffer unit, for caching one bag data, and whether the length detecting the data of caching reaches default length, or
Person detects last bag data whether described bag data are upgrading data;
Backup area writing unit, for default storage cell write backup area and this is pre-described bag data
If the write state of storage cell be saved in described backup area write index record;
Second mark unit, when being used for having cached all described upgrading data, is designated liter by described update phase mark
DBMS success downloads to backup area from the air.
Alternatively, described upgraded module includes:
Data-reading unit, for reading bag data from described backup area, and the length detecting described bag data is
No reach described default length, or detect last bag data whether described bag data are upgrading data;
Code segment writing unit, for default storage cell write code segment and this is pre-described bag data
If the write state of storage cell be saved in described code segment and be written in index record;
3rd mark unit, when being used for having read all described upgrading data, is designated generation by described update phase mark
Code section has updated complete.
Alternatively, also include that power-off restarting module, described power-off restarting module include:
Flag-reading unit, for reading the update phase mark in flash mark region field;
Upgrading progress judging unit, for judging the progress of aerial upgrade according to described update phase mark;
Directly initiate unit, updated complete if being designated code segment for described update phase mark, then directly initiated
Perform code;
Restarting upgrade unit, downloading to from the air standby if being designated the success of upgrading data for described update phase mark
Part district, but code segment does not also update complete, then be written into index record according to described code segment and enter upgraded module;
Restart download unit, if be designated will fill upgrading data to backup area for described update phase mark, but
Have not yet been downloaded complete, then enter download module according to described backup area write index record.
The self-healing over-the-air upgrade method of a kind of power-off of present invention proposition and device, the method includes: will download in the air
Ascending series preset according to this storage cell write backup area;Read described from described backup area with described default storage cell
Upgrading data, and described upgrading data are written to code segment upgrade;Wherein, the writing of each described default storage cell
Entering state uses the mode of bitmask to be identified, it is possible to run into data service during being guaranteed in aerial upgrade abnormal, unexpected
Power down, module surprisingly crash when stability, and can automatically recover after power-off, continue upgrading.
Accompanying drawing explanation
A kind of power-off self-healing over-the-air upgrade method flow process that Fig. 1 provides for the embodiment of the present invention one;
The distribution schematic diagram of the flash mark region field that Fig. 2 provides for the embodiment of the present invention one;
A kind of power-off self-healing over-the-air upgrade method flow process that Fig. 3 provides for the embodiment of the present invention two;
A kind of power-off self-healing over-the-air upgrade method flow process that Fig. 4 provides for the embodiment of the present invention three;
A kind of power-off self-healing over-the-air upgrade method flow process that Fig. 5 provides for the embodiment of the present invention four;
A kind of power-off self-healing aerial upgrade device exemplary block diagram that Fig. 6 provides for the embodiment of the present invention five;
A kind of power-off self-healing aerial upgrade device exemplary block diagram that Fig. 7 provides for the embodiment of the present invention six;
A kind of power-off self-healing aerial upgrade device exemplary block diagram that Fig. 8 provides for the embodiment of the present invention seven;
A kind of power-off self-healing aerial upgrade device exemplary block diagram that Fig. 9 provides for the embodiment of the present invention eight.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further referring to the drawings.
Detailed description of the invention
Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Embodiment one
As it is shown in figure 1, in the present embodiment, a kind of self-healing over-the-air upgrade method of power-off, including:
S20, the storage cell that the ascending series downloaded in the air is preset according to this write backup area;
S30, read described upgrading data from described backup area with described default storage cell, and by described upgrading data
It is written to code segment upgrade;Wherein, the write state of each described default storage cell uses the mode of bitmask to enter
Line identifier.
In the present embodiment, it is primarily adapted for use in the aerial upgrade of Wireless Telecom Equipment, by being temporarily stored in standby by upgrading data
Part district, then upgrade with default storage cell write code segment, it is possible to ensure Wireless Telecom Equipment escalation process aloft
In run into data service exception, unexpected power down, module surprisingly crash when stability, and can be the most extensive after power-off
Multiple, continue upgrading.
In the present embodiment, described default storage cell represents with block, and block is the minimum memory in data base
With process unit, comprise header information data or the PL/SQL code of block itself.The size of block is can to select when mounted " to make by oneself
Yian city fills " specify, in the present embodiment, the size of block is 8KB.
In the present embodiment, also include before described step S20:
S10, in a flash memory definition flash mark region field, described flash mark region field includes update phase mark
Will, backup area write index record and code segment are written into index record.
It is illustrated in figure 2 the distribution schematic diagram of flash mark region field, wherein, a length of 4 words of update phase mark
Saving, backup area write index record and code segment are written into the length of index record and are all 256 bytes, and each byte includes
8bit, each bit position (namely block) represents 8KB data and has been successfully written backup area/code segment, so this
In at most can record the file size of 256*8*8KB=16MB, enough we accommodate the upgrading data of daily firmware.
In the present embodiment, the write state of each described default storage cell block uses bitmask (bit
Mask) mode is identified, and be stored in described backup area write index record or code segment be written in index record, make
By the benefit of bitmask it is obvious that be that writing this blocks of data need not first wipe flash every time.
Embodiment two
As it is shown on figure 3, in the present embodiment, described step S20 includes:
S21, described update phase mark is designated will to backup area fill upgrading data;
S22, cache bag data, and whether the length detecting the data of caching reaches default length, or detection institute
State last bag data whether bag data are upgrading data;
S23, the most then described bag data with default storage cell write backup area, and the storage that this is preset
The write state of unit is saved in described backup area write index record;
S24, when having cached all described upgrading data, described update phase mark is designated the success of upgrading data from
Download to backup area in the air.
In the present embodiment, described default a length of 8KB, the present invention stores upgrading data in units of 8KB so that
Byte overhead is minimum when power is off, so that before aerial upgrade is automatically moved back to power-off after the power-off of data backup stage
Upgrading progress, continue upgrading, this upgrading progress can backup area write index record in inquire about.
Embodiment three
As shown in Figure 4, in the present embodiment, described step S30 includes:
S31, read bag data from described backup area, and whether the length detecting described bag data reaches described and preset
Length, or detect last bag data whether described bag data are upgrading data;
S32, the most then described bag data with default storage cell write code segment, and the storage that this is preset
The write state of unit is saved in described code segment and is written in index record;
S33, when having read all described upgrading data, described update phase mark is designated code segment and has updated
Finish.
Similar with embodiment two, at brush code segment update phase, still using 8KB is the length of packet, so that
Aerial upgrade after brush code segment update phase power-off, be automatically moved back to power-off before upgrading progress, continue upgrading, this liter
Level progress can be inquired about in code segment is written into index record.
Embodiment four
As it is shown in figure 5, in the present embodiment, in escalation process, the upgrade method after power-off restarting is:
S41, the update phase mark read in flash mark region field;
S42, judge the progress of aerial upgrade according to described update phase mark;
If S43 described update phase mark is designated code segment and has updated complete, then directly initiate execution code;
If S44 described update phase mark is designated the success of upgrading data and downloads to backup area from the air, but code segment
Also do not update complete, be then written into index record according to described code segment and enter step S30;
If S45 described update phase mark is designated will fill upgrading data to backup area, but has not yet been downloaded complete,
Then enter step S20 according to described backup area write index record.
In step S41, described update phase mark, there is following several state:
1,0xFFFFFFFF, represents and is not carried out any upgrading download action, and equipment directly initiates system;
2,0xFFFFFF00, represents and has begun to carry out preserving upgrading data to backup area, simply the most do not downloaded
Become;Now, then step S45 is entered;
3,0xFFFF0000, represents and completes, during code segment brush to backup area preservation air-data;
Now, then step S44 is entered;
4,0xFF000000, represents and has refreshed to code segment, now, then enters step S43.
In the present embodiment, by above method, aerial upgrade is divided into 4 stages, no matter anticipates in which in stage
The situations such as outer power-off, can automatically restore to the upgrading progress before power-off, continue upgrading.
Embodiment five
As shown in Figure 6, in the present embodiment, a kind of power-off self-healing aerial upgrade device, including:
Download module 20, for the storage cell write backup area preset according to this by the ascending series downloaded in the air;
Upgraded module 30, for reading described upgrading data from described backup area with described default storage cell, and will
Described upgrading data are written to code segment and upgrade;
Mark module 40, for using the mode of bitmask to carry out by the write state of each described default storage cell
Mark.
In the present embodiment, also include:
Definition module 10, for definition flash mark region field, described flash mark region field bag in a flash memory
Include update phase mark, backup area write index record and code segment and be written into index record.
In the present embodiment, it is primarily adapted for use in the aerial upgrade of Wireless Telecom Equipment, by being temporarily stored in standby by upgrading data
Part district, then upgrade with default storage cell write code segment, it is possible to ensure Wireless Telecom Equipment escalation process aloft
In run into data service exception, unexpected power down, module surprisingly crash when stability, and can be the most extensive after power-off
Multiple, continue upgrading.
Embodiment six
As it is shown in fig. 7, in the present embodiment, described download module 20 includes:
First mark unit 21, will fill upgrading data to backup area for being designated by described update phase mark;
Buffer unit 22, for caching one bag data, and whether the length detecting the data of caching reaches default length,
Or detect last bag data whether described bag data are upgrading data;
Backup area writing unit 23, for described bag data are write backup area with default storage cell, and should
The write state of the storage cell preset is saved in described backup area write index record;
Second mark unit 24, when being used for having cached all described upgrading data, is designated described update phase mark
The success of upgrading data downloads to backup area from the air.
In the present embodiment, described default a length of 8KB, the present invention stores upgrading data in units of 8KB so that
Byte overhead is minimum when power is off, so that before aerial upgrade is automatically moved back to power-off after the power-off of data backup stage
Upgrading progress, continue upgrading, this upgrading progress can backup area write index record in inquire about.
Embodiment seven
As shown in Figure 8, in the present embodiment, described upgraded module 30 includes:
Data-reading unit 31, for reading bag data from described backup area, and detects the length of described bag data
Whether reach described default length, or detect last bag data whether described bag data are upgrading data;
Code segment writing unit 32, for described bag data are write code segment with default storage cell, and should
The write state of the storage cell preset is saved in described code segment and is written in index record;
3rd mark unit 33, when being used for having read all described upgrading data, is designated described update phase mark
Code segment has updated complete.
Similar with embodiment six, at brush code segment update phase, still using 8KB is the length of packet, so that
Aerial upgrade after brush code segment update phase power-off, be automatically moved back to power-off before upgrading progress, continue upgrading, this liter
Level progress can be inquired about in code segment is written into index record.
Embodiment eight
As it is shown in figure 9, in the present embodiment, a kind of power-off self-healing aerial upgrade device, also include power-off restarting mould
Block 50, described power-off restarting module 50 includes:
Flag-reading unit 51, for reading the update phase mark in flash mark region field;
Upgrading progress judging unit 52, for judging the progress of aerial upgrade according to described update phase mark;
Directly initiate unit 53, having updated complete if being designated code segment for described update phase mark, the most directly having opened
Dynamic execution code;
Restarting upgrade unit 54, downloading to from the air if being designated the success of upgrading data for described update phase mark
Backup area, but code segment does not also update complete, then be written into index record according to described code segment and enter upgraded module;
Restart download unit 55, if be designated will fill upgrading data to backup area for described update phase mark,
But have not yet been downloaded complete, then enter download module according to described backup area write index record.
In the present embodiment, described update phase mark, there is following several state:
1,0xFFFFFFFF, represents and is not carried out any upgrading download action, and equipment directly initiates system;
2,0xFFFFFF00, represents and has begun to carry out preserving upgrading data to backup area, simply the most do not downloaded
Become;Now, then download unit 55 is restarted in entrance;
3,0xFFFF0000, represents and completes, during code segment brush to backup area preservation air-data;
Now, then upgrade unit 54 is restarted in entrance;
4,0xFF000000, represents and has refreshed to code segment, now, then enters and directly initiates unit 53.
In the present embodiment, by with upper type, aerial upgrade is divided into 4 stages, no matter anticipates in which in stage
The situations such as outer power-off, can automatically restore to the upgrading progress before power-off, continue upgrading.
It should be noted that in this article, term " includes ", " comprising " or its any other variant are intended to non-row
Comprising of his property, so that include that the process of a series of key element, method, article or device not only include those key elements, and
And also include other key elements being not expressly set out, or also include intrinsic for this process, method, article or device
Key element.In the case of there is no more restriction, statement " including ... " key element limited, it is not excluded that including this
The process of key element, method, article or device there is also other identical element.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art is it can be understood that arrive above-described embodiment side
Method can add the mode of required general hardware platform by software and realize, naturally it is also possible to by hardware, but a lot of in the case of
The former is more preferably embodiment.Based on such understanding, prior art is done by technical scheme the most in other words
The part going out contribution can embody with the form of software product, and this computer software product is stored in a storage medium
In (such as ROM/RAM, magnetic disc, CD), including some instructions with so that a station terminal equipment (can be mobile phone, computer, take
Business device, air-conditioner, or the network equipment etc.) perform the method described in each embodiment of the present invention.
These are only the preferred embodiments of the present invention, not thereby limit the scope of the claims of the present invention, every utilize this
Equivalent structure or equivalence flow process that bright description and accompanying drawing content are made convert, or are directly or indirectly used in other relevant skills
Art field, is the most in like manner included in the scope of patent protection of the present invention.