[go: up one dir, main page]

TWI521435B - Electronic apparatus and firmware updating method thereof - Google Patents

Electronic apparatus and firmware updating method thereof Download PDF

Info

Publication number
TWI521435B
TWI521435B TW103107459A TW103107459A TWI521435B TW I521435 B TWI521435 B TW I521435B TW 103107459 A TW103107459 A TW 103107459A TW 103107459 A TW103107459 A TW 103107459A TW I521435 B TWI521435 B TW I521435B
Authority
TW
Taiwan
Prior art keywords
sectors
storage unit
firmware
sector
same
Prior art date
Application number
TW103107459A
Other languages
Chinese (zh)
Other versions
TW201535261A (en
Inventor
簡安健
Original Assignee
啟碁科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 啟碁科技股份有限公司 filed Critical 啟碁科技股份有限公司
Priority to TW103107459A priority Critical patent/TWI521435B/en
Publication of TW201535261A publication Critical patent/TW201535261A/en
Application granted granted Critical
Publication of TWI521435B publication Critical patent/TWI521435B/en

Links

Landscapes

  • Stored Programmes (AREA)

Description

電子裝置及其韌體更新方法 Electronic device and firmware update method thereof

本發明是有關於一種韌體更新方法及裝置,且特別是有關於一種將更新韌體片段化以進行韌體更新的方法及裝置。 The present invention relates to a method and apparatus for firmware renewal, and more particularly to a method and apparatus for fragmenting a firmware to perform firmware renewal.

軟韌體是資訊產品的靈魂,韌體更新對於軟體工程師而言,是最常做的一件事。而對於產品使用者來說,當其所使用的產品發生程式錯誤(bug)的情況或者有改善效能的需求時,這時也需要做韌體更新的動作。 Soft firmware is the soul of information products, and firmware update is the most common thing for software engineers. For the product user, when the product used is in a bug or the need to improve the performance, the firmware update action is also required.

韌體更新通常是將新版的韌體映像檔(image)透過實體傳輸媒介,例如隨身碟、光碟、記憶卡等,或是透過網路傳輸協定,例如超文件傳輸協定(HyperText Transport Protocol,HTTP)或簡單檔案傳輸通訊協定(Trivial File Transfer Protocol,TFTP),傳送到產品的系統記憶體(如隨機存取記憶體)上,再寫入其韌體的儲存媒介(如快閃記憶體)上,之後重新開機即可完成韌體更新。 The firmware update usually uses a new version of the firmware image through a physical transmission medium, such as a flash drive, a CD, a memory card, etc., or a network transmission protocol, such as the HyperText Transport Protocol (HTTP). Or a simple file transfer protocol (TFTP), transmitted to the system memory of the product (such as random access memory), and then written to the firmware storage medium (such as flash memory). After rebooting, you can complete the firmware update.

然而,當韌體映像檔的尺寸較大時,韌體更新通常需要花費相當長的時間。對於軟體工程師而言,耗時較久將會影響產品的開發時效。而對於產品使用者而言,耗時較久則往往會讓使用者失去耐心而將系統重新啟動,此時若韌體更新尚未完成,則會造成系統死機(無法開機)的結果。 However, when the size of the firmware image is large, the firmware update usually takes a considerable amount of time. For software engineers, it takes a long time to affect the development time of the product. For product users, it takes a long time to make the user lose patience and restart the system. If the firmware update is not completed, the system will crash (can not be turned on).

本發明提供一種電子裝置及其韌體更新方法,可加快韌體更新的速度。 The invention provides an electronic device and a firmware updating method thereof, which can speed up the firmware renewal.

本發明的韌體更新方法,適用於具有儲存單元與暫存單元的電子裝置,其中儲存單元儲存韌體。此方法係取得更新韌體並將此更新韌體儲存於暫存單元。接著,將更新韌體區分為連續的多個扇區(sector),其中更新韌體的這些扇區對映於儲存單元的連續的多個對應扇區。然後,比對更新韌體的各個扇區與儲存單元中相對映的對應扇區的內容,並判斷是否相同,而在判斷不同時,將對應扇區的資料抹除,並將更新韌體的此扇區資料複製到此對應扇區。 The firmware updating method of the present invention is applicable to an electronic device having a storage unit and a temporary storage unit, wherein the storage unit stores the firmware. This method obtains the updated firmware and stores the updated firmware in the temporary storage unit. Next, the update firmware is divided into a plurality of consecutive sectors, wherein the sectors of the updated firmware are mapped to successive consecutive sectors of the storage unit. Then, comparing the contents of the corresponding sectors of the firmware and the corresponding sectors in the storage unit, and determining whether they are the same, and when the judgment is different, erasing the data of the corresponding sector, and updating the firmware. This sector data is copied to this corresponding sector.

在本發明的一實施例中,上述比對更新韌體的各個扇區與儲存單元中相對映的對應扇區的內容,並判斷是否相同的步驟是比對更新韌體的各個扇區的核對和(checksum)與儲存單元中相對映的對應扇區的核對和,以判斷更新韌體的各個扇區與儲存單元中相對映的對應扇區的內容是否相同。 In an embodiment of the present invention, the comparing the contents of the corresponding sectors of the firmware and the corresponding sectors in the storage unit, and determining whether the same step is to check the matching of the sectors of the firmware. Checksum sums with the corresponding sectors in the storage unit to determine whether the contents of the corresponding sectors of the updated firmware and the corresponding sectors in the storage unit are the same.

在本發明的一實施例中,上述比對更新韌體的各個扇區與儲存單元中相對映的對應扇區的內容,並判斷是否相同的步驟是比對更新韌體的所述扇區中連續的多個第一扇區的核對和與儲存單元中相對映的多個第一對應扇區的核對和,以判斷更新韌體的這些第一扇區與儲存單元中的這些第一對應扇區的內容是否相同,其中若相同,則判斷更新韌體的這些第一扇區與儲存單元中的這些第一對應扇區的內容相同;若不同,則繼續比對更新韌體的這些第一扇區中連續的多個第二扇區的核對和與儲存單元中的這些第一對應扇區中相對映的連續的多個第二對應扇區的核對和,以判斷更新韌體的這些第二扇區與儲存單元中的這些第二對應扇區的內容是否相同,其中所述第二扇區的數目少於所述第一扇區的數目。 In an embodiment of the present invention, the comparing the contents of the corresponding sector of the firmware and the corresponding sector in the storage unit, and determining whether the same step is to compare the firmware in the sector. a checksum of a plurality of consecutive first sectors and a checksum of a plurality of first corresponding sectors in the storage unit to determine to update the first sectors of the firmware and the first corresponding fans in the storage unit Whether the contents of the area are the same, wherein if they are the same, it is determined that the first sectors of the updated firmware are the same as the contents of the first corresponding sectors in the storage unit; if different, the first of the firmware updates are continued. A checksum of a plurality of consecutive second sectors in the sector and a checksum of a plurality of consecutive second corresponding sectors in the first corresponding sectors in the storage unit to determine the updated firmware The two sectors are identical to the contents of the second corresponding sectors in the storage unit, wherein the number of the second sectors is less than the number of the first sectors.

本發明的電子裝置包括用以儲存韌體的儲存單元、用以取得更新韌體的傳輸介面、用以暫存傳輸介面所取得的更新韌體的暫存單元,以及耦接儲存單元、傳輸介面及暫存單元的處理器。其中,處理器係將暫存於暫存單元中的更新韌體區分為連續的多個扇區,其中更新韌體的這些扇區係對映於儲存單元的連續的多個對應扇區。接著,處理器將比對更新韌體的各個扇區與儲存單元中相對映的對應扇區的內容,並在判斷不同時,將對應扇區的資料抹除,並將更新韌體的此扇區資料複製到此對應扇區。 The electronic device of the present invention includes a storage unit for storing the firmware, a transmission interface for obtaining the updated firmware, a temporary storage unit for temporarily storing the updated firmware obtained by the transmission interface, and a coupling storage unit and a transmission interface. And the processor of the temporary storage unit. The processor divides the update firmware temporarily stored in the temporary storage unit into a plurality of consecutive sectors, wherein the sectors of the updated firmware are mapped to a plurality of consecutive corresponding sectors of the storage unit. Then, the processor compares the contents of the corresponding sectors of the firmware and the corresponding sectors in the storage unit, and when the judgment is different, erases the data of the corresponding sector, and updates the fan of the firmware. The area data is copied to this corresponding sector.

在本發明的一實施例中,上述的處理器是藉由比對更新韌體的各個扇區的核對和與儲存單元中相對映的對應扇區的核對 和,以判斷更新韌體的各個扇區與儲存單元中相對映的對應扇區的內容是否相同。 In an embodiment of the invention, the processor is configured to check the verification of each sector of the firmware and the corresponding sector in the storage unit. And, to determine whether the content of the corresponding sector of the updated firmware and the corresponding sector in the storage unit are the same.

在本發明的一實施例中,上述的處理器會比對更新韌體的這些扇區中連續的多個第一扇區的核對和與儲存單元中相對映的多個第一對應扇區的核對和,以判斷更新韌體的這些第一扇區與儲存單元中的這些第一對應扇區的內容是否相同,並在判斷相同時,判斷更新韌體的這些第一扇區與儲存單元中的這些第一對應扇區的內容相同,以及在判斷不同時,繼續比對更新韌體的這些第一扇區中連續的多個第二扇區的核對和與儲存單元中的這些第一對應扇區中相對映的連續的多個第二對應扇區的核對和,以判斷更新韌體的這些第二扇區與儲存單元中的這些第二對應扇區的內容是否相同,其中所述第二扇區的數目少於所述第一扇區的數目。 In an embodiment of the invention, the processor compares the collation of a plurality of consecutive first sectors in the sectors of the updated firmware with the plurality of first corresponding sectors in the storage unit. Checking the sum to determine whether the content of the first sector of the updated firmware is the same as the content of the first corresponding sectors in the storage unit, and when determining the same, determining to update the first sector and the storage unit of the firmware The contents of the first corresponding sectors are the same, and when the judgment is different, the collation of the consecutive plurality of second sectors in the first sectors of the updated firmware is continued and the first correspondences with the storage units are And a checksum of the plurality of consecutive second corresponding sectors in the sector to determine whether the second sectors of the updated firmware are identical to the contents of the second corresponding sectors in the storage unit, wherein the The number of two sectors is less than the number of the first sectors.

基於上述,本發明的電子裝置及其韌體更新方法係根據儲存韌體之記憶體的最小抹除單位將所取得的更新韌體區分為多個扇區,並藉由判斷這些扇區的內容與記憶體中對應扇區的內容是否相同,決定是否將這些扇區的資料更新至記憶體中的對應扇區。藉此,可有效減少記憶體的抹除次數以及資料複製的時間,從而加快韌體更新的速度。 Based on the above, the electronic device and the firmware updating method thereof according to the present invention divide the obtained updated firmware into a plurality of sectors according to the minimum erasing unit of the memory of the storage firmware, and determine the contents of the sectors by determining the contents of the sectors. Whether or not the contents of the corresponding sectors in the memory are the same, whether or not to update the data of the sectors to the corresponding sectors in the memory. Thereby, the number of erases of the memory and the time of copying the data can be effectively reduced, thereby speeding up the firmware update.

為讓本發明的上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式作詳細說明如下。 The above described features and advantages of the invention will be apparent from the following description.

10‧‧‧電子裝置 10‧‧‧Electronic devices

12‧‧‧儲存單元 12‧‧‧ storage unit

14‧‧‧傳輸介面 14‧‧‧Transport interface

16‧‧‧暫存單元 16‧‧‧Scratch unit

18‧‧‧處理器 18‧‧‧ processor

32‧‧‧更新韌體 32‧‧‧Update firmware

34‧‧‧儲存單元 34‧‧‧ storage unit

S202~S212‧‧‧本發明一實施例的韌體更新方法的步驟 S202~S212‧‧‧ steps of the firmware updating method according to an embodiment of the present invention

圖1是依照本發明一實施例所繪示之電子裝置的方塊圖。 FIG. 1 is a block diagram of an electronic device according to an embodiment of the invention.

圖2是依照本發明一實施例所繪示的韌體更新方法的流程圖。 2 is a flow chart of a firmware update method according to an embodiment of the invention.

圖3是根據本發明一實施例所繪示之更新韌體與儲存單元中對應扇區的示意圖。 FIG. 3 is a schematic diagram of updating a corresponding sector in a firmware and a storage unit according to an embodiment of the invention.

韌體更新的過程可區分為取得更新韌體、抹除記憶體,以及複製更新韌體的資料至記憶體三個部份,而經研究發現,其中最花費時間的部分在於抹除記憶體,其次為複製更新韌體資料。由於記憶體在進行資料抹除及複製時都是以扇區(sector)為單位,故本發明在執行上述抹除及複製資料的步驟之前,即先行判斷哪些扇區的資料是必要寫入的,並僅針對記憶體中對應扇區的資料進行抹除及複製,藉此可有效節省韌體更新所花費的時間。 The firmware update process can be divided into three parts: obtaining the updated firmware, erasing the memory, and copying and updating the firmware to the memory. The research found that the most time-consuming part is to erase the memory. The second is to copy and update the firmware data. Since the memory is in the sector (sector) when performing data erasing and copying, the present invention first determines which sectors of the data are necessary to be written before performing the above steps of erasing and copying data. And erasing and copying only the data of the corresponding sector in the memory, thereby effectively saving the time spent on the firmware update.

圖1是依照本發明一實施例所繪示之電子裝置的方塊圖。請參照圖1,本實施例的電子裝置10包括儲存單元12、傳輸介面14、暫存單元16及處理器18,其功能分述如下: FIG. 1 is a block diagram of an electronic device according to an embodiment of the invention. Referring to FIG. 1, the electronic device 10 of the embodiment includes a storage unit 12, a transmission interface 14, a temporary storage unit 16, and a processor 18. The functions are as follows:

儲存單元12例如是唯讀記憶體(Read Only Memory,ROM)、可程式唯讀記憶體(Programmable ROM,PROM)、可抹除可編程唯讀記憶體(Erasable Programmable Read Only Memory,EPROM)、電子抹除式可複寫唯讀記憶體(Electrically Erasable Programmable Read Only Memory,EEPROM)、反及閘型(NAND-type)快閃記憶體(Flash memory)或反或閘型(NOR-type)快閃記憶體等非揮發性記憶體,其係用以儲存電子裝置10的韌體。 The storage unit 12 is, for example, a read only memory (ROM), a programmable read only memory (PROM), an erasable programmable read only memory (EPROM), and an electronic Erase rewritable read-only memory (Electrically Non-volatile memory such as Erasable Programmable Read Only Memory (EEPROM), NAND-type flash memory (Flash memory) or reverse or gate type (NOR-type) flash memory To store the firmware of the electronic device 10.

傳輸介面14例如是通用序列匯流排(Universal Serial Bus,USB)介面,其可連接外部的隨身碟、記憶卡讀卡機等,從而取得更新的韌體映像檔(image)。此外,傳輸介面14也可以是支援超文件傳輸協定(HyperText Transport Protocol,HTTP)、簡單檔案傳輸通訊協定(Trivial File Transfer Protocol,TFTP)等網路通訊協定的網路介面卡,而可透過網路與外部的伺服器連接,而從伺服器下載更新韌體。 The transmission interface 14 is, for example, a Universal Serial Bus (USB) interface, which can be connected to an external flash drive, a memory card reader, etc., to obtain an updated firmware image. In addition, the transmission interface 14 can also be a network interface card supporting a network protocol such as a HyperText Transport Protocol (HTTP) or a Trivial File Transfer Protocol (TFTP). Connect to an external server and download the firmware from the server.

暫存單元16例如是隨機存取記憶體(Random Access Memory,RAM)等揮發性記憶體,其是用以暫存電子裝置10利用傳輸介面14所取得的更新韌體。 The temporary storage unit 16 is, for example, a volatile memory such as a random access memory (RAM), and is used to temporarily store the updated firmware obtained by the electronic device 10 using the transmission interface 14.

處理器18例如是中央處理單元(Central Processing Unit,CPU),或是其他可程式化之一般用途或特殊用途的微處理器(Microprocessor)、數位訊號處理器(Digital Signal Processor,DSP)、可程式化控制器、特殊應用積體電路(Application Specific Integrated Circuit,ASIC)或其他類似元件或上述元件的組合,其係耦接儲存單元12、傳輸介面14及暫存單元16,而可實現本發明實施例的韌體更新方法。 The processor 18 is, for example, a central processing unit (CPU), or another programmable general purpose or special purpose microprocessor (Microprocessor), a digital signal processor (DSP), and a programmable program. The application controller, the application specific integrated circuit (ASIC) or other similar components or a combination of the above components are coupled to the storage unit 12, the transmission interface 14 and the temporary storage unit 16, and can implement the implementation of the present invention. Example firmware update method.

圖2是依照本發明一實施例所繪示的韌體更新方法的流程圖。請同時參照圖1與圖2,本實施例的方法適用於上述的電子 裝置10,以下即搭配圖1中電子裝置10的各項元件,說明本實施例方法的詳細流程。 2 is a flow chart of a firmware update method according to an embodiment of the invention. Referring to FIG. 1 and FIG. 2 simultaneously, the method of the embodiment is applicable to the above electronic The detailed flow of the method of the present embodiment will be described below with reference to the components of the electronic device 10 of FIG.

首先,電子裝置10經由處理器18的控制,利用傳輸介面14取得更新韌體,並將此更新韌體儲存於暫存單元16(步驟S202)。其中,電子裝置10例如是利用USB介面連接外部的隨身碟、記憶卡讀卡機等,從而取得更新韌體,或是利用網路卡連接外部的伺服器,從而下載更新韌體,本實施例並不限制更新韌體的取得方式。 First, the electronic device 10 obtains the updated firmware by using the transmission interface 14 via the control of the processor 18, and stores the updated firmware in the temporary storage unit 16 (step S202). The electronic device 10 is connected to an external flash drive, a memory card reader, or the like by using a USB interface to obtain an updated firmware, or a network card is used to connect to an external server to download and update the firmware. There is no restriction on how to obtain firmware.

接著,處理器18會將儲存於暫存單元16的更新韌體區分為連續的多個扇區(sector),其中更新韌體的扇區係對映於儲存單元12的連續的多個對應扇區(步驟S204)。上述扇區的大小例如是儲存單元12進行資料抹除及複製時的最小單位,其中藉由將更新韌體區分為與儲存單元12相對應的多個扇區,將有利於後續資料的比對及更新。 Next, the processor 18 divides the updated firmware stored in the temporary storage unit 16 into a plurality of consecutive sectors, wherein the sector of the updated firmware is mapped to a plurality of consecutive corresponding fans of the storage unit 12. Zone (step S204). The size of the above-mentioned sector is, for example, a minimum unit when the storage unit 12 performs data erasing and copying, wherein the comparison of the updated firmware into a plurality of sectors corresponding to the storage unit 12 will facilitate the comparison of subsequent materials. And updates.

詳言之,圖3是根據本發明一實施例所繪示之更新韌體與儲存單元相對映扇區的示意圖。請參照圖3,更新韌體32係根據儲存單元34進行資料抹除及複製時的最小單位區分為N個扇區(m_sector[0]~m_sector[N-1]),這N個扇區與儲存單元34的N個對應扇區(n_sector[0]~n_sector[N-1])相對映。本發明實施例即藉由比對彼此相對映之扇區的內容是否相同,從而決定是否進行儲存單元34中該扇區資料的抹除及更新。 In detail, FIG. 3 is a schematic diagram of updating a firmware and a storage unit relative to a sector according to an embodiment of the invention. Referring to FIG. 3, the update unit 32 is divided into N sectors (m_sector[0]~m_sector[N-1]) according to the minimum unit for data erasing and copying according to the storage unit 34, and the N sectors are associated with The N corresponding sectors (n_sector[0]~n_sector[N-1]) of the storage unit 34 are mapped. In the embodiment of the present invention, whether or not the content of the sectors in the storage unit 34 is erased and updated is determined by comparing whether the contents of the sectors that are opposite each other are the same.

回到圖2的流程,處理器18接著會比對更新韌體的各個 扇區與儲存單元12中相對映的對應扇區的內容(步驟S206),並判斷是否相同(步驟S208)。其中,處理器18例如是藉由比對更新韌體的各個扇區的核對和(checksum)與儲存單元12中相對映的對應扇區的核對和,以判斷更新韌體的各個扇區與儲存單元12中相對映的對應扇區的內容是否相同。 Returning to the flow of Figure 2, the processor 18 will then compare the various firmware updates. The contents of the sector corresponding to the corresponding sector in the storage unit 12 (step S206), and whether or not the same is determined (step S208). The processor 18 determines, for example, by comparing the checksums of the updated sectors of the firmware and the checksums of the corresponding sectors in the storage unit 12 to determine the updated sectors and storage units of the firmware. Whether the contents of the corresponding sectors in 12 are the same.

需說明的是,在一實施例中,處理器18更可一次比對多個扇區的核對和,從而加快比對的速度,進而節省韌體更新的時間。詳言之,處理器18例如會比對更新韌體中連續的多個第一扇區的核對和與儲存單元12中相對映的多個第一對應扇區的核對和,以判斷更新韌體的這些第一扇區與儲存單元12中的這些第一對應扇區的內容是否相同。其中,若相同,處理器18即可判斷更新韌體的這些第一扇區與儲存單元12中的這些第一對應扇區的內容相同,從而不進行這些扇區資料的抹除及更新;反之,若不同,則處理器18將會繼續比對這些第一扇區中連續的多個第二扇區的核對和與儲存單元12中的這些第一對應扇區中相對映的連續的多個第二對應扇區的核對和,以判斷這些第二扇區與儲存單元12中的這些第二對應扇區的內容是否相同。其中,上述第二扇區的數目係少於所述第一扇區的數目。 It should be noted that, in an embodiment, the processor 18 can compare the checksums of multiple sectors at a time, thereby speeding up the comparison, thereby saving the firmware update time. In detail, the processor 18 compares, for example, the checksum of the plurality of consecutive first sectors in the firmware and the checksum of the plurality of first corresponding sectors in the storage unit 12 to determine the updated firmware. Whether these first sectors are identical to the contents of these first corresponding sectors in the storage unit 12. If the same, the processor 18 can determine that the first sectors of the updated firmware are the same as the contents of the first corresponding sectors in the storage unit 12, so that the erasing and updating of the sector data are not performed; If not, the processor 18 will continue to compare the collation of a plurality of consecutive second sectors in the first sector with successive ones of the first corresponding sectors in the storage unit 12. A checksum of the second corresponding sectors is used to determine whether the contents of the second sectors and the second corresponding sectors in the storage unit 12 are the same. The number of the second sectors is less than the number of the first sectors.

舉例來說,處理器可一次比對連續8個扇區的核對和,若更新韌體與儲存單元中相對映的8個扇區的核對和相同,即可判定這8個扇區的內容相同,而不進行資料的抹除及更新。反之,若這8個扇區的核對和不同,即可判定這8個扇區中有部分扇區 的內容不同,此時處理器可改為將這8個扇區分為前4個及後4個扇區繼續進行比對,並根據相對映的4個扇區的核對和是否相同來判斷這些扇區的內容是否相同及是否進行這些扇區資料的抹除及更新。以此類推,若這4個扇區的核對和仍不同,則可繼續比對其中的2個扇區、1個扇區的核對和,直到判斷出所有具有不同核對和的扇區為止。藉由上述方法,即可快速找出內容不同的扇區,從而進行扇區資料的抹除及更新。 For example, the processor can compare the collation of 8 consecutive sectors at a time, and if the firmware and the matching of the 8 sectors in the storage unit are updated and identical, it can be determined that the contents of the eight sectors are the same. Without the erasing and updating of the data. On the other hand, if the check and the difference of the 8 sectors are different, it can be determined that there are some sectors among the 8 sectors. The content of the processor is different. At this time, the processor can divide the 8 sectors into the first 4 and the last 4 sectors to continue the comparison, and judge the fans according to the comparison of the 4 sectors and the same. Whether the content of the area is the same and whether the data of these sectors is erased and updated. By analogy, if the checksums of the four sectors are still different, the checksum of the two sectors and one sector can be continued until all sectors having different checksums are determined. By the above method, the sectors with different contents can be quickly found, thereby erasing and updating the sector data.

回到圖2的流程,在步驟S208中,當處理器18判斷扇區內容相同時,即會繼續判斷此扇區是否為更新韌體的最後一個扇區(步驟S210)。其中,若不是最後一個扇區,則回到步驟S206,繼續比對更新韌體的下一個扇區與儲存單元12中相對映的對應扇區的內容是否相同;反之,若為最後一個扇區,則結束韌體更新流程。 Returning to the flow of FIG. 2, in step S208, when the processor 18 determines that the sector contents are the same, it continues to determine whether the sector is the last sector of the updated firmware (step S210). If it is not the last sector, then returning to step S206, it is continued whether the content of the corresponding sector of the updated firmware and the corresponding sector in the storage unit 12 is the same; otherwise, if it is the last sector , then the firmware update process is ended.

另一方面,在步驟S208中,當處理器18判斷扇區內容不同時,則會將儲存單元12中此對應扇區的資料抹除,並將更新韌體的扇區資料複製到此對應扇區(步驟S212),從而完成此扇區資料的更新。接著,處理器18將繼續判斷此扇區是否為更新韌體的最後一個扇區(步驟S210),從而決定是要進行下一個扇區的判斷及更新,還是結束韌體更新流程。 On the other hand, in step S208, when the processor 18 determines that the sector contents are different, the data of the corresponding sector in the storage unit 12 is erased, and the sector data of the updated firmware is copied to the corresponding fan. The area (step S212), thereby completing the update of the sector data. Next, the processor 18 will continue to determine whether the sector is the last sector of the updated firmware (step S210), thereby deciding whether to perform the determination and update of the next sector, or to end the firmware update process.

藉由上述方法,電子裝置可在短時間內找出資料有改變的扇區並進行更新,而由於僅針對資料有改變的扇區進行更新,因此可省去針對其他扇區進行更新所花費的時間,從而加快韌體 更新的速度。 By the above method, the electronic device can find the sector with the changed data and update it in a short time, and since only the sector with the changed data is updated, the cost for updating the other sectors can be omitted. Time, thus speeding up the firmware The speed of the update.

綜上所述,本發明的電子裝置及其韌體更新方法藉由在對記憶體進行資料抹除及複製之前,先判斷這些扇區與記憶體中對應扇區的內容是否相同,從而排除不必要寫入的扇區資料,達到有效減少記憶體的抹除次數以及資料複製時間,加快韌體更新的速度的目的。 In summary, the electronic device and the firmware updating method of the present invention determine whether the contents of the corresponding sectors in the memory and the memory are the same before the data is erased and copied to the memory, thereby eliminating the The sector data that needs to be written achieves the purpose of effectively reducing the number of erases of the memory and the time of data copying, and speeding up the firmware update.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明的精神和範圍內,當可作些許的更動與潤飾,故本發明的保護範圍當視後附的申請專利範圍所界定者為準。 Although the present invention has been disclosed in the above embodiments, it is not intended to limit the present invention, and any one of ordinary skill in the art can make some changes and refinements without departing from the spirit and scope of the present invention. The scope of the invention is defined by the scope of the appended claims.

S202~S212‧‧‧本發明一實施例的韌體更新方法的步驟 S202~S212‧‧‧ steps of the firmware updating method according to an embodiment of the present invention

Claims (6)

一種韌體更新方法,適用於具有一儲存單元與一暫存單元的一電子裝置,其中該儲存單元儲存一韌體,該方法包括下列步驟:取得一更新韌體並儲存於該暫存單元;區分該更新韌體為連續的多個扇區(sector),其中該更新韌體的所述扇區對映於該儲存單元的連續的多個對應扇區;比對該更新韌體的各所述扇區與該儲存單元中相對映的該對應扇區的內容,並判斷是否相同;以及若不同,抹除該對應扇區的資料,並複製該更新韌體的該扇區的資料至該對應扇區。 A firmware updating method is applicable to an electronic device having a storage unit and a temporary storage unit, wherein the storage unit stores a firmware, the method comprising the steps of: obtaining a new firmware and storing the firmware in the temporary storage unit; Distinguishing the updated firmware into a plurality of consecutive sectors, wherein the sector of the updated firmware is mapped to a plurality of consecutive corresponding sectors of the storage unit; compared to each of the updated firmware Determining whether the sector is the same as the content of the corresponding sector in the storage unit; and if not, erasing the data of the corresponding sector, and copying the data of the sector of the updated firmware to the Corresponding sector. 如申請專利範圍第1項所述的韌體更新方法,其中比對該更新韌體的各所述扇區與該儲存單元中相對映的該對應扇區的內容,並判斷是否相同的步驟包括:比對該更新韌體的各所述扇區的核對和(checksum)與該儲存單元中相對映的該對應扇區的該核對和,以判斷該更新韌體的各所述扇區與該儲存單元中相對映的該對應扇區的內容是否相同。 The firmware updating method according to claim 1, wherein the step of determining whether the same is the same as the content of the corresponding sector in the sector corresponding to the updated firmware and determining whether the same is included Comparing the checksum of each of the sectors of the update firmware with the checksum of the corresponding sector in the storage unit to determine each of the sectors of the updated firmware and the Whether the contents of the corresponding sectors in the storage unit are the same. 如申請專利範圍第1項所述的韌體更新方法,其中比對該更新韌體的各所述扇區與該儲存單元中相對映的該對應扇區的內容,並判斷是否相同的步驟包括:比對該更新韌體的所述扇區中連續的多個第一扇區的核對和 與該儲存單元中相對映的多個第一對應扇區的該核對和,以判斷該更新韌體的所述多個第一扇區與該儲存單元中的所述多個第一對應扇區的內容是否相同,其中若相同,則判斷該更新韌體的所述多個第一扇區與該儲存單元中的所述多個第一對應扇區的內容相同;以及若不同,則繼續比對該更新韌體的所述多個第一扇區中連續的多個第二扇區的該核對和與該儲存單元中的所述多個第一對應扇區中相對映的連續的多個第二對應扇區的該核對和,以判斷該更新韌體的所述多個第二扇區與該儲存單元中的所述多個第二對應扇區的內容是否相同,其中所述多個第二扇區的數目少於所述多個第一扇區的數目。 The firmware updating method according to claim 1, wherein the step of determining whether the same is the same as the content of the corresponding sector in the sector corresponding to the updated firmware and determining whether the same is included : checking and comparing a plurality of consecutive first sectors in the sector of the update firmware And the collation of the plurality of first corresponding sectors in the storage unit to determine the plurality of first sectors of the updated firmware and the plurality of first corresponding sectors in the storage unit Whether the contents are the same, wherein if they are the same, determining that the plurality of first sectors of the updated firmware are the same as the contents of the plurality of first corresponding sectors in the storage unit; and if different, continuing to compare And the consecutive plurality of consecutive ones of the plurality of second sectors of the plurality of first sectors of the update firmware and the plurality of first corresponding sectors of the storage unit And the checksum of the second corresponding sector to determine whether the content of the plurality of second sectors of the updated firmware and the plurality of second corresponding sectors in the storage unit are the same, wherein the plurality of The number of second sectors is less than the number of the plurality of first sectors. 一種電子裝置,包括:一儲存單元,儲存一韌體;一傳輸介面,取得一更新韌體;一暫存單元,暫存該傳輸介面所取得的該更新韌體;以及一處理器,耦接該儲存單元、該傳輸介面及該暫存單元,區分暫存於該暫存單元中的該更新韌體為連續的多個扇區,其中該更新韌體的所述扇區對映於該儲存單元的連續的多個對應扇區,該處理器比對該更新韌體的各所述扇區與該儲存單元中相對映的該對應扇區的內容,並在判斷不同時,抹除該對應扇區的資料,並複製該更新韌體的該扇區的資料至該對應扇區。 An electronic device includes: a storage unit for storing a firmware; a transmission interface for obtaining a firmware; a temporary storage unit for temporarily storing the updated firmware obtained by the transmission interface; and a processor coupled The storage unit, the transmission interface, and the temporary storage unit distinguish that the updated firmware temporarily stored in the temporary storage unit is a plurality of consecutive sectors, wherein the sector of the updated firmware is mapped to the storage a plurality of consecutive corresponding sectors of the unit, the processor erasing the corresponding content of the corresponding sector in the storage unit and the corresponding sector in the storage unit, and erasing the corresponding content when the determination is different The data of the sector, and copy the data of the sector of the updated firmware to the corresponding sector. 如申請專利範圍第4項所述的電子裝置,其中該處理器是 藉由比對該更新韌體的各所述扇區的核對和與該儲存單元中相對映的該對應扇區的該核對和,以判斷該更新韌體的各所述扇區與該儲存單元中相對映的該對應扇區的內容是否相同。 The electronic device of claim 4, wherein the processor is Determining each of the sectors of the updated firmware and the storage unit by comparing the checksum of each of the sectors of the update firmware with the checksum of the corresponding sector in the storage unit Whether the content of the corresponding sector is the same. 如申請專利範圍第4項所述的電子裝置,其中該處理器比對該更新韌體的所述扇區中連續的多個第一扇區的核對和與該儲存單元中相對映的多個第一對應扇區的該核對和,以判斷該更新韌體的所述多個第一扇區與該儲存單元中的所述多個第一對應扇區的內容是否相同,並在判斷相同時,判斷該更新韌體的所述多個第一扇區與該儲存單元中的所述多個第一對應扇區的內容相同,以及在判斷不同時,繼續比對該更新韌體的所述多個第一扇區中連續的多個第二扇區的該核對和與該儲存單元中的所述多個第一對應扇區中相對映的連續的多個第二對應扇區的該核對和,以判斷該更新韌體的所述多個第二扇區與該儲存單元中的所述多個第二對應扇區的內容是否相同,其中所述多個第二扇區的數目少於所述多個第一扇區的數目。 The electronic device of claim 4, wherein the processor is more than a plurality of consecutive first sectors in the sector of the update firmware and a plurality of opposite ones of the storage unit And the checksum of the first corresponding sector to determine whether the content of the plurality of first sectors of the updated firmware and the plurality of first corresponding sectors in the storage unit are the same, and when the judgment is the same Determining that the plurality of first sectors of the updated firmware are identical to the contents of the plurality of first corresponding sectors in the storage unit, and continuing to compare the modified firmware when the determination is different The check of the plurality of consecutive second sectors of the plurality of first sectors and the consecutive plurality of second corresponding sectors of the plurality of first corresponding sectors in the storage unit And determining to determine whether the plurality of second sectors of the updated firmware are identical to contents of the plurality of second corresponding sectors in the storage unit, wherein the number of the plurality of second sectors is less than The number of the plurality of first sectors.
TW103107459A 2014-03-05 2014-03-05 Electronic apparatus and firmware updating method thereof TWI521435B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW103107459A TWI521435B (en) 2014-03-05 2014-03-05 Electronic apparatus and firmware updating method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW103107459A TWI521435B (en) 2014-03-05 2014-03-05 Electronic apparatus and firmware updating method thereof

Publications (2)

Publication Number Publication Date
TW201535261A TW201535261A (en) 2015-09-16
TWI521435B true TWI521435B (en) 2016-02-11

Family

ID=54695239

Family Applications (1)

Application Number Title Priority Date Filing Date
TW103107459A TWI521435B (en) 2014-03-05 2014-03-05 Electronic apparatus and firmware updating method thereof

Country Status (1)

Country Link
TW (1) TWI521435B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10503489B1 (en) * 2018-05-22 2019-12-10 Quanta Computer Inc. Updating firmware via a remote utility

Also Published As

Publication number Publication date
TW201535261A (en) 2015-09-16

Similar Documents

Publication Publication Date Title
CN103914393B (en) MCU-based (microprogrammed control unit-based) non-loss FLASH storage update method
US9099187B2 (en) Reducing erase cycles in an electronic storage device that uses at least one erase-limited memory device
CN110162429B (en) System repair method, server and storage medium
CN111444030B (en) Data storage device and method for avoiding firmware failure
KR20160126067A (en) Securely booting a computing device
US9081658B2 (en) Storage device and data management method thereof
US20120117367A1 (en) Electronic apparatus and booting method thereof
KR102185150B1 (en) Generalized write operations verification method
CN103226505B (en) A kind of method and apparatus verifying basic input-output system BIOS
CN112540725A (en) Nonvolatile data storage method, embedded system and storage medium
CN109426445B (en) Data storage method for optimizing data storage device and data storage device thereof
WO2016188037A1 (en) Version burning method, system and terminal, and computer storage medium
CN112527745B (en) Embedded file system multi-partition analysis method, terminal device and storage medium
TWI515557B (en) Computer system and control method
TWI521435B (en) Electronic apparatus and firmware updating method thereof
CN115803712A (en) Device Firmware Descriptor
CN114020306A (en) Method and device for updating hard disk firmware, electronic equipment and storage medium
CN1977244A (en) Safe flashing
CN104615449B (en) Firmware loading system and firmware loading method thereof
CN103106125B (en) The flash memory storage method repaired based on memory block
US20240004641A1 (en) Memory system firmware update using virtual slots
CN112148201B (en) Data writing method, device and storage medium
TWI614684B (en) Field firmware upgrading method and computer-readable medium
TWI716969B (en) Recovery image downloads via data chunks
CN109725939A (en) A chip booting method, chip and computer readable storage medium