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

Data processing system and data processing method Download PDF

Info

Publication number
TWI676987B
TWI676987B TW107127283A TW107127283A TWI676987B TW I676987 B TWI676987 B TW I676987B TW 107127283 A TW107127283 A TW 107127283A TW 107127283 A TW107127283 A TW 107127283A TW I676987 B TWI676987 B TW I676987B
Authority
TW
Taiwan
Prior art keywords
processor
memory
data processing
area
memory controller
Prior art date
Application number
TW107127283A
Other languages
Chinese (zh)
Other versions
TW202008371A (en
Inventor
王政治
Cheng-Chih Wang
郭長煌
Chuang-Huang Kuo
Original Assignee
新唐科技股份有限公司
Nuvoton Technology Corporation
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 新唐科技股份有限公司, Nuvoton Technology Corporation 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

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]

Abstract

一種資料處理系統,包括記憶體裝置、處理器、記憶體控制器以及偵測電路。記憶體裝置包括第一區域以及第二區域,其中第一區域被配置用以儲存複數程式碼,第二區域被配置用以儲存系統資料。處理器被配置用以根據程式碼執行至少一指令,其中處理器發出一存取控制信號用以取得程式碼之至少一部分。記憶體控制器耦接於處理器與記憶體裝置之間,被配置用以因應存取控制信號存取記憶體裝置。偵測電路耦接至記憶體控制器,被配置用以偵測處理器是否已進入一閒置狀態。當偵測電路偵測到處理器已進入閒置狀態時,偵測電路發出一處理器閒置信號。因應處理器閒置信號,記憶體控制器發出一擦除命令。因應擦除命令,擦除第二區域所儲存之至少一部分資料。 A data processing system includes 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 plural 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 sends an access control signal to obtain at least a portion 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, at least a part of the data stored in the second area is erased.

Description

資料處理系統與資料處理方法 Data processing system and 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 memory erasing operation on the system operation.

非揮發性記憶體(Non-volatile memory)為一種斷電後重新啟動後也可以保留資料的記憶體。當應用於電腦裝置或處理器裝置時,非揮發性記憶體通常可被切分出用於儲存應用程式碼的程式碼執行區域(code execution region),或稱應用程式碼區域(application code region),以及用於儲存系統運作時需要被改變或紀錄的資料或參數的資料紀錄區域(data log region)。Non-volatile memory (non-volatile memory) is a type of memory that can retain data even after restarting after a power failure. When applied to a computer device or a processor device, non-volatile memory can usually be segmented into a code execution region for storing application code, or an application code region. , And a data log region for storing 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 several tens of microseconds (uS), and the erase operation takes several to several tens of milliseconds (mS). Therefore, When data or parameters need to be changed or recorded during system 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 the delay of the system process, the data or parameters are written directly into the new memory data page or memory block, instead of 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 the 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 process, and the system processing program will not be forced to be delayed or interrupted by the data erasure process, the present invention proposes A data processing system and a data processing method suitable for the 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 plural 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 sends an access control signal to obtain at least a portion 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, at least a part of the data stored in the second area is erased.

本發明揭露一種資料處理方法,適用於一資料處理系統,資料處理系統包括記憶體裝置、處理器以及記憶體控制器,記憶體裝置包括第一區域以及第二區域,第一區域被配置用以儲存複數程式碼,第二區域被配置用以儲存系統資料,處理器發出存取控制信號用以取得程式碼之至少一部分,並根據取得之程式碼執行至少一指令,記憶體控制器因應存取控制信號存取記憶體裝置,資料處理方法包括:接收一擦除控制信號;偵測處理器是否已進入一閒置狀態;當偵測到處理器已進入閒置狀態時,發出一處理器閒置信號;因應處理器閒置信號,發出一擦除命令;以及因應擦除命令,擦除第二區域所儲存之至少一部分資料。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 The plurality of codes are stored. 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 instruction 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 erasure 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 an idle state; In response to the processor idle signal, an erase command is issued; and in response to the erase command, at least a part of the data stored in the second area is erased.

為讓本發明之目的、特徵和優點能更明顯易懂,下文特舉出本發明之具體實施例,並配合所附圖式,作詳細說明如下。目的在於說明本發明之精神而非用以限定本發明之保護範圍,應理解下列實施例可經由軟體、硬體、韌體、或上述任意組合來實現。In order to make the objects, features, and advantages of the present invention more comprehensible, specific embodiments of the present invention are specifically listed below, and described in detail with the accompanying drawings. The purpose is to explain the spirit of the present invention and not 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 thereof.

