TW202008371A - Data processing system and data processing method - Google Patents

Data processing system and data processing method Download PDF

Info

Publication number
TW202008371A
TW202008371A TW107127283A TW107127283A TW202008371A TW 202008371 A TW202008371 A TW 202008371A TW 107127283 A TW107127283 A TW 107127283A TW 107127283 A TW107127283 A TW 107127283A TW 202008371 A TW202008371 A TW 202008371A
Authority
TW
Taiwan
Prior art keywords
processor
memory
erase
data processing
memory controller
Prior art date
Application number
TW107127283A
Other languages
Chinese (zh)
Other versions
TWI676987B (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 TW107127283A priority Critical patent/TWI676987B/en
Priority to CN201811100135.XA priority patent/CN110806836B/en
Application granted granted Critical
Publication of TWI676987B publication Critical patent/TWI676987B/en
Publication of TW202008371A publication Critical patent/TW202008371A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0626Reducing size or complexity of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

A data processing system includes a memory device, a processor, a memory controller and a detection circuit. The memory device includes a first region and a second region. The first region is configured to store program codes and the second region is configured to store system data. The processor is configured to execute at least one instruction according to the program codes. The processor issues an access control signal to fetch at least a portion of the program codes stored in the first region. The memory controller is coupled between the processor and the memory device and is configured to access the memory device in response to the access control signal. The detection circuit is coupled to the memory controller and is configured to detect whether the processer has entered an idle state. When the detection circuit detects that the processer has entered the idle state, the detection circuit issues a processor idle signal. In response to the processor idle signal, the memory controller issues an erase command. In response to the erase command, the memory device erases at least a portion of data stored in the second region.

Description

資料處理系統與資料處理方法Data processing system and data processing method

本發明係關於一種資料處理系統與資料處理方法,特別是一種可有效降低記憶體之擦除操作對於系統運作之干擾的資料處理系統與資料處理方法。The invention relates to a data processing system and a data processing method, in particular to a data processing system and a data processing method which can effectively reduce the interference of the erase operation of the memory to the system operation.

非揮發性記憶體(Non-volatile memory)為一種斷電後重新啟動後也可以保留資料的記憶體。當應用於電腦裝置或處理器裝置時,非揮發性記憶體通常可被切分出用於儲存應用程式碼的程式碼執行區域(code execution region),或稱應用程式碼區域(application code region),以及用於儲存系統運作時需要被改變或紀錄的資料或參數的資料紀錄區域(data log region)。Non-volatile memory (Non-volatile memory) is a kind of memory that can retain data even after power-off and restart. When applied to a computer device or a processor device, the non-volatile memory can usually be divided into a code execution region (application code region) for storing application code And a data log region used to store data or parameters that need to be changed or recorded during system operation.

一般而言,非揮發性記憶體的寫入(write)操作需花費數個至數十微秒(uS),而擦除(erase)操作需花費數個至數十毫秒(mS),因此,當系統運作過程中需要改變或紀錄資料或參數時,處理器都只會執行寫入動作。亦即,即使資料或參數需要再次被更改或者記錄,為避免造成系統處理程序的延宕,也是將資料或者參數直接寫入新的記憶資料頁或記憶體區塊,而不是在原來的記憶資料頁或記憶體區塊上做擦除及覆寫。Generally speaking, the write operation of non-volatile memory takes several to tens of microseconds (uS), and the erase operation takes several to tens of milliseconds (mS). Therefore, When the system needs to change or record data or parameters during operation, the processor will only perform write operations. That is, even if the data or parameters need to be changed or recorded again, in order to avoid delays in system processing procedures, the data or parameters are written directly to the new memory data page or memory block, rather than the original memory data page Or erase and overwrite on the memory block.

而當資料紀錄區域的使用率達到一定程度時,仍必需執行擦除操作,將資料紀錄區域中無效的資料擦除,以釋放出記憶體空間。When the usage rate of the data recording area reaches a certain level, it is still necessary to perform an erasing operation to erase invalid data in the data recording area to free up memory space.

為使系統運作(例如,應用程式碼區域的存取)不會因資料擦除的進行而受影響,且系統處理程序不會因資料擦除的進行而被迫延宕或中斷,本發明提出一種資料處理系統及適用於此系統的資料處理方法,用以控制資料紀錄區域的擦除操作。In order that the system operation (for example, access to the application code area) will not be affected by the data erasure, and the system processing procedure will not be forced to be delayed or interrupted by the data erasure, the present invention proposes a A data processing system and a data processing method suitable for this system are used to control the erasing operation of the data recording area.

本發明揭露一種資料處理系統,包括記憶體裝置、處理器、記憶體控制器以及偵測電路。記憶體裝置包括第一區域以及第二區域,其中第一區域被配置用以儲存複數程式碼,第二區域被配置用以儲存系統資料。處理器被配置用以根據程式碼執行至少一指令,其中處理器發出一存取控制信號用以取得程式碼之至少一部分。記憶體控制器耦接於處理器與記憶體裝置之間,被配置用以因應存取控制信號存取記憶體裝置。偵測電路耦接至記憶體控制器,被配置用以偵測處理器是否已進入一閒置狀態。當偵測電路偵測到處理器已進入閒置狀態時,偵測電路發出一處理器閒置信號。因應處理器閒置信號,記憶體控制器發出一擦除命令。因應擦除命令,記憶體裝置擦除第二區域所儲存之至少一部分資料。The invention discloses a data processing system including a memory device, a processor, a memory controller and a detection circuit. The memory device includes a first area and a second area, wherein the first area is configured to store a plurality of program codes, and the second area is configured to store system data. The processor is configured to execute at least one instruction according to the code, wherein the processor issues an access control signal to obtain at least a part of the code. The memory controller is coupled between the processor and the memory device, and is configured to access the memory device in response to the access control signal. The detection circuit is coupled to the memory controller and is configured to detect whether the processor has entered an idle state. When the detection circuit detects that the processor has entered an idle state, the detection circuit sends a processor idle signal. In response to the processor idle signal, the memory controller issues an erase command. In response to the erase command, the memory device erases at least a part of the data stored in the second area.

本發明揭露一種資料處理方法,適用於一資料處理系統,資料處理系統包括記憶體裝置、處理器以及記憶體控制器,記憶體裝置包括第一區域以及第二區域,第一區域被配置用以儲存複數程式碼,第二區域被配置用以儲存系統資料,處理器發出存取控制信號用以取得程式碼之至少一部分,並根據取得之程式碼執行至少一指令,記憶體控制器因應存取控制信號存取記憶體裝置,資料處理方法包括:接收一擦除控制信號;偵測處理器是否已進入一閒置狀態;當偵測到處理器已進入閒置狀態時,發出一處理器閒置信號;因應處理器閒置信號,發出一擦除命令;以及因應擦除命令,擦除第二區域所儲存之至少一部分資料。The invention discloses a data processing method suitable for a data processing system. The data processing system includes a memory device, a processor and a memory controller. The memory device includes a first area and a second area. The first area is configured to Store a plurality of code, the second area is configured to store system data, the processor sends an access control signal to obtain at least a part of the code, and executes at least one command according to the obtained code, the memory controller responds to the access The control signal accesses the memory device. The data processing method includes: receiving an erase control signal; detecting whether the processor has entered an idle state; and sending a processor idle signal when it is detected that the processor has entered the idle state; An erase command is issued in response to the processor idle signal; and at least a portion of the data stored in the second area is erased in response to the erase command.

為讓本發明之目的、特徵和優點能更明顯易懂,下文特舉出本發明之具體實施例,並配合所附圖式,作詳細說明如下。目的在於說明本發明之精神而非用以限定本發明之保護範圍,應理解下列實施例可經由軟體、硬體、韌體、或上述任意組合來實現。In order to make the purpose, features and advantages of the present invention more obvious and understandable, specific embodiments of the present invention are specifically listed below, and in conjunction with the accompanying drawings, detailed descriptions are as follows. The purpose is to illustrate the spirit of the present invention rather than to limit the protection scope of the present invention. It should be understood that the following embodiments can be implemented by software, hardware, firmware, or any combination of the above.

如上述,非揮發性記憶體通常可被分為用於儲存應用程式碼的程式碼執行區域(code execution region),或稱應用程式碼區域(application code region),以及用於儲存系統運作時需要被改變或紀錄的資料或參數的資料紀錄區域(data log region)。當系統運作過程中需要改變或紀錄資料或參數時,處理器都只會執行寫入動作。即使資料或參數需要再次被更改或者記錄,為避免造成系統處理程序的延宕,也是將資料或者參數直接寫入新的記憶資料頁或記憶體區塊,而不是在原來的記憶資料頁或記憶體區塊上做擦除及覆寫。As mentioned above, non-volatile memory can generally be divided into a code execution region, or application code region, for storing application code, as well as storage system operation needs. The data log region of the changed or recorded data or parameters. When the system needs to change or record data or parameters during operation, the processor will only perform write operations. Even if the data or parameters need to be changed or recorded again, in order to avoid delays in system processing procedures, the data or parameters are written directly to the new memory data page or memory block, rather than the original memory data page or memory Erase and overwrite on the block.

然而,當資料紀錄區域的使用率達到一定程度時,仍必需執行擦除操作,將資料紀錄區域中無效的資料擦除,以釋放出記憶體空間。However, when the usage rate of the data recording area reaches a certain level, it is still necessary to perform an erasing operation to erase invalid data in the data recording area to free up memory space.

由於一般快閃記憶體的設計會將應用程式碼區域與資料紀錄區域配置於同一塊快閃記憶體,因此當需要對資料紀錄區域進行擦除時,系統便無法對應用程式碼區域進行存取。也就是,程式必須停止運行,直到資料紀錄區域的擦除操作完成。Since the design of the general flash memory will arrange the application code area and the data recording area in the same flash memory, when the data recording area needs to be erased, the system cannot access the application code area . That is, the program must stop running until the erase operation of the data recording area is completed.

為了不影響系統程式的執行,現行的一種解決方法為先將應用程式碼區域內所儲存的程式碼(Application code) 搬移至另一記憶體裝置(例如,一靜態隨機存取記憶體(Static Random-Access Memory,SRAM)),再將系統的處理器導向至SRAM執行,同時對快閃記憶體進行擦除。待快閃記憶體擦除操作完畢後,再將處理器導向回原來快閃記憶體上執行。然而,這種方式會增加程式設計的複雜度與困難度,同時系統也必須預留額外一塊可以容納程式碼大小的SRAM,導致系統成本增加。In order not to affect the execution of system programs, a current solution is to first move the application code stored in the application code area to another memory device (for example, a static random access memory (Static Random -Access Memory, SRAM)), then direct the system's processor to SRAM for execution, and at the same time erase the flash memory. After the flash memory erase operation is completed, the processor is directed back to the original flash memory for execution. However, this method will increase the complexity and difficulty of programming. At the same time, the system must reserve an additional SRAM that can accommodate the size of the code, resulting in an increase in system cost.

現行的另一種解決方法為將應用程式碼區域與資料紀錄區域分別配置於兩個完全獨立的快閃記憶體庫(bank) 中,或是配置在同一個快閃記憶體,但各自有獨立的擦除/寫入控制電路(Erase/Program Control Circuit),使得系統在對資料紀錄區域進行擦除操作時,應用程式碼區域仍可被系統的處理器存取。然而,這種方式會增加硬體電路成本,且需要應用於特別客製化的快閃記憶體。Another current solution is to configure the application code area and data record area in two completely independent flash memory banks (banks), or in the same flash memory, but each has its own independent The Erase/Program Control Circuit makes the application code area still accessible by the system processor when the system is erasing the data recording area. However, this method will increase the cost of the hardware circuit, and needs to be applied to a specially customized flash memory.

為使系統運作(例如,應用程式碼區域的存取)不會因資料擦除的進行而受影響,且系統處理程序不會因資料擦除的進行而被迫延宕或中斷,本發明提出一種資料處理系統及適用於此系統的資料處理方法,用以控制資料紀錄區域的擦除操作。藉由本發明所提出之系統與方法,無須大幅增加硬體成本與系統程式開發複雜度,便可達到不中斷系統程式正常運行的結果,並且相較於現有技術,可有效地把擦除操作對於系統運作的干擾程度降至最低。以下將針對本發明所提出之資料處理系統及資料處理方法做更詳細的介紹。In order that the system operation (for example, access to the application code area) will not be affected by the data erasure, and the system processing procedure will not be forced to be delayed or interrupted by the data erasure, the present invention proposes a A data processing system and a data processing method suitable for this system are used to control the erasing operation of the data recording area. With the system and method proposed by the present invention, without significantly increasing the cost of hardware and the complexity of system program development, the result of uninterrupted normal operation of the system program can be achieved, and compared with the prior art, the erasing operation can be effectively The degree of interference of system operation is minimized. The data processing system and data processing method proposed in the present invention will be described in more detail below.

第1圖係顯示根據本發明之一實施例所述之一資料處理系統方塊圖。根據本發明之一實施例,資料處理系統100可為一微控制器(Micro-Controller Unit,MCU)。資料處理系統100可包括一記憶體裝置110、一記憶體控制器120以及一處理器130。值得注意的是,第1圖為一簡化過的方塊圖,其中僅顯示出與本發明相關的元件。任何熟悉此項技藝者當可理解一資料處理系統亦可包含其他未示於第1圖之元件。Figure 1 shows a block diagram of a data processing system according to an embodiment of the invention. According to an embodiment of the present invention, the data processing system 100 may be a microcontroller (Micro-Controller Unit, MCU). The data processing system 100 may include a memory device 110, a memory controller 120, and a processor 130. It is worth noting that Figure 1 is a simplified block diagram showing only the components related to the present invention. Anyone familiar with this art should understand that a data processing system may also include other components not shown in FIG.

根據本發明之一實施例,記憶體裝置110包括一第一區域以及一第二區域,第一區域可為上述之程式碼執行區域(code execution region),或稱應用程式碼區域(application code region),被配置用以儲存複數程式碼,第二區域可為上述之資料紀錄區域(data log region),被配置用以儲存系統運作時需要被改變或紀錄的資料或參數(以下稱為系統資料)。根據本發明之一實施例,記憶體裝置110可為一快閃記憶體。According to an embodiment of the invention, the memory device 110 includes a first region and a second region. The first region may be the aforementioned code execution region, or application code region ), configured to store plural code, the second area can be the above data log region (data log region), configured to store data or parameters that need to be changed or recorded during system operation (hereinafter referred to as system data) ). According to an embodiment of the invention, the memory device 110 may be a flash memory.

