JP2020135656A - File management system - Google Patents

File management system Download PDF

Info

Publication number
JP2020135656A
JP2020135656A JP2019030888A JP2019030888A JP2020135656A JP 2020135656 A JP2020135656 A JP 2020135656A JP 2019030888 A JP2019030888 A JP 2019030888A JP 2019030888 A JP2019030888 A JP 2019030888A JP 2020135656 A JP2020135656 A JP 2020135656A
Authority
JP
Japan
Prior art keywords
data
file
management
sector
area
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
JP2019030888A
Other languages
Japanese (ja)
Inventor
順一 古川
Junichi Furukawa
順一 古川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Intellectual Property Management Co Ltd
Original Assignee
Panasonic Intellectual Property Management Co Ltd
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 Panasonic Intellectual Property Management Co Ltd filed Critical Panasonic Intellectual Property Management Co Ltd
Priority to JP2019030888A priority Critical patent/JP2020135656A/en
Publication of JP2020135656A publication Critical patent/JP2020135656A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

To materialize a file system that is suitable for a system having small memory size.SOLUTION: A file management system 20 comprises: a data region 22 that is a memory space in which file data is stored; and a management region 24 that is a memory space in which attribute information pertaining to the file data is stored. The data region 22 is divided into a plurality of sectors, and one piece of file data is stored in continuing sectors. When the one piece of file data is stored in the data region 22, an identification name of the file data and one piece of attribute information indicating a beginning position of the continuing sectors are stored in the management region 24.SELECTED DRAWING: Figure 2

Description

本開示はデータ処理技術に関し、特にファイル管理システムに関する。 The present disclosure relates to data processing techniques, especially file management systems.

様々な機器が通信ネットワークに接続されるIoT(Internet of Things)が進展している。通信ネットワークに接続される家電製品やセンサ装置等に組み込まれるコンピュータシステム(組み込みシステムとも呼ばれる)では、マイクロコントローラ(ワンチップマイコンとも呼ばれる)が使用されることがある。 The IoT (Internet of Things), in which various devices are connected to communication networks, is progressing. A microcontroller (also called a one-chip microcomputer) may be used in a computer system (also called an embedded system) incorporated in a home appliance or a sensor device connected to a communication network.

特許第4745337号Patent No. 4745337

PC等と同様に、組み込みシステムにおいても、ファイルシステムが利用できることのメリットは大きい。しかし、マイクロコントローラのメモリサイズは、大きくても数MBである。そのため、組み込みシステムにおいて従来のファイルシステムを利用することは困難であった。 As with PCs, the advantage of being able to use a file system is great in embedded systems. However, the memory size of the microcontroller is at most several MB. Therefore, it has been difficult to use a conventional file system in an embedded system.

本開示はこうした状況に鑑みてなされたものであり、1つの目的は、メモリサイズが小さいシステムに好適なファイルシステムを実現することにある。 The present disclosure has been made in view of these circumstances, and one object is to realize a file system suitable for a system having a small memory size.

上記課題を解決するために、本発明のある態様のファイル管理システムは、ファイルデータが格納されるメモリ空間であるデータ領域と、ファイルデータに関する属性情報が格納されるメモリ空間である管理領域と、を備える。データ領域は、複数のセクタに分割されており、1つのファイルデータは、連続するセクタに格納され、1つのファイルデータがデータ領域に格納される場合、管理領域には、1つのファイルデータの識別名称と、連続するセクタの先頭位置とを示す1つの属性情報が格納される。 In order to solve the above problems, the file management system of a certain aspect of the present invention includes a data area which is a memory space in which file data is stored, a management area which is a memory space in which attribute information related to file data is stored, and the like. To be equipped. The data area is divided into a plurality of sectors, one file data is stored in consecutive sectors, and when one file data is stored in the data area, the management area identifies one file data. One attribute information indicating the name and the start position of consecutive sectors is stored.

なお、以上の構成要素の任意の組合せ、本開示の表現を、装置、方法、コンピュータプログラム、コンピュータプログラムを記録した記録媒体などの間で変換したものもまた、本開示の態様として有効である。 It should be noted that any combination of the above components and the expression of the present disclosure converted between an apparatus, a method, a computer program, a recording medium on which a computer program is recorded, and the like are also effective as aspects of the present disclosure.

本開示によれば、メモリサイズが小さいシステムに好適なファイルシステムを実現することができる。 According to the present disclosure, it is possible to realize a file system suitable for a system having a small memory size.

実施例のマイクロコントローラのハードウェア構成を示す図である。It is a figure which shows the hardware configuration of the microcontroller of an Example. 実施例のファイル管理システムの機能ブロックを示すブロック図である。It is a block diagram which shows the functional block of the file management system of an Example. 管理領域に格納される管理情報の構成を示す図である。It is a figure which shows the structure of the management information stored in a management area. 管理情報のウェアレベリングを模式的に示す図である。It is a figure which shows the wear leveling of management information schematically. ファイル管理システムの起動時の動作を示すフローチャートである。It is a flowchart which shows the operation at the time of starting a file management system. ファイルデータ書き込み時の動作を示すフローチャートである。It is a flowchart which shows the operation at the time of writing a file data. ファイルデータ削除時の動作を示すフローチャートである。It is a flowchart which shows the operation at the time of deleting a file data. ファイルデータが削除された状態を模式的に示す図である。It is a figure which shows typically the state which the file data was deleted. 図9(a)と図9(b)は、ファイルデータを非連続のセクタ群に書き込む例を示す図である。9 (a) and 9 (b) are diagrams showing an example of writing file data to a non-contiguous sector group.

本開示における装置または方法の主体は、コンピュータを備えている。このコンピュータがプログラムを実行することによって、本開示における装置または方法の主体の機能が実現される。コンピュータは、プログラムにしたがって動作するプロセッサを主なハードウェア構成として備える。プロセッサは、プログラムを実行することによって機能を実現することができれば、その種類は問わない。プロセッサは、半導体集積回路(IC)、またはLSI(large scale integration)を含む1つまたは複数の電子回路で構成される。ここではICやLSIと呼んでいるが、集積の度合いによって呼び方が変わり、システムLSI、VLSI(very large scale integration)もしくはUSLI(ultra large scale integration)と呼ばれるものであってもよい。LSIの製造後にプログラムされる、フィールド・プログラマブル・ゲート・アレイ(FPGA)、又はLSI内部の接合関係の再構成又はLSI内部の回路区画のセットアップができる再構成可能な論理デバイスも同じ目的で使うことができる。複数の電子回路は、1つのチップに集積されてもよいし、複数のチップに設けられてもよい。複数のチップは1つの装置に集約されていてもよいし、複数の装置に備えられていてもよい。プログラムは、コンピュータが読み取り可能なROM、光ディスク、ハードディスクドライブなどの非一時的記録媒体に記録される。プログラムは、記録媒体に予め格納されていてもよいし、インターネット等を含む広域通信網を介して記録媒体に供給されてもよい。 The subject of the device or method in the present disclosure comprises a computer. By executing the program by this computer, the function of the subject of the device or method in the present disclosure is realized. A computer has a processor that operates according to a program as a main hardware configuration. The type of processor does not matter as long as the function can be realized by executing the program. A processor is composed of one or more electronic circuits including a semiconductor integrated circuit (IC) or an LSI (large scale integration). Although they are called ICs and LSIs here, they may be called system LSIs, VLSIs (very large scale integrations) or USLIs (ultra large scale integrations), depending on the degree of integration. Field programmable gate arrays (FPGAs), which are programmed after the LSI is manufactured, or reconfigurable logic devices that can reconfigure the junction relationships inside the LSI or set up circuit partitions inside the LSI should also be used for the same purpose. Can be done. The plurality of electronic circuits may be integrated on one chip or may be provided on a plurality of chips. A plurality of chips may be integrated in one device, or may be provided in a plurality of devices. The program is recorded on a non-temporary recording medium such as a computer-readable ROM, optical disc, or hard disk drive. The program may be stored in the recording medium in advance, or may be supplied to the recording medium via a wide area communication network including the Internet or the like.

