But a kind of embedded system of on-line software updating and online upgrading method
Technical field
The present invention relates to a kind of technology of embedded computer on-line software updating, especially have the system software and the application software online upgrading of the embedded computer of embedded OS.
Background technology
Traditional embedded type terminal equipment, because the restriction of resource and environmental baseline just need solidify software code in the production phase, online modification at the scene after equipment dispatches from the factory.In case upgrade requirement occurs, or be the equipment depot repair, or be to tear machine at the scene open to change component plate or replace the procedure stores chip.
Along with improving constantly of computer utility level, in order to satisfy the demand that the client continues variation, prolong the life cycle of product, improve the performance of system, embedded product need possess the online upgrading ability.
Present known embedded software online upgrading method has been idealized working environment.In the actual environment, we may face various unusual, as phenomenons such as communication transmission error code, storage operation fault, transmission interruption, manually-operated error, the generation that any one is unusual, the escalation process failure is caused in the capital, even causes that systemic breakdown causes product failure.
Summary of the invention
The objective of the invention is to overcome the deficiency of prior art, but provide a kind of embedded system and online upgrading method of on-line software updating, make in this way, can effectively discern the various unusual conditions in the online escalation process, and take corresponding measure to be remedied, or error code retransmits, or breakpoint transmission, or invalid abandoning, or fail and reduce, guarantee the correctness and the robustness of online upgrading.
The technical solution adopted for the present invention to solve the technical problems is: but a kind of embedded system of on-line software updating comprises:
One built-in terminal, it comprises main control chip, program storage, data-carrier store, remote communication interface and this locality/short-haul connections interface; Main control chip is connected with program storage, data-carrier store, remote communication interface and this locality/short-haul connections interface respectively; This program storage is divided into A district and the B district with peering structure at least, and each district further is divided into three sub regions with identical size and structure again; Described three sub regions are respectively the start-up routine districts that are used for storing start-up routine, be used for storing the boot district of boot and be used for the system program district of storage system program; This data-carrier store is provided with the storage space of storage service program, business datum and ROMPaq bag thereof simultaneously; Described start-up routine district also stores the upgrading control information;
One is located at first main website long-range and that can be connected with described built-in terminal by the wireless network access, be provided with the communication protocol of mutual approval between this first main website and the built-in terminal so that can realize exchanges data between first main website and the built-in terminal, first main website sends ROMPaq bag and upgrade thereof to built-in terminal, and built-in terminal carries out software upgrading;
One second main website that is located at short range and can be connected with described built-in terminal by the wireless mode access, be provided with the communication protocol of mutual approval between this second main website and the built-in terminal so that can realize exchanges data between second main website and the built-in terminal, second main website sends ROMPaq bag and upgrade thereof to built-in terminal, and built-in terminal carries out software upgrading;
One the 3rd main website that is located at short range and can be connected with described built-in terminal by this locality access, be provided with the communication protocol of mutual approval between the 3rd main website and the built-in terminal so that can realize exchanges data between the 3rd main website and the built-in terminal, the 3rd main website sends ROMPaq bag and upgrade thereof to built-in terminal, and built-in terminal carries out software upgrading.
Described program storage adopts the Flash memory device.
Described second main website, the 3rd main website are respectively portable equipment or desk-top computer or laptop computer.
A kind of on-line software updating method of embedded system comprises the steps:
A. built-in terminal starts from the A district according to predefined bootmode, loads the boot in A district, and the operating system program in guiding A district enters duty;
B. one of them main website by first main website or second main website or the 3rd main website sends the ROMPaq bag that several are used for software upgrading to built-in terminal; Built-in terminal check ROMPaq bag is guaranteed complete all ROMPaq bags that correctly receives;
C. the main website that sends the ROMPaq bag sends instruction to built-in terminal, and the notice built-in terminal carries out software upgrading to be upgraded;
D. built-in terminal uses the ROMPaq bag to upgrade the B district, and registration upgrading control information in the start-up routine district in A district, and it is ready that this upgrading control information is labeled as redaction;
E. built-in terminal restarts, start from the A district, check the upgrading control information of A district registration, finding that the upgrading control information is labeled as redaction when ready, registration upgrading control information again, this upgrading control information is labeled as redaction and enables, and loads the boot in B district, the operating system program in guiding B district enters duty;
F. if guidance system is successful, then boot district and the system program district with the B district copies to the A district, registration upgrading control information once more, and this upgrading control information is labeled as redaction and upgrades; Escalation process finishes;
G. if guidance system failure, preestablish the overtime of time through one, built-in terminal resets under the watchdog circuit effect;
H. built-in terminal restarts, and starts from the A district, checks the upgrading control information, the mark of finding the upgrading control information is still enabled for redaction and is not modified to redaction and upgrades, then load the boot in A district, the operating system program in guiding A district enters duty;
I. guidance system success copies to B district with the boot district and the system program district in A district, the registration control information of upgrading once more, and this upgrading control information is labeled as redaction and discards; System recovery is to the preceding state of upgrading, and escalation process finishes.
Described predefined bootmode is to carry out in turn from A district and B district successively, successfully carries out then changing the guidance field behind the system software upgrading at every turn.
Described ROMPaq bag is broken down into an AKU data of description piece and several upgrade data pieces, these data blocks are sent on the built-in terminal from first main website or second main website or the 3rd main website in turn, be temporarily stored on the zone of delimiting in advance of data-carrier store of built-in terminal, transmit and finish the back and merge automatically by built-in terminal and be reduced to the ROMPaq bag.
Described ROMPaq bag is the AKU of first main website or second main website or the transmission of the 3rd main website; The data block of this AKU is sent to built-in terminal from first main website or second main website or the 3rd main website in turn, and this process can be interrupted by system's other business; Between two data block transfers, first main website or second main website or the 3rd main website can issue other instructions, and built-in terminal can be restarted, and first main website or second main website or the 3rd main website also can be restarted.
Described ROMPaq bag is the AKU of first main website or second main website or the transmission of the 3rd main website; The data block of this AKU transmits has the ability of automatically restoring fault; First main website or second main website or the 3rd main website can inquire the data block quantity of the AKU that is transmitting, and continue to transmit follow-up AKU data block.
Described ROMPaq wraps in the branch block transfer and merges in the process of reduction, has passed through two layers inspection verification, and its process is as follows:
Check the check information of upgrade data piece after the check information that comprises self in the transport process of each upgrade data piece, built-in terminal receive earlier, just store after correct, and the corresponding main website of notice sends next upgrade data piece;
In AKU data of description piece, comprise check information, built-in terminal is after all data blocks transmit end, merging is reduced into the ROMPaq bag, also will check verification to the check information of AKU data of description piece, guarantees that with this ROMPaq bag correctly transmits.
A described remote upgrade renewal process can be upgraded a plurality of program modules simultaneously, and each program module transmits as a ROMPaq bag, can concurrently transmit between a plurality of ROMPaq bags.
But the embedded system of a kind of on-line software updating of the present invention and online upgrading method, embedded type terminal equipment by main control chip, procedure stores device, data storage device and can and main website (can be first main website, also can be second main website, perhaps can be the 3rd main website) communication interface of communication constitutes.Software section comprises system program (start-up routine, boot and embedded OS) and business procedure.
Between main website (comprising first main website, second main website and the 3rd main website) and built-in terminal, formulate have a communications protocol, this communications protocol to make can swap data between embedded type terminal equipment and the main website.The ROMPaq bag is sent to embedded type terminal equipment according to this kind communications protocol mode by main website.This communications protocol can be supported multiple communication modes, can be telecommunication (as TCP/UDP, GPRS/CDMA, PSTN, 230MHz are wireless etc.), or locally-attached communication (as USB, RS232, RS485, high speed infrared etc.), can also be Near Field Communication (as far infrared, less radio-frequency, bluetooth etc.).Can both finish the transmission of online upgrading bag as long as can realize the communication modes of main website and embedded device swap data.
The transmission and the renewal process of software upgrade package realize in business procedure.
The bootup process of system is carried out in turn from A district and B district successively, carries out system software upgrading at every turn and then changes the guidance field.The zone that the system software upgrading bag upgrades is current non-guidance field.Be that system guides from the A district, then software version update is to the B district.Otherwise system is from the guiding of B district, and then software version update is to the A district.
After the booting operating system success, whether the software version that reexamines A memory block and B memory block is consistent, if inconsistent, then replace the version of non-boot section with the version of boot section, keep the software version in 2 zones (being A memory block and B memory block) synchronous with this.
If the operating system after upgrading can not successfully guide, then from the guiding of old version system boot section, and the system realm that will upgrade is reduced into legacy version.
The invention has the beneficial effects as follows, but owing to adopted one to be located at long-range and can to insert and first main website, that be connected with described built-in terminal is located at short range and can inserts and second main website, that be connected with described built-in terminal is located at short range and can inserts and the 3rd main website that is connected with described built-in terminal and the built-in terminal that includes main control chip, program storage, data-carrier store, remote communication interface and this locality/short-haul connections interface constitute the embedded system of on-line software updating by this locality by wireless mode by wireless network; And dividing in the program storage of built-in terminal has A district and the B district with peering structure, and the bootup process of system is carried out in turn from A district and B district successively, carries out system software upgrading at every turn and then changes the guidance field; The zone that the system software upgrading bag upgrades is current non-guidance field, and promptly system is from the guiding of A district, and then software version update is to the B district; Otherwise system is from the guiding of B district, and then software version update is to the A district.This embedded system and online upgrading method have following beneficial effect: the one, and, system program is preserved double copies at program storage, if the escalation process failure can be reduced from the zone that the last time successfully starts, has robustness; The 2nd,, transmission course has multiple check, possesses the ability of fault recovery, supports concurrent transmission; The 3rd,, various communication modes all can be realized updating operation, have dirigibility; The 4th,, the transmission and the control procedure of escalation process realize that in application layer the user can upgrade voluntarily.
Below in conjunction with drawings and Examples the present invention is described in further detail; But but the embedded system of a kind of on-line software updating of the present invention and online upgrading method are not limited to embodiment.
Description of drawings
But Fig. 1 is the structural representation of the embedded system of on-line software updating of the present invention;
Fig. 2 is the structural representation of built-in terminal of the present invention;
Fig. 3 is the dividing mode synoptic diagram of the program storage of built-in terminal of the present invention;
Fig. 4 is the transmission and the renewal process process flow diagram of software upgrade package of the present invention.
Embodiment
Embodiment, shown in accompanying drawing, but the embedded system of a kind of on-line software updating of the present invention comprises:
One built-in terminal 1, it comprises main control chip 11, program storage 12, data-carrier store 13, remote communication interface 14 and this locality/short-haul connections interface 15; Main control chip 11 is connected with program storage 12, data-carrier store 13, remote communication interface 14 and this locality/short-haul connections interface 15 respectively; This program storage 12 is divided into A district and the B district with peering structure at least, and each district further is divided into three sub regions with identical size and structure again; Described three sub regions are respectively the start-up routine district LOADER that are used for storing start-up routine, be used for storing the boot district BOOT of boot and be used for the system program district SYSTEM of storage system program; This data-carrier store 13 is provided with the storage space of storage service program, business datum and ROMPaq bag thereof simultaneously; Described start-up routine district LOADER also stores the upgrading control information; This built-in terminal 1 can also have the electron device of band digital register, if having the electron device of band digital register, this digital register is used to deposit the check information of upgrading control information; Built-in terminal 1 has boot BSP and embedded OS;
One is located at first main website 2 long-range and that can be connected with described built-in terminal by wireless network 5 accesses, be provided with the communication protocol of mutual approval between this first main website 2 and the built-in terminal 1 so that can realize exchanges data between first main website 2 and the built-in terminal 1, first main website 2 sends ROMPaq bag and upgrade thereof to built-in terminal 1, and built-in terminal 1 carries out software upgrading; Wireless network 5 is public or special-purpose long-distance communication networks;
One second main website 3 that is located at short range and can be connected with described built-in terminal by the wireless mode access, be provided with the communication protocol of mutual approval between this second main website 3 and the built-in terminal 1 so that can realize exchanges data between second main website 3 and the built-in terminal 1, second main website 3 sends ROMPaq bag and upgrade thereof to built-in terminal, and built-in terminal 1 carries out software upgrading;
One the 3rd main website 4 that is located at short range and can be connected with described built-in terminal by this locality access, be provided with the communication protocol of mutual approval between the 3rd main website 4 and the built-in terminal 1 so that can realize exchanges data between the 3rd main website 4 and the built-in terminal 1, the 3rd main website 4 sends ROMPaq bag and upgrade thereof to built-in terminal, and built-in terminal 1 carries out software upgrading.
Wherein:
Program storage 12 adopts the Flash memory device;
Second main website 3, the 3rd main website 4 are respectively portable equipment or desk-top computer or laptop computer.
A kind of on-line software updating method of embedded system comprises the steps:
A. built-in terminal 1 starts from the A district according to predefined bootmode, loads the boot in A district, and the operating system program in guiding A district enters duty; As the frame 401 of Fig. 4 to shown in the frame 408;
B. send several by one of them main website of first main website 2 or second main website 3 or the 3rd main website 4 to built-in terminal 1 and be used for the ROMPaq bag of software upgrading; Built-in terminal 1 check ROMPaq bag is guaranteed complete all ROMPaq bags that correctly receives; Shown in the frame 409 of Fig. 4;
C. the main website that sends the ROMPaq bag sends instruction to built-in terminal 1, and notice built-in terminal 1 carries out software upgrading to be upgraded;
D. built-in terminal 1 uses the ROMPaq bag to upgrade the B district, and registration upgrading control information in the start-up routine district in A district, and it is ready that this upgrading control information is labeled as redaction; Shown in the frame 410 of Fig. 4;
E. built-in terminal 1 restarts, start from the A district, check the upgrading control information of A district registration, finding that the upgrading control information is labeled as redaction when ready, registration upgrading control information again, this upgrading control information is labeled as redaction and enables, and loads the boot in B district, the operating system program in guiding B district enters duty; Shown in the frame 411 of Fig. 4;
F. if guidance system is successful, then boot district and the system program district with the B district copies to the A district, registration upgrading control information once more, and this upgrading control information is labeled as redaction and upgrades; Escalation process finishes; Shown in the frame 407 of Fig. 4;
G. if guidance system failure, preestablish the overtime of time through one, built-in terminal resets under the watchdog circuit effect; Shown in the frame 412 of Fig. 4;
H. built-in terminal restarts, and starts from the A district, checks the upgrading control information, the mark of finding the upgrading control information is still enabled for redaction and is not modified to redaction and upgrades, then load the boot in A district, the operating system program in guiding A district enters duty; As the frame 401 of Fig. 4 to shown in the frame 406;
I. guidance system success copies to B district with the boot district and the system program district in A district, the registration control information of upgrading once more, and this upgrading control information is labeled as redaction and discards; System recovery is to the preceding state of upgrading, and escalation process finishes; Shown in the frame 407 of Fig. 4.
Wherein:
Predefined bootmode is to carry out in turn from A district and B district successively, successfully carries out then changing the guidance field behind the system software upgrading at every turn.
The ROMPaq bag is broken down into an AKU data of description piece and several upgrade data pieces, these data blocks are sent on the built-in terminal from first main website or second main website or the 3rd main website in turn, be temporarily stored on the zone of delimiting in advance of data-carrier store of built-in terminal, transmit and finish the back and merge automatically by built-in terminal and be reduced to the ROMPaq bag.
The ROMPaq bag is the AKU of first main website or second main website or the transmission of the 3rd main website; The data block of this AKU is sent to built-in terminal from first main website or second main website or the 3rd main website in turn, and this process can be interrupted by system's other business; Between two data block transfers, first main website or second main website or the 3rd main website can issue other instructions, and built-in terminal can be restarted, and first main website or second main website or the 3rd main website also can be restarted.
The ROMPaq bag is the AKU of first main website or second main website or the transmission of the 3rd main website; The data block of this AKU transmits has the ability of automatically restoring fault; First main website or second main website or the 3rd main website can inquire the data block quantity of the AKU that is transmitting, and continue to transmit follow-up AKU data block.
ROMPaq wraps in the branch block transfer and merges in the process of reduction, has passed through two layers inspection verification, and its process is as follows:
Check the check information of upgrade data piece after the check information that comprises self in the transport process of each upgrade data piece, built-in terminal receive earlier, just store after correct, and the corresponding main website of notice sends next upgrade data piece;
In AKU data of description piece, comprise check information, built-in terminal is after all data blocks transmit end, merging is reduced into the ROMPaq bag, also will check verification to the check information of AKU data of description piece, guarantees that with this ROMPaq bag correctly transmits.
In remote upgrade renewal process, can upgrade a plurality of program modules simultaneously, each program module transmits as a ROMPaq bag, can concurrently transmit between a plurality of ROMPaq bags; Improve the efficient of communication channel.
But the embedded system of a kind of on-line software updating of the present invention and online upgrading method, embedded type terminal equipment by main control chip, procedure stores device, data storage device and can and main website (can be first main website, also can be second main website, perhaps can be the 3rd main website) communication interface of communication constitutes.Software section comprises system program (start-up routine, boot and embedded OS) and business procedure.
Between main website (comprising first main website, second main website and the 3rd main website) and built-in terminal, formulate have a communications protocol, this communications protocol to make can swap data between embedded type terminal equipment and the main website.The ROMPaq bag is sent to embedded type terminal equipment according to this kind communications protocol mode by main website.This communications protocol can be supported multiple communication modes, can be telecommunication (as TCP/UDP, GPRS/CDMA, PSTN, 230MHz are wireless etc.), or locally-attached communication (as USB, RS232, RS485, high speed infrared etc.), can also be Near Field Communication (as far infrared, less radio-frequency, bluetooth etc.).Can both finish the transmission of online upgrading bag as long as can realize the communication modes of main website and embedded device swap data.
The transmission and the renewal process of software upgrade package realize in business procedure.
The bootup process of system is carried out in turn from A district and B district successively, carries out system software upgrading at every turn and then changes the guidance field.The zone that the system software upgrading bag upgrades is current non-guidance field.Be that system guides from the A district, then software version update is to the B district.Otherwise system is from the guiding of B district, and then software version update is to the A district.
After the booting operating system success, whether the software version that reexamines A memory block and B memory block is consistent, if inconsistent, then replace the version of non-boot section with the version of boot section, keep the software version in 2 zones (being A memory block and B memory block) synchronous with this.
If the operating system after upgrading can not successfully guide, then from the guiding of old version system boot section, and the system realm that will upgrade is reduced into legacy version.
But the foregoing description only is used for further specifying the embedded system and the online upgrading method of on-line software updating of the present invention; but the present invention is not limited to embodiment; every foundation technical spirit of the present invention all falls in the protection domain of technical solution of the present invention any simple modification, equivalent variations and modification that above embodiment did.