記憶體控制器120耦接於處理器130與記憶體裝置110之間,被配置用以控制記憶體裝置110的存取。The memory controller 120 is coupled between the processor 130 and the memory device 110 and is configured to control the access of the memory device 110.

處理器130可向記憶體控制器120發出一存取控制信號,記憶體控制器120因應存取控制信號存取記憶體裝置110。即,處理器130係透過記憶體控制器120存取記憶體裝置110之應用程式碼區域及資料紀錄區域,以取得(fetch)所欲執行的程式碼及所需之系統資料,其中程式碼可包含一或多個指令(Instruction),處理器130可根據程式碼內容執行對應之指令。The processor 130 may send an access control signal to the memory controller 120, and the memory controller 120 accesses the memory device 110 in response to the access control signal. That is, the processor 130 accesses the application code area and the data recording area of the memory device 110 through the memory controller 120 to fetch the program code to be executed and the required system data, where the code can be Including one or more instructions, the processor 130 can execute the corresponding instructions according to the content of the program code.

更具體的說,處理器130可透過一雙向的匯流排(bus)21耦接至記憶體控制器120,用以傳送複數控制信號,例如,存取控制信號、擦除控制信號等至記憶體控制器120,以及接收透過記憶體控制器120自記憶體裝置110取得之程式碼與系統資料。More specifically, the processor 130 may be coupled to the memory controller 120 through a bidirectional bus 21 to transmit a plurality of control signals, such as access control signals, erase control signals, etc. to the memory The controller 120, and receives the program code and system data obtained from the memory device 110 through the memory controller 120.