実施例の概要を説明する。組み込みシステムで使用されるCPUやSoC(System-On-a-Chip)(実施例ではマイクロコントローラ)は、ROM(Read Only Memory)およびRAM(Random Access Memory)のサイズが非常に小さい。例えば、OSにLinux(登録商標)を搭載する組み込みシステムでは、ROMおよびRAMの最低サイズがそれぞれ64MB程度となるが、マイクロコントローラにおけるROMおよびRAMのサイズは大きくても2MB程度である。 The outline of the embodiment will be described. The CPU and SoC (System-On-a-Chip) (microcontroller in the embodiment) used in the embedded system have very small ROM (Read Only Memory) and RAM (Random Access Memory) sizes. For example, in an embedded system in which Linux (registered trademark) is installed in an OS, the minimum size of ROM and RAM is about 64 MB, respectively, but the size of ROM and RAM in a microcontroller is about 2 MB at the maximum.

PC等においてROMやRAMのデータを活用する場合、ファイルシステムを使用して、ファイル単位でデータを管理することが一般的である。組み込みシステムにおいても、OSがファイルシステムの機能を提供する場合(組み込みLinux等)、ファイル単位でデータを管理することができる。しかし、リアルタイムOS等、ファイルシステムを前提としない軽量なOSを使用する場合、PC等で使用されているファイルシステムを移植するか、もしくは、ファイルシステムを使用せずにROMのデータを直に管理する必要がある。 When utilizing ROM or RAM data in a PC or the like, it is common to use a file system to manage the data in file units. Even in an embedded system, when the OS provides a file system function (embedded Linux, etc.), data can be managed in file units. However, when using a lightweight OS such as a real-time OS that does not assume a file system, either port the file system used in a PC or the like, or manage the ROM data directly without using the file system. There is a need to.

ファイルシステムの従来例としてFATファイルシステムがある。FATファイルシステムでは、種々の管理用データをユーザデータと同様にROMに配置し、また、「File Allocation Table(FAT)」と呼ばれる参照テーブルを設ける。FATは、ROMやハードディスク上で断片化したデータを1つのファイルとして管理するためのテーブルであるが、ROMの容量に応じて一定のメモリ領域を占有する。また、FATファイルシステムでは、ファイルの他にディレクトリ(フォルダとも呼ばれる)の概念もあり、フォルダもファイルと同様に管理され、一定のメモリ領域を占有する。 There is a FAT file system as a conventional example of a file system. In the FAT file system, various management data are arranged in the ROM in the same manner as the user data, and a reference table called "File Allocation Table (FAT)" is provided. The FAT is a table for managing fragmented data on the ROM or the hard disk as one file, and occupies a certain memory area according to the capacity of the ROM. Further, in the FAT file system, there is a concept of a directory (also called a folder) in addition to a file, and the folder is managed in the same manner as a file and occupies a certain memory area.

ファイルシステムの別の従来例としてJFFS2(Journaling Flash File System, version 2)がある。JFFS2は、組み込みシステムに搭載されるLinuxで使用されるファイルシステムであり、フラッシュROM等の不揮発性メモリの使用を前提に作られている。フラッシュROMは、複数のセクタにより構成され、各セクタは、フラッシュROMのデータを消去する際の消去単位である。JFFS2では、1つのセクタに複数のノード(データの塊)が記録され、1つのファイルは複数のノードにより構成される。 Another conventional example of a file system is JFFS2 (Journaling Flash File System, version 2). JFFS2 is a file system used in Linux installed in an embedded system, and is made on the assumption that a non-volatile memory such as a flash ROM is used. The flash ROM is composed of a plurality of sectors, and each sector is an erasing unit when erasing data in the flash ROM. In JFFS2, a plurality of nodes (data chunks) are recorded in one sector, and one file is composed of a plurality of nodes.

ROMおよびRAMのサイズが小さい組み込みシステムにおいてもファイルシステムが利用できることのメリットは大きい。ファイルシステムを使用することで、例えば、複数のプログラムで共通のAPI(Application Programming Interface)を利用してファイルを管理でき、また、データの追加や削除も容易になる。一方、従来のファイルシステム(上記のFATファイルシステムやJFFS2等)は、ファイルやディレクトリの管理情報によりROM領域を大量に使用するため、ROMおよびRAMのサイズが小さい組み込みシステムでは使用が困難であった。 The advantage of being able to use the file system is great even in embedded systems with small ROM and RAM sizes. By using a file system, for example, files can be managed using a common API (Application Programming Interface) in a plurality of programs, and data can be easily added or deleted. On the other hand, conventional file systems (FAT file system, JFFS2, etc.) use a large amount of ROM area due to file and directory management information, so it is difficult to use in embedded systems with small ROM and RAM sizes. ..

ROMおよびRAMのサイズが小さい組み込みシステムでは、記憶すべきデータのサイズは、大きくても数百KBと想定される。また、組み込みシステムでは、基本的には最初(例えば工場出荷時)にROMに書かれたデータがそのまま使い続けられ、データの追加や削除は稀である。また、組み込みシステムではファイルの種類も少ないため、ディレクトリや拡張子でファイルを分類する必要はない。これらを考慮し、実施例では、ROMおよびRAMのサイズが小さい組み込みシステムに好適なファイルシステムを提案する。 In embedded systems with small ROM and RAM sizes, the size of data to be stored is assumed to be at most several hundred KB. Further, in an embedded system, basically, the data written in the ROM at the beginning (for example, at the time of shipment from the factory) is continuously used as it is, and the addition or deletion of the data is rare. Also, since there are few types of files in embedded systems, there is no need to classify files by directory or extension. In consideration of these, in the embodiment, a file system suitable for an embedded system having a small size of ROM and RAM is proposed.

図1は、実施例のマイクロコントローラ10のハードウェア構成を示す。マイクロコントローラ10は、CPUコア12、ROM14、RAM16、入出力装置18を備える。CPUコア12は、各種データ処理を実行する。ROM14およびRAM16は、CPUコア12によるデータ処理において参照され、または更新されるデータを記憶する。実施例のROM14は、書き換え可能なフラッシュROMである。また、実施例のRAM16は、SDRAM(Synchronous Dynamic RAM)である。入出力装置18は、外部機器とデータを送受信する。 FIG. 1 shows the hardware configuration of the microcontroller 10 of the embodiment. The microcontroller 10 includes a CPU core 12, a ROM 14, a RAM 16, and an input / output device 18. The CPU core 12 executes various data processing. The ROM 14 and the RAM 16 store data that is referenced or updated in data processing by the CPU core 12. The ROM 14 of the embodiment is a rewritable flash ROM. Further, the RAM 16 of the embodiment is an SDRAM (Synchronous Dynamic RAM). The input / output device 18 transmits / receives data to / from an external device.

図2は、実施例のファイル管理システム20の機能ブロックを示すブロック図である。実施例のファイル管理システム20は、図1のマイクロコントローラ10に導入され、マイクロコントローラ10においてファイル単位でデータを管理するためのファイルシステムを実現する。 FIG. 2 is a block diagram showing a functional block of the file management system 20 of the embodiment. The file management system 20 of the embodiment is introduced into the microcontroller 10 of FIG. 1, and realizes a file system for managing data in a file unit in the microcontroller 10.

ファイル管理システム20は、ROM14内にデータ領域22と管理領域24とを備える。データ領域22は、ファイルとして管理すべきデータであるファイルデータが格納されるメモリ空間である。データ領域22は、複数の固定長のセクタに分割されており、1つのファイルデータは、原則として連続するセクタに格納される。実施例では、各セクタのサイズは、512バイトとする。 The file management system 20 includes a data area 22 and a management area 24 in the ROM 14. The data area 22 is a memory space in which file data, which is data to be managed as a file, is stored. The data area 22 is divided into a plurality of fixed-length sectors, and one file data is stored in consecutive sectors in principle. In the embodiment, the size of each sector is 512 bytes.

図2では、データ領域22に、5つのファイルデータ(ファイルf1〜ファイルf5)が格納されている。ROM14では、ファイルデータはセクタ単位で配置される。例えば、ファイルf1は、セクタs0の先頭アドレスからセクタs2に亘り配置される。セクタs0およびセクタs1の全領域はファイルf1のデータで埋められ、ファイルf1の残りのデータが、セクタs2の一部または全領域に配置される In FIG. 2, five file data (files f1 to f5) are stored in the data area 22. In ROM 14, file data is arranged in sector units. For example, the file f1 is arranged from the start address of the sector s0 to the sector s2. The entire area of sector s0 and sector s1 is filled with the data of file f1, and the remaining data of file f1 is arranged in a part or all area of sector s2.

管理領域24は、ファイルデータに関する属性情報が格納されるメモリ空間である。1つのファイルデータがデータ領域(典型的には連続する1つ以上のセクタ)に格納される場合、管理領域24には、1つの属性情報(実施例では「管理ブロック」とも呼ぶ)が格納される。以下、1つのセクタまたは複数のセクタを総称して「セクタ群」とも呼ぶ。例外として、1つのファイルデータが非連続のセクタ群に分散して格納される場合、管理領域24には、非連続のセクタ群ごとに1つの管理ブロックが格納される。 The management area 24 is a memory space in which attribute information related to file data is stored. When one file data is stored in a data area (typically one or more consecutive sectors), one attribute information (also referred to as a "management block" in the embodiment) is stored in the management area 24. File. Hereinafter, one sector or a plurality of sectors are collectively referred to as a "sector group". As an exception, when one file data is distributed and stored in a discontinuous sector group, one management block is stored in the management area 24 for each discontinuous sector group.

1つのファイルデータに対応する管理ブロックには、上記1つのファイルデータの識別名称(典型的にはファイル名)と、上記1つのファイルデータが格納された連続するセクタの先頭位置とが記録される。管理領域24には、データ領域22に格納された複数のファイルデータに対応する複数の管理ブロックを含む管理情報が格納される。 In the management block corresponding to one file data, the identification name (typically the file name) of the one file data and the start position of consecutive sectors in which the one file data is stored are recorded. .. The management area 24 stores management information including a plurality of management blocks corresponding to the plurality of file data stored in the data area 22.

図2の管理領域24には、管理ブロック26a、管理ブロック26b、管理ブロック26c(これらを総称する場合「管理ブロック26」と呼ぶ)が格納されている。管理ブロック26aは、ファイルf1に対応し、開始セクタとしてセクタs0が記録される。管理ブロック26bは、ファイルf2に対応し、開始セクタとしてセクタs3が記録される。管理ブロック26cは、ファイルf3に対応し、開始セクタとしてセクタs5が記録される。 The management block 26a, management block 26b, and management block 26c (collectively referred to as "management block 26") are stored in the management area 24 of FIG. The management block 26a corresponds to the file f1, and the sector s0 is recorded as the start sector. The management block 26b corresponds to the file f2, and the sector s3 is recorded as the start sector. The management block 26c corresponds to the file f3, and the sector s5 is recorded as the start sector.

図3は、管理領域24に格納される管理情報の構成を示す。管理情報は、管理ヘッダ(16バイト)と、管理されるファイル数分の管理ブロック(1つの管理ブロックのサイズは16バイト)を含む。管理ブロックにおけるデータ種別「start sector」には、ファイルデータが格納される先頭位置、実施例では、ファイルデータが格納される先頭のセクタ番号が記録される。変形例として、「start sector」には、ファイルデータが格納されるセクタの先頭位置のアドレスが記録されてもよい。 FIG. 3 shows the configuration of management information stored in the management area 24. The management information includes a management header (16 bytes) and management blocks for the number of files to be managed (the size of one management block is 16 bytes). In the data type "start sector" in the management block, the start position where the file data is stored, and in the embodiment, the start sector number where the file data is stored are recorded. As a modification, the address of the start position of the sector in which the file data is stored may be recorded in the "start sector".

管理ブロックにおけるデータ種別「status」には、ファイルデータの記憶に関する状態が記録され、例えば、使用中、空き、削除状態のいずれかが記録される。後述するが、「使用中」は、非連続のセクタ群に分割して格納されるファイルデータのどの部分に対応するかを示すよう細分化されてもよい。例えば、使用中(先頭)、使用中(中間)、使用中(末尾)のいずれかが記録されてもよい。 In the data type "status" in the management block, the status related to the storage of file data is recorded, and for example, one of the busy, free, and deleted status is recorded. As will be described later, "in use" may be subdivided to indicate which part of the file data is divided and stored in discontinuous sector groups. For example, one of in use (beginning), in use (intermediate), and in use (end) may be recorded.

管理ブロックにおけるデータ種別「ext info」には、ファイルデータが連続するセクタ群に格納される場合(すなわち分割なし)、または、ファイルデータが非連続のセクタ群に分散して格納され(すなわち分割あり)かつファイルデータの先頭部分である場合、ファイルデータ(の先頭部分)が格納された連続するセクタ群のセクタ数が記録される。一方、ファイルデータが非連続のセクタに分散して格納され(すなわち分割あり)かつファイルデータの先頭以外の部分である場合、「ext info」には、ファイルデータの分割態様に応じた通し番号(すなわち複数の管理ブロックの何番目に該当するかを示す番号)が記録される。 In the data type "ext info" in the management block, when the file data is stored in consecutive sector groups (that is, without division), or when the file data is distributed and stored in non-continuous sector groups (that is, with division). ) And the first part of the file data, the number of sectors of the continuous sector group in which the file data (the first part) is stored is recorded. On the other hand, when the file data is distributed and stored in non-contiguous sectors (that is, with division) and is a part other than the beginning of the file data, "ext info" contains a serial number (that is, a serial number according to the division mode of the file data). The number indicating which number of multiple management blocks corresponds to) is recorded.

管理ブロックにおけるデータ種別「size」には、ファイルデータが連続するセクタ群に格納される場合(すなわち分割なし)、または、ファイルデータが非連続のセクタ群に分散して格納され(すなわち分割あり)かつファイルデータの先頭部分である場合、ファイルデータの全体サイズが記録される。一方、ファイルデータが非連続のセクタ群に分散して格納され(すなわち分割あり)かつファイルデータの先頭以外の部分である場合、当該管理ブロックに対応するセクタ群に格納されたファイルデータのサイズが記録される。 In the data type "size" in the management block, when the file data is stored in consecutive sector groups (that is, without division), or when the file data is distributed and stored in non-continuous sector groups (that is, with division). If it is the first part of the file data, the entire size of the file data is recorded. On the other hand, when the file data is distributed and stored in non-contiguous sector groups (that is, there is division) and is a part other than the beginning of the file data, the size of the file data stored in the sector group corresponding to the management block is large. Recorded.

実施例のファイル管理システム20では、原則として、1つのファイルデータは連続するセクタ群に格納され、1つのファイルデータを管理するために必要な最低限の属性を含む1つの管理ブロックが管理領域24に格納される。これにより、ROM14およびRAM16のサイズが小さいマイクロコントローラ10であっても、ROM14のデータをファイル単位で管理可能なファイルシステムであって、かつ、ROM14およびRAM16の消費量や処理量が小さいファイルシステムを実現できる。 In the file management system 20 of the embodiment, as a general rule, one file data is stored in a continuous sector group, and one management block including the minimum attributes necessary for managing one file data is a management area 24. Stored in. As a result, even if the microcontroller 10 has a small size of the ROM 14 and the RAM 16, the file system can manage the data of the ROM 14 in file units, and the consumption and the processing amount of the ROM 14 and the RAM 16 are small. realizable.

例えば、実施例のファイル管理システム20では、管理領域24のサイズが4KBである場合、(4096/16)−1 = 255個のファイルデータを管理可能である。 For example, in the file management system 20 of the embodiment, when the size of the management area 24 is 4KB, (4096/16) -1 = 255 file data can be managed.

図2に戻り、ファイル管理システム20は、RAM16内にセクタマップ28を備える。セクタマップ28は、データ領域22へのファイルデータの書き込み可否を判断するためのデータであって、かつ、データ領域22の各セクタの使用状態を示すデータである。各セクタの使用状態は、使用中、空き、削除状態を含む。 Returning to FIG. 2, the file management system 20 includes a sector map 28 in the RAM 16. The sector map 28 is data for determining whether or not file data can be written to the data area 22, and is data indicating the usage state of each sector of the data area 22. The usage status of each sector includes the usage status, free status, and deletion status.