如上述,非揮發性記憶體通常可被分為用於儲存應用程式碼的程式碼執行區域(code execution region),或稱應用程式碼區域(application code region),以及用於儲存系統運作時需要被改變或紀錄的資料或參數的資料紀錄區域(data log region)。當系統運作過程中需要改變或紀錄資料或參數時,處理器都只會執行寫入動作。即使資料或參數需要再次被更改或者記錄,為避免造成系統處理程序的延宕,也是將資料或者參數直接寫入新的記憶資料頁或記憶體區塊,而不是在原來的記憶資料頁或記憶體區塊上做擦除及覆寫。As mentioned above, non-volatile memory can usually be divided into a code execution region, or application code region, for storing application code, and a storage system that needs The data log region of the data or parameters that were changed or recorded. When data or parameters need to be changed or recorded during system 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 the delay of the system process, the data or parameters are written directly into the new memory data page or memory block, instead of the original memory data page or memory. Erase and overwrite blocks.

然而,當資料紀錄區域的使用率達到一定程度時,仍必需執行擦除操作,將資料紀錄區域中無效的資料擦除,以釋放出記憶體空間。However, when the utilization 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.

由於一般快閃記憶體的設計會將應用程式碼區域與資料紀錄區域配置於同一塊快閃記憶體,因此當需要對資料紀錄區域進行擦除時,系統便無法對應用程式碼區域進行存取。也就是,程式必須停止運行,直到資料紀錄區域的擦除操作完成。Because the design of general flash memory will allocate the application code area and the data record area in the same flash memory, when the data record 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 the system program, 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 Random Access Memory) -Access Memory (SRAM)), and then the system's processor is directed to the SRAM for execution, while the flash memory is erased. After the flash memory erasing 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 also reserve an additional SRAM that can accommodate the code size, resulting in an increase in system cost.

現行的另一種解決方法為將應用程式碼區域與資料紀錄區域分別配置於兩個完全獨立的快閃記憶體庫(bank) 中,或是配置在同一個快閃記憶體,但各自有獨立的擦除/寫入控制電路(Erase/Program Control Circuit),使得系統在對資料紀錄區域進行擦除操作時,應用程式碼區域仍可被系統的處理器存取。然而,這種方式會增加硬體電路成本,且需要應用於特別客製化的快閃記憶體。Another current solution is to allocate the application code area and the data recording area in two completely independent flash banks, or in the same flash memory, but each has its own independent Erase / Program Control Circuit (Erase / Program Control Circuit), so that when the system erases the data recording area, the application code area can still be accessed by the system's processor. However, this method increases the cost of the hardware circuit and needs to be applied to 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 process, and the system processing program will not be forced to be delayed or interrupted due to the data erasure process, the present invention proposes a A data processing system and a data processing method suitable for the system are used to control the erasing operation of the data recording area. With the system and method provided by the present invention, the results of not interrupting the normal operation of the system program can be achieved without greatly increasing the hardware cost and the complexity of system program development. Compared with the prior art, the erasing operation can effectively Interference with system operation is minimized. The data processing system and data processing method proposed by the present invention will be described in more detail below.

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

根據本發明之一實施例,記憶體裝置110包括一第一區域以及一第二區域,第一區域可為上述之程式碼執行區域(code execution region),或稱應用程式碼區域(application code region),被配置用以儲存複數程式碼,第二區域可為上述之資料紀錄區域(data log region),被配置用以儲存系統運作時需要被改變或紀錄的資料或參數(以下稱為系統資料)。根據本發明之一實施例,記憶體裝置110可為一快閃記憶體。According to an embodiment of the present invention, the memory device 110 includes a first region and a second region. The first region may be the above-mentioned code execution region, or an application code region. ) Is configured to store plural codes, and the second region may be the data log region described above, and is 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 present 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 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 according 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 obtain the code to be executed and the required system data, where the code can be The processor 130 may include one or more instructions, and the processor 130 may execute corresponding instructions according to the content of the 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 an access control signal, an erasure control signal, and the like to the memory. The controller 120 receives 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 buses. Among them, the control bus 22 is used to transmit a plurality of control commands (Command), and the address bus 23 is used to transmit the data to be accessed. Address, the data bus 24 is a two-way bus for transmitting data to be written into the memory device 110 and receiving data obtained from the memory device 110.