記憶體控制器120亦可透過複數匯流排耦接至記憶體裝置110,其中,控制匯流排22用以傳送複數控制指令(Command),位址匯流排23用以傳送所欲存取之資料的位址,資料匯流排24為一雙向的匯流排,用以傳送欲寫入記憶體裝置110之資料,以及接收自記憶體裝置110取得之資料。The memory controller 120 can also be coupled to the memory device 110 through a plurality of busses, wherein the control bus 22 is used to send a plurality of control commands (Command), and the address bus 23 is used to send data to be accessed Address, the data bus 24 is a bidirectional bus used to transmit data to be written to the memory device 110 and receive data obtained from the memory device 110.

第2圖係顯示根據本發明之另一實施例所述之一資料處理系統方塊圖。根據本發明之一實施例,資料處理系統200可為一微控制器(MCU)。資料處理系統200所包含的大部分元件與資料處理系統100相同,因此,相關的說明可參考以上第1圖的介紹,並於此不在贅述。Figure 2 is a block diagram of a data processing system according to another embodiment of the invention. According to an embodiment of the invention, the data processing system 200 may be a microcontroller (MCU). Most of the components included in the data processing system 200 are the same as those of the data processing system 100. Therefore, for related descriptions, reference may be made to the introduction in FIG. 1 above, and details are not repeated here.

根據本發明之一實施例,資料處理系統200可更包括一直接記憶體存取(Direct Memory Access,DMA)控制器240。DMA控制器240透過雙向的匯流排25耦接至記憶體控制器220,被配置用以透過記憶體控制器220存取記憶體裝置210。匯流排25用以將直接記憶體存取請求傳送至記憶體控制器220,以及接收自記憶體裝置210取得之資料。According to an embodiment of the present invention, the data processing system 200 may further include a direct memory access (DMA) controller 240. The DMA controller 240 is coupled to the memory controller 220 through a bidirectional bus 25, and is configured to access the memory device 210 through the memory controller 220. The bus 25 is used to send a direct memory access request to the memory controller 220 and receive data obtained from the memory device 210.

根據本發明之一實施例,記憶體裝置110/210可更包括複數暫存器。於本發明之一實施例中,各記憶體區塊可被配置一可獨立地被設定及控制的暫存器。於本發明之另一實施例中,各記憶體資料頁可被配置一可獨立地被設定及控制的暫存器。各暫存器用以儲存一擦除位元,用以指示該暫存器所對應之一記憶體資料頁或一記憶體區塊所儲存之資料是否需被擦除。According to an embodiment of the invention, the memory device 110/210 may further include a plurality of registers. In one embodiment of the present invention, each memory block can be configured with a register that can be independently set and controlled. In another embodiment of the present invention, each memory data page may be configured with a register that can be independently set and controlled. Each register is used to store an erase bit to indicate whether the data stored in a memory data page or a memory block corresponding to the register needs to be erased.

第3圖係顯示根據本發明之一實施例所述之於複數暫存器所儲存之擦除位元示意圖。各擦除位元可對應於一記憶體資料頁或一記憶體區塊。當擦除位元被設定為1時,代表對應之一記憶體資料頁或一記憶體區塊所儲存之資料需被擦除。因此,於此實施例中,當記憶體控制器120/220對記憶體裝置110/210發出擦除命令以進行擦除操作時,只有記憶體區塊編號或記憶體資料頁編號為2跟3的記憶體區塊或記憶體資料頁所儲存之資料會被擦除,其他的記憶體區塊或記憶體資料頁所儲存之資料則不受影響。根據本發明之一實施例,記憶體裝置120/220可包括一擦除控制電路111/211。因應記憶體控制器120/220所發出之擦除命令,擦除控制電路111/211可根據如第3圖所示之擦除位元所夾帶之資訊擦除第二區域(資料紀錄區域)所儲存之至少一部分資料,例如,第2、3個記憶體區塊或記憶體資料頁所儲存之資料。FIG. 3 is a schematic diagram showing erase bits stored in a complex register according to an embodiment of the invention. Each erase bit may correspond to a memory data page or a memory block. When the erase bit is set to 1, it means that the data stored in a corresponding memory data page or a memory block needs to be erased. Therefore, in this embodiment, when the memory controller 120/220 issues an erase command to the memory device 110/210 to perform an erase operation, only the memory block number or memory data page number is 2 and 3. The data stored in the memory block or the memory data page will be erased, and the data stored in other memory blocks or the memory data page will not be affected. According to an embodiment of the invention, the memory device 120/220 may include an erase control circuit 111/211. In response to the erase command issued by the memory controller 120/220, the erase control circuit 111/211 can erase the second area (data recording area) based on the information carried by the erase bit as shown in FIG. 3 At least a part of the stored data, for example, the data stored in the second or third memory block or the memory data page.

第4圖係顯示根據本發明之一實施例所述之一資料處理方法範例流程圖。首先,記憶體控制器120/220可自處理器130/230接收一擦除控制信號(步驟S402)。根據本發明之一實施例,當系統需要對第二區域(資料紀錄區域)的某些記憶體區塊或記憶體資料頁進行擦除時,便會向記憶體控制器120/220發出擦除控制信號。於此,所述之系統係指針對此資料處理系統100/200所設計的軟體與韌體程式及執行此軟體與韌體程式之處理器130/230的一個整體。因此,擦除控制信號可於處理器130/230執行對應之程式碼的過程中,經由一些對應的判斷認為需要執行擦除操作時發出。FIG. 4 is a flowchart showing an example of a data processing method according to an embodiment of the invention. First, the memory controller 120/220 may receive an erase control signal from the processor 130/230 (step S402). According to an embodiment of the present invention, when the system needs to erase certain memory blocks or memory data pages in the second area (data recording area), it will send an erase to the memory controller 120/220 control signal. Here, the system refers to the entirety of the software and firmware programs designed for the data processing system 100/200 and the processors 130/230 that execute the software and firmware programs. Therefore, the erasure control signal can be issued when the processor 130/230 executes the corresponding program code, and after some corresponding judgment that the erasure operation needs to be performed.

根據本發明之一實施例,擦除控制信號夾帶著第二區域(資料紀錄區域)之哪些位址(或者,記憶體區塊或記憶體資料頁之編號)所儲存之資料需被擦除之資訊。接著,記憶體控制器120/220可根據擦除控制信號夾帶的資訊設定對應之暫存器所儲存之擦除位元(步驟S404)。例如,將需被擦除之記憶體區塊或記憶體資料頁所對應之擦除位元設定為一特定數值。待擦除位元設定完成後,處理器130/230會再對記憶體控制器120/220發出擦除記憶體區塊/記憶體資料頁之命令(亦為一種控制信號)。值得注意的是,於本發明之其他實施例中,記憶體區塊/記憶體資料頁之擦除命令亦可與擦除控制信號一併被發出,或者可整合為同一個控制信號。According to an embodiment of the present invention, the data stored in the addresses (or the number of the memory block or memory data page) in the second area (data recording area) with the erasure control signal needs to be erased News. Then, the memory controller 120/220 can set the erase bit stored in the corresponding register according to the information carried by the erase control signal (step S404). For example, the erase bit corresponding to the memory block or memory data page to be erased is set to a specific value. After the erasing bit setting is completed, the processor 130/230 will issue a command (also a kind of control signal) to the memory controller 120/220 to erase the memory block/memory data page. It is worth noting that in other embodiments of the present invention, the erase command of the memory block/memory data page may also be issued together with the erase control signal, or may be integrated into the same control signal.

