TW201709055A - Field firmware upgrading method and computer-readable medium - Google Patents

Field firmware upgrading method and computer-readable medium Download PDF

Info

Publication number
TW201709055A
TW201709055A TW104126975A TW104126975A TW201709055A TW 201709055 A TW201709055 A TW 201709055A TW 104126975 A TW104126975 A TW 104126975A TW 104126975 A TW104126975 A TW 104126975A TW 201709055 A TW201709055 A TW 201709055A
Authority
TW
Taiwan
Prior art keywords
firmware
instant
logical block
update method
operating system
Prior art date
Application number
TW104126975A
Other languages
Chinese (zh)
Other versions
TWI614684B (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 TW104126975A priority Critical patent/TWI614684B/en
Publication of TW201709055A publication Critical patent/TW201709055A/en
Application granted granted Critical
Publication of TWI614684B publication Critical patent/TWI614684B/en

Links

Abstract

A field firmware upgrading method is adopted in a field firmware upgrading system having a computing device and a storage device. First, the computing device is boot up to a real-time operating system (RTOS), wherein the RTOS and a firmware of the storage device are communicated with each other via a driver. The RTOS send reading commands to the firmware, such that the firmware perform a reading operation meeting a prefix proceeding, wherein the prefix proceeding defines an order which specific logic block addresses (LBAs) are read. After the firmware performs the reading operation meeting the prefix proceeding, the RTOS sends writing commands to the firmware, such that the firmware perform a writing operation meeting a specific writing proceeding, and thus from a target LBA defined by the specific writing proceeding, an image file is written of the storage device.

Description

即時韌體更新方法及其電腦可讀取媒介 Instant firmware update method and computer readable medium

本發明係關於一種儲存裝置,且特別是一種透過即時作業系統(real-time operating system,RTOS,例如:Windows®、Linux®、Android®)來更新儲存裝置之韌體的即時韌體更新方法,以及一種具有多個程式碼以執行所述即時韌體更新方法的電腦可讀取媒介,其中電腦可讀取媒介為一種非暫態媒介(non-transitory medium)。 The present invention relates to a storage device, and more particularly to a real-time operating system through a (real-time operating system, RTOS , for example: Windows ®, Linux ®, Android ®) to update the firmware update method of the instant storage apparatus of the firmware, And a computer readable medium having a plurality of code codes for performing the instant firmware update method, wherein the computer readable medium is a non-transitory medium.

隨著電子技術的發展,各種不同類型的儲存裝置被提出。早期使用磁性媒介來作為儲存裝置的產品有存取速度慢的問題,故現在有不少儲存裝置採用NAND快閃記憶體(NAND flash memory)來作為儲存裝置,舉例來說,微型安全記憶卡(Micro SD card)、嵌入式多媒體卡(eMMC)或固態硬碟(SSD)等。 With the development of electronic technology, various types of storage devices have been proposed. Early use of magnetic media as a storage device has the problem of slow access speed, so many storage devices now use NAND flash memory as a storage device, for example, a micro secure memory card ( Micro SD card), embedded multimedia card (eMMC) or solid state drive (SSD).

對於使用者而言,儲存裝置的效能與可靠度必須達到一定程度,因此,在一些情況下,需要對儲存裝置的韌體進行更新,以改善其效能與可靠度。有些儲存裝置(例如:嵌入式多媒體卡)需要透過主控端(host)進入特定模式下,才可以進行韌體更新。例如,主控端得先進入開機模式(boot mode),才可以允許主控端輸入設備供應商端(vendor)提供的指令(command),執行特定功能以更新韌體。然而,對使用者來說,上述傳統更新韌體的方式並不方便。 For the user, the performance and reliability of the storage device must be to a certain extent. Therefore, in some cases, the firmware of the storage device needs to be updated to improve its performance and reliability. Some storage devices (for example, embedded multimedia cards) need to enter the specific mode through the host to perform firmware update. For example, the host must first enter the boot mode to allow the host to input a command provided by the device vendor to perform a specific function to update the firmware. However, the above-mentioned conventional way of updating the firmware is inconvenient for the user.

本發明實施例提供一種即時韌體更新方法,適用於包括計算機裝置與儲存裝置的即時韌體更新系統。首先,計算機裝置啟動至即時作業系統進行操作,其中即時作業系統與儲存裝置的韌體透過驅動程式進行溝通。即時作業系統向韌體下達多個讀取指令,以使韌體進行符合前綴流程的讀取動作,其中前綴流程定義多個特定邏輯塊位址被讀取的順序。在韌體進行符合前綴流程的讀取動作後,即時作業系統項韌體下達多個寫入指令,以使韌體進行特定寫入流程的寫入動作,而將韌體映像檔自寫入流程定義的目標邏輯塊位址開始寫入至儲存裝置。 The embodiment of the invention provides an instant firmware update method, which is applicable to an instant firmware update system including a computer device and a storage device. First, the computer device is activated to operate in an immediate operating system, wherein the real-time operating system communicates with the firmware of the storage device through the driver. The real-time operating system issues a plurality of read commands to the firmware to enable the firmware to perform a read operation conforming to the prefix process, wherein the prefix process defines an order in which a plurality of specific logical block addresses are read. After the firmware performs the read operation conforming to the prefix process, the real-time operating system item firmware issues multiple write commands, so that the firmware performs the write operation of the specific write process, and the firmware image file is written into the process. The defined target logical block address begins to be written to the storage device.

本發明實施例還提供一種非暫態的電腦可讀取媒介,所述電腦可讀取媒介包括有多個程式碼,用以執行如上述即時韌體更新方法。 The embodiment of the invention further provides a non-transitory computer readable medium, the computer readable medium comprising a plurality of code codes for performing the instant firmware update method as described above.

據此,本發明實施例提供一種透過即時作業系統來更新儲存裝置之韌體的即時韌體更新方法及其電腦可讀取媒介,故可以讓使用者在對儲存裝置進行韌體更新時,給予使用者極大的便利性。 Accordingly, the embodiment of the present invention provides an instant firmware update method for updating a firmware of a storage device through a real-time operating system and a computer readable medium thereof, so that the user can give a firmware update to the storage device. Great convenience for users.

為使能更進一步瞭解本發明之特徵及技術內容,請參閱以下有關本發明之詳細說明與附圖,但是此等說明與所附圖式僅係用來說明本發明,而非對本發明的權利範圍作任何的限制。 The detailed description of the present invention and the accompanying drawings are to be understood by the claims The scope is subject to any restrictions.

1‧‧‧即時韌體更新系統 1‧‧‧ Instant Firmware Update System

11‧‧‧計算機裝置 11‧‧‧Computer equipment

12‧‧‧儲存裝置 12‧‧‧Storage device

121‧‧‧快閃記憶體 121‧‧‧Flash memory

122‧‧‧控制器 122‧‧‧ Controller

S21~S23、S311~S314、S321~S326‧‧‧步驟流程 S21~S23, S311~S314, S321~S326‧‧‧ Step procedure

H411、H421‧‧‧標頭 H411, H421‧‧ heading

C412‧‧‧盤問金鑰 C412‧‧‧Question Key

C422‧‧‧盤問成功訊息 C422‧‧‧Question success message

LBA(m)~LBA(z)、LBA(k)‧‧‧邏輯塊位址 LBA(m)~LBA(z), LBA(k)‧‧‧ logical block address

圖1是本發明實施例的即時韌體更新系統的示意圖。 FIG. 1 is a schematic diagram of an instant firmware update system according to an embodiment of the present invention.

圖2是本發明實施例的即時韌體更新方法的流程圖。 2 is a flow chart of a method for updating an instant firmware according to an embodiment of the present invention.

圖3是本發明實施例的即時韌體更新方法的細部流程圖。 FIG. 3 is a detailed flowchart of a method for updating an instant firmware according to an embodiment of the present invention.

圖4是本發明實施例的快閃記憶體之多個邏輯塊位址所對應的內容之示意圖。 4 is a schematic diagram of content corresponding to multiple logical block addresses of a flash memory according to an embodiment of the present invention.

在下文將參看隨附圖式更充分地描述各種例示性實施例,在隨附圖式中展示一些例示性實施例。然而,本發明概念可能以許多不同形式來體現,且不應解釋為限於本文中所闡述之例示性實施例。確切而言,提供此等例示性實施例使得本發明將為詳盡且完整,且將向熟習此項技術者充分傳達本發明概念的範疇。在諸圖式中,可為了清楚而誇示層及區之大小及相對大小。類似數字始終指示類似元件,且本文中所使用的術語「或」視實際情況可能包括相關聯之列出項目中之任一者或者多者之所有組合。 Various illustrative embodiments are described more fully hereinafter with reference to the accompanying drawings. However, the inventive concept may be embodied in many different forms and should not be construed as being limited to the illustrative embodiments set forth herein. Rather, these exemplary embodiments are provided so that this invention will be in the In the drawings, the size and relative sizes of layers and regions may be exaggerated for clarity. Like numbers refer to like elements throughout, and the term "or" as used herein may include all combinations of any one or more of the associated listed items.

本發明實施例提供一種透過即時作業系統(例如:Windows®、Linux®、Android®)來更新儲存裝置之韌體的即時韌體更新方法。使用者可在不需要使主控端(亦即,計算機裝置)進入特定模式下,透過即時作業系統下達指令給韌體進行特定行為,即可以進行韌體更新。舉例來說,所述即時韌體更新方法可以是Android®系統的一個應用程式,使用者在Android®系統上執行此應用程式即可以方便地進行韌體更新。除此之外,本發明實施例還提供一種具有多個程式碼以執行上述即時韌體更新方法的電腦可讀取媒介,其中電腦可讀取媒介為一種非暫態媒介。 Embodiment of the present invention provides a real-time operating system via: Instant firmware update method for updating firmware stored in the apparatus (e.g., Windows ®, Linux ®, Android ® ). The user can perform a firmware update by sending a command to the firmware through the immediate operating system without requiring the host (ie, the computer device) to enter a specific mode. For example, the instant method may be a firmware update app Android ® system, the user to run this application on Android ® system which can easily update the firmware. In addition, the embodiment of the present invention further provides a computer readable medium having a plurality of code codes for performing the above-mentioned instant firmware update method, wherein the computer readable medium is a non-transitory medium.

即時作業系統與韌體之間透過驅動程式來溝通,且上述即時韌體更新方法的大概說明如下。首先,即時作業系統下達多個讀取指令給韌體。韌體檢查讀取多個邏輯塊位址(logic block address,LBA)的讀取流程是否符合多個特定邏輯塊位址的前綴流程。若讀取流程符合前綴流程,則基於前綴流程中最後一個特定位址的內容回傳盤問金鑰(challenge key)給即時作業系統。即時作業系統會等待韌體回傳的資訊,以得知讀取流程是否符合前綴流程,以及是否順利地收到盤問金鑰。 The real-time operating system and the firmware communicate through the driver, and the above description of the instant firmware update method is as follows. First, the real-time operating system issues multiple read commands to the firmware. The firmware check reads whether the read flow of multiple logic block addresses (LBAs) conforms to the prefix flow of multiple specific logical block addresses. If the read process conforms to the prefix process, the challenge key is returned to the immediate operating system based on the content of the last specific address in the prefix process. The real-time operating system waits for information about the firmware backhaul to know if the read process conforms to the prefix process and whether the challenge key is successfully received.

即時作業系統在收到盤問金鑰後,會基於盤問金鑰進行解密回傳答案訊息(answer)給韌體,其中答案訊息是一個目標邏輯塊位址。若韌體判斷答案訊息正確,則韌體會讀取答案訊息對應之目 標邏輯塊位址的內容,以根據目標邏輯塊位址的內容回傳盤問成功訊息給即時作業系統,且即時作業系統在收到盤問成功訊息後,即表示即時作業系統與韌體之間的交握確認(handshake confirm)已經完成,而可以進一步地新的韌體映像檔寫入至目標邏輯塊位址。 After receiving the challenge key, the real-time operating system decrypts the answer message based on the challenge key to the firmware, where the answer message is a target logical block address. If the firmware determines that the answer message is correct, the firmware will read the corresponding message of the answer message. The content of the logical block address is returned to the real-time operating system according to the content of the target logical block address, and the real-time operating system, after receiving the successful question of the cross-examination, represents the real-time operating system and the firmware. The handshake confirmation has been completed and a new firmware image can be written to the target logical block address.

接著,即時作業系統下達自目標邏輯塊位址寫入具有校驗和(checksum)之韌體映像檔(firmware image file)的寫入指令給韌體。接著,韌體收到寫入指令後,開始自目標邏輯塊位址寫入具有校驗和之韌體映像檔,以在成功地將具有校驗和之韌體映像檔寫入後,完成對儲存裝置的韌體更新。 Then, the real-time operating system issues a write command to the firmware file file with the checksum from the target logical block address to the firmware. Then, after receiving the write command, the firmware starts to write the firmware image with the checksum from the target logical block address to complete the pair after successfully writing the firmware image with the checksum. Firmware update of the storage device.

上述儲存裝置可以是計算機裝置內的儲存裝置(例如,內建的固態硬碟),且亦可以是外接或擴展的儲存裝置(例如,微型數位安全記憶卡或嵌入式多媒體卡)。版本為v4.x的嵌入式多媒體卡目前僅能透過進入開機模式來對韌體進行更新,故可以使用本發明實施例的即時韌體更新方法透過即時作業系統對韌體進行更新,以賦予使用者較多的便利性。版本為v5.x的嵌入式多媒體卡目前都能提供使用者透過即時作業系統來更新儲存裝置之韌體,但其詳細作法則與本發明實施例的即時韌體更新方法不同,且此版本的嵌入式多媒體卡亦能使用本發明實施例的即時韌體更新方法。簡單地說,根據上述內容,本發明不以儲存裝置的類型為限制。 The storage device may be a storage device (for example, a built-in solid state drive) in the computer device, and may also be an external or extended storage device (for example, a micro digital security memory card or an embedded multimedia card). The embedded multimedia card of the version v4.x can only update the firmware by entering the boot mode. Therefore, the firmware can be updated by the real-time operating system by using the instant firmware update method of the embodiment of the present invention. More convenience. The embedded multimedia card of the version v5.x can provide the user with the firmware of the storage device through the real-time operating system, but the detailed method is different from the instant firmware update method of the embodiment of the present invention, and the version is The embedded multimedia card can also use the instant firmware update method of the embodiment of the present invention. Briefly, in accordance with the above, the present invention is not limited by the type of storage device.

請參照圖1,圖1是本發明實施例的即時韌體更新系統的示意圖。作為主控端的計算機裝置11與儲存裝置12形成一個即時韌體更新系統1,計算機裝置11電性連接儲存裝置12。儲存裝置12具有快閃記憶體121與控制器122,其中快閃記憶體121電性連接控制器122。於此實施例中,儲存裝置12是一個外接或擴展的快閃記憶體儲存裝置,於其他實施例中,儲存裝置12亦可以是內建於計算機裝置11的快閃記憶體儲存裝置,且儲存裝置12的類型並非用以限制本發明。 Please refer to FIG. 1. FIG. 1 is a schematic diagram of an instant firmware update system according to an embodiment of the present invention. The computer device 11 as the master terminal and the storage device 12 form an instant firmware update system 1, and the computer device 11 is electrically connected to the storage device 12. The storage device 12 has a flash memory 121 and a controller 122, wherein the flash memory 121 is electrically connected to the controller 122. In this embodiment, the storage device 12 is an externally connected or expanded flash memory storage device. In other embodiments, the storage device 12 can also be a flash memory storage device built into the computer device 11 and stored. The type of device 12 is not intended to limit the invention.

接著,請同時參照圖1與圖2,圖2是本發明實施例的即時韌體更新方法的流程圖。所述即時韌體更新方法可以執行於圖1的即時韌體更新系統1中,進一步地,即時作業系統係運行於計算機裝置11中,且即時作業系統透過驅動程式與儲存裝置12的韌體溝通。韌體的程式碼可以儲存於快閃記憶體121中,透過控制器122來執行所述韌體,以控制快閃記憶體121的存取動作。 Next, please refer to FIG. 1 and FIG. 2 simultaneously. FIG. 2 is a flowchart of a method for updating the firmware in the embodiment of the present invention. The instant firmware update method can be implemented in the instant firmware update system 1 of FIG. 1. Further, the real-time operating system runs in the computer device 11, and the real-time operating system communicates with the firmware of the storage device 12 through the driver. . The firmware code can be stored in the flash memory 121, and the firmware is executed by the controller 122 to control the access operation of the flash memory 121.

首先,在步驟S21中,透過計算機裝置11,啟動至即時作業系統進行操作。接著,在步驟S22中,透過即時作業系統向韌體下達多個讀取指令,以執行前綴流程的讀取動作後,再向韌體下達多個寫入指令,執行特定寫入流程的寫入動作,以將具有校驗和之韌體映像檔寫入至快閃記憶體121中,其中特定寫入流程定義有韌體映像檔所要寫入的邏輯塊位址。接著,在步驟S23中,完成所述韌體更新。 First, in step S21, the computer device 11 is activated to start the operation to the real-time operating system. Next, in step S22, a plurality of read commands are sent to the firmware through the real-time operating system to perform a read operation of the prefix process, and then a plurality of write commands are issued to the firmware to perform writing of the specific write flow. Action to write the firmware image with the checksum to the flash memory 121, wherein the specific write flow defines the logical block address to be written by the firmware image. Next, in step S23, the firmware update is completed.

更進一步地說,在步驟S22中,在執行前綴流程的讀取動作後,即時作業系統可以得到盤問金鑰,接著,即時作業系統會根據盤問金鑰獲得答案訊息以對應一個目標邏輯塊位址,待韌體確認此答案訊息,並讀取目標邏輯塊位址之內容以回傳盤問成功訊息給韌體後,即時作業系統才會下達自目標邏輯塊位址寫入具有校驗和之韌體映像檔的寫入指令給韌體(亦即執行特定寫入流程的寫入動作,其中特定寫入流程定義有寫入韌體映像檔之目標邏輯塊位址作為寫入起始點的邏輯塊位址)。 Further, in step S22, after performing the reading operation of the prefix process, the real-time operating system can obtain the challenge key, and then the real-time operating system obtains the answer message according to the challenge key to correspond to a target logical block address. After the firmware confirms the answer message and reads the content of the target logical block address to return the challenge success message to the firmware, the real-time operating system will release the target logical block address and write the checksum toughness. The write command of the body image file is sent to the firmware (that is, the write operation of the specific write process is performed, wherein the specific write process defines the logic of the target logical block address written in the firmware image file as the write start point. Block address).

接著,請參照圖3,圖3是本發明實施例的即時韌體更新方法的細部流程圖。於圖3中,即時作業系統透過驅動程式與儲存裝置的韌體進行溝通,即時作業系統會下達多個讀取指令給韌體,韌體會藉此去讀取快閃記憶體中之多個邏輯塊位址。因此,在步驟S311中,即時作業系統會等待韌體回覆的資訊以判斷快閃記憶體中被讀取之多個邏輯塊位址的讀取流程是否等於多個特定邏輯塊位址的前綴流程,以及在讀取流程符合前綴流程時,判斷是否 收到韌體回覆的盤問金鑰。若讀取流程等於前綴流程,且收到韌體回覆的盤問金鑰,則即時作業系統執行下一個步驟S312;否則,則步驟S311繼續被即時作業系統所執行。 Next, please refer to FIG. 3. FIG. 3 is a detailed flowchart of the method for updating the instant firmware according to the embodiment of the present invention. In Figure 3, the real-time operating system communicates with the firmware of the storage device through the driver, and the real-time operating system will issue a plurality of read commands to the firmware, and the firmware will read multiple logics in the flash memory. Block address. Therefore, in step S311, the real-time operating system waits for the firmware reply information to determine whether the read flow of the plurality of logical block addresses read in the flash memory is equal to the prefix flow of the plurality of specific logical block addresses. And when the read process conforms to the prefix process, determine whether Received the challenge key for the firmware reply. If the read process is equal to the prefix process and the challenge key of the firmware reply is received, the immediate operation system performs the next step S312; otherwise, step S311 continues to be performed by the immediate operation system.

在步驟S321中,韌體會判斷讀取之多個邏輯塊位址的讀取流程是否等於多個特定邏輯塊位址的前綴流程,並回覆相關的資訊給即時作業系統。若讀取流程等於前綴流程,則韌體執行下一個步驟S322;否則,則步驟S321繼續被韌體所執行。接著,在步驟S322中,韌體基於前綴流程中最後一個特定邏輯塊位址的內容回傳盤金鑰給即時作業系統。 In step S321, the firmware determines whether the read flow of the read multiple logical block addresses is equal to the prefix flow of the specific logical block addresses, and replies the relevant information to the real-time operating system. If the read process is equal to the prefix process, the firmware performs the next step S322; otherwise, step S321 continues to be performed by the firmware. Next, in step S322, the firmware returns the disk key to the real-time operating system based on the content of the last specific logical block address in the prefix process.

請同時參照圖3與圖4,圖4是本發明實施例的快閃記憶體之多個邏輯塊位址所對應的內容之示意圖。在步驟S311中,即時作業系統透過韌體回覆的資訊判斷韌體是否依序地去讀取邏輯塊位址LBA(m)、LBA(n)、LBA(o)、LBA(p)、...、LBA(y)、LBA(z)的內容,其中m、n、...、y、z彼此不相同,且並非升冪或降冪排序。 也就是說,前綴流程定義多個特定邏輯塊位址LBA(m)、LBA(n)、LBA(o)、LBA(p)、...、LBA(y)、LBA(z)被讀取之順序,即時作業系統先判斷韌體回覆讀取多個邏輯塊位址之讀取流程是否等於前綴流程的資訊是否為真。若韌體回覆的資訊為真,則在步驟S311中,即時作業系統再判斷韌體是否回覆盤問金鑰C412。 Please refer to FIG. 3 and FIG. 4 simultaneously. FIG. 4 is a schematic diagram of content corresponding to multiple logical block addresses of the flash memory according to the embodiment of the present invention. In step S311, the real-time operating system determines whether the firmware sequentially reads the logical block addresses LBA(m), LBA(n), LBA(o), LBA(p), .. through the information of the firmware reply. The contents of LBA(y), LBA(z), where m, n, ..., y, z are different from each other, and are not sorted by power or power. That is, the prefix process defines that a number of specific logical block addresses LBA(m), LBA(n), LBA(o), LBA(p), ..., LBA(y), LBA(z) are read. In the order, the real-time operating system first determines whether the read process of reading the plurality of logical block addresses by the firmware reply is equal to whether the information of the prefix process is true. If the information of the firmware reply is true, then in step S311, the real-time operating system determines whether the firmware returns the challenge key C412.

另外,在步驟S321,韌體會判斷邏輯塊位址LBA(m)、LBA(n)、LBA(o)、LBA(p)、...、LBA(y)、LBA(z)的內容是否依序被讀取,並回覆相關的資訊給即時作業系統。若邏輯塊位址LBA(m)、LBA(n)、LBA(o)、LBA(p)、...、LBA(y)、LBA(z)的內容依序被讀取,則根據邏輯塊位址LBA(z)的內容回覆盤問金鑰C412給即時作業系統。在此請注意,邏輯塊位址LBA(z)的內容包括標頭H411與盤問金鑰C412,標頭H411可以被韌體進一步地檢查,以確認邏輯塊位址LBA(z)的盤問金鑰C412是否正確,在其他實施例中,標頭H411亦可以改作為盤問金鑰C412的一部份。 In addition, in step S321, the firmware determines whether the contents of the logical block addresses LBA(m), LBA(n), LBA(o), LBA(p), ..., LBA(y), LBA(z) are dependent on The sequence is read and the relevant information is replied to the real-time operating system. If the contents of the logical block addresses LBA(m), LBA(n), LBA(o), LBA(p), ..., LBA(y), LBA(z) are sequentially read, according to the logical block The content of the address LBA(z) is replied to the challenge key C412 to the instant operating system. Please note that the content of the logical block address LBA(z) includes the header H411 and the challenge key C412, and the header H411 can be further checked by the firmware to confirm the challenge key of the logical block address LBA(z). Whether C412 is correct or not, in other embodiments, header H411 can also be changed to be part of challenge key C412.

另外一方面,前面前綴流程雖然是指多個特定邏輯塊位址LBA(m)、LBA(n)、LBA(o)、LBA(p)、...、LBA(y)、LBA(z)之順序,但是,於其他實施例中,前綴流程亦可以是代表多個特定邏輯塊位址LBA(m)、LBA(n)、LBA(o)、LBA(p)、...、LBA(y)、LBA(z)之依序任兩者的多個位址差值所形成的位址差值序列,而讀取流程則是代表被讀取之多個邏輯塊位址之依序任兩者的多個位址差值所形成的位址差值序列,僅要此兩位址差值序列符合,則可以代表讀取流程等於前綴流程。 On the other hand, the previous prefix process refers to multiple specific logical block addresses LBA(m), LBA(n), LBA(o), LBA(p), ..., LBA(y), LBA(z). The order, however, in other embodiments, the prefix flow may also be representative of a plurality of specific logical block addresses LBA(m), LBA(n), LBA(o), LBA(p), ..., LBA ( y), LBA (z) is a sequence of address difference values formed by multiple address differences of the two, and the reading process is based on the sequence of the plurality of logical block addresses being read. The sequence of address differences formed by the difference between the two addresses may only represent the read process equal to the prefix process if the sequence of the two-bit difference difference is met.

接著,請回去繼續參照圖3,在步驟S312中,即時作業系統基於盤問金鑰獲得目標邏輯塊位址,並下達讀取指令給韌體對目標邏輯塊位址的內容進行讀取,也就是說,即時作業系統對盤問金鑰進行解密,以獲得答案訊息回傳給韌體與命令韌體依據答案訊息進行讀取動作,其中答案訊息對應目標邏輯塊位址。在步驟S323,韌體判斷即時作業系統回覆的答案訊息是否正確,也就是判斷目標邏輯塊位址是否正確。若答案訊息正確,則韌體進一步地執行步驟S324,否則,則繼續執行步驟S321。 Next, please go back to FIG. 3. In step S312, the real-time operating system obtains the target logical block address based on the challenge key, and issues a read command to the firmware to read the content of the target logical block address, that is, Said, the real-time operating system decrypts the challenge key to obtain an answer message back to the firmware and the command firmware to perform a reading operation according to the answer message, wherein the answer message corresponds to the target logical block address. In step S323, the firmware determines whether the answer message replied by the real-time operating system is correct, that is, whether the target logical block address is correct. If the answer message is correct, the firmware further performs step S324, otherwise, step S321 is continued.

之後,在步驟S324中,韌體讀取目標邏輯塊位址的內容,並基於目標邏輯塊位址的內容,回傳盤問成功訊息給即時作業系統。在步驟S313中,即時作業系統判斷是否收到盤問成功訊息。若收到盤問成功訊息,則即時作業系統接著執行步驟S314,否則,則繼續執行步驟S311。 Then, in step S324, the firmware reads the content of the target logical block address, and based on the content of the target logical block address, returns the challenge success message to the real-time operating system. In step S313, the real-time operating system determines whether a challenge success message is received. If the challenge success message is received, the immediate job system then proceeds to step S314, otherwise, proceeds to step S311.

在步驟S314中,即時作業系統下達自目標邏輯塊位址寫入具有校驗和之韌體映像檔的寫入指令給韌體。然後,韌體收到此寫入指令後,於步驟S325中,韌體開始自目標邏輯塊位址寫入具有校驗和之韌體映像檔,並判斷是否成功將韌體映像檔寫入。若成功地將韌體映像檔寫入,則韌體執行步驟S326,完成韌體更新,否則,則繼續執行步驟S321。在此請注意,上述校驗和並非用以限制本發明,換言之,亦可以寫入不具有校驗和的韌體映像檔, 只是較佳地,為了資料正確性,一般會設計成寫入具有校驗和的韌體映像檔。 In step S314, the real-time operating system issues a write command to the firmware with the firmware image file of the checksum from the target logical block address. Then, after the firmware receives the write command, in step S325, the firmware starts to write the firmware image file with the checksum from the target logical block address, and determines whether the firmware image file is successfully written. If the firmware image is successfully written, the firmware performs step S326 to complete the firmware update. Otherwise, step S321 is continued. Please note that the above checksum is not intended to limit the present invention. In other words, it is also possible to write a firmware image without a checksum. Preferably, for data correctness, it is generally designed to write a firmware image with a checksum.

請同時參照圖3與圖4,進一步地,在步驟S312中,即時作業系統基於盤問金鑰C412進行解密,以獲得答案訊息,也就目標邏輯塊位址LBA(k)。然後,在步驟S323中,韌體會檢查答案訊息的目標邏輯塊位址LBA(k)是否正確,以及在步驟S324中,讀取目標邏輯塊位址LBA(k)之內容中的盤問成功訊息C422,並回傳給即時作業系統。在步驟S313中,即時作業系統檢查是否收到盤問成功訊息C422。在步驟S314中,即時作業系統下達寫入指令給韌體自目標邏輯塊位址LBA(k)開始寫入具有校驗和之韌體映像檔,以及在步驟S325,韌體開始自目標邏輯塊位址LBA(k)開始寫入具有校驗和之韌體映像檔並判斷是否成功地將具有校驗和之韌體映像檔寫入。 Referring to FIG. 3 and FIG. 4 simultaneously, further, in step S312, the real-time operating system decrypts based on the challenge key C412 to obtain an answer message, that is, the target logical block address LBA(k). Then, in step S323, the firmware checks whether the target logical block address LBA(k) of the answer message is correct, and in step S324, reads the challenge success message C422 in the content of the target logical block address LBA(k). And passed back to the real-time operating system. In step S313, the immediate job system checks if a challenge success message C422 is received. In step S314, the immediate operating system issues a write command to the firmware to start writing the firmware image file with the checksum from the target logical block address LBA(k), and in step S325, the firmware starts from the target logical block. The address LBA(k) begins to write the firmware image with the checksum and determines whether the firmware image with the checksum is successfully written.

在此請注意,邏輯塊位址LBA(k)的內容包括標頭H421與盤問成功訊息C422,標頭H421可以被韌體進一步地檢查,以確認邏輯塊位址LBA(k)的盤問成功訊息C422是否正確,在其他實施例中,標頭H421亦可以改作為盤問成功訊息C422的一部份。另外一方面,上述盤問金鑰C412係在韌體更新方法被執行時,被動態地決定,因此,目標邏輯塊位址LBA(k)與盤問成功訊息C422亦為動態決定。簡單地說,邏輯塊位址LBA(m)~LBA(y)儲存的資料是之前存在快閃記憶體中的資料,而存在邏輯塊位址LBA(z)與LBA(k)的資料則是動態產生的虛擬資料(dummy data),其目的係為了即時作業系統與韌體之間進行交握確認使用。 Please note that the content of the logical block address LBA(k) includes the header H421 and the challenge success message C422, and the header H421 can be further checked by the firmware to confirm the challenge success message of the logical block address LBA(k). Whether C422 is correct or not, in other embodiments, header H421 can also be changed to be part of the challenge success message C422. On the other hand, the above-mentioned challenge key C412 is dynamically determined when the firmware update method is executed. Therefore, the target logical block address LBA(k) and the challenge success message C422 are also dynamically determined. Simply put, the data stored in the logical block addresses LBA(m)~LBA(y) is the data stored in the flash memory before, and the data in the logical block addresses LBA(z) and LBA(k) are Dynamically generated dummy data, the purpose of which is to use the handshake between the real-time operating system and the firmware.

綜合以上所述,本發明實施例提供一種透過即時作業系統來更新儲存裝置之韌體的即時韌體更新方法。上述即時韌體更新方法可以適用於不同的儲存裝置,且特別適用於版本為v4.x的嵌入式多媒體卡,以讓使用者在不需要使主控端(亦即,計算機裝置)進入特定模式下,便能夠透過即時作業系統下達指令給韌體進行 特定行為來進行韌體更新,故給予使用者在韌體更新上的便利性。另外,上述即時韌體更新方法具有一定的安全性,不易被側錄而得知韌體映像檔的儲存位址,以避免惡意分子隨意篡改韌體映像檔的內容。 In summary, the embodiment of the present invention provides an instant firmware update method for updating a firmware of a storage device through an instant operation system. The above-mentioned instant firmware update method can be applied to different storage devices, and is particularly suitable for an embedded multimedia card of version v4.x, so that the user does not need to make the host (ie, the computer device) enter a specific mode. Then, the firmware can be issued to the firmware through the real-time operating system. The specific behavior is used to perform firmware update, so the user is given convenience in firmware update. In addition, the above-mentioned instant firmware update method has certain security, and it is not easy to be recorded by the side view to know the storage address of the firmware image file, so as to prevent malicious elements from arbitrarily tampering with the contents of the firmware image file.

以上所述,僅為本發明最佳之具體實施例,惟本發明之特徵並不侷限於此,任何熟悉該項技藝者在本發明之領域內,可輕易思及之變化或修飾,皆可涵蓋在以下本案之專利範圍。 The above description is only the preferred embodiment of the present invention, but the features of the present invention are not limited thereto, and any one skilled in the art can easily change or modify it in the field of the present invention. Covered in the following patent scope of this case.

S21~S23‧‧‧步驟流程 S21~S23‧‧‧Step process

Claims (10)

一種即時韌體更新方法,適用於包括一計算機裝置與一儲存裝置的一即時韌體更新系統,其中該即時韌體更新方法包括:該計算機裝置啟動至一即時作業系統進行操作,其中該即時作業系統與該儲存裝置的一韌體透過一驅動程式進行溝通;該即時作業系統向該韌體下達多個讀取指令,以使韌體進行符合一前綴流程的一讀取動作,其中該前綴流程定義多個特定邏輯塊位址被讀取的順序;以及在韌體進行符合該前綴流程的該讀取動作後,該即時作業系統向該韌體下達多個寫入指令,以使該韌體進行特定寫入流程的一寫入動作,而將一韌體映像檔自該寫入流程定義的一目標邏輯塊位址開始寫入至該儲存裝置。 An instant firmware update method is applicable to a real-time firmware update system including a computer device and a storage device, wherein the instant firmware update method includes: the computer device is booted to an immediate operation system, wherein the instant job The system communicates with a firmware of the storage device through a driver program; the real-time operating system issues a plurality of read commands to the firmware, so that the firmware performs a read operation conforming to a prefix process, wherein the prefix process Defining an order in which a plurality of specific logical block addresses are read; and after the firmware performs the read operation conforming to the prefix flow, the real-time operating system issues a plurality of write commands to the firmware to enable the firmware A write operation of a specific write process is performed, and a firmware image file is written to the storage device from a target logical block address defined by the write process. 如請求項第1項的即時韌體更新方法,其中該韌體在收到該些讀取指令後,判斷讀取多個邏輯塊位址的一讀取流程是否符合該前綴流程,並據此回覆相關的一第一資訊給該即時作業系統,若該讀取流程符合該前綴流程,則該韌體基於該前綴流程中最後一個特定邏輯塊位址的內容回傳一盤問金鑰給該即時作業系統。 The instant firmware update method of claim 1, wherein the firmware determines, after receiving the read commands, whether a read process of reading a plurality of logical block addresses conforms to the prefix process, and accordingly Responding a related first information to the real-time operating system. If the reading process conforms to the prefix process, the firmware returns a question key to the instant based on the content of the last specific logical block address in the prefix process. working system. 如請求項第2項的即時韌體更新方法,其中該前綴流程中最後一個特定邏輯塊位址的內容包括一標頭與該盤問金鑰,該韌體用以檢查該標準,以確認該盤問金鑰。 The instant firmware update method of claim 2, wherein the content of the last specific logical block address in the prefix process includes a header and the challenge key, and the firmware is used to check the standard to confirm the challenge. Key. 如請求項第2項的即時韌體更新方法,其中該即時作業系統對該盤問金鑰解密,以獲得具有一目標邏輯塊位址的一答案訊息,並回傳該答案訊息給該韌體,以命令該韌體讀取該目標邏輯塊位址的內容。 The instant firmware update method of claim 2, wherein the real-time operating system decrypts the challenge key to obtain an answer message having a target logical block address, and returns the answer message to the firmware. Commanding the firmware to read the contents of the target logical block address. 如請求項第4項的即時韌體更新方法,其中該韌體更確認該答案訊息是否正確,且若該答案訊息正確,則讀取該目標邏輯塊位址的內容,以獲得一盤問成功訊息,並回傳給該即時作業系 統。 The instant firmware update method of claim 4, wherein the firmware further confirms whether the answer message is correct, and if the answer message is correct, reading the content of the target logical block address to obtain a question success message. And passed back to the instant operating system System. 如請求項第5項的即時韌體更新方法,其中該目標邏輯塊位址的內容包括一標頭與該盤問成功訊息,該韌體用以檢查該標準,以確認該盤問成功訊息。 The instant firmware update method of claim 5, wherein the content of the target logical block address includes a header and the challenge success message, and the firmware is used to check the criterion to confirm the challenge success message. 如請求項第1項的即時韌體更新方法,其中該盤問金鑰、該目標邏輯塊位址與該盤問成功訊息係動態產生。 The instant firmware update method of claim 1, wherein the challenge key, the target logical block address, and the challenge success message are dynamically generated. 如請求項第1項的即時韌體更新方法,其中該韌體映像檔具有一校驗和。 The instant firmware update method of claim 1, wherein the firmware image file has a checksum. 如請求項第1項的即時韌體更新方法,其中該些特定邏輯塊位址被讀取的順序是指該些特定邏輯塊位址的一位址差值序列。 The instant firmware update method of claim 1, wherein the order in which the specific logical block addresses are read refers to a sequence of address difference values of the specific logical block addresses. 一種非暫態的電腦可讀取媒介,包括有多個程式碼,用以執行如請求項第1~9項其中之一的即時韌體更新方法。 A non-transitory computer readable medium comprising a plurality of code codes for performing an instant firmware update method as in one of claims 1-9.
TW104126975A 2015-08-19 2015-08-19 Field firmware upgrading method and computer-readable medium TWI614684B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW104126975A TWI614684B (en) 2015-08-19 2015-08-19 Field firmware upgrading method and computer-readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW104126975A TWI614684B (en) 2015-08-19 2015-08-19 Field firmware upgrading method and computer-readable medium

Publications (2)

Publication Number Publication Date
TW201709055A true TW201709055A (en) 2017-03-01
TWI614684B TWI614684B (en) 2018-02-11

Family

ID=58774378

Family Applications (1)

Application Number Title Priority Date Filing Date
TW104126975A TWI614684B (en) 2015-08-19 2015-08-19 Field firmware upgrading method and computer-readable medium

Country Status (1)

Country Link
TW (1) TWI614684B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI736074B (en) * 2019-12-20 2021-08-11 瑞昱半導體股份有限公司 Peripheral devices and upgrade-verifying method thereof
CN113327639A (en) * 2021-05-26 2021-08-31 翱捷科技股份有限公司 Firmware storage reading method and device based on LVGL

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9292277B2 (en) * 2009-12-18 2016-03-22 Hewlett-Packard Development Company, L.P. Methods and devices for updating firmware of a component using a firmware update application

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI736074B (en) * 2019-12-20 2021-08-11 瑞昱半導體股份有限公司 Peripheral devices and upgrade-verifying method thereof
CN113327639A (en) * 2021-05-26 2021-08-31 翱捷科技股份有限公司 Firmware storage reading method and device based on LVGL
CN113327639B (en) * 2021-05-26 2023-09-15 翱捷科技股份有限公司 Firmware storage reading method and device based on LVGL

Also Published As

Publication number Publication date
TWI614684B (en) 2018-02-11

Similar Documents

Publication Publication Date Title
US11216206B2 (en) Method of operating data storage device
US9043549B2 (en) Memory storage apparatus, memory controller, and method for transmitting and identifying data stream
US9858008B2 (en) Method to reduce flash memory IOs with host maintained address mapping table
TWI692690B (en) Method for accessing flash memory module and associated flash memory controller and electronic device
US8954705B2 (en) Memory space management method and memory controller and memory storage device and memory storage using the same
KR101986355B1 (en) A embedded Multimedia Card(eMMC), eMMC system including the eMMC, and a method for operating the eMMC
US10475516B2 (en) Data storage device and data erasing method wherein after erasing process, predetermined value is written to indicate completion of said erasing method
CN109697170B (en) Method for accessing flash memory module, related flash memory controller and electronic device
TW202028981A (en) Data storage devices and methods for firmware failure prevention
US9032135B2 (en) Data protecting method, memory controller and memory storage device using the same
TWI614684B (en) Field firmware upgrading method and computer-readable medium
US9880831B2 (en) Field firmware upgrading method and computer-readable medium
US20170090947A1 (en) Electronic apparatus and booting method thereof
CN109445686B (en) Storage disk and data access method
TWI633434B (en) Method, system, and computer readable medium for managing solid state drive
KR20210065439A (en) Memory system and operating method thereof
CN107729067B (en) Registration method and device for FLASH chip drive
EP3961451B1 (en) Storage device
TWI820952B (en) Method and apparatus for performing data access control of memory device with aid of predetermined command
TWI705330B (en) Data storage device and parameter rewrite method thereof
US10324894B2 (en) Storage device management method and system, and memory storage device thereof
TW201604772A (en) Data storage device and method for operating the same
TWI248026B (en) Data storing method for bios
KR100640612B1 (en) Method and Apparatus for writing a main code
CN115708073A (en) Control method of memory chip, related device and storage medium