CN101968724A - Method for storing and deleting data of SD card by using embedded ARM processor - Google Patents

Method for storing and deleting data of SD card by using embedded ARM processor Download PDF

Info

Publication number
CN101968724A
CN101968724A CN 201010532108 CN201010532108A CN101968724A CN 101968724 A CN101968724 A CN 101968724A CN 201010532108 CN201010532108 CN 201010532108 CN 201010532108 A CN201010532108 A CN 201010532108A CN 101968724 A CN101968724 A CN 101968724A
Authority
CN
China
Prior art keywords
data
card
file
bunch
timer
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.)
Granted
Application number
CN 201010532108
Other languages
Chinese (zh)
Other versions
CN101968724B (en
Inventor
赵祥模
惠飞
余腾
史昕
杨澜
雷涛
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.)
Changan University
Original Assignee
Changan University
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 Changan University filed Critical Changan University
Priority to CN2010105321087A priority Critical patent/CN101968724B/en
Publication of CN101968724A publication Critical patent/CN101968724A/en
Application granted granted Critical
Publication of CN101968724B publication Critical patent/CN101968724B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The invention discloses a method for storing and deleting data of a secure digital (SD) card by using an embedded advanced RISC machines (ARM) processor. The data is quantitatively or regularly stored and quickly deleted by a cache and a timer on an ARM-based data acquisition system. According to the characteristic of real-time data acquisition and data storage and deletion application, data operation with high randomness and burstiness is written into the SD card in a fixed size or fixed time mode through the cache and the timer, and a judgment mode is introduced into data delete operation, so that times for repeatedly reading and writing the data in a certain cluster are reduced, the resource occupancy rate of the processor in an event is greatly reduced, data storage and deletion speed is improved by over 400 percent; the method is independent of an operating system, and the data is easy to transplant; and the capability of the system of acquiring and processing the data in real time is improved.

Description