根據本發明之一實施例,記憶體控制器120/220可包含一擦除進行計時器(Erase Elapse Timer)121/221。記憶體控制器120/220在收到擦除命令後,並不會立刻對記憶體裝置110/210執行擦除記憶體區塊/記憶體資料頁的工作,而是先設定好擦除進行計時器的時間,此計時器儲存著擦除記憶體區塊/記憶體資料頁所需要的時間。值得注意的是,於本發明之實施例中,當複數個記憶體區塊/記憶體資料頁需被擦除時,這些記憶體區塊/記憶體資料頁的擦除操作係同時被執行的。因此,擦除進行計時器121/221所儲存的時間無須隨著需被擦除之記憶體區塊/記憶體資料頁的數量改變而變化。於本發明之實施例中,步驟S404亦可包含擦除進行計時器121/221的設定。According to an embodiment of the invention, the memory controller 120/220 may include an Erase Elapse Timer 121/221. After receiving the erase command, the memory controller 120/220 does not immediately erase the memory block/memory data page to the memory device 110/210, but first sets the erase for timing The time of the device. This timer stores the time required to erase the memory block/memory data page. It is worth noting that, in the embodiment of the present invention, when a plurality of memory blocks/memory data pages need to be erased, the erasing operations of these memory blocks/memory data pages are simultaneously performed . Therefore, the time stored in the erase progress timer 121/221 does not need to change as the number of memory blocks/memory data pages to be erased changes. In the embodiment of the present invention, step S404 may also include setting the erasure timer 121/221.

根據本發明之一實施例,待擦除位元及擦除進行計時器121/221被設定後,記憶體控制器120/220仍不會立刻對記憶體裝置110/210執行擦除記憶體區塊/記憶體資料頁的工作,而是等待直到資料處理系統100/200或處理器130/230閒置時,才會執行擦除記憶體區塊/記憶體資料頁的工作。According to an embodiment of the present invention, after the erasing bit and erasing progress timer 121/221 are set, the memory controller 120/220 still does not immediately erase the memory area of the memory device 110/210 The task of block/memory data page is to wait until the data processing system 100/200 or the processor 130/230 is idle before the task of erasing the memory block/memory data page is performed.

根據本發明之一實施例,記憶體控制器120/220可更包括一偵測電路122/222,被配置用以偵測處理器130/230是否已進入一閒置狀態(步驟S406)。根據本發明之一實施例,當偵測電路122/222偵測到處理器130/230已進入閒置狀態時,會發出一處理器閒置信號Processor_Idle給記憶體控制器120/220(步驟S408),做後續的工作判斷依據。根據本發明之一實施例,偵測電路122/222可將處理器閒置信號Processor_Idle位元數值設定為’1’,用以代表處理器130/230已進入閒置狀態。According to an embodiment of the invention, the memory controller 120/220 may further include a detection circuit 122/222 configured to detect whether the processor 130/230 has entered an idle state (step S406). According to an embodiment of the present invention, when the detection circuit 122/222 detects that the processor 130/230 has entered an idle state, it will issue a processor idle signal Processor_Idle to the memory controller 120/220 (step S408), Do the basis for subsequent work judgment. According to an embodiment of the present invention, the detection circuit 122/222 may set the value of the processor idle signal Processor_Idle bit to '1', which represents that the processor 130/230 has entered the idle state.

根據本發明如第1圖所示之實施例,因應處理器閒置信號Processor_Idle之接收,記憶體控制器120才對記憶體裝置110發出擦除命令以進行擦除操作(步驟S412)(於此實施例中,步驟S410被略過),同時啟動擦除進行計時器121/221開始計時。根據本發明如第2圖所示之實施例,因應處理器閒置信號Processor_Idle之接收,記憶體控制器220會進一步判斷DMA控制器240是否未發出一直接記憶體存取請求(步驟S410)。當判斷DMA控制器240並未發出直接記憶體存取請求時,記憶體控制器220才對記憶體裝置210發出擦除命令以進行擦除操作(步驟S412),同時啟動擦除進行計時器121/221開始計時。According to the embodiment shown in FIG. 1 of the present invention, in response to the reception of the processor idle signal Processor_Idle, the memory controller 120 issues an erase command to the memory device 110 to perform an erase operation (step S412) (implemented here In the example, step S410 is skipped), and at the same time, the erasure progress timer 121/221 is started to start timing. According to the embodiment shown in FIG. 2 of the present invention, in response to the reception of the processor idle signal Processor_Idle, the memory controller 220 further determines whether the DMA controller 240 has not issued a direct memory access request (step S410). When it is determined that the DMA controller 240 has not issued a direct memory access request, the memory controller 220 issues an erase command to the memory device 210 to perform an erase operation (step S412), and simultaneously starts the erase progress timer 121 /221 starts timing.

最後,因應記憶體控制器120/220所發出之擦除命令,擦除控制電路111/211可根據擦除位元所夾帶之資訊擦除第二區域(資料紀錄區域)所儲存之至少一部分資料(步驟S414)。Finally, in response to the erase command issued by the memory controller 120/220, the erase control circuit 111/211 can erase at least a part of the data stored in the second area (data recording area) according to the information carried by the erase bit (Step S414).

值得注意的是,於本發明之多種可實施架構中,偵測電路與擦除進行計時器並不限於被設置於記憶體控制器內。第5圖係顯示根據本發明之又另一實施例所述之資料處理系統方塊圖。資料處理系統500可為一微控制器(MCU)。資料處理系統500所包含的大部分元件與資料處理系統100/200相同,因此,相關的說明可參考以上第1、2圖的介紹,並於此不在贅述。It is worth noting that, in various implementable architectures of the present invention, the detection circuit and the erase progress timer are not limited to being installed in the memory controller. Figure 5 is a block diagram of a data processing system according to yet another embodiment of the present invention. The data processing system 500 may be a microcontroller (MCU). Most of the components included in the data processing system 500 are the same as those of the data processing system 100/200. Therefore, for related descriptions, reference may be made to the introductions in FIGS. 1 and 2 above, and they are not repeated here.

於此實施例中,擦除進行計時器521與偵測電路522係被配置於記憶體控制器520外部,並且可透過對應之匯流排及/或信號走線與記憶體控制器520溝通。In this embodiment, the erasure progress timer 521 and the detection circuit 522 are arranged outside the memory controller 520, and can communicate with the memory controller 520 through corresponding bus bars and/or signal traces.

值得注意的是,以上所介紹之控制方法、流程與各元件所執行的操作均可適用於如第5圖所示之記憶體裝置510、擦除控制電路511、記憶體控制器520、擦除進行計時器521、偵測電路522、處理器530、以及DMA控制器540等。因此,相關的說明可參考以上的介紹,並於此不在贅述。It is worth noting that the control methods, processes and operations performed by the components described above can be applied to the memory device 510, the erase control circuit 511, the memory controller 520, and the erase as shown in FIG. A timer 521, a detection circuit 522, a processor 530, a DMA controller 540, etc. are performed. Therefore, the relevant description can refer to the above introduction, and will not be repeated here.

根據本發明之一實施例,偵測電路122/222/522可藉由解碼處理器130/230/530所執行之該指令,判斷處理器130/230/530是否已進入閒置狀態。舉例而言,偵測電路122/222/522可解譯(interprete)處理器130/230/530所欲取得之程式碼,以解碼出處理器130/230/530目前所執行或即將執行的指令。根據本發明之一實施例,當處理器130/230/530執行到等待(wait)、while迴圈、反覆跳躍(jump)至同一行程式碼或維持(hold)等相關指令時,偵測電路122/222/522可根據相關指令內容判斷處理器130/230/530是否已進入閒置狀態。According to an embodiment of the present invention, the detection circuit 122/222/522 can determine whether the processor 130/230/530 has entered an idle state by decoding the instruction executed by the processor 130/230/530. For example, the detection circuit 122/222/522 can interpret the code to be obtained by the processor 130/230/530 to decode the instruction currently executed or to be executed by the processor 130/230/530 . According to an embodiment of the invention, when the processor 130/230/530 executes wait, while loop, jump to the same line of code or hold and other related instructions, the detection circuit 122/222/522 can determine whether the processor 130/230/530 has entered the idle state according to the relevant instruction content.

