TWI768316B - Memory apparatus and memory management method for safe power-up - Google Patents
Memory apparatus and memory management method for safe power-up Download PDFInfo
- Publication number
- TWI768316B TWI768316B TW109110766A TW109110766A TWI768316B TW I768316 B TWI768316 B TW I768316B TW 109110766 A TW109110766 A TW 109110766A TW 109110766 A TW109110766 A TW 109110766A TW I768316 B TWI768316 B TW I768316B
- Authority
- TW
- Taiwan
- Prior art keywords
- boot code
- read
- flag
- block
- code
- Prior art date
Links
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
- Power Sources (AREA)
Abstract
Description
本發明是有關於一種記憶體裝置以及安全開機的記憶體管理方法,且特別是有關於一種可提升開機成功率的記憶體裝置以及安全開機的記憶體管理方法。 The present invention relates to a memory device and a memory management method for safe booting, and more particularly, to a memory device that can improve the success rate of booting and a memory management method for safe booting.
在現今的電子裝置中,主機端的開機碼常儲存在非揮發性記憶體中,例如快閃記憶體。儲存在快閃記憶體中的開機碼,常因各種原因而發生損壞的現象,一旦開機碼的內容發生損壞,主機端將無碼正確的開機,且無法正常的進行運作。並且,習知技術中,當主機端發生無法開機而當機的情況下,只能將系統送回至供應者端進行維修,在使用上極端的不便利。 In today's electronic devices, the host-side boot codes are often stored in non-volatile memory, such as flash memory. The boot code stored in the flash memory is often damaged due to various reasons. Once the content of the boot code is damaged, the host will boot correctly without the code and cannot operate normally. Moreover, in the prior art, when the host end fails to boot and crashes, the system can only be sent back to the supplier end for maintenance, which is extremely inconvenient in use.
本發明提供一種記憶體裝置以及安全開機的記憶體管理方法,可提升主機端的開機成功的機率。 The present invention provides a memory device and a memory management method for safe booting, which can improve the probability of successful booting of the host.
本發明的安全開機的記憶體管理方法,包括:在記憶胞 陣列中區分出第一區塊以及第二區塊;使開機碼在儲存在第一區塊,並備份開機碼以在第二區塊儲存備份開機碼;在開機程序中,設定失敗-安全旗標,並依據主機端可程式軟體命令以讀取第一區塊中的開機碼以獲得第一讀出開機碼;判斷第一讀出開機碼是否正確以產生判斷結果,以及,依據判斷結果或失敗-安全旗標以設定預審旗標,並依據預審旗標決定是否讀出備份開機碼以作為第二讀出開機碼。 The memory management method for safe booting of the present invention includes: in the memory cell Distinguish the first block and the second block in the array; make the boot code stored in the first block, and back up the boot code to store the backup boot code in the second block; in the boot process, set the fail-safe flag mark, and read the boot code in the first block according to the command of the host-side programmable software to obtain the first read boot code; determine whether the first read boot code is correct to generate a judgment result, and, according to the judgment result or Fail-safe flag to set the pre-check flag, and according to the pre-check flag to decide whether to read the backup boot code as the second read boot code.
本發明的記憶體裝置包括記憶胞陣列以及控制電路。記憶胞陣列具有第一區塊以及第二區塊,第一區塊以及第二區塊分別儲存開機碼以及備份開機碼。控制電路耦接在記憶胞陣列以及主機端間,用以執行上述的安全開機的管理方法。 The memory device of the present invention includes a memory cell array and a control circuit. The memory cell array has a first block and a second block, and the first block and the second block store the boot code and the backup boot code respectively. The control circuit is coupled between the memory cell array and the host, and is used for executing the above-mentioned management method for safe booting.
基於上述,本發明透過在記憶胞陣列中的第一區塊以及第二區塊,分別儲存開機碼以及備份開機碼。並透過在開機程序中,依據失敗-安全旗標或第一讀出開機碼是否正確的判斷結果來設定預審旗標,並依據預審旗標決定是否讀出備份開機碼以執行主機端的開機動動作。可維持主機端的正常運作。 Based on the above, the present invention stores the boot code and the backup boot code respectively through the first block and the second block in the memory cell array. In the boot process, the pre-check flag is set according to the fail-safe flag or the judgment result of whether the first read-out boot code is correct, and according to the pre-check flag, it is determined whether to read the backup boot code to execute the booting action on the host side . It can maintain the normal operation of the host.
S110~S150、S310~S3130、S410~S4120:記憶體管理步驟 S110~S150, S310~S3130, S410~S4120: Memory management steps
200:記憶胞陣列 200: Memory Cell Array
501:記憶體裝置 501: Memory device
510:記憶胞陣列 510: Memory Cell Array
520:控制電路 520: Control circuit
521:位址解碼器 521: address decoder
522:邏輯電路 522: Logic Circuits
ADD1~ADD3:位址 ADD1~ADD3: address
BA-DEF:開機位址設定值 BA-DEF: Boot address setting value
BC1:開機碼 BC1: boot code
BC2:備份開機碼 BC2: Backup boot code
BC-DEF:開機碼設定值 BC-DEF: Boot code setting value
FF1:正反器 FF1: Flip-flop
HLSB:低位元位址 HLSB: low byte address
HMSB:最高位元位址 HMSB: Highest bit address
MMSAD:切換位址 MMSAD: toggle address
PREQ:預審旗標 PREQ: Prequalification Flag
PUT:開機觸發信號 PUT: Power-on trigger signal
XOR:互斥或閘 XOR: Mutually exclusive OR gate
Z1:第一區塊 Z1: The first block
Z2:第二區塊 Z2: Second block
圖1繪示本發明一實施例的安全開機的記憶體管理方法的流程圖。 FIG. 1 is a flowchart of a memory management method for secure booting according to an embodiment of the present invention.
圖2繪示本發明實施例的記憶胞陣列的配置方式的示意圖。 FIG. 2 is a schematic diagram illustrating a configuration of a memory cell array according to an embodiment of the present invention.
圖3繪示本發明另一實施例的記憶體管理方法的流程圖。 FIG. 3 is a flowchart illustrating a memory management method according to another embodiment of the present invention.
圖4繪示本發明另一實施例的安全開機的記憶體管理方法的流程圖。 FIG. 4 is a flowchart illustrating a memory management method for secure booting according to another embodiment of the present invention.
圖5A以及圖5B分別繪示本發明實施例的記憶體裝置的不同實施方式的示意圖。 5A and 5B are schematic diagrams of different implementations of a memory device according to an embodiment of the present invention, respectively.
請參照圖1,圖1繪示本發明一實施例的安全開機的記憶體管理方法的流程圖。其中,在步驟S110中,記憶體中的記憶胞陣列可區分出第一區塊以及第二區塊。第一區塊以及第二區塊可以為在記憶胞陣列中,位址連續或不連續的兩個不同的區塊。在本發明實施例中,第一區塊可以設置在記憶胞陣列中,具有相對低的位址範圍中,第二區塊則可以設置在記憶胞陣列中,具有相對高的位址範圍中。在本實施例中,記憶體可以為非揮發性記憶體,例如為快閃記憶體。 Please refer to FIG. 1 . FIG. 1 is a flowchart illustrating a memory management method for secure booting according to an embodiment of the present invention. Wherein, in step S110, the memory cell array in the memory can distinguish the first block and the second block. The first block and the second block may be two different blocks with consecutive or non-consecutive addresses in the memory cell array. In the embodiment of the present invention, the first block may be disposed in the memory cell array with a relatively low address range, and the second block may be disposed in the memory cell array with a relatively high address range. In this embodiment, the memory may be a non-volatile memory, such as a flash memory.
接著,在步驟S120中,則使開機碼儲存在第一區塊,並備份開機碼以在第二區塊儲存備份開機碼。其中開機碼用以提供主機端進行讀取,並提供主機端執行開機動作。 Next, in step S120, the boot code is stored in the first block, and the boot code is backed up to store the backup boot code in the second block. The boot code is used to provide the host to read, and to provide the host to execute the booting action.
在步驟S130中,進入開機程序,並在開機程序中,設定失敗-安全旗標,並依據重置命令以讀取第一區塊中的開機碼以獲得第一讀出開機碼。其中,在快閃記憶體中可以設置一失敗-安全旗標。並且,在步驟S130中,可設定失敗-安全旗標為第一邏輯 準位(例如為邏輯準位1)。接著,主機端可透過主機端可程式軟體執行一重置命令,而基於重置命令的觸發,主機端可對記憶胞陣列中的第一區塊的開機碼進行讀取動作,並藉以讀出第一讀出開機碼。 In step S130, the boot process is entered, and in the boot process, a fail-safe flag is set, and the boot code in the first block is read according to the reset command to obtain the first read boot code. Among them, a fail-safe flag can be set in the flash memory. And, in step S130, a fail-safe flag can be set as the first logic level (eg logic level 1). Then, the host side can execute a reset command through the host-side programmable software, and based on the trigger of the reset command, the host side can read the boot code of the first block in the memory cell array, and thereby read out First read the boot code.
在此,當執行對記憶體的第一區塊的開機碼的讀取動作時,可設定存取位址為第一起始存取位址,並針對記憶胞陣列的第一起始存取位址執行讀取動作以獲得第一讀出開機碼。 Here, when the read operation of the boot code of the first block of the memory is performed, the access address can be set as the first start access address, and the first start access address of the memory cell array can be set A read action is performed to obtain the first read-out boot code.
接著,在步驟S140中,可針對第一讀出開機碼是否正確進行判斷,並藉以產生判斷結果。在本實施例中,可以透過對第一讀出開機碼執行循環冗餘校驗(Cyclic redundancy check,CRC)以獲得判斷結果。或者,在本發明其他實施例中,也可在主機端依據第一讀出開機碼執行開機動作後,透過執行特定的功能檢查來獲得判斷結果,並藉以得知記憶胞陣列中的第一區塊所儲存的開機碼是否正確。 Next, in step S140, it can be judged whether the first read-out boot code is correct, and a judgment result can be generated thereby. In this embodiment, the judgment result can be obtained by performing a cyclic redundancy check (CRC) on the first readout code. Or, in other embodiments of the present invention, after the host side performs the booting action according to the first read-out code, the judgment result can be obtained by performing a specific function check, and the first area in the memory cell array can be known by this. Check whether the boot code stored in the block is correct.
附帶一提的,在當步驟S140中所獲得的判斷結果表示第一讀出開機碼是正確的,失敗-安全旗標可以被清除為第二邏輯準位(例如為邏輯準位0)。若當步驟S140中所獲得的判斷結果表示第一讀出開機碼是錯誤的,失敗-安全旗標可以被保持為第一邏輯準位(例如為邏輯準位1)。 Incidentally, when the judgment result obtained in step S140 indicates that the first read boot code is correct, the fail-safe flag can be cleared to the second logic level (eg, logic level 0). If the judgment result obtained in step S140 indicates that the first read-out code is wrong, the fail-safe flag can be maintained at the first logic level (eg, logic level 1).
在步驟S150中,可依據判斷結果或失敗-安全旗標來設定一預審旗標。其中,預審旗標是為配置在記憶體中的揮發性記憶體旗標。並且,在開機程序中,當失敗-安全旗標為被設定(等 於第一邏輯準位)的狀態,或者步驟S140的判斷結果指示第一讀出開機碼為錯誤的條件下,預審旗標可以被設定為等於第一邏輯準位。此外,在預審旗標等於第一邏輯準位的狀態下,主機端可讀取記憶胞陣列中的第二區塊的備份開機碼,並藉以獲得第二讀出開機碼。主機端並可依據第二讀出開機碼進行重新開機的動作。 In step S150, a pre-trial flag may be set according to the judgment result or the fail-safe flag. The pre-qualification flag is a volatile memory flag configured in the memory. Also, during the boot process, when the fail-safe flag is set (etc. In the state of the first logic level), or under the condition that the judgment result of step S140 indicates that the first read boot code is wrong, the pre-trial flag may be set equal to the first logic level. In addition, when the pre-check flag is equal to the first logic level, the host can read the backup boot code of the second block in the memory cell array, and thereby obtain the second read boot code. The host can perform restarting according to the second read-out code.
在另一方面,在上述的步驟S150中,當要針對記憶胞陣列的第二區塊的備份開機碼執行讀取動作時,主機端可依據等於第一邏輯準位的預審旗標,在不變更起始存取位址的條件下,對記憶胞陣列執行讀取動作以獲得第二讀出開機碼。 On the other hand, in the above-mentioned step S150, when the read operation is to be performed on the backup boot code of the second block of the memory cell array, the host side can, according to the pre-check flag equal to the first logic level, Under the condition of changing the initial access address, a read operation is performed on the memory cell array to obtain a second read boot code.
由上述的說明不難得知,本發明實施例的安全開機的記憶體管理方法中,在當記憶胞陣列所儲存的開機碼發生錯誤時,記憶胞陣列可提供第二區塊中所儲存的備份開機碼,並透過備份開機碼使主機端成功開機動作,有效提升主機端成功開機的機率。 It is not difficult to know from the above description that in the memory management method for safe booting according to the embodiment of the present invention, when the boot code stored in the memory cell array is wrong, the memory cell array can provide a backup copy stored in the second block The boot code is backed up, and the host side is successfully booted by backing up the boot code, which effectively increases the probability of the host side successfully booting.
請參照圖2,圖2繪示本發明實施例的記憶胞陣列的配置方式的示意圖。在圖2中,記憶體的記憶胞陣列200可區分為第一區塊Z1以及第二區塊Z2。在本實施例中,第一區塊Z1配置在位址ADD1至位址ADD2間,第二區塊Z2則配置在位址ADD2至位址ADD3間。並且,開機碼BC1儲存在第一區塊Z1,且備份開機碼BC2儲存在第二區塊Z2中。當要針對第一區塊Z1中的開機碼BC1進行讀取動作時,可設定作為起始位址的位址ADD1作為存取位址,並進行開機碼BC1的讀取動作。相對的,當預審旗標致能時,要針對第二區塊Z2中的備份開機碼BC2進行讀取動
作時,主機端維持原來起始位址的位址(ADD1)作為存取位址,並進行備份開機碼BC2的讀取動作。
Please refer to FIG. 2 , which is a schematic diagram illustrating a configuration of a memory cell array according to an embodiment of the present invention. In FIG. 2, the
在此,第一區塊Z1以及第二區塊Z2的記憶容量大於開機碼BC1以及備份開機碼BC2的尺寸。此外,第一區塊Z1以及第二區塊Z2在位址的配置上可以是連續的,但也可以是不連續的,沒有一定的限制。 Here, the memory capacity of the first block Z1 and the second block Z2 is larger than the size of the boot code BC1 and the backup boot code BC2. In addition, the address configuration of the first block Z1 and the second block Z2 may be continuous, but may also be discontinuous, and there is no certain limitation.
請參照圖3,圖3繪示本發明另一實施例的記憶體管理方法的流程圖。在圖3中,步驟S310啟動開機程序。步驟S320針對失敗-安全旗標是否已被設定進行判斷,在當失敗-安全旗標為已被設定的狀態下,執行步驟S3100,相對的,在當失敗-安全旗標非為被設定的狀態下,執行步驟S330。在此,步驟S320可依據失敗-安全旗標的邏輯準位進行判斷。例如,當失敗-安全旗標為第一邏輯準位時,可視失敗-安全旗標為被設定的狀態。相反的,當失敗-安全旗標為第二邏輯準位時,則可視失敗-安全旗標為非被設定的狀態。其中第一邏輯準位與第二邏輯準位互補。 Please refer to FIG. 3 , which is a flowchart illustrating a memory management method according to another embodiment of the present invention. In FIG. 3, step S310 starts the booting procedure. Step S320 judges whether the failure-safety flag has been set. In the state where the fail-safety flag has been set, step S3100 is executed. On the contrary, in the state when the failure-safety flag is not set Next, step S330 is executed. Here, step S320 may be determined according to the logic level of the fail-safe flag. For example, when the fail-safe flag is at the first logic level, the fail-safe flag can be viewed as a set state. On the contrary, when the fail-safety flag is at the second logic level, the fail-safety flag can be regarded as a non-set state. The first logic level and the second logic level are complementary.
值得注意的,當步驟S320中判斷出失敗-安全旗標已被設定,表示失敗-安全開機的條件已存在,且失敗-安全開機的機制需要被啟動。在此情況下,代表前一次開機(讀取開機碼BC1)失敗,失敗-安全旗標未被清除。接著執行步驟S3100,以設定預審旗標為致能。 It is worth noting that when it is determined in step S320 that the fail-safety flag has been set, it means that the condition for fail-safe booting exists, and the fail-safe booting mechanism needs to be activated. In this case, it means that the previous power-on (reading the power-on code BC1) failed, and the fail-safe flag was not cleared. Next, step S3100 is executed to set the pre-trial flag to enable.
附帶一提的,失敗-安全旗標可被設置在非揮發性記憶體(例如快閃記憶體)中,因此,透過主機端的重新開機動作,並 不會變更失敗-安全旗標的邏輯準位。另外,在本發明實施例中,失敗-安全旗標可以儲存在與儲存開機碼相同的快閃記憶體中。在本發明其他實施例中,失敗-安全旗標與開機碼也可儲存在不同的快閃記憶體中。 Incidentally, the fail-safe flag can be set in non-volatile memory (such as flash memory), so through a reboot action on the host side, and Does not change the logical level of the fail-safe flag. Additionally, in an embodiment of the present invention, the fail-safe flag may be stored in the same flash memory as the boot code is stored. In other embodiments of the present invention, the fail-safe flag and the boot code may also be stored in different flash memories.
步驟S330中設定失敗-安全旗標為第一邏輯準位,接著在步驟S340中,主機端可發送重置記憶體命令,在步驟S350中下載在記憶胞陣列中的第一區塊的開機碼。接著,步驟S360中針對所讀出的第一讀出開機碼進行功能檢查或是CRC檢查,並藉以確認第一讀出開機碼是否正確。其中,當步驟S360的檢查結果為通過時,表示第一讀出開機碼正確,並可執行步驟S370。相對的,當步驟S360的檢查結果非為通過時,表示第一讀出開機碼錯誤並對應執行步驟S390。 In step S330, the setting fails - the security flag is the first logic level, then in step S340, the host can send a reset memory command, and in step S350, the boot code of the first block in the memory cell array is downloaded . Next, in step S360, a function check or a CRC check is performed on the read out first readout code, so as to confirm whether the first readout code is correct. Wherein, when the check result of step S360 is passed, it means that the first read-out code is correct, and step S370 can be executed. On the contrary, when the check result of step S360 is not passed, it means that the first read-out code is wrong and step S390 is executed accordingly.
步驟S370中,基於第一讀出開機碼是正確的,失敗-安全旗標可被清除為第二邏輯準位,以表示執行失敗-安全開機的條件不存在。並在步驟S380中,主機端可以執行正常的動作。 In step S370 , based on the correctness of the first read boot code, the fail-safe flag can be cleared to the second logic level to indicate that the execution fail-safe boot condition does not exist. And in step S380, the host can perform normal actions.
在另一方面,步驟S390中,主機端再次執行重置命令或啟動硬體重置(Hardware Reset)動作。接著,透過步驟S3100,記憶體內部設定預審旗標為致能。在此,可透過此設定預審旗標為高邏輯準位來完成設定預審旗標為致能的動作,相對應的,當預審旗標為第二邏輯準位時,可視預審旗標為禁能。 On the other hand, in step S390, the host side executes the reset command again or starts a hardware reset (Hardware Reset) action. Next, through step S3100, the pre-check flag is set as enabled in the memory. Here, the action of setting the pre-check flag to enable can be accomplished by setting the pre-check flag to a high logic level. Correspondingly, when the pre-check flag is at the second logic level, the pre-check flag can be viewed as disabled. .
步驟S3110中,則依據被設定為致能的預審旗標來下載記憶體的第二區塊中的備份開機碼,並藉此獲得第二讀出開機 碼。接著,步驟S3120針對第二讀出開機碼執行功能檢查或CRC檢查。若步驟S3120的第二讀出開機檢查動作通過時,則執行步驟S3130。相反的,若步驟S3120的第二讀出開機檢查動作未通過,則進行回報錯誤的動作(步驟S3140)。 In step S3110, download the backup boot code in the second block of the memory according to the pre-qualification flag set as enabled, and thereby obtain the second read boot code code. Next, step S3120 performs a function check or a CRC check for the second readout code. If the second read-out power-on check in step S3120 is passed, step S3130 is executed. On the contrary, if the second readout power-on check operation in step S3120 fails, an error reporting operation is performed (step S3140 ).
在步驟S3130中,主機端可執行失敗-安全旗標的清除動作(清除為第二邏輯準位),並可執行記憶體中第一區塊的開機碼的修復動作。值得一提的,關於開機碼的修復動作的細節,首先可針對記憶體中的第一區塊進行抹除動作。接著再透過將第二區塊中的備份開機碼(亦即第二讀出開機碼)寫回記憶體的第一區塊來完成。 In step S3130, the host side can perform the clearing operation of the fail-safe flag (cleared to the second logic level), and can perform the repairing operation of the boot code of the first block in the memory. It is worth mentioning that, regarding the details of the recovery action of the boot code, the first block in the memory can be erased first. Then, it is completed by writing the backup boot code (ie, the second read boot code) in the second block back to the first block of the memory.
在此請注意,在本實施例中,失敗-安全旗標設置在記憶體中。因此,圖3的記憶體管理流程可透過記憶體以及對應的控制電路來完成。 Note here that in this embodiment, the fail-safe flag is set in memory. Therefore, the memory management process of FIG. 3 can be accomplished through the memory and the corresponding control circuit.
以下請參照圖4,圖4繪示本發明另一實施例的安全開機的記憶體管理方法的流程圖。與前述實施例不相同的,圖4的實施例透過記憶體及其控制器外的使用者(外部電子裝置)來設定強迫交換旗標(等同於前述實施例的失敗-安全旗標)的邏輯準位。 Please refer to FIG. 4 below. FIG. 4 is a flowchart illustrating a memory management method for safe booting according to another embodiment of the present invention. Different from the previous embodiment, the embodiment of FIG. 4 sets the logic of the forced exchange flag (equivalent to the fail-safe flag in the previous embodiment) through the user (external electronic device) outside the memory and its controller. level.
在動作細節上,步驟S410中啟動開機程序。接著,在步驟S430中,可由記憶體的第一區塊下載開機碼,並獲得第一讀出開機碼。 In terms of action details, a boot procedure is started in step S410. Next, in step S430, the boot code can be downloaded from the first block of the memory, and the first read boot code is obtained.
步驟S440中,則針對第一讀出開機碼進行CRC或功能檢查,並藉以判斷第一讀出開機碼的正確與否。若步驟S440的判 斷結果,指示第一讀出開機碼是正確的,步驟S450中可先行禁用強迫交換旗標,並執行正常動作(步驟S460)。相反的,步驟S440的判斷結果,指示第一讀出開機碼是錯誤的,則系統端可將連接至記憶體(強迫交換腳)(步驟S445)的一外部訊號設置為高邏輯準位,並執行一暖開機(warm reboot)的重新開機動作,此同時,記憶體設定預審旗標為致能的動作(步驟S470)。在步驟S480的暖開機動作的等待結束後,在步驟S490中進行下載記憶體中第二區塊的備份開機碼的動作。 In step S440, a CRC or function check is performed on the first read-out boot code, so as to judge whether the first read-out boot code is correct or not. If the decision in step S440 If the disconnection result indicates that the first read-out boot code is correct, in step S450, the forced exchange flag can be disabled in advance, and a normal action is performed (step S460). On the contrary, if the judgment result of step S440 indicates that the first read boot code is wrong, the system can set an external signal connected to the memory (forced switch pin) (step S445) to a high logic level, and A restarting action of a warm reboot is performed, and at the same time, the memory sets the pre-check flag as an action of enabling (step S470 ). After the waiting for the warm-up action in step S480 ends, the action of downloading the backup boot code of the second block in the memory is performed in step S490.
在此請注意,在本實施例中,強迫交換旗標的邏輯準位可由外部的電子裝置來進行設定。在當強迫交換旗標被啟用,且當強迫交換旗標為第一邏輯準位的條件下,步驟S490可以執行下載記憶體中第二區塊的備份開機碼的動作,並藉此獲得第二讀出開機碼。 Please note that in this embodiment, the logic level of the forced exchange flag can be set by an external electronic device. Under the condition that the forced swap flag is enabled and the forced swap flag is at the first logic level, step S490 may execute the action of downloading the backup boot code of the second block in the memory, thereby obtaining the second Read the boot code.
接著,步驟S4100中,針對第二讀出開機碼執行功能檢查或CRC檢查,並在檢查通過時執行步驟S4120,或在檢查不通過時執行步驟S4110以進行錯誤回報。 Next, in step S4100, a function check or CRC check is performed on the second readout code, and step S4120 is performed when the check passes, or step S4110 is performed when the check fails to report an error.
在步驟S4120中,可進行記憶體中第一區塊的開機碼的修復動作,強迫交換旗標可在第一區塊的開機碼修復之後被清除(清除為第二邏輯準位)。 In step S4120, a repair action of the boot code of the first block in the memory can be performed, and the forced swap flag can be cleared (cleared to a second logic level) after the boot code of the first block is repaired.
以下請參照圖5A以及圖5B,圖5A以及圖5B分別繪示本發明實施例的記憶體裝置的不同實施方式的示意圖。在圖5A中,記憶體裝置501包括記憶胞陣列510以及控制電路520。記憶
胞陣列510區分為第一區塊以及第二區塊,並分別儲存開機碼BC1以及備份開機碼BC2。
Please refer to FIGS. 5A and 5B below. FIGS. 5A and 5B are schematic diagrams of different implementations of the memory device according to the embodiment of the present invention, respectively. In FIG. 5A , the
控制電路520可用以執行前述實施例的記憶體管理流程,藉以提升主機端成功開機的機率。
The
在另一方面,控制電路520包括正反器FF1、邏輯電路522以及位址解碼器521。正反器FF1的資料端接收開機位址設定值BA-DEF,正反器FF1的時脈端接收開機觸發信號PUT,正反器FF1的輸出端依據重開機動作所產生的開機觸發信號PUT來產生開機位址設定值BA-DEF。
On the other hand, the
在另一方面,邏輯電路522可作為主機端以及記憶胞陣列510間的膠合邏輯(glue logic)電路。邏輯電路522接收開機碼設定值BC-DEF、最高位元位址HMSB以及正反器FF1的輸出,並進行邏輯運算來產生切換位址MMSAD。另外,位址解碼器521接收低位元位址HLSB以及切換位址MMSAD,並依據低位元位址HLSB以及切換位址MMSAD以值行位址解碼動作來產生存取位址。並依據存取位址以讀取記憶胞陣列510中的開機碼BC1或備份開機碼BC2。
On the other hand, the
在動作細節上,當開機碼設定值BC-DEF被禁能時,位址解碼器521僅能提供存取位址來針對記憶胞陣列510的第一區塊的開機碼BC1進行讀取。在當開機碼設定值BC-DEF被致能時,邏輯電路522可依據最高位元位址HMSB以及正反器FF1的輸出來產生的切換位址MMSAD。
In operation details, when the boot code setting value BC-DEF is disabled, the
進一步說明,在此條件下,當正反器FF1的輸出例如為邏輯準位0時,邏輯電路522可輸出高位元位址HMSB以作為切換位址MMSAD。位址解碼器521則依據切換位址MMSAD以及低位元位址HLSB來產生存取位址。切換位址MMSAD可以為單一個位元,可以做為存取為位址的最高位元,並用以與低位元位址HLSB相整合。在低位元位址HLSB為0且切換位址MMSAD也為0的條件下,位址解碼器521可產生等於000000h(十六進位值)的存取位址來讀取開機碼BC1。
To further illustrate, under this condition, when the output of the flip-flop FF1 is, for example, a logic level of 0, the
當正反器FF1的輸出例如為邏輯準位1時,邏輯電路522可使切換位址MMSAD反向,並使切換位址MMSAD成為邏輯準位1。位址解碼器521則可產生等於800000h(十六進位值)的存取位址來讀取備份開機碼BC2。
When the output of the flip-flop FF1 is, for example, a logic level of 1, the
在此請注意,正反器FF1的輸出可依據開機位址設定值BA-DEF來產生,而當開機位址設定值BA-DEF變更後,正反器FF1需在重開機動作發生後,才可依據開機觸發信號PUT變更所產生的輸出。 Please note here that the output of the flip-flop FF1 can be generated according to the boot address setting value BA-DEF, and when the boot address setting value BA-DEF is changed, the flip-flop FF1 needs to be restarted after the restart. The generated output can be changed according to the power-on trigger signal PUT.
接著請參照圖5B,與圖5A的實施方式不相同的,圖5B的記憶體裝置502中的控制電路520更包括互斥或閘XOR。互斥或閘XOR耦接在正反器FF1的輸出端以及邏輯電路522間。互斥或閘XOR接收預審旗標PREQ以及正反器FF1的輸出。在當預審旗標PREQ被啟用時,正反器FF1的輸出可依據預審旗標PREQ而被反向(或不反向),並藉以變更邏輯電路522所產生的切換位
址MMSAD,並選擇讀出開機碼BC1或備份開機碼BC2。
Next, please refer to FIG. 5B , which is different from the embodiment of FIG. 5A , the
在此,預審旗標PREQ可由一隨機存取記憶體來提供。也就是說,外部電子裝置可以透過對隨機存取記憶體寫入資料來變更預審旗標PREQ,並據以進行讀出開機碼BC1或備份開機碼BC2的切換動作。 Here, the pre-qualification flag PREQ may be provided by a random access memory. That is to say, the external electronic device can change the pre-qualification flag PREQ by writing data to the random access memory, and perform the switching action of reading the boot code BC1 or the backup boot code BC2 accordingly.
綜上所述,本發明透過在記憶胞陣列中的不同區塊分別儲存開機碼以及備份開機碼。並在當開機碼判斷為發生錯誤的狀態下,切換讀取備份開機碼以執行開機動作。如此一來,主機端確保可成功開機,維持系統的正常運作。 To sum up, the present invention stores the boot codes and backup boot codes respectively in different blocks in the memory cell array. And when the boot code is judged to be in an error state, it switches to read the backup boot code to execute the boot action. In this way, the host can be guaranteed to boot successfully and maintain the normal operation of the system.
S110~S150:記憶體管理步驟S110~S150: Memory management steps
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW109110766A TWI768316B (en) | 2020-03-30 | 2020-03-30 | Memory apparatus and memory management method for safe power-up |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW109110766A TWI768316B (en) | 2020-03-30 | 2020-03-30 | Memory apparatus and memory management method for safe power-up |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TW202136995A TW202136995A (en) | 2021-10-01 |
| TWI768316B true TWI768316B (en) | 2022-06-21 |
Family
ID=79601292
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW109110766A TWI768316B (en) | 2020-03-30 | 2020-03-30 | Memory apparatus and memory management method for safe power-up |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI768316B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TWI854589B (en) * | 2023-04-11 | 2024-09-01 | 新唐科技股份有限公司 | Microcontroller circuit and boot control method |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TW200428285A (en) * | 2003-06-03 | 2004-12-16 | Hon Hai Prec Ind Co Ltd | System and method for automatically bootstrap with double boot areas in a single flash ROM |
| US20190213012A1 (en) * | 2018-01-11 | 2019-07-11 | Macronix International Co., Ltd. | Method for managing system boot code memory, memory device and electronic system using the same |
| TW201937367A (en) * | 2018-01-11 | 2019-09-16 | 旺宏電子股份有限公司 | Method for managing system boot code memory, memory device and electronic system using the same |
-
2020
- 2020-03-30 TW TW109110766A patent/TWI768316B/en active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TW200428285A (en) * | 2003-06-03 | 2004-12-16 | Hon Hai Prec Ind Co Ltd | System and method for automatically bootstrap with double boot areas in a single flash ROM |
| US20190213012A1 (en) * | 2018-01-11 | 2019-07-11 | Macronix International Co., Ltd. | Method for managing system boot code memory, memory device and electronic system using the same |
| TW201937367A (en) * | 2018-01-11 | 2019-09-16 | 旺宏電子股份有限公司 | Method for managing system boot code memory, memory device and electronic system using the same |
| TWI678613B (en) * | 2018-01-11 | 2019-12-01 | 旺宏電子股份有限公司 | Method for managing system boot code memory,memory device and manufacturing method thereof |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TWI854589B (en) * | 2023-04-11 | 2024-09-01 | 新唐科技股份有限公司 | Microcontroller circuit and boot control method |
Also Published As
| Publication number | Publication date |
|---|---|
| TW202136995A (en) | 2021-10-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| TWI664574B (en) | Method of patching boot code of read-only memory and system-on-chip | |
| TWI722361B (en) | Method for managing system boot code memory, memory device and electronic system using the same | |
| CN100432948C (en) | A Double BIOS Computer System and Automatic Replacement Method for Damaged BIOS Image | |
| JP4994112B2 (en) | Semiconductor integrated circuit device and memory control method | |
| US20100125752A1 (en) | System for auto-operating backup firmware and method thereof | |
| JP4840859B2 (en) | Semiconductor device and startup method | |
| CN113094107B (en) | Data protection method, device, equipment and computer storage medium | |
| KR100833627B1 (en) | Repairable semiconductor memory device and method | |
| CN105786545B (en) | Breakpoint recovery method and system based on heterogeneous hybrid memory | |
| TWI665606B (en) | A system and a method for testing a data storage device | |
| TWI768316B (en) | Memory apparatus and memory management method for safe power-up | |
| JP4743182B2 (en) | Microcomputer | |
| CN113495808B (en) | Memory device and memory management method for secure booting | |
| CN114911648B (en) | XIP FLASH program driving method and system | |
| CN101354654A (en) | System and method for automatically switching basic input/output program | |
| CN109871334B (en) | Cable modem and method of operation | |
| CN116501409B (en) | Dual-Flash-based server starting method, computer equipment and storage medium | |
| JP2008251154A (en) | Nonvolatile semiconductor memory device | |
| US20070277028A1 (en) | Method and system for recovery from reprogramming failures in nonvolatile memory | |
| TW202420070A (en) | Firmware updating method and data storage device utilizing the same | |
| CN117992082A (en) | Data storage device and firmware updating method | |
| TWI655537B (en) | System code management device and management method thereof | |
| CN113626091A (en) | Starting optimization method and device of solid state disk, computer equipment and storage medium | |
| KR100575927B1 (en) | How to boot from mobile terminal | |
| TWI881649B (en) | Method of recovering a configuration file |