At embedded ARM processor to SD card data storage and delet method
Technical field
The present invention relates to a kind of computer data storage means, relate in particular to a kind of at embedded-type ARM (Advanced RISC Machines) processor to SD card data storage and delet method.
Background technology
Along with development of Embedded technique, especially aspect Industry Control, embedded system is strong with specificity, cost is low, performance is high, good stability and more and more widely being used.Based on the microprocessor of ARM kernel,, saving energy low with performance height, cost, abundant external expanded circuit, exploitation is convenient is being used widely aspect the embedded industry control.
The data acquisition storage is preserved the data of a large amount of embedded systems collection in real time and the data that system uses as a pith of built-in field.The SD card is used widely with its high capacity, high-performance, and it is integrated solid dielectric simultaneously, without any movable part, does not worry the damage of mechanical motion, becomes the first-selection of embedded memory device.In order effectively to visit the data of SD card storage, generally in the SD card, introduce embedded file system simultaneously.
Existing embedded real-time data acquisition system, general embedded ARM processor management data collection and the store tasks that adopts no operating system, when the SD card is operated, especially the real-time data acquisition class is used, can occur because excessive frequent small amount of data writes and the data deletion demand, make processor waste ample resources be used to handle the low speed peripheral hardware time, between collection and store tasks, switch repeatedly, cause real-time to be subjected to very big influence.
Being extensive use of of Windows operating system makes the FAT file system become first-selection.Because the FAT32 file system is subjected to rolling up the restriction of size and the restriction of file directory maximum number unlike FAT12, FAT16, is particularly suitable as embedded file system.At industrial control field, efficiently data storage, read, delete and can reduce the loss of peripheral hardware cpu resource, make the performance that improves embedded system in and the application that data storage is frequent less to greatest extent, especially in application facet such as real-time data acquisition, data processing in the single operation data volume.
Summary of the invention
The objective of the invention is to, provide a kind of at need not embedded ARM processor that operating system supports to SD card data storage and delet method, this method can increase substantially that its data write and deletion speed, be reduced in data acquisition use in SD card data storage operations to the occupation rate of system resource.
In order to realize above-mentioned task, the present invention takes following technical solution to be achieved:
A kind of at embedded ARM processor to SD card data storage and delet method, it is characterized in that, this method writes SD card by buffer memory and timer in the mode of fixed size or set time with randomness and sudden strong data manipulation, specifically carries out according to the following steps:
1) arm processor sticks into the foundation of capable initialization and FAT32 file to SD;
2) in internal memory, set up the data buffer area of one 512 byte;
3) clock timer is set, makes clock timer count 500ms and produce interruption;
4) the SD card data operation request based on arm processor is judged:
A is if data write request is then carried out following operation:
(1) as data volume less than buffer size, then deposit buffer area in and start timer;
(2) if before timer interrupts taking place, there is not data write operation for the second time, the data in the buffer area are write in the SD card;
(3), continue to deposit data in buffer area if before timer interrupts, still have data to write request;
(4) if data volume more than or equal to buffer size, then in time writes in the SD card;
B is if following operation is then carried out in the data deletion request:
(1) only take a document cluster when file, this document bunch is the 2KB byte, reads corresponding bunch number and writes 0XFF, 0XFF, 0XFF, 0X0F;
(2) take two document clusters or greater than two document clusters when file, each document cluster is the 2KB byte, judge that whether this bunch number be in the same data block with last one bunch number, continue to handle this bunch number if be in the same data block, if this bunch number and last not being in for one bunch number with in the cluster number, amended document cluster number is write the SD card, and from newly reading another blocks of data, bunch whole set of number quilt that take until file.
The present invention preserves and the deletion required time significantly reducing data in and the single data volume smaller applications higher in embedded data acquisition field frequency, reduces data preservation and the deletion demand to processor resource.
Method of the present invention has been introduced judgment mode in the data deletion operation, reduced the number of times of read-write repeatedly to data in certain cluster, realized not relying on embedded ARM processor efficiently the writing and deletion action of operating system to the SD card, thereby reduced the resources occupation rate of processor in this type of incident significantly, data are preserved and deletion speed has improved more than 400%, increase substantially data access speed, and do not rely on operating system, transplant simple.
Description of drawings
Fig. 1 is a file write operation process flow diagram;
Fig. 2 is the file delete operational flowchart.
The present invention is further detailed explanation below in conjunction with accompanying drawing.
Embodiment
Acquiescence entered the SD communication pattern after the SD card powered on, at this moment to stick into capable initialization to SD, initialization procedure is mainly finished the obtaining of information such as size of capacity, the card of setting, the card of SD card frequency of operation, the most important thing is the setting of SD card data block length, at the general setting of built-in field one block size is 512 bytes, and this is consistent with the allocation units size that Windows operating system is given tacit consent to also.This process is finished by writing the SD card command to the SD card.
The English full name of FAT is File Allocation Table, means file allocation table, and bunch number 32 bits of use of 32 each document cluster of expression come addressing.Bunch be the least unit of file access, file system by bunch dividing and manage, bunch is the base unit of allocation of space and recovery to the storage space of data field.Be generally 2 times, 4 times, 8 times, 16 times of block size (promptly 2 nDoubly).From statistics, the average space of 0.5 bunch of each file wastes both, bunch big more, the waste of storage file time space is many more, utilization factor is low more, therefore built-in field a document cluster should be provided with excessive, be generally 4 times or 8 times of block size.
The FAT32 file system is three parts with the spatial division of Logical Disk, is boot section (BOOT district), file allocation list area (FAT district), data field (DATA district) successively.
The information such as entry address in the parameter that boot section (BOOT district) log file system is the most basic and FAT1, FAT2 table and DATA district.FAT1 and FAT2 are writing down duplicate document cluster chain index structure, because these district's data are extremely important, therefore use FAT2 as backup.Root directory area writes down filename, file attribute, the establishment visit of each file and revises date and position and file size in the FAT table.Creating a file and will operate this district and revise corresponding TAT concordance list simultaneously, also is will revise this district equally to delete index record in the TAT table simultaneously and delete a file.
For the efficient that improves CPU, reduce the loss of peripheral hardware to cpu resource, reduce the number of times that CPU reads SD card data block to greatest extent.This is to improving system real time performance significant role.
When file is carried out write operation, according to this document in the FAT district, write down bunch number, calculate the address that file data is stored in the data field, under the general situation, file data is very little when writing, information such as tens bits, if at this moment trigger write operation one time, this can cause cpu resource to expend in a large number in peripheral hardware operation at a slow speed, here, need to introduce the buffer area of a blocks of files size and clock timer is set, the value of timer is according to the data acquisition rate of data system and definite, the time interval of general timer is set to 500ms, and timer is counted 500ms and promptly produced interruption.
Writing fashionablely when file, is in time to write the data field or leave buffer area in according to the size decision file that writes file, simultaneously the timer value of She Dinging and start timer.If the second time, data did not write before timer interrupted taking place, in time the data with buffer zone deposit in, if still have request of data to write before timer interrupts, these data are continued to deposit in buffer area.
Its write operation flow process is as shown in Figure 1: the size of judgment data piece at first, if data block is less than 512 bytes, deposit data buffer area in, and startup timer, judge then whether timer arrives the time of setting (500ms), if before timer interrupts, still have data to write request, continue to deposit data in buffer area; If do not have then in time deposit the data of data buffer area in the SD card, on the contrary, when timer does not also reach the timing value of 500ms, when memory data output has reached the data buffer area size, should in time deposit data in the SD card, prevent that data from overflowing.
When file is carried out deletion action, the lot of data operation will occur in removes FAT bunch number that this document takies, when file relatively hour, as long as read corresponding bunch number and write 0XFF, 0XFF, 0XFF, 0X0F, but when file is big, reading of need not stopping revised and to be write document cluster number, can waste a large amount of system resource.Whether the number of times that reduces read-write piece number can be in the same data block with last one bunch number by judging this bunch number, continue to handle bunch number if be in the same data block, if be not in in the cluster number, amended document cluster number is write the SD card, and from newly reading another blocks of data, bunch whole set of number quilt that take until file.Can infer that file is big more, the efficient of this deleted file method is just high more.
Its deletion action flow process is as shown in Figure 2: at first file is used the number of clusters amount to subtract 1, if the result is 0, continue to judge the operation of having read FAT, if the result is not 0, read a bunch number access site data block and be revised as 0X00, read down cluster number, judge then to be in the same data block for new bunch number, if return; If not, data block is write a bunch number place FAT1, FAT2 position, read the storaging position data piece new bunch number, return.If, then being revised as 0X00, data block writes a bunch number place FAT1, FAT2 position then, and file delete successfully returns.If not, read a bunch number access site data block, be revised as 0X00 then.