更具體的說,舉例而言,當處理器130/230/530執行到用以等待外界週邊裝置發出中斷信號的WFI(Wait For Interrupt)指令時,偵測電路122/222/522可判斷處理器130/230/530已進入閒置狀態。舉另一例而言,當處理器130/230/530執行到用以等待特定事件的WFE(Wait For Event) 指令時,偵測電路122/222/522可判斷處理器130/230/530已進入閒置狀態。舉又另一例而言,當處理器130/230/530執行到while(1)迴圈或JMP $等類似的指令,使其會持續停留於或反覆跳躍至同一行程式碼執行時,偵測電路122/222/522可判斷處理器130/230/530已進入閒置狀態。More specifically, for example, when the processor 130/230/530 executes a WFI (Wait For Interrupt) command to wait for an external peripheral device to issue an interrupt signal, the detection circuit 122/222/522 can determine the processor 130/230/530 has entered the idle state. As another example, when the processor 130/230/530 executes a WFE (Wait For Event) command to wait for a specific event, the detection circuit 122/222/522 can determine that the processor 130/230/530 has entered Idle state. For another example, when the processor 130/230/530 executes a similar instruction such as while(1) loop or JMP $, it will continue to stay or jump to the same line of code repeatedly. The circuit 122/222/522 can determine that the processor 130/230/530 has entered an idle state.

根據本發明之另一實施例,偵測電路122/222/522亦可偵測處理器130/230/530所欲取得之程式碼所對應之位址是否改變,據以判斷處理器130/230/530是否已進入閒置狀態。舉例而言,當處理器130/230/530送給記憶體控制器110/210/520的位址(所欲存取之程式碼的位址)與先前的一或多個存取請求相同時,偵測電路122/222/522可判斷處理器130/230/530已進入閒置狀態。According to another embodiment of the present invention, the detection circuit 122/222/522 can also detect whether the address corresponding to the program code to be obtained by the processor 130/230/530 has changed, according to which the processor 130/230 is determined /530 has entered the idle state. For example, when the address (the address of the code to be accessed) sent by the processor 130/230/530 to the memory controller 110/210/520 is the same as the previous one or more access requests The detection circuit 122/222/522 can determine that the processor 130/230/530 has entered the idle state.

根據本發明之又另一實施例,偵測電路122/222/522亦可根據處理器130/230/530是否於執行某特定指令後,或者於一段時間內並未向記憶體控制器120/220/520發出存取控制信號用以自應用程式碼區域取得(fetch)所欲執行的程式碼,判斷處理器130/230/530是否已進入閒置狀態。舉例而言,若處理器130/230/530於執行某特定指令後,或者於一段時間內並未向記憶體控制器120/220/520發出存取控制信號用以自應用程式碼區域取得(fetch)所欲執行的程式碼,偵測電路122/222/522可判斷處理器130/230/530已進入閒置狀態。According to yet another embodiment of the present invention, the detection circuit 122/222/522 may also be based on whether the processor 130/230/530 executes a certain instruction or does not report to the memory controller 120/ The 220/520 sends an access control signal to fetch the code to be executed from the application code area to determine whether the processor 130/230/530 has entered an idle state. For example, if the processor 130/230/530 does not send an access control signal to the memory controller 120/220/520 after executing a certain instruction or for a period of time to obtain from the application code area ( fetch) the code to be executed, the detection circuit 122/222/522 can determine that the processor 130/230/530 has entered an idle state.

於本發明之實施例中,只要指令解碼結果、程式碼位址是否改變的判斷結果、及是否未發出存取控制信號以取得所欲執行的程式碼的判斷結果的其中一者成立,偵測電路122/222/522即可據以判斷處理器130/230/530已進入閒置狀態。In the embodiment of the present invention, as long as one of the instruction decoding result, the judgment result of whether the program code address is changed, and whether the access control signal is not issued to obtain the code to be executed is established, the detection The circuit 122/222/522 can then determine that the processor 130/230/530 has entered an idle state.

根據本發明之一實施例,當擦除控制電路111/211/511根據擦除位元所夾帶之資訊擦除第二區域(資料紀錄區域)所儲存之資料時,記憶體控制器120/220/520可進一步根據擦除進行計時器121/221/521的計時結果判斷擦除操作是否完成。當擦除進行計時器121/221/521發生溢位時(例如,計時器預定計數的時間屆滿),會發出溢位信號Time_out通知記憶體控制器120/220/520,記憶體控制器120/220/520可藉此推斷擦除操作應該已經完成。According to an embodiment of the present invention, when the erasing control circuit 111/211/511 erases the data stored in the second area (data recording area) according to the information carried by the erasing bit, the memory controller 120/220 /520 may further determine whether the erasing operation is completed according to the timing result of the erasing progress timer 121/221/521. When the erasure progress timer 121/221/521 overflows (for example, when the timer counts up to expire), an overflow signal Time_out is sent to notify the memory controller 120/220/520 and the memory controller 120/ 220/520 can infer that the erase operation should have been completed.

於接獲溢位信號Time_out後,記憶體控制器120/220/520可讀取需被擦除之記憶體區塊/記憶體資料頁內的資料,用以確認擦除操作是否成功。舉例而言,若需被擦除之記憶體區塊/記憶體資料頁內的資料為一特定值,例如,各位元所記錄的內容均為1,則記憶體控制器120/220/520可判斷擦除操作已成功完成,並且可設定記憶體控制器120/220/520內部之一狀態暫存器(例如,一擦除完畢旗標),用以通知系統擦除操作已成功完成。若記憶體控制器120/220/520判斷擦除操作並未成功,記憶體控制器120/220/520可重新設定擦除進行計時器121/221/521的時間,並且再次對記憶體裝置110/210/510發出擦除命令以進行擦除操作,同時再度啟動擦除進行計時器121/221/521進行計時。此流程可被反覆進行,直到記憶體控制器120/220/520確認擦除操作已成功完成。After receiving the overflow signal Time_out, the memory controller 120/220/520 can read the data in the memory block/memory data page to be erased to confirm whether the erase operation is successful. For example, if the data in the memory block/memory data page to be erased is a specific value, for example, the content recorded by each bit is 1, the memory controller 120/220/520 may It is determined that the erasing operation has been successfully completed, and a state register (for example, an erasing completed flag) in the memory controller 120/220/520 can be set to notify the system that the erasing operation has been successfully completed. If the memory controller 120/220/520 determines that the erase operation is unsuccessful, the memory controller 120/220/520 may reset the time of the erasure progress timer 121/221/521, and the memory device 110 again /210/510 issues an erase command to perform an erase operation, and at the same time restarts the erase progress timer 121/221/521 to count. This process can be repeated until the memory controller 120/220/520 confirms that the erase operation has been successfully completed.

