CN106528440A - Flash memory operation method and apparatus based on embedded system - Google Patents

Flash memory operation method and apparatus based on embedded system Download PDF

Info

Publication number
CN106528440A
CN106528440A CN201610950273.1A CN201610950273A CN106528440A CN 106528440 A CN106528440 A CN 106528440A CN 201610950273 A CN201610950273 A CN 201610950273A CN 106528440 A CN106528440 A CN 106528440A
Authority
CN
China
Prior art keywords
file
flash
block
physical address
address
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
CN201610950273.1A
Other languages
Chinese (zh)
Other versions
CN106528440B (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.)
Hisense Broadband Multimedia Technology Co Ltd
Original Assignee
Hisense Broadband Multimedia Technology 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 Hisense Broadband Multimedia Technology Co Ltd filed Critical Hisense Broadband Multimedia Technology Co Ltd
Priority to CN201610950273.1A priority Critical patent/CN106528440B/en
Publication of CN106528440A publication Critical patent/CN106528440A/en
Application granted granted Critical
Publication of CN106528440B publication Critical patent/CN106528440B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention discloses a flash memory operation method and apparatus based on an embedded system, used for solving the problem that Flash needs to be designed and planned according to different operating systems in the prior art. The method comprises: receiving a flash memory operation request initiated by an application layer; determining whether an operation mode is to operate in a file manner or to operate in a physical address manner; when it is determined that the operation mode is to operate in the file manner, continuing to determine whether a file corresponding to an address section indicated by operation address information exists in a flash memory, and if yes, performing a corresponding operation on the file according to an operation instruction, or otherwise, creating a file corresponding to the address section, and performing a corresponding operation on the created file according to the operation instruction; and when it is determined that the operation mode is to operate in the physical address manner, performing a corresponding operation according to the operation instruction and based on the address section indicated by the operation address information. The present invention provides a method for unifying operations and managing Flash for embedded products of different operating systems.

Description