ファイル管理システム20は、制御部30を備える。制御部30は、起動処理部31、読出部32、書込部33、管理領域更新部34、削除部35を含む。これら複数の機能ブロックに対応する複数のモジュールを含むコンピュータプログラムが記録媒体に格納され、その記録媒体を介して上記コンピュータプログラムがROM14にインストールされてもよい。または、外部装置がマイクロコントローラ10へ上記コンピュータプログラムを送信して、上記コンピュータプログラムがROM14にインストールされてもよい。マイクロコントローラ10のCPUコア12は、上記コンピュータプログラムをRAM16に読み出して実行することにより、各機能ブロックの機能を発揮してもよい。 The file management system 20 includes a control unit 30. The control unit 30 includes an activation processing unit 31, a reading unit 32, a writing unit 33, a management area update unit 34, and a deletion unit 35. A computer program including a plurality of modules corresponding to the plurality of functional blocks may be stored in a recording medium, and the computer program may be installed in the ROM 14 via the recording medium. Alternatively, the external device may send the computer program to the microcontroller 10 and the computer program may be installed in the ROM 14. The CPU core 12 of the microcontroller 10 may exert the function of each functional block by reading the computer program into the RAM 16 and executing the program.

また、読出部32、書込部33、管理領域更新部34、削除部35は、ファイル管理システム20が提供するファイルシステムを利用するアプリケーションプログラムに動的または静的にリンクされるライブラリプログラムとして実装されてもよい。 Further, the read unit 32, the write unit 33, the management area update unit 34, and the delete unit 35 are implemented as library programs that are dynamically or statically linked to the application program that uses the file system provided by the file management system 20. May be done.

起動処理部31は、ファイル管理システム20の起動時の処理を実行する。起動処理部31は、管理領域24に格納された管理情報(すなわち複数の管理ブロックの情報)を読み出してRAM16に格納する。また、起動処理部31は、管理領域24に格納された管理情報をもとに、データ領域22の各セクタの使用状態を示すセクタマップ28をRAM16内に生成する。RAM16(実施例ではSDRAM)へのアクセス速度は、ROM14(実施例ではフラッシュROM)へのアクセス速度より高速であるため、管理領域24の管理情報と、セクタマップ28をRAM16に配置することで、ファイルデータの読み書きに要する時間を短縮することができる。 The startup processing unit 31 executes the processing at the time of starting the file management system 20. The startup processing unit 31 reads the management information (that is, the information of a plurality of management blocks) stored in the management area 24 and stores it in the RAM 16. Further, the activation processing unit 31 generates a sector map 28 showing the usage state of each sector of the data area 22 in the RAM 16 based on the management information stored in the management area 24. Since the access speed to the RAM 16 (SDRAM in the embodiment) is faster than the access speed to the ROM 14 (flash ROM in the embodiment), the management information of the management area 24 and the sector map 28 can be arranged in the RAM 16. The time required to read and write file data can be shortened.

読出部32は、データ領域22に格納されたファイルデータの読み出しが要求された場合、ファイルデータの読み出し処理を実行する。書込部33は、データ領域22へのファイルデータの書き込みが要求された場合、ファイルデータの書き込み処理を実行する。削除部35は、データ領域22に格納されたファイルデータの削除が要求された場合、ファイルデータの削除処理を実行する。読み出し、書き込み、および削除の要求元は、典型的にはCPUコア12で実行中のアプリケーションプログラムとなる。 When the reading unit 32 is requested to read the file data stored in the data area 22, the reading unit 32 executes the reading process of the file data. When the writing unit 33 is requested to write the file data to the data area 22, the writing unit 33 executes the file data writing process. When the deletion unit 35 is requested to delete the file data stored in the data area 22, the deletion unit 35 executes the file data deletion process. The request source for reading, writing, and deleting is typically an application program running on the CPU core 12.

なお、削除部35は、データ領域22に格納されたファイルデータを削除すべき場合、データ領域22に格納された当該ファイルデータを消去せず残し、すなわち、削除すべきファイルデータが格納されたセクタをイレースしない。一方、削除部35は、削除すべきファイルデータに対応する管理ブロックに、ファイルデータを削除したことを記録する。具体的には、削除部35は、削除すべきファイルデータの名称が記録された管理ブロックのstatusに「削除状態」を記録する。後述するが、書込部33は、データ領域22に新たなファイルデータを格納すべき場合、削除状態が記録された管理ブロックが示すセクタに新たなファイルデータを格納する。 When the file data stored in the data area 22 should be deleted, the deletion unit 35 leaves the file data stored in the data area 22 without erasing it, that is, the sector in which the file data to be deleted is stored. Do not erase. On the other hand, the deletion unit 35 records that the file data has been deleted in the management block corresponding to the file data to be deleted. Specifically, the deletion unit 35 records the "deletion status" in the status of the management block in which the name of the file data to be deleted is recorded. As will be described later, when new file data should be stored in the data area 22, the writing unit 33 stores the new file data in the sector indicated by the management block in which the deleted state is recorded.

管理領域更新部34は、RAM16に格納された管理情報が更新された場合、更新前の管理情報が格納されたROM14の領域とは異なるROM14の領域に、更新後の管理情報を格納する。ROM14(実施例ではフラッシュROM)には書き換え限度回数が存在するが、管理情報の書き込み領域を分散させること(すなわちウェアレベリング)により、ROM14の使用寿命を延ばすことができる。 When the management information stored in the RAM 16 is updated, the management area update unit 34 stores the updated management information in an area of ROM 14 different from the area of ROM 14 in which the management information before the update is stored. Although the ROM 14 (flash ROM in the embodiment) has a rewrite limit number of times, the service life of the ROM 14 can be extended by distributing the writing area of the management information (that is, wear leveling).

図4は、管理情報のウェアレベリングを模式的に示す。管理領域更新部34は、RAM16に読み出された管理情報が更新される都度、更新された管理情報を、第1管理領域24a(セクタN)、第2管理領域24b(セクタN+1)、第3管理領域24c(セクタN+2)、第4管理領域24d(セクタN+3)の順にサイクリックに格納する。なお、管理領域更新部34は、更新後の管理情報を或るセクタ(例えばセクタN+1)に格納する際、更新前の管理情報が格納されたセクタ(例えばセクタN)をイレースする。 FIG. 4 schematically shows wear leveling of management information. Each time the management information read into the RAM 16 is updated, the management area update unit 34 uses the updated management information in the first management area 24a (sector N), the second management area 24b (sector N + 1), and the third. The management area 24c (sector N + 2) and the fourth management area 24d (sector N + 3) are cyclically stored in this order. When the management area update unit 34 stores the updated management information in a certain sector (for example, sector N + 1), the management area update unit 34 erases the sector (for example, sector N) in which the management information before the update is stored.

以上の構成によるファイル管理システム20の動作を説明する。
まず、ファイル管理システム20の起動時の動作を説明する。図5は、ファイル管理システム20の起動時の動作を示すフローチャートである。起動処理部31は、複数の管理領域24の中で管理情報が格納された管理領域24から管理情報を読み出し、読み出した管理情報をRAM16に格納する(S10)。起動処理部31は、RAM16に読み出した管理情報(管理領域24の管理情報でもよい)をもとにセクタマップ28を生成してRAM16に格納する(S12)。
The operation of the file management system 20 with the above configuration will be described.
First, the operation at the time of starting the file management system 20 will be described. FIG. 5 is a flowchart showing the operation at the time of starting the file management system 20. The startup processing unit 31 reads the management information from the management area 24 in which the management information is stored in the plurality of management areas 24, and stores the read management information in the RAM 16 (S10). The startup processing unit 31 generates a sector map 28 based on the management information (which may be the management information of the management area 24) read into the RAM 16 and stores it in the RAM 16 (S12).

次に、ファイルデータ読み込み時の動作を説明する。読出部32は、CPUコア12で実行中のコンピュータプログラムのプロセスから、ファイルデータの読み出し要求を受け付ける。このコンピュータプログラムは、ファイル管理システム20が提供するファイルシステムを利用してROM14のファイルデータを読み出す処理が実装されたコンピュータプログラムである。読み出し要求では、読み出しの対象となるファイル名が指定される。 Next, the operation at the time of reading the file data will be described. The reading unit 32 receives a file data reading request from a computer program process running on the CPU core 12. This computer program is a computer program in which a process of reading the file data of the ROM 14 is implemented by using the file system provided by the file management system 20. In the read request, the file name to be read is specified.