值得注意的是,若於擦除操作的過程中,記憶體控制器120/220/520偵測到處理器閒置信號Processor_Idle的狀態改變,例如,由原先代表處理器130/230/530已進入閒置狀態的位元’1’轉變為代表處理器130/230/530進入非閒置狀態的位元’0’,或者,於另一實施例中,於擦除操作的過程中,記憶體控制器120/220/520自DMA控制器140/240/540接收到直接記憶體存取請求時,記憶體控制器120/220/520將立刻向記憶體裝置110/210/510發出中斷命令,以中斷擦除操作。同時間,記憶體控制器120/220/520亦會暫停擦除進行計時器121/221/521的計時。根據本發明之一實施例,直到記憶體控制器120/220/520再度偵測到處理器閒置信號Processor_Idle指示處理器130/230/530已進入閒置狀態時(例如,轉變為位元’1’時),記憶體控制器120/220/520再度對記憶體裝置110/210/510發出擦除命令以進行擦除操作,同時再次啟動擦除進行計時器121/221/521進行計時。或者,於另一實施例中,直到記憶體控制器120/220/520再度偵測到處理器閒置信號Processor_Idle指示處理器130/230/530已進入閒置狀態時且判斷DMA控制器140/240/540並未發出直接記憶體存取請求時,記憶體控制器120/220/520再度對記憶體裝置110/210/510發出擦除命令以進行擦除操作,同時再次啟動擦除進行計時器121/221/521進行計時。It is worth noting that if the memory controller 120/220/520 detects a state change of the processor idle signal Processor_Idle during the erase operation, for example, the original representative processor 130/230/530 has entered idle The bit '1' of the state changes to a bit '0' representing that the processor 130/230/530 enters the non-idle state, or, in another embodiment, during the erase operation, the memory controller 120 /220/520 When receiving a direct memory access request from the DMA controller 140/240/540, the memory controller 120/220/520 will immediately issue an interrupt command to the memory device 110/210/510 to interrupt the erase Except operation. At the same time, the memory controller 120/220/520 will also pause erasing and count the timers 121/221/521. According to an embodiment of the present invention, until the memory controller 120/220/520 detects the processor idle signal Processor_Idle again to indicate that the processor 130/230/530 has entered the idle state (for example, it transitions to bit '1' Time), the memory controller 120/220/520 issues an erase command to the memory device 110/210/510 again to perform the erase operation, and at the same time restarts the eraser timer 121/221/521 to count. Or, in another embodiment, until the memory controller 120/220/520 detects the processor idle signal Processor_Idle again indicating that the processor 130/230/530 has entered the idle state and judges the DMA controller 140/240/ When the 540 does not issue a direct memory access request, the memory controller 120/220/520 issues an erase command to the memory device 110/210/510 again to perform the erase operation, and at the same time starts the erasure timer 121 /221/521 for timing.

第6圖係顯示根據本發明之一實施例所述之資料處理方法之一範例流程圖,用以說明於擦除操作開始後的資料處理方法流程。於此實施例中所介紹的流程係為記憶體控制器120/220/520所執行的控制流程。當系統沒有向記憶體控制器120/220/520發出擦除控制信號前,記憶體控制器120/220/520係執行其正常工作。當系統向記憶體控制器120/220/520發出擦除控制信號及/或擦除命令後,記憶體控制器120/220/520可根據擦除控制信號夾帶的資訊設定對應之暫存器所儲存之擦除位元,並且設定好擦除進行計時器的時間,以及清除擦除完畢旗標(步驟S602)。接著,記憶體控制器120/220/520判斷處理器130/230/530是否已進入閒置狀態(步驟S604)。FIG. 6 is an exemplary flowchart of a data processing method according to an embodiment of the present invention, for illustrating the flow of the data processing method after the start of the erasing operation. The process described in this embodiment is a control process executed by the memory controller 120/220/520. When the system does not send an erase control signal to the memory controller 120/220/520, the memory controller 120/220/520 performs its normal work. After the system sends an erase control signal and/or an erase command to the memory controller 120/220/520, the memory controller 120/220/520 can set the corresponding register location according to the information carried by the erase control signal The stored erasure bit is set, and the time for the erasure timer is set, and the erasure complete flag is cleared (step S602). Next, the memory controller 120/220/520 determines whether the processor 130/230/530 has entered the idle state (step S604).

若否,則流程回到步驟S604。若是,則記憶體控制器220/520進一步判斷是否自DMA控制器接收到直接記憶體存取請求(步驟S606)(於一些實施例中,步驟S606可省略)。若是,則流程回到步驟S604。If not, the flow returns to step S604. If yes, the memory controller 220/520 further determines whether a direct memory access request is received from the DMA controller (step S606) (in some embodiments, step S606 may be omitted). If yes, the flow returns to step S604.

若處理器130/230/530已進入閒置狀態,且並未接收到直接記憶體存取請求,則記憶體控制器120/220/520啟動擦除進行計時器121/221/521進行計時(步驟S608),並且對記憶體裝置110/210/510發出擦除命令以使其執行擦除操作(步驟S610)。如上述,擦除控制電路111/211/5111可根據擦除位元的設定值擦除資料紀錄區域所儲存之至少一部分資料。If the processor 130/230/530 has entered an idle state and has not received a direct memory access request, the memory controller 120/220/520 starts the erasure timer 121/221/521 to count (step S608), and issue an erase command to the memory device 110/210/510 to perform an erase operation (step S610). As described above, the erasing control circuit 111/211/5111 can erase at least a part of the data stored in the data recording area according to the setting value of the erasing bit.

於擦除操作執行的過程中,記憶體控制器120/220/520會持續偵測處理器閒置信號Processor_Idle的狀態是否改變,以判斷處理器是否仍處於閒置狀態(步驟S612),並且持續判斷是否自DMA控制器接收到直接記憶體存取請求(步驟S614)(於一些實施例中,步驟S614可省略)。若處理器仍處於閒置狀態,且並未自DMA控制器接收到直接記憶體存取請求,則記憶體控制器120/220/520進一步根據擦除進行計時器121/221/521的計時結果判斷擦除操作是否完成(步驟S616)。若擦除操作尚未完成,則流程回到步驟S612。若擦除操作已完成,則記憶體控制器120/220/520進一步確認擦除操作是否成功(步驟S618)。若是,則記憶體控制器120/220/520設定擦除完畢旗標(步驟S620),用以通知系統擦除操作已成功完成。若否,則流程回到步驟S602。During the execution of the erase operation, the memory controller 120/220/520 continuously detects whether the state of the processor idle signal Processor_Idle changes to determine whether the processor is still in the idle state (step S612), and continuously determines whether A direct memory access request is received from the DMA controller (step S614) (in some embodiments, step S614 may be omitted). If the processor is still idle and no direct memory access request is received from the DMA controller, the memory controller 120/220/520 further determines the timing results of the timers 121/221/521 based on the erase Whether the erase operation is completed (step S616). If the erase operation has not been completed, the flow returns to step S612. If the erase operation is completed, the memory controller 120/220/520 further confirms whether the erase operation is successful (step S618). If yes, the memory controller 120/220/520 sets the erasure complete flag (step S620) to notify the system that the erasure operation has been successfully completed. If not, the flow returns to step S602.

另一方面,於擦除操作執行的過程中,若記憶體控制器120/220/520偵測到處理器已進入非閒置狀態,或自DMA控制器接收到直接記憶體存取請求,則記憶體控制器120/220/520停止擦除進行計時器121/221/521 (步驟S622),並且向記憶體裝置110/210/510發出中斷命令(步驟S624),以中斷擦除操作。接著,流程回到步驟S604,記憶體控制器120/220/520回復執行其正常工作,並且持續等待處理器閒置信號Processor_Idle的狀態再度改變(例如,位元數值再度改變為’1’),以及/或直接記憶體存取請求的判斷為否(即,未自DMA控制器接收到直接記憶體存取請求,或於先前接獲的直接記憶體存取請求完成後並未再接收到新的直接記憶體存取請求)時,再命令記憶體裝置110/210/510繼續執行先前未完成的擦除操作,直到擦除進行計時器121/221/521發生溢位(Time_out)並且確認擦除操作成功為止。On the other hand, during the execution of the erase operation, if the memory controller 120/220/520 detects that the processor has entered a non-idle state, or receives a direct memory access request from the DMA controller, the memory The body controller 120/220/520 stops the erase progress timer 121/221/521 (step S622), and issues an interrupt command to the memory device 110/210/510 (step S624) to interrupt the erase operation. Then, the flow returns to step S604, the memory controller 120/220/520 resumes performing its normal work, and continues to wait for the state of the processor idle signal Processor_Idle to change again (for example, the bit value changes to '1' again), and /Or the judgment of the direct memory access request is negative (ie, no direct memory access request is received from the DMA controller, or no new memory is received after the completion of the previously received direct memory access request Direct memory access request), and then instruct the memory device 110/210/510 to continue to perform the previously unfinished erase operation until the erase progress timer 121/221/521 overflow (Time_out) and confirm the erase Until the operation is successful.