A kind of flash disk operation method and device based on embedded system
The application is to propose on March 26th, 2014, Application No. 201410117104.0, entitled a kind of based on embedded The divisional application of the Chinese invention patent application of the flash disk operation method and device of formula system.
Technical field
The present invention relates to technical field of memory, more particularly to a kind of flash disk operation method and dress based on embedded system Put.
Background technology
Flash memory(Flash)It is the storage device of embedded platform, for some embedded platform equipment, such as Set Top Box, Flash is used for the contents such as storage system software, application software and user profile.When to Design of System Software, need to above-mentioned The storage address of content carries out planning strict in detail.Some application modules, such as CA modules, advertisement module or program module Etc., the storage information of Flash all can be used, the operation such as is read out to Flash, writes or wipe, and each is applied Module can only be operated in the address section for distributing to oneself, once wrongly write address, it is possible to can cause and serious be System failure.
Using the embedded platform of different operating system, the operator scheme of Flash is made a big difference.For Linux Operating system, uses memory techniques equipment(Memory Technology Device, MTD)Unification is set up for Flash Abstraction interface, user are that the standard interface of the reading, write or erasing file of calling linux system itself to provide enters to Flash Row associative operation.For UCOS operating system, user directly invoke the original driving of Flash Flash is read out, write or The operation of erasing file.
There is following defect in prior art:When application layer software switches between different operating system, due in difference Operating system under, different to the operator scheme of Flash, needs are separately designed according to different operating system and plan Flash.
The content of the invention
The embodiment of the present invention provides a kind of flash disk operation method and device based on embedded system, to solve existing skill Need the problem of Flash is separately designed and planned for different operating system in art.
The embodiment of the present invention provides a kind of flash disk operation method and device based on embedded system, including following two sides Face.
In a first aspect, a kind of flash disk operation method based on embedded system, the method includes:
Receive application layer initiate flash disk operation request, flash disk operation request in carry operational order, operation address information with And operator scheme;
Judge that operator scheme is to operate by file mode or operate by physical address mode;
When it is determined that operator scheme is to operate by file mode, continue to judge in a flash memory with the presence or absence of referring to operation address information The corresponding file of the address section that shows, if so, then carries out corresponding operating to file according to operational order;Otherwise, corresponding address Interval establishment file, carries out corresponding operating to the file for creating according to operational order;
When it is determined that operator scheme is to operate by physical address mode, then according to operational order, according to operation address information indicate Address section carry out corresponding operating.
By this possible embodiment, it is the embedded product of different operating systems, there is provided a kind of unification Flash methods of operating, after the file store path for subsequently carrying out Flash operations is planned in Design of System Software, technology people Member need not be concerned about which kind of embedded platform the application layer software is applied at, directly using the Flash operation sides of the embodiment of the present invention Method, is processed accordingly according to different operator schemes, can be reliable and stable associative operation is carried out to Flash, reduce Cross the border the possibility of storage, it is ensured that the reliability of system.Product in different operating system is mutually inherited, for The product of same application is capable of achieving rapid switching, shortens the exploitation debug time of new product.
With reference in a first aspect, in the first possible implementation, the flash disk operation for receiving application layer initiation asks it Before, also include:
In the system configuration stage, default operator scheme is obtained, judge that operator scheme is operated by file mode or by physics Address mode is operated;
When it is determined that operator scheme is to operate by file mode, establishment carries out file store path during subsequent operation to flash memory, And the memory techniques facility information of flash memory is obtained, block message is configured according to memory techniques facility information;
When it is determined that operator scheme is to operate by physical address mode, the public flash interface information of flash memory is obtained, according to public Flash interface information configuration block message;
Wherein, block message includes block number, first address and the block size of each block.
By this possible embodiment there is provided for the UCOS systems collocation method different with linux system, making Further can respectively according to two kinds of systems different operation modes, to flash memory adopt different modes of operation.
With reference to the first possible implementation of first aspect, in second possible implementation, judge dodging With the presence or absence of the file corresponding with the address section that operation address information is indicated in depositing, including:
Start physical address and termination physical address according to carrying in operation address information determines address section;
The block number of each block covered by address section is determined according to block message, judge in flash memory with the presence or absence of with covering each The corresponding file of block number of block.
By this possible embodiment, the operation address information that application layer is indicated can be corresponded to linux system Middle file so that corresponding operating can be carried out to this document according to operational order further.
With reference to second possible implementation of first aspect, in the third possible implementation, corresponding address Interval establishment file, including:
It is determined that the block number of each block covered by address section, corresponds to one file of each piece of establishment in each block, using every One piece of block number is named to the file for creating.
By this possible embodiment, when there is no the corresponding file of address section, using this by block and file Corresponding mode, establishment file, when so can causing subsequent operation, can be by operation address information searching to correspondence File.
With reference to second or the third possible implementation of first aspect, in the 4th kind of possible implementation, Corresponding operating is carried out to the file for creating according to operational order, including:
Behaviour is read out, writes or is wiped according to the data in the corresponding file of each block that operational order is covered to address section Make.
With reference to the first possible implementation of first aspect, in the 5th kind of possible implementation, it is determined that behaviour When operation mode is to operate by physical address mode, then entered according to operational order, the address section indicated according to operation address information Row corresponding operating, including:
When it is determined that operator scheme is to operate by physical address mode, then according to operational order each block corresponding to address section In data be read out, write or erasing operation.
Second aspect, a kind of flash disk operation device based on embedded system, the device include:
Receiving unit, for receiving the flash disk operation request of application layer initiation, carries operational order, behaviour in flash disk operation request Make address information and operator scheme;
Judging unit, for judging that operator scheme is operated by file mode operation or by physical address mode;
First performance element, for when it is determined that operator scheme is to operate by file mode, continuing to judge whether deposit in a flash memory In the file corresponding with the address section that operation address information is indicated, if so, then file is carried out accordingly according to operational order Operation;Otherwise, corresponding address interval establishment file, carries out corresponding operating to the file for creating according to operational order;
Second performance element, for when it is determined that operator scheme is to operate by physical address mode, then according to operational order, according to The address section that operation address information is indicated carries out corresponding operating.
By this possible embodiment, it is the embedded product of different operating systems, there is provided one kind can be right Flash carries out the device of unified operation, in the way of module provides standard set adapting operation interface as application layer, and this causes The compatibility of Flash equipment is more preferably.Planning in Design of System Software subsequently carries out the file store path of Flash operations Afterwards, technical staff need not be concerned about which kind of embedded platform the application layer software is applied at, directly using the embodiment of the present invention Flash operation devices, are processed accordingly according to different operator schemes, can be reliable and stable correlation is carried out to Flash Operation, reduces the possibility of storage of crossing the border, it is ensured that the reliability of system.Allow the product phase in different operating system Mutually inherit, for the product of same application is capable of achieving rapid switching, shorten the exploitation debug time of new product.
With reference to second aspect, in the first possible implementation, also include:Dispensing unit, for receiving application layer Before the flash disk operation request of initiation, obtain default operator scheme, judge operator scheme be by file mode operation or by Physical address mode is operated, and when it is determined that operator scheme is to operate by file mode, when establishment carries out subsequent operation to flash memory File store path, and obtain the memory techniques facility information of flash memory, block message configured according to memory techniques facility information, with And when it is determined that operator scheme is to operate by physical address mode, the public flash interface information of acquisition flash memory, according to public sudden strain of a muscle Deposit interface message configuration block message;Wherein, block message includes block number, first address and the block size of each block.
By this possible embodiment, the flash disk operation device in the embodiment of the present invention for UCOS systems and Linux system adopts different configuration modes so that different operation modes that further can respectively according to two kinds of systems, right Flash memory adopts different modes of operation.
With reference to the first possible implementation of second aspect, in second possible implementation, first performs Unit specifically for:
Start physical address and termination physical address according to carrying in operation address information determines address section;
The block number of each block covered by address section is determined according to block message, judge in flash memory with the presence or absence of with covering each The corresponding file of block number of block.
By this possible embodiment, the operation address information that application layer is indicated can be corresponded to linux system Middle file so that corresponding operating can be carried out to this document according to operational order further.
With reference to second possible implementation of second aspect, in the third possible implementation, first performs Unit specifically for:
It is determined that the block number of each block covered by address section, corresponds to one file of each piece of establishment in each block, using every One piece of block number is named to the file for creating.
By this possible embodiment, when there is no the corresponding file of address section, using this by block and file Corresponding mode, establishment file, when so can causing subsequent operation, can be by operation address information searching to correspondence File.
With reference to second or the third possible implementation of second aspect, in the 4th kind of possible implementation, First performance element specifically for:
Behaviour is read out, writes or is wiped according to the data in the corresponding file of each block that operational order is covered to address section Make.
With reference to the first possible implementation of second aspect, in the 5th kind of possible implementation, second performs Unit specifically for:
When it is determined that operator scheme is to operate by physical address mode, then according to operational order each block corresponding to address section In data be read out, write or erasing operation.
Description of the drawings
Flash software structured flowcharts of the Fig. 1 for the embodiment of the present invention;
Fig. 2 is the flow chart processed to Flash by the Flash adaptation processings module of the embodiment of the present invention;
Flash disk operation method flow diagrams based on embedded system of the Fig. 3 for the embodiment of the present invention;
Flash disk operation installation drawings based on embedded system of the Fig. 4 for the embodiment of the present invention.
Specific embodiment
In order to be given at Flash methods of operating unified between several operation systems so that application layer software can be by system One interface interchange Flash, and the implementation for being operated to Flash in a like fashion is adopted, the embodiment of the present invention is provided A kind of flash disk operation method and device based on embedded system, is preferable to carry out to the present invention below in conjunction with Figure of description Example is illustrated.
The flash disk operation method based on embedded system in the embodiment of the present invention, will be in Linux and UCOS operating system Increase a Flash adaptation processing module between application module, standard set adapting operation is provided for upper application module Interface, unification are operated and are managed Flash.In linux system, application layer is indicated into that physical address to be operated is corresponded to File in linux system, carries out corresponding operating to Flash according to file mode;In UCOS systems, application layer is indicated will The physical address of operation is sent to Flash in system, directly carries out associative operation to Flash according to physical address.
The preferred embodiments of the present invention are illustrated below in conjunction with accompanying drawing.
Refering to shown in Fig. 1, the software of embedded platform product is that layering and sub-module are designed, the design of Flash software Also it is such.Drive layer according to the difference of operating system on the hardware, the operation to Flash is also what is processed respectively, (SuSE) Linux OS introduces MTD compared to UCOS operating system, and Flash device drives have been divided into four layers from top to bottom, It is followed successively by hardware driving layer(That is Flash is original to drive 190):The reading of responsible Flash hardware devices, write and clash operation; MTD original devices layer 180:Mainly it is made up of two parts, a part is MTD original device versatility codes, and another part is each The data of specific Flash, such as subregion;MTD mechanical floors:Based on MTD original devices, (SuSE) Linux OS can be defined MTD character devices 160 and MTD block devices 170, constitution equipment layer;Device node:Set up under/dev subdirectories by mknod Character device node 140 and block device node 150, user may have access to MTD character devices and block by accessing this device node Equipment.It is and the Flash adaptation processings module 110 in the embodiment of the present invention is in intermediate layer, embedded from different positioned at application layer 100 Formula platform(That is UCOS systems and linux system)Between, standard set adaptation is provided as upper layer application in the way of module Operate interface.
Refering to shown in Fig. 2, Flash adaptation processings module mainly provides four class interfaces to application layer, but be not limited only to this four Class, subsequently can be according to the adapting operation interface for needing continual exploitation standard of application layer.This four classes interface is respectively used for examining The version information interface that Flash is adapted to drive module is looked into, for obtaining Flash total sizes, block size, total block data etc. block message Flash information interfaces, for the initialization interface of initial configuration Flash operator scheme, and for reading, write and wipe Except the operate interface of Flash.The flow process for carrying out initial configuration includes step 2000 to step 2005, is read out write and wipes The flow process of division operation includes that step 2010, to step 2015, is read out to flash memory, is write to Flash adaptation processing modules below It is introduced with the idiographic flow of operation such as erasing.
Refering to shown in Fig. 3, in the embodiment of the present invention, the idiographic flow operated to flash memory by Flash adaptation processings module It is as follows:
Step 300:Flash adaptation processings module receives the flash disk operation request that application layer is initiated, and carries in flash disk operation request There are operational order, operation address information and operator scheme.
Specifically, before receiving the flash disk operation request that application layer is initiated, need to carry out system configuration, at Flash adaptations Reason module can provide initialization interface, call for application layer.After application layer have invoked the initialization interface, system is proceeded by Initialization operation, and default operator scheme is obtained, judge that the operator scheme is operated by file mode or by physical address Mode is operated;In being embodied as, Flash adaptation processings module can to all Flash physical address corresponding piece operate Flash blocks in linux system specifically are set to operate by file mode, are represented with digital " 1 " by the setting of pattern;Will Flash blocks in UCOS systems are set to operate by physical address mode, are represented with digital " 0 ".User can be according to current Default operator scheme is set to operator scheme corresponding with current operation system by the operating system for using, for example, if currently Linux system is used, then default operator scheme is set to operate by file mode by user in advance;If currently used It is UCOS systems, then default operator scheme is set to operate by physical address mode by user in advance;If desired use simultaneously Two kinds of operating systems, then first initialized to one of which operating system in any order, then to another kind of operating system Initialized, such as first linux system is initialized, its operator scheme is set to operate by file mode, then it is right UCOS systems are initialized, and its operator scheme is set to operate by physical address mode.
When it is determined that aforesaid operations pattern is to operate by file mode, due in linux system, introducing public flash memory Interface(Common Flash Interface, CFI)MTD, need from MTD information obtain Flash block message, therefore Create after subsequently carrying out writing the file store paths of operation such as erasing, obtain the MTD information of flash memory, matched somebody with somebody according to MTD information Put block message;When it is determined that aforesaid operations pattern is to operate by physical address mode, directly flash memory can be obtained from CFI information Block message, directly can be according to CFI information configuration block messages;Wherein, block message is used for block number, the starting point for indicating each block Location and block size, block are indicated for the least unit of data in flash memory storage;In practical application, a Flash is by some big Little identical block composition, wherein block size artificially can be configured, it would however also be possible to employ indicated block in CFI information or MTD information Size, each piece is numbered successively, and each piece is carried out with its first address corresponding.
After the completion of system initialisation phase, Flash adaptation processings module receives the flash disk operation request that application layer is initiated, and dodges Operational order, operation address information and operator scheme are carried in depositing operation requests, wherein, operational order is right for indicating Which kind of operation Flash carries out, such as read, write or wipe etc..
Step 310:Judge that operator scheme is to operate by file mode or operate by physical address mode.
Specifically, in the embodiment of the present invention, when being illustrated, linux system is operated using file mode is pressed, UCOS System is using being operated by physical address mode, but is not limited only to both operations system, other operate according to file mode or According to the operating system that physical address mode is operated, equally within the scope of the embodiment of the present invention includes.Flash adaptation processings Module obtains the operator scheme of the Flash that will be read out, and write or wipe from flash disk operation request, wherein, the operation Pattern is arranged in initialization, if operator scheme is 1, is operated according to file mode, if operator scheme is 0, according to Physical address mode is operated.
Step 320:When it is determined that operator scheme is to operate by file mode, continuation judges Flash adaptation processings module With the presence or absence of the file corresponding with the address section that operation address information is indicated in flash memory, if so, then according to operational order pair File carries out corresponding operating, and otherwise, corresponding address interval establishment file is accordingly grasped to the file for creating according to operational order Make.
Specifically, when it is determined that operator scheme is to operate by file mode, judge in a flash memory with the presence or absence of with operatively The corresponding file of address section that location information is indicated, i.e., according to the start physical address and termination carried in operation address information Physical address determines address section;The block number of each block covered by address section is determined according to block message, in judging flash memory is The no corresponding file of block number that there is each block for covering.For example, the block size of Flash is 64k, writes Flash input operations Address information, wherein, start physical address is 0x10000, termination physical address be 0x30000, Flash adaptation processing module roots According to the block size indicated in block message during initialization, the ground that inquiry starts to termination physical address to terminate from start physical address Location is interval, and the block number of all blocks covered by the address section is the 2nd piece and the 3rd piece, therefore, whether there is in judging Flash The corresponding file of the block number;Generally these files can be ordered with the block number, in this case, the filename of corresponding file For " file_2 " and " file_3 ".
If there is the file corresponding with the block number of each block, corresponding operating is done to file according to operational order.For example, to upper The file for stating file entitled " file_2 " and " file_3 " carries out write operation.
If there is no the file corresponding with the block number of each block, corresponding address interval establishment file is concretely comprised the following steps: It is determined that the block number of each block covered by address section, corresponds to one file of each piece of establishment in each block, using each piece Block number to create file be named.For example, there is no the block institute of each block covered by address section in Flash During corresponding file, however, it is determined that the block number of the block of covering is the 5th piece to the 7th piece, then the 5th piece to the 7th piece establishment file name is corresponded to For three files of " file_5 ", " file_6 " and " file_7 ".
After the completion of establishment file, the operation that the file that these create is read accordingly, writes or wiped.
Above-mentioned steps are completed when operator scheme is to operate by file mode, and application layer input is operated Flash's After physical address, the physical address is corresponded to into the file in linux system, then using these file analogy physical address These files are directly carried out corresponding operating by mode of operation.So just can adopt with UCOS systems and operate in a like fashion, all It is the physical address that Flash to be operated is input into from application layer, you can carry out corresponding operating to this section of physical address, and In linux system, the physical address of Flash to be operated that be through application layer is input into corresponds to the text in linux system Part, then corresponding operating is carried out to file, that is, corresponding that section of physical address of file carries out corresponding operating.
Step 330:Flash adaptation processings module when it is determined that operator scheme is to operate by physical address mode, then basis Operational order, the address section indicated according to operation address information carry out corresponding operating.
Specifically, when it is determined that operator scheme is to operate by physical address mode, then according to operational order, according to starting material The address section that reason address and termination physical address are indicated, carries out corresponding operating to Flash.For example, the block size of Flash is 64k, reads Flash input operation address informations, wherein, start physical address is 0x40000, terminates physical address and is 0x50000, Flash adaptation processing module, according to the reading Flash for directly indicating according to operational order, to address section Data in 0x40000 to 0x50000, that is, the 5th piece are read out.
Before introducing and corresponding operating being carried out to the file or block of address section, first introduce the practical structures of flash memory, one Individual flash memory internal has multiple pieces, and embedded platform process is all that binary data, only 0 and 1 are constituted, equally will be The data preserved in Flash are also binary, in the operation to Flash, can only be written as 0 by 1, and can not be write as 1 by 0, So before write Flash, will first carry out erasing operation, content that will be in Flash is all changed into 1, is being write Operation, when write operation is carried out, i.e., only will be write for 0 position.The least unit of erasing operation is block, i.e., every time A block will at least be wiped.
When application layer calls reading, write or the operate interface wiped, Flash adaptation processing modules are also according to difference Operator scheme being processed.
When it is determined that operator scheme is to be operated by file mode, corresponding operating is carried out to file according to operational order, Refer specifically to:It is read out, writes or wipes according to the data in the corresponding file of each block that operational order is covered to address section Division operation.
Specifically, if operational order indicates to be read, read each block covered by address section corresponding The data stored in file;For example, when block size is 64k, application layer to be read the address section in Linux system The data of 0x00000 to 0x20000, then by Flash adaptation processing modules, using unified operate interface, to the address area Between the corresponding file of each block that covers, i.e., deposit in the file of the 1st piece and the 2nd piece corresponding entitled " file_1 " and " file_2 " Storage data are read out.
If operational order indicates to carry out write operation, each block that the data write being written into is covered by address section In corresponding file;For example, when block size is 64k, application layer to be write address section 0x00000 in Linux system extremely The data of 0x20000, then by Flash adaptation processing modules, using unified operate interface, what the address section was covered is each The corresponding file of individual block, i.e., in the file of the 1st piece and the 2nd piece corresponding entitled " file_1 " and " file_2 ", data storage is carried out Write.
If operational order indicates to carry out erasing operation, by the number in the corresponding file of each block covered by address section According to being wiped;When block size is 64k, application layer to be read the address section 0x00000 to 0x20000 in Linux system Data, then by Flash adaptation processing modules, using unified operate interface, each block pair that the address section is covered In the file answered, i.e., the 1st piece and the file of the 2nd piece corresponding entitled " file_1 " and " file_2 ", data storage is all written as 1.
It is when it is determined that operator scheme is to operate by physical address mode, then corresponding to address section each according to operational order Data in individual block are read out, write or erasing operation.
Specifically, if operational order indicates to be read, store in reading corresponding each block of address section Data;For example, when block size is 64k, application layer to be read the address section 0x10000's to 0x20000 in UCOS systems Data, then by Flash adaptation processing modules, using unified operate interface, each block that the address section is covered, i.e., the In 2 pieces, data storage is read out.
If operational order indicates to carry out write operation, interval corresponding each block of the data writing address being written into In;For example, when block size is 64k, application layer to be read the number of the address section 0x10000 to 0x20000 in UCOS systems According to, then by Flash adaptation processing modules, using unified operate interface, each block that the address section is covered, i.e., the 2nd In block, data storage is wiped, and then carries out write operation.
If operational order indicates to carry out erasing operation, the data stored in wiping corresponding each block of address section;Example Such as, when block size is 64k, application layer to be read the data of the address section 0x10000 to 0x20000 in UCOS systems, then By Flash adaptation processing modules, using unified operate interface, each block covered to the address section, i.e., deposit in the 2nd piece Storage data are all written as 1.
So it is achieved that.
Below in conjunction with the accompanying drawings, the method and device that the present invention is provided is described in detail with specific embodiment.
Based on same inventive concept, according to the flash disk operation side based on embedded system that the above embodiment of the present invention is provided Method, correspondingly, another embodiment of the present invention additionally provides a kind of flash disk operation device based on embedded system, and apparatus structure shows It is intended to as shown in figure 4, specifically including:
Receiving unit 400, for receiving the flash disk operation request of application layer initiation, carries operation in flash disk operation request and refers to Make, operation address information and operator scheme;
Judging unit 410, for judging that operator scheme is operated by file mode operation or by physical address mode;
Whether the first performance element 420, for when it is determined that operator scheme is to operate by file mode, continue to judge in a flash memory There is the file corresponding with the address section that operation address information is indicated, phase is carried out to file according to operational order then if so, Should operate;Otherwise, corresponding address interval establishment file, carries out corresponding operating to the file for creating according to operational order;
Second performance element 430, for when it is determined that operator scheme is to operate by physical address mode, then according to operational order, The address section indicated according to operation address information carries out corresponding operating.
Dispensing unit 440, before the flash disk operation for receiving application layer initiation is asked, obtains default operator scheme, Judge that operator scheme is to operate by file mode or operate by physical address mode, and it is determined that operator scheme is by file side When formula is operated, file store path when establishment carries out subsequent operation to flash memory, and the memory techniques facility information of flash memory is obtained, Block message is configured according to memory techniques facility information, and when it is determined that operator scheme is to operate by physical address mode, is obtained The public flash interface information of flash memory, according to public flash interface information configuration block message;Wherein, block message includes each block Block number, first address and block size.
First performance element 420 specifically for:According to the start physical address and termination thing that carry in operation address information Reason address determines address section;
The block number of each block covered by address section is determined according to block message, judge in flash memory with the presence or absence of with covering each The corresponding file of block number of block.
First performance element 420 specifically for:It is determined that the block number of each block covered by address section, corresponds in each block Each piece establishment one file, using each piece of block number to create file be named.
First performance element 420 specifically for:The corresponding file of each block address section covered according to operational order In data be read out, write or erasing operation.
Second performance element 430 specifically for:
When it is determined that operator scheme is to operate by physical address mode, then according to operational order each block corresponding to address section In data be read out, write or erasing operation.
In sum, scheme provided in an embodiment of the present invention, is the embedded product of different operating systems, there is provided one Unified Flash methods of operating being planted, and standard set adapting operation interface being provided as application layer in the way of module, this makes Obtain the compatibility of Flash equipment more preferably, planning in Design of System Software subsequently carries out the file store path of Flash operations Afterwards, technical staff need not be concerned about which kind of embedded platform the application layer software is applied at, directly using the embodiment of the present invention Flash methods of operating, the possibility that associative operation is carried out to Flash, storage of crossing the border is reduced that can be reliable and stable, it is ensured that The reliability of system.
Flash provided in an embodiment of the present invention operates treatment technology, is provided for the embedded product of different operating system The method that unification is operated and managed Flash so that mutually can inherit in the product of different operating system, for identical Using product be capable of achieving it is rapid switch, shorten the exploitation debug time of new product.And clearly hierarchical design is provided, is increased The stability of systems soft ware, the overall performance of improving product are added.
Obviously, those skilled in the art can carry out the essence of various changes and modification without deviating from the present invention to the present invention God and scope.So, if these modifications of the present invention and modification belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising these changes and modification.