Claims (1)

  1. One kind at embedded ARM processor to SD card data storage and delet method, it is characterized in that, this method writes SD card by buffer memory and timer in the mode of fixed size or set time with randomness and sudden strong data manipulation, specifically carries out according to the following steps:
    1) arm processor sticks into the foundation of capable initialization and FAT32 file to SD;
    2) in internal memory, set up the data buffer area of one 512 byte;
    3) clock timer is set, makes clock timer count 500ms and produce interruption;
    4) the SD card data operation request based on arm processor is judged:
    A is if data write request is then carried out following operation:
    (1) as data volume less than buffer size, then deposit buffer area in and start timer;
    (2) if before timer interrupts taking place, there is not data write operation for the second time, the data in the buffer area are write in the SD card;
    (3), continue to deposit data in buffer area if before timer interrupts, still have data to write request;
    (4) if data volume more than or equal to buffer size, then in time writes in the SD card;
    B is if following operation is then carried out in the data deletion request:
    (1) only take a document cluster when file, this document bunch is the 2KB byte, reads corresponding bunch number and writes 0XFF, 0XFF, 0XFF, 0X0F;
    (2) take two document clusters or greater than two document clusters when file, each document cluster is the 2KB byte, judge that whether this bunch number be in the same data block with last one bunch number, continue to handle this bunch number if be in the same data block, if this bunch number and last not being in for one bunch number with in the cluster number, amended document cluster number is write the SD card, and from newly reading another blocks of data, bunch whole set of number quilt that take until file.
CN2010105321087A 2010-11-04 2010-11-04 Method for storing and deleting data of SD card by using embedded ARM processor Expired - Fee Related CN101968724B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010105321087A CN101968724B (en) 2010-11-04 2010-11-04 Method for storing and deleting data of SD card by using embedded ARM processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010105321087A CN101968724B (en) 2010-11-04 2010-11-04 Method for storing and deleting data of SD card by using embedded ARM processor

Publications (2)

Publication Number Publication Date
CN101968724A true CN101968724A (en) 2011-02-09
CN101968724B CN101968724B (en) 2012-05-23

Family

ID=43547885

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010105321087A Expired - Fee Related CN101968724B (en) 2010-11-04 2010-11-04 Method for storing and deleting data of SD card by using embedded ARM processor

Country Status (1)