読出部32は、RAM16に読み出された管理情報を参照して、読み出し要求で指定されたファイル名が記録された管理ブロック26を特定し、その管理ブロック26に記録された開始セクタとサイズを特定する。読出部32は、特定したデータ領域22の開始セクタから、特定したサイズ分のファイルデータを読み出し、読み出したファイルデータを要求元のプログラムへ出力する。 The reading unit 32 refers to the management information read into the RAM 16 to identify the management block 26 in which the file name specified in the read request is recorded, and determines the start sector and size recorded in the management block 26. Identify. The reading unit 32 reads the file data of the specified size from the start sector of the specified data area 22, and outputs the read file data to the requesting program.

次に、ファイルデータ書き込み時の動作を説明する。図6は、ファイルデータ書き込み時の動作を示すフローチャートである。書込部33は、CPUコア12で実行中のコンピュータプログラムのプロセスから、ファイルデータの書き込み要求を受け付ける。このコンピュータプログラムは、ファイル管理システム20が提供するファイルシステムを利用してROM14へファイルデータを書き込む処理が実装されたコンピュータプログラムである。書き込み要求では、ROM14への書き込み対象となるファイルデータについて、RAM16上でのアドレスとファイル名とが指定される。 Next, the operation at the time of writing the file data will be described. FIG. 6 is a flowchart showing an operation at the time of writing file data. The writing unit 33 receives a file data writing request from the process of the computer program being executed by the CPU core 12. This computer program is a computer program in which a process of writing file data to the ROM 14 is implemented by using the file system provided by the file management system 20. In the write request, the address and the file name on the RAM 16 are specified for the file data to be written to the ROM 14.

書き込み要求を受け付けた書込部33は、RAM16に読み込まれた管理情報を参照して、今回書き込むファイルデータ用の管理ブロック(典型的には新たな管理ブロック)を格納する空きが管理領域24にあるか否かを確認する。また、書込部33は、セクタマップ28を参照して、ファイルデータを書き込み可能な空きセクタ(後述するように削除状態のセクタを含む)があるか否かを確認する。管理領域24に空きがあり(S20のY)、かつ、データ領域22に空きセクタがあれば(S22のY)、書込部33は、書き込み対象となるファイルデータを、RAM16内に設けられたセクタキャッシュに書き込む(S24)。 The writing unit 33 that has received the write request refers to the management information read in the RAM 16, and the management area 24 has a free space for storing the management block (typically a new management block) for the file data to be written this time. Check if it exists. Further, the writing unit 33 refers to the sector map 28 and confirms whether or not there is a free sector in which the file data can be written (including a sector in a deleted state as described later). If there is a free space in the management area 24 (Y in S20) and there is a free sector in the data area 22 (Y in S22), the writing unit 33 is provided with the file data to be written in the RAM 16. Write to the sector cache (S24).

セクタキャッシュは、セクタ単位でデータを書き込むために設けられた、1つのセクタと同じサイズ(実施例では512バイト)の記憶領域である。セクタキャッシュは、ファイルデータの中の512バイト分のデータを一時的に記憶する。管理領域24に空きがなく(S20のN)、または、データ領域22に空きセクタがなければ(S22のN)、書込部33は、要求元のプログラムへエラーを返し、書き込み処理を終了する(S26)。 The sector cache is a storage area of the same size as one sector (512 bytes in the embodiment) provided for writing data in sector units. The sector cache temporarily stores 512 bytes of data in the file data. If there is no free space in the management area 24 (N in S20) or there is no free sector in the data area 22 (N in S22), the writing unit 33 returns an error to the requesting program and ends the writing process. (S26).

ファイルデータにおける最後のデータまでの書き込みが未完了であり(S28のN)、セクタキャッシュに対する1セクタ分のデータの書き込みも未完了であれば(S30のN)、S24に戻り、セクタキャッシュへのファイルデータの書き込みを続ける。セクタキャッシュに対する1セクタ分のデータの書き込みが完了すると(S30のY)、書込部33は、セクタキャッシュに格納された1セクタ分のデータをデータ領域22の空きセクタに書き込む(S32)。書込部33は、ファイルデータを書き込んだ空きセクタに対応するセクタマップ28の領域に「使用中」を記録し(S34)、S24に戻る。すなわち、書込部33は、セクタキャッシュに対してファイルデータの残りを書き込む。 If the writing to the last data in the file data is incomplete (N in S28) and the writing of data for one sector to the sector cache is also incomplete (N in S30), the process returns to S24 and is sent to the sector cache. Continue writing file data. When the writing of the data for one sector to the sector cache is completed (Y in S30), the writing unit 33 writes the data for one sector stored in the sector cache to the free sector of the data area 22 (S32). The writing unit 33 records "in use" in the area of the sector map 28 corresponding to the free sector in which the file data is written (S34), and returns to S24. That is, the writing unit 33 writes the rest of the file data to the sector cache.

セクタキャッシュに対してファイルデータにおける最後のデータまで書き込みが完了すると(S28のY)、書込部33は、セクタキャッシュに格納された1セクタ分のデータをデータ領域22の空きセクタに書き込む(S36)。書込部33は、ファイルデータを書き込んだ空きセクタに対応するセクタマップ28の領域に「使用中」を記録する(S38)。ここでは、ファイルデータは、データ領域22における連続するセクタ群に格納されたこととする。書込部33は、書き込んだファイルデータに対応する管理ブロックであって、ファイル名や開始セクタ等を設定した管理ブロックを1つ生成し、RAM16に読み出された管理情報に当該管理ブロックを追加する(S40)。 When writing to the last data in the file data to the sector cache is completed (Y in S28), the writing unit 33 writes the data for one sector stored in the sector cache to the free sector of the data area 22 (S36). ). The writing unit 33 records "in use" in the area of the sector map 28 corresponding to the free sector in which the file data is written (S38). Here, it is assumed that the file data is stored in a continuous sector group in the data area 22. The writing unit 33 is a management block corresponding to the written file data, generates one management block in which a file name, a start sector, etc. are set, and adds the management block to the management information read into the RAM 16. (S40).

さらに書込部33は、RAM16に読み出された管理情報における管理ヘッダを更新する(S42)。例えば、書込部33は、管理ヘッダにおけるファイル数をインクリメントする。管理領域更新部34は、更新後の管理情報を、更新前の管理情報が格納された管理領域(例えば第1管理領域24a)とは異なる管理領域(例えば第2管理領域24b)に格納する(S44)。 Further, the writing unit 33 updates the management header in the management information read into the RAM 16 (S42). For example, the writing unit 33 increments the number of files in the management header. The management area update unit 34 stores the updated management information in a management area (for example, a second management area 24b) different from the management area (for example, the first management area 24a) in which the management information before the update is stored (for example, the second management area 24b). S44).

次に、ファイルデータ削除時の動作を説明する。図7は、ファイルデータ削除時の動作を示すフローチャートである。削除部35は、CPUコア12で実行中のコンピュータプログラムのプロセスから、ファイルデータの削除要求を受け付ける。このコンピュータプログラムは、ファイル管理システム20が提供するファイルシステムを利用してROM14からファイルデータを削除する処理が実装されたコンピュータプログラムである。削除要求では、削除対象となるファイルデータのファイル名が指定される。 Next, the operation at the time of deleting the file data will be described. FIG. 7 is a flowchart showing the operation when the file data is deleted. The deletion unit 35 receives a file data deletion request from the computer program process running on the CPU core 12. This computer program is a computer program in which a process of deleting file data from the ROM 14 is implemented by using the file system provided by the file management system 20. In the deletion request, the file name of the file data to be deleted is specified.

削除部35は、RAM16に読み出された管理情報を参照して、削除要求で指定されたファイル名が記録された管理ブロック(ここでは「対象管理ブロック」と呼ぶ)を特定する。削除部35は、対象管理ブロックに記録された開始セクタおよびサイズをもとに、削除対象のファイルデータが格納されたデータ領域22の1つ以上のセクタを特定する。削除部35は、削除対象のファイルデータが格納された1つ以上のセクタの情報を「削除状態」とするようセクタマップ28を更新する(S50)。 The deletion unit 35 refers to the management information read into the RAM 16 and identifies a management block (referred to here as a “target management block”) in which the file name specified in the deletion request is recorded. The deletion unit 35 identifies one or more sectors of the data area 22 in which the file data to be deleted is stored, based on the start sector and the size recorded in the target management block. The deletion unit 35 updates the sector map 28 so that the information of one or more sectors in which the file data to be deleted is stored is in the “deleted state” (S50).

また、削除部35は、RAM16に読み出された管理情報における対象管理ブロックの「status」を削除状態に変更する(S52)また、削除部35は、RAM16に読み出された管理情報における管理ヘッダを更新し、例えば、管理ヘッダにおけるファイル数をデクリメントする(S54)。管理領域更新部34は、更新後の管理情報を、更新前の管理情報が格納された管理領域(例えば第1管理領域24a)とは異なる管理領域(例えば第2管理領域24b)に格納する(S56)。 Further, the deletion unit 35 changes the “status” of the target management block in the management information read into the RAM 16 to the deleted state (S52), and the deletion unit 35 also changes the management header in the management information read into the RAM 16. Is updated, for example, the number of files in the management header is decremented (S54). The management area update unit 34 stores the updated management information in a management area (for example, a second management area 24b) different from the management area (for example, the first management area 24a) in which the management information before the update is stored (for example, the second management area 24b). S56).

図8は、ファイルデータが削除された状態を模式的に示す。データ領域22のファイルf2を削除した場合、ファイルf2に対応する管理ブロック26bには「削除状態」が記録され、かつ、セクタs3およびセクタs4に対応するセクタマップ28の領域にも「削除状態」が記録される。ここで新たなファイルf6をデータ領域22に格納する場合、実施例では、削除状態のセクタを再利用することより優先して、空きセクタの先頭(例えばセクタs11)からファイルf6を格納する。 FIG. 8 schematically shows a state in which the file data is deleted. When the file f2 in the data area 22 is deleted, the "deleted state" is recorded in the management block 26b corresponding to the file f2, and the "deleted state" is also recorded in the sector map 28 area corresponding to the sector s3 and the sector s4. Is recorded. Here, when the new file f6 is stored in the data area 22, in the embodiment, the file f6 is stored from the beginning of the free sector (for example, sector s11) in preference to reusing the deleted sector.

すなわち、書込部33は、新たなファイルデータの格納先として、削除したことが記録された管理ブロック26が示すセクタよりも空き状態のセクタを優先して選択する。これにより、データ領域22の同じセクタに対する書き換え回数を低減し、データ領域22の使用寿命を伸ばすことができる。なお、書込部33は、削除したファイルf2に対応する管理ブロック26bを、新たに追加するファイルf6用に再利用してもよい。この場合、管理ブロック26bの「status」「ext info」「size」「name」をファイルf6にあわせて変更する一方、「start sector」は変更なしで使用することができる。 That is, the writing unit 33 preferentially selects a free sector as a storage destination of new file data over the sector indicated by the management block 26 in which the deletion is recorded. As a result, the number of times the data area 22 is rewritten for the same sector can be reduced, and the service life of the data area 22 can be extended. The writing unit 33 may reuse the management block 26b corresponding to the deleted file f2 for the newly added file f6. In this case, the "status", "ext info", "size", and "name" of the management block 26b can be changed according to the file f6, while the "start sector" can be used without any change.

ファイル管理システム20においてファイルデータの削除を繰り返すと、データ領域22には「使用中」の領域と「削除状態」の領域が混在するようになる。空きセクタにファイルデータを書き込めなくなった場合、書込部33は、削除状態のセクタを再利用する。例えば、書込部33は、非連続のセクタ群に対して1つのファイルデータを書き込む。削除状態のセクタを有効活用することで、より多くのファイルデータをファイル管理システム20で管理可能になる。 When the file data is repeatedly deleted in the file management system 20, the "in use" area and the "deleted state" area are mixed in the data area 22. When the file data cannot be written to the free sector, the writing unit 33 reuses the deleted sector. For example, the writing unit 33 writes one file data to a non-continuous sector group. By effectively utilizing the deleted sector, more file data can be managed by the file management system 20.

図9(a)と図9(b)は、ファイルデータを非連続のセクタ群に書き込む例を示す。データ領域22のセクタs3、セクタs4、セクタs7は使用中である。一方、データ領域22のセクタs0〜セクタs2、セクタs5、セクタs6、セクタs8以降は、削除状態である。この例において、書き込むべきファイルf7は、8セクタを占有するサイズとする。 9 (a) and 9 (b) show an example of writing file data to a non-contiguous sector group. The sectors s3, s4, and s7 of the data area 22 are in use. On the other hand, sectors s0 to sector s2, sector s5, sector s6, and sector s8 and subsequent sectors of the data area 22 are in the deleted state. In this example, the file f7 to be written has a size that occupies 8 sectors.

図9(a)に示すように、書込部33は、セクタs0〜セクタs2にファイルf7の先頭部分を格納し、セクタs5とセクタs6にファイルf7の中間部分を格納し、セクタs8〜セクタs10にファイルf7の末尾部分を格納する。書き込み先のセクタが削除状態の場合、そのセクタには削除対象のデータが消去されず残っているため、書込部33は、そのセクタに対してイレース処理を実行後、そのセクタにデータを書き込む。 As shown in FIG. 9A, the writing unit 33 stores the head portion of the file f7 in sectors s0 to sector s2, stores the intermediate portion of the file f7 in sectors s5 and sector s6, and stores sectors s8 to sectors. The last part of the file f7 is stored in s10. When the write-destination sector is in the deleted state, the data to be deleted remains in that sector without being erased. Therefore, the writing unit 33 writes data to that sector after performing erase processing on that sector. ..

書込部33は、非連続のセクタ群に対してファイルデータを書き込む場合、連続するセクタセクタ群ごとに1つの管理ブロック26を割り当てる。図9(a)の例では、書込部33は、管理ブロック26aと、管理ブロック26bと、管理ブロック26cを管理領域24に格納する。管理ブロック26aは、ファイルf7の先頭部分(言い換えればセクタs0〜セクタs2)に対応し、その開始セクタにはセクタs0が記録される。管理ブロック26bは、ファイルf7の中間部分(言い換えればセクタs5およびセクタs6)に対応し、その開始セクタにはセクタs5が記録される。管理ブロック26cは、ファイルf7の末尾部分(言い換えればセクタs8〜セクタs10)に対応し、その開始セクタにはセクタs8が記録される。 When writing file data to a non-contiguous sector group, the writing unit 33 allocates one management block 26 to each continuous sector sector group. In the example of FIG. 9A, the writing unit 33 stores the management block 26a, the management block 26b, and the management block 26c in the management area 24. The management block 26a corresponds to the first portion of the file f7 (in other words, sector s0 to sector s2), and sector s0 is recorded in the start sector. The management block 26b corresponds to an intermediate portion (in other words, sector s5 and sector s6) of the file f7, and sector s5 is recorded in the start sector thereof. The management block 26c corresponds to the end portion of the file f7 (in other words, sectors s8 to s10), and sector s8 is recorded in the start sector thereof.

図9(b)は、各管理ブロックに記録されるデータを示している。管理ブロック26aでは、先頭部分であることを示すフラグである「使用中(先頭)」がstatusに記録され、先頭部分のセクタ数(図9の例では「3」)がext infoに記録される。また、管理ブロック26aのsizeには、ファイルデータ全体のサイズが記録される。 FIG. 9B shows the data recorded in each management block. In the management block 26a, "in use (head)", which is a flag indicating that it is the head part, is recorded in status, and the number of sectors in the head part ("3" in the example of FIG. 9) is recorded in ext info. .. Further, the size of the entire file data is recorded in the size of the management block 26a.

管理ブロック26bでは、中間部分であることを示すフラグである「使用中(中間)」がstatusに記録され、通し番号(図9の例では「1」)がext infoに記録される。また、管理ブロック26bのsizeには、中間部分のセクタ数(図9の例では「2」)が記録される。ファイルf7の中間部分が格納されるセクタはその全領域がファイルf7のデータになるため、中間部分のセクタ数は、中間部分のデータサイズと実質的に同義である。 In the management block 26b, "in use (intermediate)", which is a flag indicating that it is an intermediate part, is recorded in status, and a serial number ("1" in the example of FIG. 9) is recorded in ext info. Further, the number of sectors in the intermediate portion (“2” in the example of FIG. 9) is recorded in the size of the management block 26b. Since the entire area of the sector in which the intermediate portion of the file f7 is stored is the data of the file f7, the number of sectors in the intermediate portion is substantially synonymous with the data size of the intermediate portion.

管理ブロック26cでは、末尾部分であることを示すフラグである「使用中(末尾)」がstatusに記録され、通し番号(図9の例では「2」)がext infoに記録される。また、管理ブロック26cのsizeには、使用サイズが記録される。最後のセクタ(図9の例ではセクタs10)は一部領域が未使用の可能性があるため、管理ブロック26cのsizeには、セクタ数でなく、末尾部分の実際のデータサイズが記録される。 In the management block 26c, "in use (end)", which is a flag indicating the end part, is recorded in status, and a serial number ("2" in the example of FIG. 9) is recorded in ext info. Further, the used size is recorded in the size of the management block 26c. Since a part of the last sector (sector s10 in the example of FIG. 9) may be unused, the actual data size of the last part is recorded in the size of the management block 26c, not the number of sectors. ..

図9(a)(b)で示した断片化したファイルデータの読み出し処理を説明する。読出部32は、ファイル名「test.bin」を指定した読み出し要求を受け付けると、管理領域24の管理情報(実際にはRAM16に読み出された管理情報、以下同じ。)を参照して、ファイル名に「test.bin」が記録され、かつ、statusに「使用中(先頭)」が記録された管理ブロック26aを特定する。読出部32は、管理ブロック26aの開始セクタであるセクタs0から、ext infoに記録されたセクタ数分のデータを先頭部分のデータとして読み込む。 The process of reading the fragmented file data shown in FIGS. 9A and 9B will be described. When the reading unit 32 receives the reading request for which the file name "test.bin" is specified, the reading unit 32 refers to the management information of the management area 24 (actually, the management information read into the RAM 16; the same applies hereinafter) and files. The management block 26a in which "test.bin" is recorded in the name and "in use (top)" is recorded in the status is specified. The reading unit 32 reads data for the number of sectors recorded in ext info from the sector s0, which is the starting sector of the management block 26a, as the data of the head portion.

次に読出部32は、管理領域24の管理情報を参照して、ファイル名に「test.bin」が記録され、かつ、通し番号「1」が記録された管理ブロック26bを特定する。読出部32は、管理ブロック26bの開始セクタであるセクタs5から、sizeに記録されたセクタ数分のデータを中間部分のデータとして読み込む。 Next, the reading unit 32 refers to the management information of the management area 24 and identifies the management block 26b in which "test.bin" is recorded in the file name and the serial number "1" is recorded. The reading unit 32 reads data for the number of sectors recorded in size from the sector s5, which is the starting sector of the management block 26b, as data in the intermediate portion.

次に読出部32は、管理領域24の管理情報を参照して、ファイル名に「test.bin」が記録され、かつ、通し番号「2」が記録された管理ブロック26cを特定する。読出部32は、管理ブロック26cの開始セクタであるセクタs8から、sizeに記録された長さのデータを末尾部分のデータとして読み込む。読出部32は、先頭部分のデータ、中間部分のデータ、および末尾部分のデータを合成することにより要求された「test.bin」のファイルデータを生成し、そのファイルデータを要求元のプログラムに返す。 Next, the reading unit 32 refers to the management information of the management area 24 and identifies the management block 26c in which "test.bin" is recorded in the file name and the serial number "2" is recorded. The reading unit 32 reads the data of the length recorded in size from the sector s8, which is the starting sector of the management block 26c, as the data of the trailing portion. The reading unit 32 generates the file data of "test.bin" requested by synthesizing the data of the head portion, the data of the middle portion, and the data of the tail portion, and returns the file data to the requesting program. ..

以上、本開示を実施例をもとに説明した。この実施例は例示であり、各構成要素あるいは各処理プロセスの組合せにいろいろな変形例が可能なこと、またそうした変形例も本開示の範囲にあることは当業者に理解されるところである。 The present disclosure has been described above based on the examples. This embodiment is an example, and it will be understood by those skilled in the art that various modifications are possible for each component or combination of each processing process, and that such modifications are also within the scope of the present disclosure.

上述した実施例および変形例の任意の組み合わせもまた本開示の実施の形態として有用である。組み合わせによって生じる新たな実施の形態は、組み合わされる実施例および変形例それぞれの効果をあわせもつ。また、請求項に記載の各構成要件が果たすべき機能は、実施例および変形例において示された各構成要素の単体もしくはそれらの連携によって実現されることも当業者には理解されるところである。 Any combination of the examples and modifications described above is also useful as an embodiment of the present disclosure. The new embodiments resulting from the combination have the effects of the combined examples and the modifications. It is also understood by those skilled in the art that the functions to be fulfilled by each of the constituent elements described in the claims are realized by a single component or a cooperation thereof shown in the examples and modifications.

実施例および変形例に記載の技術は、以下の項目によって特定されてもよい。
[項目1]
ファイルデータが格納されるメモリ空間であるデータ領域(22)と、ファイルデータに関する属性情報が格納されるメモリ空間である管理領域(24)と、を備え、
前記データ領域(22)は、複数のセクタに分割されており、1つのファイルデータは、連続するセクタに格納され、
前記1つのファイルデータが前記データ領域に格納される場合、前記管理領域には、前記1つのファイルデータの識別名称と、前記連続するセクタの先頭位置とを示す1つの属性情報が格納されることを特徴とするファイル管理システム(20)。
[項目2]
複数の管理領域(24)を書き換え可能なROM(14)に備え、
第1の管理領域(24a)に格納された属性情報がRAM(16)に読み出され、当該属性情報が更新された場合、前記第1の管理領域(24a)とは異なる第2の管理領域(24b)に更新後の属性情報を格納することを特徴とする項目1に記載のファイル管理システム(20)。
[項目3]
前記管理領域(24)はROM(14)に設けられ、
本ファイル管理システム(20)の起動時に、前記管理領域(24)に格納された属性情報をもとに、前記データ領域(22)へのファイルデータの書き込み可否を判断するためのデータであって、前記データ領域(22)の各セクタの使用状態を示すデータ(28)をRAM(16)に格納する生成部(31)をさらに備えることを特徴とする項目1または2に記載のファイル管理システム(20)。
[項目4]
前記データ領域(22)に格納されたファイルデータを削除すべき場合、前記データ領域(22)に格納されたファイルデータを消去せず残し、当該ファイルデータに対応する属性情報に削除したことを記録する削除部(35)と、
前記データ領域(22)に新たなファイルデータを格納すべき場合、削除したことが記録された属性情報が示すセクタに前記新たなファイルデータを格納する書込部(33)と、
をさらに備えることを特徴とする項目1から3のいずれかに記載のファイル管理システム(20)。
[項目5]
前記書込部(33)は、前記新たなファイルデータの格納先として、削除したことが記録された属性情報が示すセクタよりも空き状態のセクタを優先して選択することを特徴とする項目4に記載のファイル管理システム(20)。
The techniques described in the examples and modifications may be specified by the following items.
[Item 1]
A data area (22), which is a memory space for storing file data, and a management area (24), which is a memory space for storing attribute information related to file data, are provided.
The data area (22) is divided into a plurality of sectors, and one file data is stored in consecutive sectors.
When the one file data is stored in the data area, one attribute information indicating the identification name of the one file data and the head position of the continuous sector is stored in the management area. A file management system (20) characterized by.
[Item 2]
A plurality of management areas (24) are provided in a rewritable ROM (14).
When the attribute information stored in the first management area (24a) is read into the RAM (16) and the attribute information is updated, a second management area different from the first management area (24a) is used. The file management system (20) according to item 1, wherein the updated attribute information is stored in (24b).
[Item 3]
The management area (24) is provided in the ROM (14).
This data is used to determine whether or not file data can be written to the data area (22) based on the attribute information stored in the management area (24) when the file management system (20) is started. The file management system according to item 1 or 2, further comprising a generation unit (31) for storing data (28) indicating a usage state of each sector of the data area (22) in a RAM (16). (20).
[Item 4]
When the file data stored in the data area (22) should be deleted, the file data stored in the data area (22) is left unerased and the deletion is recorded in the attribute information corresponding to the file data. Delete part (35) and
When new file data should be stored in the data area (22), a writing unit (33) that stores the new file data in the sector indicated by the attribute information in which the deletion is recorded, and
The file management system (20) according to any one of items 1 to 3, further comprising.
[Item 5]
Item 4 characterized in that the writing unit (33) preferentially selects a free sector as a storage destination of the new file data over the sector indicated by the attribute information in which the deletion is recorded. The file management system (20) described in.