Claims (9)

1. a kind of flash disk operation method based on embedded system, it is characterised in that methods described includes:
The physical address to be operated carried in receiving the instruction that application layer sends;
If current system uses linux system, the instruction corresponding operator scheme is set to grasp by file mode Make, and search the file in the linux system according to the physical address to be operated to be operated;
If current system uses UCOS systems, the instruction corresponding operator scheme is set to by physical address mode Operation, and the physical address to be operated is sent to into system Flash, so that the UCOS systems are according to physical address pair System Flash is operated.
2. the method for claim 1, it is characterised in that described according to the physical address to be operated is searched File in linux system, specially:
Judge in system Flash with the presence or absence of the text corresponding with the address section that the physical address to be operated is indicated Part;
If so, the file in the linux system is then searched according to the physical address to be operated;
If it is not, one file of each piece of establishment in each block for then covering to the address section, by the text of the new establishment Part is used as system file corresponding with the physical address to be operated.
3. the method for claim 1, it is characterised in that before receiving the instruction that application layer is initiated, also include:
In the system configuration stage, obtain default operator scheme, judge the operator scheme be by file mode operation or by Physical address mode is operated;
When it is determined that the operator scheme is to operate by file mode, establishment carries out file storage road during subsequent operation to flash memory Footpath, and the memory techniques facility information of flash memory is obtained, block message is configured according to the memory techniques facility information;
When it is determined that the operator scheme is to operate by physical address mode, the public flash interface information of flash memory is obtained, according to The public flash interface information configuration block message;
Wherein, the block message includes block number, first address and the block size of each block.
4. method as claimed in claim 2, it is characterised in that judge in system Flash with the presence or absence of waiting to grasp with described The corresponding file of address section that the physical address of work is indicated, including:
Start physical address and termination physical address according to carrying in the physical address information to be operated determines address area Between;
The block number of each block covered by the address section is determined according to the block message, judge in flash memory with the presence or absence of with institute State the corresponding file of block number of each block of covering.
5. method as described in claim 4, it is characterised in that each piece in each block covered to the address section A file is created, including:
It is determined that by the address section cover described in each block block number, each piece described in correspondence in each block create one File, is named to the file of the establishment using each piece of block number.
6. the method as described in claim 4 or 5, it is characterised in that each in each block covered to the address section Block also includes after creating a file:
According to the physical address to be operated to the data in the corresponding file of each block described in address section covering It is read out, writes or erasing operation.
7. method as claimed in claim 2, it is characterised in that so that the UCOS systems according to physical address to the system System Flash is operated, and is specifically included:
When it is determined that the operator scheme is to operate by physical address mode, then triggers system Flash and wait to grasp according to described Data in the physical address of work each block corresponding to the address section are read out, write or erasing operation.
8. a kind of flash disk operation device based on embedded system, it is characterised in that described device includes:
Receiving unit, for receiving the physical address to be operated carried in the instruction that application layer sends;;
Judging unit, including
First performance element, if using linux system for current system, the instruction corresponding operator scheme is set It is set to and operates by file mode, and the file in the linux system is searched according to the physical address to be operated and is grasped Make;
Second performance element, if using UCOS systems for current system, the instruction corresponding operator scheme is set It is set to and operates by physical address mode, and the physical address to be operated is sent to into system Flash, so that the UCOS System is operated to system Flash according to physical address.
9. device as claimed in claim 8, it is characterised in that also include:Dispensing unit, for obtaining default operation mould Formula, judges that the operator scheme is to operate by file mode or operate by physical address mode, and it is determined that the operation mould When formula is to operate by file mode, establishment carries out file store path during subsequent operation to flash memory, and obtains the internal memory of flash memory Technical equipment information, configures block message according to the memory techniques facility information, and it is determined that the operator scheme is by thing When reason address mode is operated, the public flash interface information of flash memory is obtained, believed according to the public flash interface information configuration block Breath;Wherein, the block message includes block number, first address and the block size of each block.
CN201610950273.1A 2014-03-26 2014-03-26 Flash memory operation method and device based on embedded system Active CN106528440B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610950273.1A CN106528440B (en) 2014-03-26 2014-03-26 Flash memory operation method and device based on embedded system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410117104.0A CN103870392B (en) 2014-03-26 2014-03-26 Flash memory operating method and device based on embedded system
CN201610950273.1A CN106528440B (en) 2014-03-26 2014-03-26 Flash memory operation method and device based on embedded system

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201410117104.0A Division CN103870392B (en) 2014-03-26 2014-03-26 Flash memory operating method and device based on embedded system