Country Link
CN (1) CN101968724B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102323907A (en) * 2011-08-19 2012-01-18 长安大学 Method for embedded ARM (advanced RISC machines) processor to store and delete NANDFLASH data
CN106557572A (en) * 2016-11-11 2017-04-05 武汉斗鱼网络科技有限公司 A kind of extracting method and system of Android application program file
CN110427340A (en) * 2018-04-28 2019-11-08 伊姆西Ip控股有限责任公司 Method, apparatus and computer storage medium for file storage
CN113612699A (en) * 2021-08-02 2021-11-05 上海航天测控通信研究所 Method for improving IP over CCSDS transmission efficiency
CN113961558A (en) * 2021-10-08 2022-01-21 上海信宝博通电子商务有限公司 Front-end data storage method and device and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1553496A (en) * 2003-06-05 2004-12-08 中兴通讯股份有限公司 Controller for accessing system chip external SDRAM and realizing method thereof
CN1661586A (en) * 2005-01-21 2005-08-31 长沙科瑞捷机电技术有限公司 PC104 embedded type computer based on ARM

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1553496A (en) * 2003-06-05 2004-12-08 中兴通讯股份有限公司 Controller for accessing system chip external SDRAM and realizing method thereof
CN1661586A (en) * 2005-01-21 2005-08-31 长沙科瑞捷机电技术有限公司 PC104 embedded type computer based on ARM

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《科技资讯》 20071231 丁富舜等 低端嵌入式系统中SD卡读写的实现 第218-219页 1 , 第21期 2 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102323907A (en) * 2011-08-19 2012-01-18 长安大学 Method for embedded ARM (advanced RISC machines) processor to store and delete NANDFLASH data
CN106557572A (en) * 2016-11-11 2017-04-05 武汉斗鱼网络科技有限公司 A kind of extracting method and system of Android application program file
CN110427340A (en) * 2018-04-28 2019-11-08 伊姆西Ip控股有限责任公司 Method, apparatus and computer storage medium for file storage
CN113612699A (en) * 2021-08-02 2021-11-05 上海航天测控通信研究所 Method for improving IP over CCSDS transmission efficiency
CN113612699B (en) * 2021-08-02 2023-12-08 上海航天测控通信研究所 Method for improving transmission efficiency of IP over CCSDS
CN113961558A (en) * 2021-10-08 2022-01-21 上海信宝博通电子商务有限公司 Front-end data storage method and device and storage medium

Also Published As

Publication number Publication date
CN101968724B (en) 2012-05-23

Similar Documents

Publication Publication Date Title
KR101522848B1 (en) Self-journaling and hierarchical consistency for non-volatile storage
CN101968724B (en) Method for storing and deleting data of SD card by using embedded ARM processor
US8578112B2 (en) Data management system and data management method
US10540095B1 (en) Efficient garbage collection for stable data
US20230046216A1 (en) Data management system and method of controlling
CN101707633B (en) Message-oriented middleware persistent message storing method based on file system
CN110968253B (en) Data storage method, device and system
CN101968796B (en) Method for segmenting bidirectionally and concurrently executed file level variable-length data
WO2012054223A2 (en) Low ram space, high-throughput persistent key-value store using secondary memory
CN103218224A (en) Method and terminal for improving utilization ratio of memory space
CN103049396B (en) The method of writing with a brush dipped in Chinese ink of data and device
Ji et al. Lightweight data compression for mobile flash storage
CN104571955A (en) Method and device for expanding storage capacity
CN104798063A (en) Memory device and host device
US20210191658A1 (en) Storage system and data compression method for storage system
CN108089825B (en) Storage system based on distributed cluster
Lee et al. iLSM-SSD: An intelligent LSM-tree based key-value SSD for data analytics
CN105094709A (en) Dynamic data compression method for solid-state disc storage system
CN104092670A (en) Method for utilizing network cache server to process files and device for processing cache files
Rumble Memory and object management in RAMCloud
CN117472285A (en) Intelligent operation acceleration method for solid state disk, computer equipment and storage medium
CN108958657B (en) Data storage method, storage device and storage system
KR100852729B1 (en) Compressed file managementing device
US9646014B1 (en) Systems and methods for selective defragmentation
CN105608014B (en) A kind of storage device using MRAM

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120523

Termination date: 20211104

CF01 Termination of patent right due to non-payment of annual fee