10 マイクロコントローラ、 14 ROM、 16 RAM、 20 ファイル管理システム、 22 データ領域、 24 管理領域、 31 起動処理部、 33 書込部、 34 管理領域更新部、 35 削除部。 10 Microcontroller, 14 ROM, 16 RAM, 20 File management system, 22 Data area, 24 Management area, 31 Startup processing unit, 33 Writing unit, 34 Management area update unit, 35 Delete unit.

Claims (5)

ファイルデータが格納されるメモリ空間であるデータ領域と、ファイルデータに関する属性情報が格納されるメモリ空間である管理領域と、を備え、
前記データ領域は、複数のセクタに分割されており、1つのファイルデータは、連続するセクタに格納され、
前記1つのファイルデータが前記データ領域に格納される場合、前記管理領域には、前記1つのファイルデータの識別名称と、前記連続するセクタの先頭位置とを示す1つの属性情報が格納されることを特徴とするファイル管理システム。
It has a data area that is a memory space for storing file data and a management area that is a memory space for storing attribute information related to file data.
The data area is divided into a plurality of sectors, and one file data is stored in consecutive sectors.
When the one file data is stored in the data area, one attribute information indicating the identification name of the one file data and the head position of the continuous sector is stored in the management area. A file management system featuring.
複数の管理領域を書き換え可能なROMに備え、
第1の管理領域に格納された属性情報がRAMに読み出され、当該属性情報が更新された場合、前記第1の管理領域とは異なる第2の管理領域に更新後の属性情報を格納することを特徴とする請求項1に記載のファイル管理システム。
With a rewritable ROM for multiple management areas
When the attribute information stored in the first management area is read into the RAM and the attribute information is updated, the updated attribute information is stored in a second management area different from the first management area. The file management system according to claim 1, wherein the file management system is characterized in that.
前記管理領域はROMに設けられ、
本ファイル管理システムの起動時に、前記管理領域に格納された属性情報をもとに、前記データ領域へのファイルデータの書き込み可否を判断するためのデータであって、前記データ領域の各セクタの使用状態を示すデータをRAMに格納する生成部をさらに備えることを特徴とする請求項1または2に記載のファイル管理システム。
The management area is provided in ROM.
Data for determining whether or not file data can be written to the data area based on the attribute information stored in the management area when the file management system is started, and the use of each sector of the data area. The file management system according to claim 1 or 2, further comprising a generation unit that stores data indicating a state in a RAM.
前記データ領域に格納されたファイルデータを削除すべき場合、前記データ領域に格納されたファイルデータを消去せず残し、当該ファイルデータに対応する属性情報に削除したことを記録する削除部と、
前記データ領域に新たなファイルデータを格納すべき場合、削除したことが記録された属性情報が示すセクタに前記新たなファイルデータを格納する書込部と、
をさらに備えることを特徴とする請求項1から3のいずれかに記載のファイル管理システム。
When the file data stored in the data area should be deleted, a deletion unit that records that the file data stored in the data area is deleted without being deleted and deleted in the attribute information corresponding to the file data, and a deletion unit.
When new file data should be stored in the data area, a writing unit that stores the new file data in the sector indicated by the attribute information in which the deletion is recorded, and a writing unit.
The file management system according to any one of claims 1 to 3, further comprising.
前記書込部は、前記新たなファイルデータの格納先として、削除したことが記録された属性情報が示すセクタよりも空き状態のセクタを優先して選択することを特徴とする請求項4に記載のファイル管理システム。 The fourth aspect of claim 4, wherein the writing unit preferentially selects a free sector as a storage destination of the new file data over the sector indicated by the attribute information in which the deletion is recorded. File management system.
JP2019030888A 2019-02-22 2019-02-22 File management system Pending JP2020135656A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019030888A JP2020135656A (en) 2019-02-22 2019-02-22 File management system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019030888A JP2020135656A (en) 2019-02-22 2019-02-22 File management system

Publications (1)

Publication Number Publication Date
JP2020135656A true JP2020135656A (en) 2020-08-31

Family

ID=72263297

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019030888A Pending JP2020135656A (en) 2019-02-22 2019-02-22 File management system

Country Status (1)

Country Link
JP (1) JP2020135656A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826884A (en) * 2023-02-16 2023-03-21 湖南源科创新科技有限公司 Lightweight high-speed file system facing embedded heterogeneous platform and processing method thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000076117A (en) * 1998-08-31 2000-03-14 Kano Densan Hongkong Yugenkoshi Electronic device, control method therefor and storage medium
JP2008251154A (en) * 2008-04-11 2008-10-16 Renesas Technology Corp Nonvolatile semiconductor memory device
JP2009037630A (en) * 1991-11-28 2009-02-19 Hitachi Ltd Information apparatus equipped with flash memory
JP2017097404A (en) * 2015-11-18 2017-06-01 株式会社デンソー Microcomputer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009037630A (en) * 1991-11-28 2009-02-19 Hitachi Ltd Information apparatus equipped with flash memory
JP2000076117A (en) * 1998-08-31 2000-03-14 Kano Densan Hongkong Yugenkoshi Electronic device, control method therefor and storage medium
JP2008251154A (en) * 2008-04-11 2008-10-16 Renesas Technology Corp Nonvolatile semiconductor memory device
JP2017097404A (en) * 2015-11-18 2017-06-01 株式会社デンソー Microcomputer

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826884A (en) * 2023-02-16 2023-03-21 湖南源科创新科技有限公司 Lightweight high-speed file system facing embedded heterogeneous platform and processing method thereof
CN115826884B (en) * 2023-02-16 2023-04-18 湖南源科创新科技有限公司 Lightweight high-speed file system facing embedded heterogeneous platform and processing method thereof

Similar Documents

Publication Publication Date Title
US11573701B2 (en) Memory device and host device
TWI661301B (en) Memory system and control method for controlling non-volatile memory
CN110678836B (en) Persistent memory for key value storage
CN109144887B (en) Memory system and control method for controlling nonvolatile memory
US10635310B2 (en) Storage device that compresses data received from a host before writing therein
CN111344683A (en) Namespace allocation in non-volatile memory devices
KR100951107B1 (en) Method for managing files for optimal performance
US9678676B2 (en) Method for storage devices to achieve low write amplification with low over provision
KR100849221B1 (en) Method for managing non-volatile memory, and memory-based apparatus including the non-volatile memory
WO2017000658A1 (en) Storage system, storage management device, storage device, hybrid storage device, and storage management method
US20200012598A1 (en) Garbage Collection Method for Storage Medium, Storage Medium, and Program Product
JP6403164B2 (en) Memory system
CN108959119B (en) Method and system for garbage collection in storage system
JP2018073040A (en) Memory system
US10976946B2 (en) Method and computer system for managing blocks
WO2016038765A1 (en) Memory device and method for controlling memory device
JP2020135656A (en) File management system
JP2010182160A (en) Memory access device, nonvolatile storage device, nonvolatile storage system, memory access method, program and integrated circuit
JP6329185B2 (en) Memory control circuit, memory control system, memory control method, and memory control program
JP6652605B2 (en) Memory system control method
JP2010257250A (en) Electronic device, storage area allocation method for file system, and storage area allocation program
US9904483B2 (en) File management device, program and file management method
JP2011118953A (en) Device, method and program for recording information
JP2010039676A (en) Data management method
JP2012068853A (en) Information processing apparatus and information processing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20211214

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20221018

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20221122

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20230516