Publications (2)

Publication Number Publication Date
CN106528440A true CN106528440A (en) 2017-03-22
CN106528440B CN106528440B (en) 2020-06-09

Family

ID=50908946

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201410117104.0A Active CN103870392B (en) 2014-03-26 2014-03-26 Flash memory operating method and device based on embedded system
CN201610950273.1A Active CN106528440B (en) 2014-03-26 2014-03-26 Flash memory operation method and device based on embedded system

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201410117104.0A Active CN103870392B (en) 2014-03-26 2014-03-26 Flash memory operating method and device based on embedded system

Country Status (1)

Country Link
CN (2) CN103870392B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109344089B (en) * 2018-10-18 2021-06-22 京信通信系统(中国)有限公司 Method and device for operating norflash

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1758253A (en) * 2005-10-24 2006-04-12 中兴通讯股份有限公司 File management system and method
CN101149685A (en) * 2007-11-07 2008-03-26 苏州壹世通科技有限公司 Combined device and method for starting up multiple operation system from mobile memory apparatus
CN102736932A (en) * 2012-05-16 2012-10-17 上海斐讯数据通信技术有限公司 Image file, image file producing method and multisystem start guiding method
CN103345456A (en) * 2013-06-21 2013-10-09 烽火通信科技股份有限公司 Circuit and method for adjusting BootLoader starting address
CN103577201A (en) * 2012-07-20 2014-02-12 上海斐讯数据通信技术有限公司 Embedded dual system updating method and system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100843543B1 (en) * 2006-10-25 2008-07-04 삼성전자주식회사 System comprising flash memory device and data recovery method thereof
CN103269391B (en) * 2013-05-03 2016-09-14 惠州Tcl移动通信有限公司 A kind of bracket with foldable protection set assembly

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1758253A (en) * 2005-10-24 2006-04-12 中兴通讯股份有限公司 File management system and method
CN101149685A (en) * 2007-11-07 2008-03-26 苏州壹世通科技有限公司 Combined device and method for starting up multiple operation system from mobile memory apparatus
CN102736932A (en) * 2012-05-16 2012-10-17 上海斐讯数据通信技术有限公司 Image file, image file producing method and multisystem start guiding method
CN103577201A (en) * 2012-07-20 2014-02-12 上海斐讯数据通信技术有限公司 Embedded dual system updating method and system
CN103345456A (en) * 2013-06-21 2013-10-09 烽火通信科技股份有限公司 Circuit and method for adjusting BootLoader starting address