第2圖係顯示根據本發明之另一實施例所述之一資料處理系統方塊圖。根據本發明之一實施例,資料處理系統200可為一微控制器(MCU)。資料處理系統200所包含的大部分元件與資料處理系統100相同,因此,相關的說明可參考以上第1圖的介紹,並於此不在贅述。FIG. 2 is a block diagram of a data processing system according to another embodiment of the present invention. According to an embodiment of the present 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 description in FIG. 1 above, and details are not described herein.

根據本發明之一實施例,資料處理系統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 for transmitting a direct memory access request to the memory controller 220 and receiving data obtained from the memory device 210.

根據本發明之一實施例,記憶體裝置110/210可更包括複數暫存器。於本發明之一實施例中,各記憶體區塊可被配置一可獨立地被設定及控制的暫存器。於本發明之另一實施例中,各記憶體資料頁可被配置一可獨立地被設定及控制的暫存器。各暫存器用以儲存一擦除位元,用以指示該暫存器所對應之一記憶體資料頁或一記憶體區塊所儲存之資料是否需被擦除。According to an embodiment of the present invention, the memory devices 110/210 may further include a plurality of registers. In one embodiment of the present invention, each memory block may 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 erasing bit, which is used 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 erasing bits stored in a plurality of registers according to an embodiment of the present invention. Each erasure bit may correspond to a memory data page or a memory block. When the erase bit is set to 1, it means that the corresponding data stored in a memory data page or a memory block needs to be erased. Therefore, in this embodiment, when the memory controller 120/220 sends an erase command to the memory devices 110/210 to perform the erase operation, only the memory block number or the memory data page number is 2 and 3. The data stored in the memory block or memory data page will be erased, and the data stored in other memory blocks or memory data pages will not be affected. According to an embodiment of the present invention, the memory devices 120/220 may include an erasure control circuit 111/211. In response to the erase command issued by the memory controller 120/220, the erasure control circuit 111/211 can erase the second area (data recording area) according to 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 and third memory blocks or the memory data page.

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