如上述,與現有技術不同之處在於,藉由本發明所提出之資料處理系統及適用於此系統的資料處理方法,無須大幅增加硬體成本與系統程式開發複雜度,便可達到不中斷系統程式正常運行的結果,並且相較於現有技術,本發明所提出之資料處理系統及方法可有效地把擦除操作對於系統運作的干擾程度降至最低。As described above, the difference from the prior art is that the data processing system and the data processing method applicable to the system proposed by the present invention can achieve uninterrupted system programs without significantly increasing the hardware cost and the complexity of system program development The result of normal operation, and compared with the prior art, the data processing system and method proposed by the present invention can effectively minimize the degree of interference of the erase operation with the system operation.

申請專利範圍中用以修飾元件之“第一”、“第二”等序數詞之使用本身未暗示任何優先權、優先次序、各元件之間之先後次序、或方法所執行之步驟之次序,而僅用作標識來區分具有相同名稱(具有不同序數詞)之不同元件。The use of ordinal numbers such as "first" and "second" in the scope of the patent application to modify an element itself does not imply any priority, priority order, order between elements, or order of steps performed by the method, It is only used as a logo to distinguish different components with the same name (with different ordinal numbers).

雖然本發明已以較佳實施例揭露如上,然其並非用以限定本發明,任何熟悉此項技藝者,在不脫離本發明之精神和範圍內,當可做些許更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。Although the present invention has been disclosed as above with preferred embodiments, it is not intended to limit the present invention. Anyone who is familiar with this skill can do some modifications and retouching without departing from the spirit and scope of the present invention. Therefore, the present invention The scope of protection shall be as defined in the scope of the attached patent application.

21、22、23、24、25‧‧‧匯流排;100、200、500‧‧‧資料處理系統;110、210、510‧‧‧記憶體裝置;111、211、511‧‧‧擦除控制電路;120、220、520‧‧‧記憶體控制器;121、221、521‧‧‧擦除進行計時器;122、222、522‧‧‧偵測電路;130、230、530‧‧‧處理器;240、540‧‧‧DMA控制器。21, 22, 23, 24, 25‧‧‧‧ bus; 100, 200, 500‧‧‧‧ data processing system; 110, 210, 510‧‧‧ memory device; 111, 211, 511‧‧‧ erasing control Circuit; 120, 220, 520‧‧‧ memory controller; 121, 221, 521‧‧‧ erasing timer; 122, 222, 522‧‧‧ detection circuit; 130, 230, 530‧‧‧ processing Controller; 240, 540 ‧‧‧ DMA controller

第1圖係顯示根據本發明之一實施例所述之一資料處理系統方塊圖。 第2圖係顯示根據本發明之另一實施例所述之一資料處理系統方塊圖。 第3圖係顯示根據本發明之一實施例所述之於複數暫存器所儲存之擦除位元示意圖。 第4圖係顯示根據本發明之一實施例所述之一資料處理方法範例流程圖。 第5圖係顯示根據本發明之又另一實施例所述之資料處理系統方塊圖。 第6圖係顯示根據本發明之一實施例所述之資料處理方法之一範例流程圖。Figure 1 shows a block diagram of a data processing system according to an embodiment of the invention. Figure 2 is a block diagram of a data processing system according to another embodiment of the invention. FIG. 3 is a schematic diagram showing erase bits stored in a complex register according to an embodiment of the invention. FIG. 4 is a flowchart showing an example of a data processing method according to an embodiment of the invention. Figure 5 is a block diagram of a data processing system according to yet another embodiment of the present invention. FIG. 6 is an exemplary flowchart of a data processing method according to an embodiment of the invention.

21、22、23、24、25‧‧‧匯流排 21, 22, 23, 24, 25 ‧‧‧ bus

200‧‧‧資料處理系統 200‧‧‧Data processing system

210‧‧‧記憶體裝置 210‧‧‧Memory device

211‧‧‧擦除控制電路 211‧‧‧Erase control circuit

220‧‧‧記憶體控制器 220‧‧‧Memory controller

221‧‧‧擦除進行計時器 221‧‧‧Erase progress timer

222‧‧‧偵測電路 222‧‧‧ detection circuit

230‧‧‧處理器 230‧‧‧ processor

240‧‧‧DMA控制器 240‧‧‧DMA controller

Claims (10)