Also Published As

Publication number Publication date
CN106528440B (en) 2020-06-09
CN103870392A (en) 2014-06-18
CN103870392B (en) 2017-01-11

Similar Documents

Publication Publication Date Title
CN107111450B (en) Disk partition stitching and rebalancing using partition tables
US7987330B2 (en) Apparatus for migrating data between heterogeneous data storage devices
CN103995884A (en) Hybrid application page switching method and system
US6215502B1 (en) Method and apparatus for automatically reconfiguring graphical objects relative to new graphical layouts
CN110333918B (en) Method and equipment for managing boarder programs
CN104104705B (en) The cut-in method and equipment of distributed memory system
CN110377232A (en) A kind of method, apparatus and system for disposing distributed storage cluster
CN110413368A (en) Page switching method, device, electronic equipment and machine readable storage medium
CN112596950A (en) Virtual machine data backup method, device, equipment and storage medium
CN103617133A (en) Method and device for compressing virtual memory in Windows system
KR101551206B1 (en) A vehicle data control system and a control method
CN103246545A (en) Multi-virtual-domain-facing customized PCIe (peripheral component interface express) periphery equipment tree generating method
CN106528440A (en) Flash memory operation method and apparatus based on embedded system
CN109324867A (en) A kind of virtual machine temporary storage method, restoration methods and device
CN103246544B (en) virtual hardware driving method
CN106569829B (en) Method for realizing switching of working modes of touch screen, touch screen device and head-mounted equipment
US20150112591A1 (en) Apparatus and method for partially updating a navigation data while driving
CN108833177A (en) Virtual switch management method and main control card
CN107422990A (en) A kind of dynamic migration method and device
CN1963794B (en) System and method to realize driving of equipment
US20070283087A1 (en) Method and structure for adapting a storage virtualization scheme using transformations
CN113741889A (en) Method and equipment for intelligently accessing data of heterogeneous database
CN106855820A (en) The CD hot-plug method and system of a kind of virtual machine
CN106095538B (en) A kind of method and device of records application program operation
CN110362386A (en) Network interface card processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant