The system of the method for firmware update and execution the method
(1) technical field
The method of the relevant a kind of firmware update of the present invention, particularly relevant a kind of when the program updates sign indicating number writes the program area of firmware, the method for the firmware update that firmware is protected.
(2) background technology
In the various now computer utility equipment, the running of many hardware is responsible for starting and carrying out by firmware (firmware), for example CD-ROM drive (optical disk drive; ODD), modulator-demodular unit (modem) or the like.And the storage device of firmware also is renewable device by the device that can't upgrade in early days is progressive gradually, as electronics programmable memory (the electrically erasable programmable read only memory that can erase; EEPROM) or flash memory (Flash ROM) etc.Therefore, also by the equipment at firmware place being sent back to former factory in early days to carry out the mode of program updates, changing the user gradually into can download voluntarily in the mode of upgrading in firmware update.The present mode of upgrading firmware voluntarily and being passed through by the user, it is the refresh routine code that firmware is provided on the Internet (Internet) by former manufacturer, then the user can carry out the renewal of firmware according to the execution in step that former manufacturer provided again by downloading the firmware that (download) upgrades on the network.
Yet the unusual condition that can't expect may take place in the aforementioned firmware of being operated control by the user when upgrading.For example, in the process of firmware update, the situation of abnormity of power supply takes place, and make firmware update produce the mistake that can't expect.Perhaps the user does not carry out the renewal of firmware according to the execution in step that former manufacturer provided fully, and it is unusual that firmware update is produced.Or some operating system (operating system), as windows etc., itself have some mistakes (bug), and in the process of firmware update, highlight, it is unusual to cause firmware update to take place.
When abnormal case takes place in the process of firmware update when, can make the equipment (as CD-ROM drive etc.) at firmware place can't continue running usually, so the user also can't write by the renewal firmware of network download so far in the equipment once more.Cause the equipment at firmware place must send Yuan Chang back to and keep in repair and upgrade, cause user's inconvenience and the puzzlement that former manufacturer handles.Therefore, under the inexorable trend that firmware is upgraded voluntarily by the user, provide a kind of when firmware update, even the method that the unusual situation of firmware update still can make equipment be continued to carry out takes place, real is an important topic of computer industry correlation technique.
Yet, in the existing firmware update technology, do not have a kind of when can be used for the program updates sign indicating number and writing the program area of firmware, the method that firmware is protected.
(3) summary of the invention
The method that the purpose of this invention is to provide a kind of firmware update can be protected firmware when being updated into firmware; In this firmware can be stored in the flash memory or electronics can the be erased programmable memory.If the firmware update failure then allows firmware enter the execution pattern or the state of comparison safety, and does not continue the firmware of execution error.Pass through the interface then, as electronics integrating apparatus interface (integrated device electronicsinterface, IDE interface) etc., read the renewal firmware, and then the equipment or the system at recovery (recover) firmware place, the normal operation that keeps firmware place equipment or system.
For achieving the above object, the invention provides a kind of method of firmware update, when being used to be updated into firmware, firmware is protected.In this firmware can be stored in the flash memory or electronics can the be erased programmable memory.
At first, write label (tag) to the firmware storage device.The action that writes label can be finished by firmware originally, promptly learns when firmware just to add label when upgrading.Perhaps, the action that writes label also can be finished by upgrading firmware (updated firmware), adds label when promptly upgrading firmware and upgrading earlier.Then, recognize firmware with renewal and replace this firmware originally.When finishing, displacement just deletes label.
Then, whether first inspection tag exists before re-executing the renewal firmware, when label does not exist, does not have abnormal case to take place when promptly representing firmware update, so the former label that writes is deleted, then can continue to carry out the renewal firmware.When label exists, there is abnormal case to take place when promptly representing firmware update, so that label does not have is deleted, then enter exception handler.
As from the foregoing, method proposed by the invention can overcome in the existing firmware update technology, and insurmountable situation when unusual takes place during for firmware update.Add the method for label when utilizing firmware update, whether first inspection tag exists before beginning to carry out after firmware update, whether enters exception handler with decision.Exception handler can be guaranteed the firmware that firmware can execution error, and causes equipment or system not normal, significantly reduces user's inconvenience and sends the puzzlement of original manufacturer merchant maintenance back to.
And; present most manufacturer is when selecting the storage type of firmware for use; program integral body is caused irreparable error when avoiding firmware update; usually can select block of cells to write the flash memory of (page write or smallsector type); yet the flash memory that block of cells writes, the cost of its making is higher.If adopt method proposed by the invention, because the abnormal case in the time of can handling firmware update, therefore manufacturer just can enlarge the scope of its selection when selecting the storage type of firmware for use, writes the flash memory of (byte write mode) as block type, reduces the cost of manufacture of firmware.
The present invention also proposes a kind of Storage Media, and in order to store a computer program, aforementioned calculation machine program is in order to be loaded in the computer system and to make aforementioned calculation machine system carry out the method step of foregoing firmware update.
The present invention proposes a kind of protective device of firmware update again, when being used to the program updates sign indicating number and writing the program area of firmware, firmware is protected, and comprises label write device, program updates device and label canceller.Firmware can be stored in flash memory or electronics and can erase in the programmable memory.
The label write device is in order to writing label to the program area of firmware, the label write device can firmware or the program updates sign indicating number finish.The program updates device upgrades sign indicating number to the program area of firmware in order to refresh routine.Deletion label when the label canceller upgrades in order to finish when the program updates sign indicating number.
Aforementioned protective device also comprises firmware actuator, label detector and program processor.The firmware actuator is in order to re-execute firmware.Whether the label detector exists in order to inspection tag.When label detector inspection tag did not exist, program processor then continued to carry out firmware, and when label detector inspection tag existed, program processor is the execute exception program processor then.
Unusual program processor comprises unusual firmware stopper, unusual interface reader and unusual program corrector.Unusual firmware stopper continues the program code of execution error in order to stop the execution of firmware to avoid firmware.Unusual interface reader is in order to by the interface, as electronics integrating apparatus interface etc., and the fetch program correcting code.Unusual program corrector is in order to in the program correcting code write-in program district.The program correcting code is in order to restore the equipment or the system at firmware place, behind the equipment or system reset at firmware place, the user just can be again voluntarily the download firmware refresh routine carry out firmware update.
In addition, the present invention proposes a kind of when realizing the system of firmware update protection, being used to the program updates sign indicating number writing the program area of firmware, and firmware is protected.Firmware can be stored in flash memory or electronics and can erase in the programmable memory.
The invention provides a kind of system of firmware update, comprise a firmware storage device and a master chip.Wherein this firmware storage device has one first firmware; This master chip is in order to when replacing first firmware with one second firmware, writes a label in this firmware storage device, and when displacement is finished, removes this label.When above-mentioned displacement was finished, this master chip was also carried out above-mentioned second firmware.Before carrying out this second firmware, whether above-mentioned master chip is also looked into above-mentioned label earlier and is existed, and when existing as if label, enters an exception handler.In exception handler, this master chip reads another and upgrades firmware also by an interface (as electronics integrating apparatus interface), and upgrades firmware with this another and replace this second firmware.In other words, no matter firmware carries out firmware update in which way, all keeps basic communication interface, and when upgrading failure, can obtain another by this interface and upgrade firmware, and then resetting device or system.
Utilize method proposed by the invention, be applicable as the firmware update of another type.The present invention proposes a kind of method of firmware update in addition, when being used for the program updates sign indicating number and writing the program area of firmware, firmware is protected.In firmware can be stored in the flash memory or electronics can the be erased programmable memory.
At first, deletion is arranged in a label of the program area of firmware, and this label is the label that is write after a preceding firmware update is normally finished.Then, refresh routine upgrades sign indicating number to the program area.At last, when the program updates sign indicating number is finished renewal, write a label to the program area.The action that writes label can be finished by firmware, promptly learns to upgrade when firmware just to add a label in the program area when finishing.The action that writes label also can be finished by the program updates sign indicating number, and promptly the program updates sign indicating number is finished when upgrading, and adds a label in the program area.Aforementioned label, label of being deleted when promptly entering firmware update and the label that renewal is added when finishing can be positioned over same position or diverse location in the program area.
Then, can check earlier when re-executing firmware more whether the label that is write after this renewal is finished exists, and then continues to carry out firmware when label exists, and has abnormal case to take place when representing firmware update when label does not exist, so label is not written into, then enter exception handler.Exception handler can stop the execution of firmware, by an interface such as electronics integrating apparatus interface etc., and fetch program correcting code and it is write in the program area again.
Moreover the present invention proposes a kind of Storage Media again, and in order to store a computer program, aforementioned calculation machine program is in order to be loaded in the computer system and to make aforementioned calculation machine system carry out the method step of foregoing firmware update.
Again moreover, the present invention proposes a kind of protective device of firmware update in addition, when being used to the program updates sign indicating number and writing the program area of firmware, firmware is protected, and comprises label canceller, program updates device and label write device.Firmware can be stored in flash memory or electronics and can erase in the programmable memory.
The label canceller is arranged in the label of the program area of firmware in order to deletion.The program updates device upgrades sign indicating number to the program area in order to refresh routine.The label write device when upgrading in order to finish when the program updates sign indicating number, writes label to the program area, the label write device can firmware or the program updates sign indicating number finish.
Aforementioned protective device also comprises firmware actuator, label detector and program processor.The firmware actuator is in order to re-execute firmware.Whether the label detector exists in order to inspection tag.When label detector inspection tag existed, program processor then continued to carry out firmware, and when label detector inspection tag did not exist, program processor is the execute exception program processor then.
Unusual program processor comprises unusual firmware stopper, unusual interface reader and unusual program corrector.Unusual firmware stopper is in order to stop the execution of firmware.Unusual interface reader is in order to by the interface, as electronics integrating apparatus interface etc., and the fetch program correcting code.Unusual program corrector is in order to write to the program correcting code in the program area.
In addition, the present invention also proposes a kind of when realizing the system of firmware update protection, being used to the program updates sign indicating number writing the program area of firmware, and firmware is protected.Firmware can be stored in flash memory or electronics and can erase in the programmable memory.
Disclosed system is when carrying out firmware update, and at first deletion is arranged in a label of the program area of firmware, and refresh routine upgrades sign indicating number to the program area again, and writes a label when finishing to the program area when upgrading.Writing label can be finished or be finished by the program updates sign indicating number by firmware itself.Deletion and the label that writes can be positioned at same position or diverse location.
Then, when system re-executes firmware, can whether exist by first inspection tag, when label exists, then continue to carry out firmware, when label does not exist, then enter exception handler.After entering exception handler, system at first stops the execution of firmware, by interface such as electronics integrating apparatus interface etc., and the fetch program correcting code, and then the program correcting code write in the program area.
Or the system of firmware update provided by the present invention comprises at least: a firmware storage device has one first firmware and one first label; One master chip in order to when replacing this first firmware with one second firmware, removes this label; And when this displacement is finished, add one second label.
For further specifying above-mentioned purpose of the present invention, design feature and effect, the present invention is described in detail below with reference to accompanying drawing.
(4) description of drawings
Fig. 1 is the flowchart that shows an embodiment of disclosed method.
Fig. 2 is the thin portion flowchart that shows exception handler in the disclosed method.
Fig. 3 is the flowchart that shows another embodiment of disclosed method.
Fig. 4 is the synoptic diagram that shows disclosed Storage Media.(Fig. 4 comprises Fig. 4 a and Fig. 4 b)
Fig. 5 is the functional block diagram that shows an embodiment of disclosed device.
Fig. 6 is the functional block diagram that shows another embodiment of disclosed device.
Fig. 7 is the synoptic diagram that shows disclosed system.
(5) embodiment
Please refer to Fig. 1, Fig. 1 is the flowchart that shows an embodiment of disclosed method.In one embodiment, the present invention proposes a kind of method of firmware update, when being used for the program updates sign indicating number and writing the program area of firmware, firmware is protected.In firmware can be stored in the flash memory or electronics can the be erased programmable memory.
At first, firmware receives the order of upgrading (step S110) and writes label (step S112) to the program area of firmware.The action that writes label among the step S112 can be finished by firmware, promptly learns when upgrading when firmware just to add a label in the program area.The action that writes label also can be finished by the program updates sign indicating number, when promptly the program updates sign indicating number upgrades, at first adds a label in the program area.
Then, refresh routine upgrades sign indicating number to the program area (step S114).At last, whether determining program renewal sign indicating number upgrades is finished (step S116), when finishing renewal, just deletes the program updates sign indicating number label (step S120), if finishing the work that renewal then upgrades, still can not finish but label not deleted (step S118) the program updates sign indicating number, for example program may enter in the infinite loop (loop), the program of forcing is jumped out circulation after carrying out certain fixed number of times, therefore can not carry out the work of deletion label.Then, whether (step S122) can exist (step S124) by first inspection tag when re-executing firmware, represents that when label does not exist the renewal of firmware is normal, then continues to carry out firmware (step S126).The update anomalies of representing firmware when label exists so that label does not have is deleted, must enter exception handler (step S128).
Please refer to Fig. 2, Fig. 2 is the thin portion flowchart that shows exception handler in the disclosed method.As shown in the figure, the exception handler of step S128 can stop the execution (step S280) of firmware, and by an interface, as electronics integrating apparatus interface etc., fetch program correcting code (step S282) also writes to (step S284) in the program area with the program correcting code.
Please refer to Fig. 3, Fig. 3 is the flowchart that shows another embodiment of disclosed method.In another embodiment, the present invention proposes a kind of method of firmware update, when being used for the program updates firmware, firmware is protected.In the firmware storage device of firmware can be stored in the flash memory for example or electronics can be erased programmable memory.This firmware is first firmware and is stored in the firmware storage device, and this firmware storage device has first label.
At first, order (step S310) that receive to upgrade of first firmware and delete this first label (step S312) in the firmware storage device.
Then, replace this first firmware (step S314) with one second firmware.Then, judge whether this displacement is finished or success (step S316), when this replaces, just write one second label (step S320) to the firmware storage device, still can not finish if the work that renewal then upgrades is finished in this displacement, but second label can not be written into (step S318).
Then, (step S322) can check earlier whether this second label exists (step S324) before carrying out second firmware, represents promptly that when second label exists the renewal of firmware is normal, then continues to carry out second firmware (step S326).There is not when promptly representing firmware update abnormal case to take place when label does not exist,, must enters exception handler (step S328) so make a mistake or fail during the displacement of second label.First deleted label and second label that is written into can be arranged in the identical or different position of firmware storage device, in other words, can utilize same position or diverse location to carry out the sign of label at every turn.
Referring again to Fig. 2, Fig. 2 is the thin portion flowchart that shows exception handler in the disclosed method.As shown in the figure, in the present embodiment, the exception handler of step S328 similarly can stop the execution (step S280) of second firmware, by an interface, as electronics integrating apparatus interface, read one the 3rd firmware (step S282) again and replace this second firmware (step S284) with this 3rd firmware.
Please refer to Fig. 4, Fig. 4 is the synoptic diagram that shows disclosed Storage Media.Fig. 4 comprises Fig. 4 a and Fig. 4 b, please refer to Fig. 4 a, as shown in the figure, the present invention proposes a kind of computer system 40, in order to store a computer program 42, computer program 42 is in order to be loaded in the computer system and to make aforementioned calculation machine system carry out the method step of the firmware update of foregoing first embodiment.Computer program 42 comprises that mainly writing label to the programmed logic 420 of program area, refresh routine upgrades the programmed logic 422 of sign indicating number and the programmed logic 424 of deletion label.
Please refer to Fig. 4 b, as shown in the figure, the present invention proposes a kind of computer system 40 in addition, and in order to store a computer program 42, computer program 42 is in order to be loaded in the computer system and to make aforementioned calculation machine system carry out the method step of the firmware update of foregoing second embodiment.Computer program 42 comprises that mainly programmed logic 426, the refresh routine of the label in delete program district upgrade the programmed logic 428 of sign indicating number and write the programmed logic 430 of label to the program area.
Please refer to Fig. 5, Fig. 5 is the functional block diagram that shows an embodiment of disclosed device.In one embodiment; the present invention proposes a kind of protective device of firmware update; when being used to the program updates sign indicating number and writing the program area of firmware; firmware is protected; firmware can be stored in flash memory or electronics and can erase in the programmable memory, and the protective device of firmware update proposed by the invention comprises label write device 500, program updates device 502, label canceller 504, firmware actuator 506, label detector 508 and program processor 510.
Label write device 500 is in order to writing label to the program area of firmware, label write device 500 can firmware or the program updates sign indicating number finish.Program updates device 502 upgrades sign indicating number to the program area in order to refresh routine.Deletion label when label canceller 504 upgrades in order to finish when the program updates sign indicating number.
Firmware actuator 506 is in order to re-execute firmware.Whether label detector 508 exists in order to inspection tag.Program processor 510 is in order to continue to carry out firmware, execute exception program processor 512 when label exists when label does not exist.
Unusual program processor 512 comprises unusual firmware stopper 514, unusual interface reader 516 and unusual program corrector 518.Unusual firmware stopper 514 is in order to stop the execution of firmware.Unusual interface reader 516 is in order to pass through the interface, as electronics integrating apparatus interface, fetch program correcting code.Unusual program corrector 518 in order to the write-in program correcting code to the program area.
Please refer to Fig. 6, Fig. 6 is the functional block diagram that shows another embodiment of disclosed device.The present invention proposes a kind of protective device of firmware update in addition; when being used to the program updates sign indicating number and writing the program area of firmware; firmware is protected, comprised label canceller 600, program updates device 602, label write device 604, firmware actuator 606, label detector 608 and program processor 610.
Label canceller 600 is arranged in the label of the program area of firmware in order to deletion.Program updates device 602 upgrades sign indicating number to the program area in order to refresh routine.Label write device 604 when upgrading in order to finish when the program updates sign indicating number, writes label to the program area.Firmware actuator 606 is in order to re-execute firmware.Whether label detector 608 exists in order to inspection tag.Label write device 604 can firmware or the program updates sign indicating number finish.Program processor 610 is in order to continue to carry out firmware, execute exception program processor 612 when label does not exist when label exists.
Unusual program processor 612 also comprises unusual firmware stopper 614, unusual interface reader 616 and unusual program corrector 618.Unusual firmware stopper 614 is in order to stop the execution of firmware.Unusual interface reader 616 is in order to by the interface, as electronics integrating apparatus interface etc., and the fetch program correcting code.Unusual program corrector 618 is in order to write to the program correcting code in the program area.
For example, please refer to Fig. 7, Fig. 7 is the synoptic diagram that shows disclosed system.The present invention proposes a kind of when realizing the system of firmware update protection, being used to the program updates sign indicating number writing the program area of firmware, and firmware is protected.In one embodiment, disclosed system comprises master chip 70, firmware storage device 72, electronic installation integrated interface 74, buffer storage 76 and firmware generator 78.Firmware storage device 72 can be flash memory or the electronics programmable memory of can erasing, and buffer storage 76 can be dynamic RAM (DRAM), and firmware generator 78 for example is the server of main frame or on the Internet etc.
When firmware upgrades, can be divided into two kinds of situations, to be that main frame or master chip 70 are leading thus finish renewal by electronic installation integrated interface (IDE interface) 74 for first kind of situation.In this case, disclosed system at first can receive the order of firmware update, and this moment, master chip 70 can be considered penetrating, and write label to firmware storage device 72 by main frame or master chip 70, upgrade original firmware again, delete this label when finishing when upgrading then.
Second kind of situation is to be upgraded by the firmware lead programmer.In this case, the kernel program of original firmware can be temporary in earlier in the buffer storage 76, after the order that receives firmware update, can write label to firmware storage device 72, upgrades firmware again, deletes label when finishing when upgrading then.
No matter carry out firmware update, then when system re-executes firmware in the firmware storage device 72, can whether exist by first inspection tag, represent that when label does not exist firmware update is normal, continue to carry out firmware in aforementioned which kind of mode.Represent that when label exists firmware update is unusual, must enter exception handler.After entering exception handler, system at first stops the execution of firmware storage device 72, reads another firmware by electronics integrating apparatus interface 74 again, this firmware is write in the firmware storage device 72 again.Like this,, must not send the original manufacturer merchant back to and keep in repair during situation about can't carry out even firmware storage device 72 takes place unusual when upgrading.Combine speech, the present invention sets up a kind of method of firmware update, when being used for the program updates sign indicating number and writing the program area of firmware, firmware is protected.Method proposed by the invention can be used for the equipment that CD-ROM drive, modulator-demodular unit etc. use firmware, increases user's ease of use, solves insurmountable problem in the present firmware update technology simultaneously, reaches the purpose that the present invention desires to reach.
Though the present invention describes with reference to current specific embodiment, but those of ordinary skill in the art will be appreciated that, above embodiment is used for illustrating the present invention, under the situation that does not break away from spirit of the present invention, also can make the variation and the modification of various equivalences, therefore, as long as variation, the modification to the foregoing description all will drop in the scope of claims of the present invention in connotation scope of the present invention.