根據本發明之一實施例,擦除控制信號夾帶著第二區域(資料紀錄區域)之哪些位址(或者,記憶體區塊或記憶體資料頁之編號)所儲存之資料需被擦除之資訊。接著,記憶體控制器120/220可根據擦除控制信號夾帶的資訊設定對應之暫存器所儲存之擦除位元(步驟S404)。例如,將需被擦除之記憶體區塊或記憶體資料頁所對應之擦除位元設定為一特定數值。待擦除位元設定完成後,處理器130/230會再對記憶體控制器120/220發出擦除記憶體區塊/記憶體資料頁之命令(亦為一種控制信號)。值得注意的是,於本發明之其他實施例中,記憶體區塊/記憶體資料頁之擦除命令亦可與擦除控制信號一併被發出,或者可整合為同一個控制信號。According to an embodiment of the present invention, the erasing control signal clips the addresses stored in the second area (data recording area) (or, the number of the memory block or the memory data page) to be erased. Information. Then, the memory controller 120/220 may set the erasure bit stored in the corresponding register according to the information carried by the erasure 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 setting of the erasing bit is completed, the processor 130/230 will send a command (also a 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 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 present 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 execute the task of erasing the memory block / memory data page on the memory device 110/210, but first sets the erase time. Time, 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 erase operation of these memory blocks / memory data pages is performed simultaneously. . Therefore, the time stored by the erasure 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 bit to be erased and the erasing timer 121/221 are set, the memory controller 120/220 will not immediately erase the memory area on the memory device 110/210. Block / memory data page work, but wait until the data processing system 100/200 or 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 present 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 the idle state, it will send a processor idle signal Processor_Idle to the memory controller 120/220 (step S408), Make judgments for subsequent work. According to an embodiment of the present invention, the detection circuit 122/222 may set the processor idle signal Processor_Idle bit value to '1' to indicate that the processor 130/230 has entered an 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 of the present invention as shown in FIG. 1, in response to the receipt of the processor idle signal Processor_Idle, the memory controller 120 sends 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 the erasing timer 121/221 is started to start counting at the same time. 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 the erase operation (step S412), and simultaneously starts the erase execution 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 erasure 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 erasure timer are not limited to being set in the memory controller. FIG. 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 systems 100/200. Therefore, for related descriptions, please refer to the descriptions in FIGS. 1 and 2 above, and will not be repeated here.

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

值得注意的是,以上所介紹之控制方法、流程與各元件所執行的操作均可適用於如第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 erasure control circuit 511, the memory controller 520, the erasure as shown in FIG. 5 The timer 521, the detection circuit 522, the processor 530, and the DMA controller 540 are performed. Therefore, related descriptions can refer to the above description, 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 (interprete) the code that the processor 130/230/530 wants to obtain, so as to decode the instructions currently executed or to be executed by the processor 130/230/530. . According to an embodiment of the present invention, when the processor 130/230/530 executes the wait, while loop, jump to the same stroke code or hold and other related instructions, the detection circuit 122/222/522 can judge 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) instruction to wait for an interrupt signal from an external peripheral device, the detection circuit 122/222/522 can determine the processor 130/230/530 has entered an idle state. For another example, when the processor 130/230/530 executes a WFE (Wait For Event) instruction 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 a while (1) loop or JMP $, it will continue to stay or repeatedly jump to the execution of the same stroke code. The circuits 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 obtained by the processor 130/230/530 has changed, thereby determining the processor 130/230. / 530 has entered the idle state. For example, when the address given by the processor 130/230/530 to the memory controller 110/210/520 (the address of the code to be accessed) is the same as one or more previous access requests 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是否於執行某特定指令後,或者於一段時間內並未向記憶體控制器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 can also determine whether the processor 130/230/530 has executed a specific instruction or has not sent the memory controller 120 / 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 for a certain period of time after executing a specific instruction, or obtain it from the application code area ( fetch), 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 code address is changed, and whether the access control signal is not issued to obtain the judgment result of the desired code is established, the detection is performed. The circuit 122/222/522 can judge that the processor 130/230/530 has entered the 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 erasure control circuit 111/211/511 erases the data stored in the second area (data recording area) according to the information carried by the erasure bit, the memory controller 120/220 The / 520 can further judge whether the erasing operation is completed according to the timing result of the erasing progress timer 121/221/521. When the erase progress timer 121/221/521 overflows (for example, the timer counts out), it will send an overflow signal Time_out 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, if the content recorded by each element is 1, the memory controller 120/220/520 may It is judged that the erasing operation has been successfully completed, and a status register (for example, an erasing completion flag) inside 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 was unsuccessful, the memory controller 120/220/520 can reset the erasure timer 121/221/521 and reset the memory device 110 again. / 210/510 issues an erase command to perform the erasing operation, and simultaneously starts the erasing 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 the status of the processor idle signal Processor_Idle during the erase operation, for example, the original processor 130/230/530 has entered the idle state. State bit '1' changes to bit '0' representing the processor 130/230/530 entering a non-idle state, or, in another embodiment, during the erase operation, the memory controller 120 / 220/520 When the DMA controller 140/240/540 receives a direct memory access request, the memory controller 120/220/520 will immediately issue an interrupt command to the memory device 110/210/510 to interrupt the erase Division operation. At the same time, the memory controller 120/220/520 will also suspend erasing for timer 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, changes to bit '1') Time), the memory controller 120/220/520 again sends an erase command to the memory device 110/210/510 to perform the erasing operation, and simultaneously starts the erasure timer 121/221/521 to count again. Or, in another embodiment, 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 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 erasing operation, and simultaneously starts the erasure timer 121 again. / 221/521.

第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 a flowchart illustrating an example of a data processing method according to an embodiment of the present invention, and is used to explain the flow of the data processing method after the erasing operation is started. The process described in this embodiment is a control process performed by the memory controller 120/220/520. Before the system does not send the erasure 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 erased bits are stored, and the erasing timer and the erasing completion flag are set (step S602). Next, the memory controller 120/220/520 determines whether the processor 130/230/530 has entered an 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 the 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 an erase command is issued to the memory devices 110/210/510 to cause it to perform an erase operation (step S610). As described above, the erasure control circuit 111/211/5111 can erase at least a part of the data stored in the data recording area according to the set value of the erasure 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 has changed to determine whether the processor is still idle (step S612), and continues to determine 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 has been received from the DMA controller, the memory controller 120/220/520 further judges based on the timing results of the erasure timer 121/221/521 Whether the erasing operation is completed (step S616). If the erase operation has not been completed, the flow returns to step S612. If the erase operation has been 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 erasing completion flag (step S620) to notify the system that the erasing 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 erasing the timer 121/221/521 (step S622), and issues an interrupt command to the memory device 110/210/510 (step S624) to interrupt the erasing operation. Then, the flow returns to step S604, the memory controller 120/220/520 returns to perform its normal work, and continuously waits 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 no (that is, no direct memory access request has been received from the DMA controller, or no new one has been received after the previously received direct memory access request is completed Direct memory access request), then instruct the memory device 110/210/510 to continue to perform the previously uncompleted erase operation until the erasure timer 121/221/521 overflows (Time_out) and confirms the erasure Until the operation is successful.

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

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

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

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

100、200、500‧‧‧資料處理系統 100, 200, 500‧‧‧ data processing system

110、210、510‧‧‧記憶體裝置 110, 210, 510‧‧‧Memory devices

111、211、511‧‧‧擦除控制電路 111, 211, 511‧‧‧ Erase control circuit

120、220、520‧‧‧記憶體控制器 120, 220, 520‧‧‧Memory controller

121、221、521‧‧‧擦除進行計時器 121, 221, 521‧‧‧‧ Erase progress timer

122、222、522‧‧‧偵測電路 122, 222, 522‧‧‧ detection circuits

130、230、530‧‧‧處理器 130, 230, 530‧‧‧ processors

240、540‧‧‧DMA控制器 240, 540‧‧‧DMA controller

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

Claims (8)

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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5930175A (en) * 1997-08-22 1999-07-27 Micron Technology, Inc. Voltage pump switch
US20080215920A1 (en) * 2007-03-02 2008-09-04 Infineon Technologies Program code trace signature
US20130262877A1 (en) * 2011-09-29 2013-10-03 Michael Neve de Mevergnies Apparatus, system, and method for providing memory access control
US9653133B2 (en) * 2015-09-23 2017-05-16 SK Hynix Inc. Semiconductor device and semiconductor system
US20180067800A1 (en) * 2016-09-07 2018-03-08 Sandisk Technologies Llc System and method for protecting firmware integrity in a multi-processor non-volatile memory system
TW201822017A (en) * 2016-12-13 2018-06-16 大陸商騰訊科技(深圳)有限公司 Information processing method, system, and apparatus, server, and mobile terminal device

Family Cites Families (5)

* 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
JP4110000B2 (en) * 2003-01-28 2008-07-02 株式会社ルネサステクノロジ Storage device
US8688894B2 (en) * 2009-09-03 2014-04-01 Pioneer Chip Technology Ltd. Page based management of flash storage
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5930175A (en) * 1997-08-22 1999-07-27 Micron Technology, Inc. Voltage pump switch
US20080215920A1 (en) * 2007-03-02 2008-09-04 Infineon Technologies Program code trace signature
US20130262877A1 (en) * 2011-09-29 2013-10-03 Michael Neve de Mevergnies Apparatus, system, and method for providing memory access control
US9653133B2 (en) * 2015-09-23 2017-05-16 SK Hynix Inc. Semiconductor device and semiconductor system
US20180067800A1 (en) * 2016-09-07 2018-03-08 Sandisk Technologies Llc System and method for protecting firmware integrity in a multi-processor non-volatile memory system
TW201822017A (en) * 2016-12-13 2018-06-16 大陸商騰訊科技(深圳)有限公司 Information processing method, system, and apparatus, server, and mobile terminal device

Also Published As

Publication number Publication date
TW202008371A (en) 2020-02-16
CN110806836B (en) 2023-03-24
CN110806836A (en) 2020-02-18

Similar Documents

Publication Publication Date Title
JP4317604B2 (en) Data processing system, non-volatile memory, and method for extending write / erase functions in flash memory
EP3436922B1 (en) Methods and apparatus to perform erase-suspend operations in memory devices
US10521375B2 (en) Controller for a memory system
US7234049B2 (en) Computer system with NAND flash memory for booting and storage
JP5043302B2 (en) Controller for controlling non-volatile memory
US8327161B2 (en) Command decoder for microcontroller based flash memory digital controller system
US5923838A (en) Microcomputer with built-in flash memory
KR100469569B1 (en) System and method for enabling non-volatile memory to execute code while operating as a data storage/processing device
US20180307496A1 (en) Methods for gc (garbage collection) por (power off recovery) and apparatuses using the same
JP4136359B2 (en) Microcomputer
US20060245274A1 (en) Apparatus and method for controlling NAND flash memory
JP4960364B2 (en) Hardware-assisted device configuration detection
JP2007058840A5 (en)
JP2008090876A (en) Nonvolatile semiconductor memory device
TWI639086B (en) Memory and method for operating a memory with interruptible command sequence
US5940861A (en) Method and apparatus for preempting operations in a nonvolatile memory in order to read code from the nonvolatile memory
US10776042B2 (en) Methods for garbage collection and apparatuses using the same
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
US7487287B2 (en) Time efficient embedded EEPROM/processor control method
US20220415405A1 (en) Memory-control circuit and method for controlling erasing operation of flash memory
JPH11260075A (en) Microcomputer with built-in flash memory and data rewrite method