一種資料處理系統,包括: 一記憶體裝置,包括一第一區域以及一第二區域,其中該第一區域被配置用以儲存複數程式碼,該第二區域被配置用以儲存系統資料; 一處理器,被配置用以根據該等程式碼執行至少一指令,其中該處理器發出一存取控制信號用以取得該等程式碼之至少一部分; 一記憶體控制器,耦接於該處理器與該記憶體裝置之間,被配置用以因應該存取控制信號存取該記憶體裝置;以及 一偵測電路,耦接至該記憶體控制器,被配置用以偵測該處理器是否已進入一閒置狀態; 其中當該偵測電路偵測到該處理器已進入該閒置狀態時,該偵測電路發出一處理器閒置信號,並且 其中因應該處理器閒置信號,該記憶體控制器發出一擦除命令,以及 其中因應該擦除命令,該記憶體裝置擦除該第二區域所儲存之至少一部分資料。A data processing system includes: a memory device including a first area and a second area, wherein the first area is configured to store a plurality of program codes, and the second area is configured to store system data; A processor configured to execute at least one instruction according to the program codes, wherein the processor issues an access control signal to obtain at least a portion of the program codes; a memory controller coupled to the processor And the memory device, configured to access the memory device in response to an access control signal; and a detection circuit, coupled to the memory controller, configured to detect whether the processor Has entered an idle state; wherein when the detection circuit detects that the processor has entered the idle state, the detection circuit sends a processor idle signal, and in response to the processor idle signal, the memory controller An erase command is issued, and in response to the erase command, the memory device erases at least a portion of the data stored in the second area. 如申請專利範圍第1項所述之資料處理系統,其中該偵測電路被設置於該記憶體控制器內部。The data processing system as described in item 1 of the patent application scope, wherein the detection circuit is provided inside the memory controller. 如申請專利範圍第1項所述之資料處理系統,其中該偵測電路藉由解碼該處理器所執行之該指令,判斷該處理器是否已進入該閒置狀態。The data processing system as described in item 1 of the patent application scope, wherein the detection circuit determines whether the processor has entered the idle state by decoding the instruction executed by the processor. 如申請專利範圍第1項所述之資料處理系統,其中該偵測電路藉由判斷該處理器所欲取得之該等程式碼所對應之位址是否未改變,判斷該處理器是否已進入該閒置狀態。A data processing system as described in item 1 of the patent application scope, wherein the detection circuit determines whether the processor has entered the program by determining whether the addresses corresponding to the program codes that the processor wants to obtain have not changed Idle state. 如申請專利範圍第1項所述之資料處理系統,其中該記憶體裝置更包括複數暫存器,各暫存器用以儲存一擦除位元,各擦除位元用以指示該暫存器所對應之一記憶體資料頁或一記憶體區塊所儲存之資料是否需被擦除。The data processing system as described in item 1 of the patent application scope, wherein the memory device further includes a plurality of registers, each register is used to store an erase bit, and each erase bit is used to indicate the register Whether the data stored in a corresponding memory data page or a memory block needs to be erased. 如申請專利範圍第1項所述之資料處理系統,其中該記憶體控制器更自該處理器接收一擦除控制信號,用以根據該擦除控制信號設定該記憶體裝置之一或多個擦除位元,並且其中於該一或多個擦除位元被設定後,該記憶體控制器等待直到接收到該處理器閒置信號後,才發出該擦除命令。The data processing system as described in item 1 of the patent application range, wherein the memory controller further receives an erase control signal from the processor for setting one or more of the memory devices according to the erase control signal Erase bits, and after the one or more erase bits are set, the memory controller waits until the processor idle signal is received before issuing the erase command. 如申請專利範圍第6項所述之資料處理系統,更包括: 一直接記憶體存取控制器,耦接至該記憶體控制器,被配置用以透過該記憶體控制器存取該記憶體裝置; 其中於該一或多個擦除位元被設定後,該記憶體控制器等待直到接收到該處理器閒置信號,並且進一步判斷該直接記憶體存取控制器並未發出一直接記憶體存取請求後,才發出該擦除命令。The data processing system described in item 6 of the patent application scope further includes: a direct memory access controller, coupled to the memory controller, configured to access the memory through the memory controller Device; wherein after the one or more erase bits are set, the memory controller waits until the processor idle signal is received, and further determines that the direct memory access controller has not issued a direct memory After the access request, the erase command is issued. 一種資料處理方法,適用於一資料處理系統,該資料處理系統包括一記憶體裝置、一處理器以及一記憶體控制器,該記憶體裝置包括一第一區域以及一第二區域,該第一區域被配置用以儲存複數程式碼,該第二區域被配置用以儲存系統資料,該處理器發出一存取控制信號用以取得該等程式碼之至少一部分,並根據取得之該等程式碼執行至少一指令,該記憶體控制器因應該存取控制信號存取該記憶體裝置,該方法包括: 接收一擦除控制信號; 偵測該處理器是否已進入一閒置狀態; 當偵測到該處理器已進入該閒置狀態時,發出一處理器閒置信號; 因應該處理器閒置信號,發出一擦除命令;以及 因應該擦除命令,擦除該第二區域所儲存之至少一部分資料。A data processing method suitable for a data processing system including a memory device, a processor and a memory controller, the memory device includes a first area and a second area, the first The area is configured to store plural codes, the second area is configured to store system data, the processor sends an access control signal to obtain at least a part of the codes, and according to the obtained codes Execute at least one instruction, the memory controller accesses the memory device in response to the access control signal, the method includes: receiving an erase control signal; detecting whether the processor has entered an idle state; when detected When the processor has entered the idle state, a processor idle signal is issued; an erase command is issued in response to the processor idle signal; and at least a portion of the data stored in the second area is erased in response to the erase command. 如申請專利範圍第8項所述之資料處理方法,其中偵測該處理器是否已進入一閒置狀態之步驟更包括: 解碼該處理器所執行之該指令,以判斷該處理器是否已進入該閒置狀態。The data processing method as described in item 8 of the patent application scope, wherein the step of detecting whether the processor has entered an idle state further includes: decoding the instruction executed by the processor to determine whether the processor has entered the Idle state. 如申請專利範圍第9項所述之資料處理方法,其中偵測該處理器是否已進入一閒置狀態之步驟更包括: 判斷該處理器所欲取得之該等程式碼所對應之位址是否未改變,以判斷該處理器是否已進入該閒置狀態。The data processing method as described in item 9 of the patent application scope, wherein the step of detecting whether the processor has entered an idle state further includes: determining whether the address corresponding to the program codes that the processor wants to obtain is not Change to determine whether the processor has entered the idle state.
TW107127283A 2018-08-06 2018-08-06 Data processing system and data processing method TWI676987B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
TW107127283A TWI676987B (en) 2018-08-06 2018-08-06 Data processing system and data processing method
CN201811100135.XA CN110806836B (en) 2018-08-06 2018-09-20 Data processing system and data processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107127283A TWI676987B (en) 2018-08-06 2018-08-06 Data processing system and data processing method

Publications (2)

Publication Number Publication Date
TWI676987B TWI676987B (en) 2019-11-11
TW202008371A true TW202008371A (en) 2020-02-16

Family

ID=69188856

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107127283A TWI676987B (en) 2018-08-06 2018-08-06 Data processing system and data processing method

Country Status (2)

Country Link
CN (1) CN110806836B (en)
TW (1) TWI676987B (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5509134A (en) * 1993-06-30 1996-04-16 Intel Corporation Method and apparatus for execution of operations in a flash memory array
US5930175A (en) * 1997-08-22 1999-07-27 Micron Technology, Inc. Voltage pump switch
JP4110000B2 (en) * 2003-01-28 2008-07-02 株式会社ルネサステクノロジ Storage device
US8261130B2 (en) * 2007-03-02 2012-09-04 Infineon Technologies Ag Program code trace signature
US8688894B2 (en) * 2009-09-03 2014-04-01 Pioneer Chip Technology Ltd. Page based management of flash storage
US9235719B2 (en) * 2011-09-29 2016-01-12 Intel Corporation Apparatus, system, and method for providing memory access control
TWI530954B (en) * 2013-11-22 2016-04-21 新唐科技股份有限公司 Apparatuses for securing software code stored in a non-volatile memory
CN106155940A (en) * 2015-04-17 2016-11-23 扬智科技股份有限公司 The System on Chip/SoC of code and the code protection method of System on Chip/SoC can be protected
KR20170036195A (en) * 2015-09-23 2017-04-03 에스케이하이닉스 주식회사 Semiconductor device and semiconductor system
US10282251B2 (en) * 2016-09-07 2019-05-07 Sandisk Technologies Llc System and method for protecting firmware integrity in a multi-processor non-volatile memory system
WO2018108035A1 (en) * 2016-12-13 2018-06-21 腾讯科技(深圳)有限公司 Information processing and virtual resource exchange method, apparatus, and device

Also Published As

Publication number Publication date
CN110806836A (en) 2020-02-18
TWI676987B (en) 2019-11-11
CN110806836B (en) 2023-03-24

Similar Documents

Publication Publication Date Title
JP4317604B2 (en) Data processing system, non-volatile memory, and method for extending write / erase functions in flash memory
TWI684868B (en) Memory controller and operating method thereof, and controlling method of a memory system
EP3436922B1 (en) Methods and apparatus to perform erase-suspend operations in memory devices
US8327161B2 (en) Command decoder for microcontroller based flash memory digital controller system
US7234049B2 (en) Computer system with NAND flash memory for booting and storage
US5923838A (en) Microcomputer with built-in flash memory
KR100725417B1 (en) Apparatus and method for operating flash memory according to priority
KR100444537B1 (en) Data processor
JP2007058840A5 (en)
JP4960364B2 (en) Hardware-assisted device configuration detection
US20060245274A1 (en) Apparatus and method for controlling NAND flash memory
JP4136359B2 (en) Microcomputer
JP2009517741A (en) Flash memory digital controller system with microcontroller
JP2004030438A (en) Microcomputer
US5940861A (en) Method and apparatus for preempting operations in a nonvolatile memory in order to read code from the nonvolatile memory
US5603010A (en) Performing speculative system memory reads prior to decoding device code
JP2008059052A (en) Semiconductor integrated circuit and microcomputer
TWI676987B (en) Data processing system and data processing method
JP2004227635A (en) Nonvolatile semiconductor memory and microcomputer including nonvolatile semiconductor memory
US10901919B2 (en) Circuit and method for managing access to memory
JP2007034554A (en) Semiconductor integrated circuit and microcomputer
US7487287B2 (en) Time efficient embedded EEPROM/processor control method
JPH11260075A (en) Microcomputer with built-in flash memory and data rewrite method
JPH05314052A (en) Processor
JP2004110407A (en) Serial eeprom interface