Data reading and writing method, device, equipment and storage medium

By creating a registry in the microcontroller system and querying the registration words to obtain the Flash memory address information, the problem of low Flash utilization is solved, and efficient and orderly reading and writing Flash data is achieved.

CN114647367BActive Publication Date: 2025-05-16FOSHAN SHUNDE MIDEA ELECTRONICS TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011518126.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-21
Publication Date
2025-05-16
Estimated Expiration
2040-12-21

AI Technical Summary

Technical Problem

In a microcontroller system, when the program module reads and writes Flash data, it is necessary to obtain the verification information such as the start flag bit, end flag bit, data length, header code, and inspection method of the data in advance, resulting in a low Flash utilization rate.

Method used

By creating a registry in advance, determining the registration words for data to be read or written, querying the registry to obtain the Flash storage area address information of the stored data, and performing reading or writing operations based on this information.

Benefits of technology

It realizes accurate reading and writing of Flash data without pre-curing address information, improves Flash utilization rate, and ensures orderly and convenient data reading and writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647367B_ABST
    Figure CN114647367B_ABST
Patent Text Reader

Abstract

The present application discloses a data reading and writing method, device, equipment and storage medium, the method comprising: pre-creating a registration table; determining a first registration word of data to be read or written; the first registration word is used to identify data; querying the registration table based on the first registration word to determine a second registration word for storing data to be read or written; the second registration word includes at least one Flash storage area address information for storing data; based on at least one address information, reading or writing data from at least one Flash storage area. In this way, a standardized reading and writing rule is provided by establishing a registration table, and data can be accurately read and written based on the reading and writing rule, ensuring the orderliness and convenience of data reading and writing; in addition, when storing Flash data, there is no need to pre-solidify the address information in the Flash, and the idle Flash storage area can be matched at any time according to the amount of read and write data, thereby improving the Flash utilization rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data storage technology, and more particularly to a data reading and writing method, device, equipment and storage medium. Background Art

[0002] In the current single-chip microcomputer system, when the program module reads and writes data in the Flash, the programmer needs to obtain the data's start flag, end flag, data length, header code, verification method and other verification information in the Flash in advance, and solidify this information in the program. Only then can the microcontroller unit (MCU) of the single-chip microcomputer effectively perform the operation of reading and writing the Flash according to this information.

[0003] Since the verification information set when storing Flash data is pre-fixed in the Flash, the Flash utilization rate is low. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a data reading and writing method, device, equipment and storage medium.

[0005] The technical solution of this application is implemented as follows:

[0006] In a first aspect, a data reading method is provided, the method comprising:

[0007] Pre-create the registration form;

[0008] Determine a first registration word of first data to be read; wherein the first registration word is used to identify the first data;

[0009] Based on the first registration word, the registration table is queried to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data;

[0010] Acquire the at least one first address information from the second registration word;

[0011] Based on the at least one first address information, the first data is read from the at least one Flash storage area.

[0012] In the above scheme, the reading of the first data from the at least one Flash storage area based on the at least one first address information includes: determining the reading order of the at least one first address information according to a preset reading strategy; reading at least one segmented data from the at least one Flash storage area based on the at least one first address information and the reading order; and using the at least one segmented data to form the first data.

[0013] In the above solution, the method further includes: querying the registration table based on the first registration word, and determining that the reading fails when the first registration word is not found in the registration table.

[0014] In the above solution, the first registration word includes data attribute information; the second registration word also includes Flash storage area attribute information.

[0015] In the above scheme, the data attribute information includes at least one of the following: data type, data size; the Flash storage area attribute information includes at least one of the following: storage area size, storage area erasure times.

[0016] In the above solution, the pre-creating of the registration table includes: creating the registration table according to a unified storage rule; and storing the registration table in a preset storage area of ​​the Flash storage area.

[0017] In a second aspect, a data writing method is provided, the method comprising:

[0018] Pre-create the registration form;

[0019] Acquire second data to be written, and determine a first registration word of the second data; wherein the first registration word is used to identify the second data;

[0020] Based on the first registration word, the registration table is queried to determine a second registration word; wherein the second registration word includes second address information of a Flash storage area storing the second data;

[0021] Acquire the second address information from the second registration word;

[0022] Based on the second address information, the second data is written into the Flash storage area.

[0023] In the above solution, the first registration word includes data attribute information; the second registration word also includes Flash storage area attribute information.

[0024] In the above scheme, querying the registration table based on the first registration word to determine the second registration word includes: querying the registration table based on the data attribute information of the second data to determine the Flash storage area that matches the data attribute information; judging whether the Flash storage area can store the second data based on the data attribute information of the second data and the attribute information of the Flash storage area; if it can be stored, determining the second address information for storing the second data.

[0025] In the above scheme, the method also includes: if storage is not possible, determining at least one first new Flash storage area outside the Flash storage area indicated by the registration table; obtaining attribute information of the at least one first new Flash storage area and obtaining address information of the at least one first new Flash storage area to generate a new second registration word; and updating the registration table using the new second registration word and the first registration word of the second data.

[0026] In the above scheme, after obtaining the second data to be written and determining the first registration word of the second data, the method also includes: if the first registration word is not found in the registration table, storing the second data in at least one second new Flash storage area outside the Flash storage area indicated by the registration table; obtaining the attribute information of the at least one second new Flash storage area and obtaining the address information of the at least one second new Flash storage area to generate a new second registration word; and updating the registration table using the new second registration word and the first registration word of the second data.

[0027] In the above scheme, the data attribute information includes at least one of the following: data type, data size; the Flash storage area attribute information includes at least one of the following: storage area size, storage area erasure times.

[0028] In the above solution, the pre-creating of the registration table includes: creating the registration table according to a unified storage rule; and storing the registration table in a preset storage area of ​​the Flash storage area.

[0029] In a third aspect, a data reading device is provided, the device comprising:

[0030] A first creation unit, used for pre-creating a registration table;

[0031] A first determining unit, configured to determine a first registration word of first data to be read; wherein the first registration word is used to identify the first data;

[0032] The first determination unit is further configured to query the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data;

[0033] A first acquiring unit, configured to acquire the at least one first address information from the second registration word;

[0034] A reading unit is used to read the first data from the at least one Flash storage area based on the at least one first address information.

[0035] In a fourth aspect, a data writing device is provided, wherein the device comprises:

[0036] A second creation unit, used for pre-creating a registration table;

[0037] A second determining unit, configured to obtain second data to be written, and determine a first registration word of the second data; wherein the first registration word is used to identify the second data;

[0038] The second determination unit is further configured to query the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes second address information of a Flash storage area storing the second data;

[0039] A second acquiring unit, configured to acquire the second address information from the second registration word;

[0040] A writing unit is used to write the second data into the Flash storage area based on the address information of the second data.

[0041] In a fifth aspect, a data reading device is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor, wherein the processor is configured to execute the steps of the aforementioned method when running the computer program.

[0042] In a sixth aspect, a data writing device is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor, wherein the processor is configured to execute the steps of the aforementioned method when running the computer program.

[0043] In a seventh aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the aforementioned method when executed by a processor.

[0044] The present application discloses a data reading and writing method, which includes: pre-creating a registration table; determining a first registration word for data to be read or written; the first registration word is used to identify data; querying the registration table based on the first registration word to determine a second registration word for storing data to be read or written; the second registration word includes at least one Flash storage area address information for storing data; based on at least one address information, reading or writing data from at least one Flash storage area. In this way, a standardized reading and writing rule is provided by establishing a registration table, and data can be accurately read and written based on the reading and writing rule, ensuring the orderliness and convenience of data reading and writing; in addition, when storing Flash data, there is no need to solidify the address information in Flash in advance, and the idle Flash storage area can be matched at any time according to the amount of read and write data, thereby improving the Flash utilization rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a schematic diagram of a first process of a data reading method in an embodiment of the present application;

[0046] Figure 2 This is a second flow chart of the data reading method in the embodiment of the present application;

[0047] Figure 3 This is a schematic diagram of a first process of a data writing method in an embodiment of the present application;

[0048] Figure 4 This is a second flow chart of the data writing method in an embodiment of the present application;

[0049] Figure 5 This is a schematic diagram of the structure of a data reading device in an embodiment of the present application;

[0050] Figure 6 This is a schematic diagram of the structure of a data writing device in an embodiment of the present application;

[0051] Figure 7 This is a schematic diagram of the structure of a data reading device in an embodiment of the present application;

[0052] Figure 8 This is a schematic diagram of the structure of a data writing device in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0054] The present application embodiment provides a data reading method. Figure 1 Schematic diagram of the first process of the data reading method in the embodiment of the present application. Figure 1 As shown, the data reading method may specifically include:

[0055] Step 101: Pre-create a registration table;

[0056] It should be noted that the registry is a table that records data-related information. By reading the registry, the relevant information corresponding to each data can be found.

[0057] In some embodiments, this step specifically includes: creating the registration table according to a unified storage rule; and storing the registration table in a preset storage area of ​​the Flash storage area.

[0058] It should be noted that the relevant information that is usually required to be stored when storing data is used as a storage rule for storing data. After the storage rule is determined, a registration table is created according to the determined data-related information.

[0059] Here, the registration table is a correspondence table consisting of data attribute information and Flash storage area attribute information and address information storing the data.

[0060] It should be noted that the preset storage area is a storage area for storing the registration table in the Flash storage area. Here, the preset storage area can be a fixed area in the Flash storage area.

[0061] Step 102: Determine a first registration word of first data to be read; wherein the first registration word is used to identify the first data;

[0062] It should be noted that the first registration word includes data attribute information of the first data. The data attribute information at least includes data type and data size.

[0063] It should be noted that the data type and data size of the first data are determined according to the first data to be read. In this way, when reading the registration table, other relevant data information corresponding to the first data can be queried according to the data type and data size of the first data.

[0064] Step 103: querying the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data;

[0065] It should be noted that the second registration word includes at least one first address information of the first data.

[0066] Here, the number of Flash storage areas stored is related to the amount of the first data. When the amount of data is too large, multiple Flash storage areas may be required for storage, which corresponds to multiple first address information.

[0067] It should be noted that when reading the registration table according to the data attribute information of the first data (i.e., the first registration word), if the attribute information matching the data attribute information of the first data is queried in the registration table, then at least one corresponding Flash storage area is queried in the registration table based on the data attribute information of the first data, and at least one first address information corresponding to the at least one Flash storage area is obtained (i.e., the second registration word). If the attribute information matching the data attribute information of the first data is not queried in the registration table, the first address information storing the first data is not queried, that is, the reading of the first data fails.

[0068] The matching mentioned above can be understood as consistency.

[0069] Step 104: Obtain the at least one first address information from the second registration word;

[0070] Step 105: Read the first data from the at least one Flash storage area based on the at least one first address information.

[0071] In the above embodiment, this step specifically includes: determining the reading order of the at least one first address information according to a preset reading strategy; reading at least one segmented data from the at least one Flash storage area based on the at least one first address information and the reading order; and using the at least one segmented data to form the first data.

[0072] It should be noted that the preset reading strategy can be to read in chronological order or to read according to the programmer's demand for data.

[0073] Here, the reading order of at least one first address information is determined by chronological order, or, if the programmer needs data generated at certain time points, the at least one first address information corresponding to the certain time points is first determined, and then the reading order of at least one first address information is determined according to usage requirements. After the order of reading at least one first address information is determined, the corresponding data is read from the corresponding at least one Flash storage area.

[0074] Here, the execution subject of step 101 to step 105 may be a processor of the data reading device.

[0075] The present application discloses a data reading method, which specifically includes: pre-creating a registration table; determining a first registration word of the first data to be read; wherein the first registration word is used to identify the first data; querying the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data; obtaining the at least one first address information from the second registration word; and reading the first data from the at least one Flash storage area based on the at least one first address information. In this way, a standardized reading rule is provided by establishing a registration table, and data can be accurately read based on the reading rule, ensuring the orderliness and convenience of data reading.

[0076] Based on the above embodiments, this application takes Flash reading data as an example to provide a data reading method. Figure 2 : is a second flow chart of the data reading method in the embodiment of the present application, such as Figure 2 As shown, the data reading method may specifically include:

[0077] Step 201: Start;

[0078] Before executing step 202, the registration table has been created and has stored relevant information of a plurality of data.

[0079] Here, the data related information includes data attribute information, Flash storage area attribute information and address information storing data. The registration table is a correspondence table composed of data attribute information (ie, first registration word) and Flash storage area attribute information and address information (ie, second registration word) storing data.

[0080] Here, the registration table is a table consisting of a first registration word and a second registration word.

[0081] Here, a fixed area is divided in the Flash as a Flash registration table.

[0082] Step 202: Read registry information;

[0083] Here, the registry information is data attribute information and Flash storage area attribute information and address information storing data.

[0084] Specifically, the registry information of the Flash is read according to the attribute information of the data to be read.

[0085] Step 203: Check whether the required data exists in the Flash; if so, execute step 204; if not, execute step 205;

[0086] That is, the Flash registry is queried in sequence according to the attribute information of the data to be read, and it is determined whether there is attribute information matching the attribute information of the data to be read in the Flash registry. Here, matching can be understood as consistency.

[0087] If there is attribute information matching the attribute information of the data to be read in the Flash registry, step 204 is executed.

[0088] If there is no attribute information matching the attribute information of the data to be read in the Flash registry, step 205 is executed.

[0089] Step 204: Read data;

[0090] According to the queried data attribute information, at least one first address information corresponding to at least one Flash storage area storing the corresponding data is determined from a Flash registration table, and data is read from the at least one Flash storage area based on the at least one first address information.

[0091] Step 205: End.

[0092] The above method of reading data in the Flash registry must comply with the registered word content in the registry when reading data, otherwise the data cannot be read, which provides a certain guarantee for the data security of the Flash.

[0093] In this way, by establishing a registry to provide a standardized reading rule, data can be accurately read based on the reading rule, ensuring the orderliness and convenience of data reading.

[0094] The present application embodiment provides a data writing method, Figure 3 Schematic diagram of the first process of the data writing method in the embodiment of the present application. Figure 3 As shown, the data writing method may specifically include:

[0095] Step 301: Pre-create a registration table;

[0096] It should be noted that the registry is a table that records data-related information. By reading the registry, the relevant information corresponding to each data can be found.

[0097] In some embodiments, this step specifically includes: creating the registration table according to a unified storage rule; and storing the registration table in a preset storage area of ​​the Flash storage area.

[0098] It should be noted that the relevant information that is usually required to be stored when storing data is used as a storage rule for storing data. After the storage rule is determined, a registration table is created according to the determined data-related information.

[0099] Here, the registration table is a correspondence table consisting of data attribute information and Flash storage area storage space attribute information and address information storing data.

[0100] It should be noted that the preset storage area is a storage area for storing the registration table in the Flash storage area. Here, the preset storage area can be a fixed area in the Flash storage area.

[0101] Step 302: Acquire second data to be written, and determine a first registration word of the second data; wherein the first registration word is used to identify the second data;

[0102] It should be noted that the first registration word includes data attribute information of the second data. The data attribute information at least includes data type and data size.

[0103] It should be noted that the second data to be written is obtained, and the data type and data size of the second data are determined. In this way, when reading the registration table, other relevant data information corresponding to the second data can be queried according to the data type and data size of the second data.

[0104] Step 303: querying the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes second address information of a Flash storage area storing the second data;

[0105] It should be noted that the second registration word includes the second address information of the second data.

[0106] It should be noted that when reading the registration table according to the data attribute information of the second data (i.e., the first registration word), if the attribute information matching the data attribute information of the second data is found in the registration table, the second address information (i.e., the second registration word) of the Flash storage area storing the second data is found in the registration table based on the data attribute information of the second data. The second data is subsequently stored according to the second address information.

[0107] In some embodiments, this step specifically includes: based on the data attribute information of the second data, querying the registry to determine the Flash storage area that matches the data attribute information; based on the data attribute information of the second data and the Flash storage area attribute information, judging whether the Flash storage area can store the second data; if it can be stored, determining the second address information for storing the second data.

[0108] It should be noted that the Flash storage area attribute information includes the storage area size and the storage area erasure count, wherein the erasure count can be understood as the number of times the storage area data is updated, and when the erasure count reaches a certain threshold, the storage performance of the storage area will be affected.

[0109] It should be noted that even if the second address information of the Flash storage area storing the second data is determined, the size of the Flash storage area corresponding to the second address information needs to be considered when storing the second data, that is, whether the storage area can store the second data is determined based on the size of the Flash storage area and the size of the stored second data.

[0110] Specifically, a matching data type is queried from the registry based on the data type of the second data, and the Flash storage area is determined from the registry based on the data type of the second data; the size of the Flash storage area and the data size of the second data are obtained respectively, if the size of the Flash storage area is greater than or equal to the data size of the second data, it means that the data can be stored, and the second address information of the Flash storage area is further obtained, and the second data can be subsequently stored based on the second address information.

[0111] In some embodiments, the method further includes: if storage is not possible, determining at least one first new Flash storage area outside the Flash storage area indicated by the registration table; obtaining attribute information of the at least one first new Flash storage area and obtaining address information of the at least one first new Flash storage area to generate a new second registration word; and updating the registration table using the new second registration word and the first registration word of the second data.

[0112] That is to say, if the size of the Flash storage area indicated by the registration table is smaller than the data size of the second data, it means that the data cannot be stored, and it is necessary to find at least one first new Flash storage area that can store the second data and store it in sequence. In order to facilitate reading, the registration table is expanded later, and the data attribute information of the second data (i.e., the first registration word) and at least one first new Flash storage area attribute information and address information (and the second registration word) are registered in the registration table, and the registration table is updated. In this way, when reading the second data, the address information of all Flash storage areas storing the second data is obtained from the updated registration table, and the second data can be read according to the address information.

[0113] In some embodiments, after obtaining the second data to be written and determining the first registration word of the second data, the method further includes: if the first registration word is not found in the registration table, storing the second data in at least one second new Flash storage area outside the Flash storage area indicated by the registration table; obtaining attribute information of the at least one second new Flash storage area and obtaining address information of the at least one second new Flash storage area to generate a new second registration word; and updating the registration table using the new second registration word and the first registration word of the second data.

[0114] That is to say, when reading the registration table according to the data attribute information of the second data (i.e., the first registration word), if the attribute information matching the data attribute information of the second data is not found in the registration table, that is, the first registration word of the second data does not exist in the registration table, the second data needs to be stored in at least one second new Flash storage area outside the registration table. Similarly, in order to facilitate reading later, the registration table needs to be expanded, and the data attribute information of the second data (i.e., the first registration word) and at least one second new Flash storage area attribute information and address information (and the second registration word) need to be registered in the registration table, and the registration table is updated.

[0115] Step 304: Obtain the second address information from the second registration word;

[0116] Step 305: Based on the second address information, write the second data into the Flash storage area.

[0117] The present application discloses a data writing method, which specifically includes: pre-creating a registration table; obtaining the second data to be written, and determining the first registration word of the second data; wherein the first registration word is used to identify the second data; querying the registration table based on the first registration word to determine the second registration word; wherein the second registration word includes the second address information of the Flash storage area storing the second data; obtaining the second address information from the second registration word; and writing the second data to the Flash storage area based on the second address information. In this way, a standardized writing rule is provided by establishing a registration table, and data can be accurately written based on the writing rule, ensuring the orderliness and convenience of data writing; in addition, when storing Flash data, there is no need to solidify the address information in Flash in advance, and the idle Flash storage area can be matched at any time according to the amount of read and write data, thereby improving the Flash utilization rate.

[0118] Based on the above embodiments, the present application takes Flash writing data as an example and provides a data writing method. Figure 4 Schematic diagram of the fourth process of the data reading method in the embodiment of the present application. Figure 4 As shown, the data writing method may specifically include:

[0119] Step 401: Start;

[0120] Before executing step 402, the registration table has been created and has stored relevant information of multiple data.

[0121] Here, the data related information includes data attribute information, Flash storage area attribute information and address information storing data. The registration table is a correspondence table composed of data attribute information (ie, first registration word) and Flash storage area attribute information and address information (ie, second registration word) storing data.

[0122] Here, a fixed area is divided in the Flash as a Flash registration table.

[0123] Step 402: Read registry information;

[0124] Here, the registry information is data attribute information and Flash storage area attribute information and address information storing data.

[0125] Specifically, the register information of the Flash is read according to the attribute information of the data to be written.

[0126] Step 403: Check whether storage space has been allocated in the Flash; if so, execute step 404; if not, execute step 405;

[0127] Here, the Flash registry is queried in sequence according to the attribute information of the data to be written, and it is determined whether there is attribute information matching the attribute information of the data to be written in the Flash registry.

[0128] If there is attribute information matching the attribute information of the data to be written in the Flash registry, combined with the corresponding Flash storage area attribute information in the registry, it is determined whether the Flash storage area can store the data to be written. If it can, step 404 is executed.

[0129] If there is no attribute information matching the attribute information of the data to be written in the Flash registry, or the Flash storage area cannot store the data to be written, step 405 is executed.

[0130] Step 404: writing data;

[0131] Step 405: whether to create or modify storage space; if so, execute step 406; if not, execute step 407;

[0132] Step 406: Update the registration table;

[0133] Here, if there is no attribute information matching the attribute information of the data to be written in the Flash registry, the data to be written needs to be stored in at least one second new Flash storage area outside the registry, and then the data attribute information of the data to be written (i.e., the first registration word) and at least one second new Flash storage area attribute information and address information (and the second registration word) are registered in the registry, and the registry is updated.

[0134] If the storage space cannot store the data to be written, it is necessary to find at least one first new Flash storage area that can store the data to be written, and then register the data attribute information of the data to be written (i.e. the first registration word) and at least one first new Flash storage area attribute information and address information (and the second registration word) in the registration table, and update the registration table.

[0135] Here, the registration table is a table consisting of a first registration word and a second registration word.

[0136] Step 407: End.

[0137] The above method of writing data into the registry in Flash must comply with the registered word content in the registry when writing data, otherwise the data cannot be modified or written at will, which provides a certain guarantee for the data security of Flash.

[0138] In this way, by establishing a registry to provide a standardized write rule, data can be written accurately based on the write rule to ensure the orderliness and convenience of data writing; in addition, when storing Flash data, there is no need to solidify the address information in the Flash in advance, and the idle Flash storage area can be matched at any time according to the amount of read and write data, thereby improving the Flash utilization rate.

[0139] In an embodiment of the present application, a data reading device is provided. Figure 5 Schematic diagram of the structure of the data reading device in the embodiment of the present application. Figure 5 As shown, the data reading device comprises:

[0140] A first creation unit 501, used to pre-create a registration table;

[0141] A first determining unit 502 is used to determine a first registration word of first data to be read; wherein the first registration word is used to identify the first data;

[0142] The first determination unit 502 is further configured to query the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data;

[0143] A first acquiring unit 503, configured to acquire the at least one first address information from the second registration word;

[0144] The reading unit 504 is configured to read the first data from the at least one Flash storage area based on the at least one first address information.

[0145] In some embodiments, the device includes: the first determination unit 502, specifically including determining the reading order of the at least one first address information according to a preset reading strategy; reading at least one segmented data from the at least one Flash storage area based on the at least one first address information and the reading order; and using the at least one segmented data to form the first data.

[0146] In some embodiments, the registration table is queried based on the first registration word, and when the first registration word is not found in the registration table, it is determined that the reading has failed.

[0147] In some embodiments, the first registration word includes data attribute information; the second registration word also includes the Flash storage area attribute information.

[0148] In some embodiments, the data attribute information includes at least one of the following: data type, data size; the Flash storage area attribute information includes at least one of the following: storage area size, storage area erase and write times.

[0149] In some embodiments, the device includes: the first creation unit 501, which is specifically used to create the registration table according to a unified storage rule; and store the registration table in a preset storage area of ​​the Flash storage area.

[0150] The present application discloses a data reading method, which includes: pre-creating a registration table; determining a first registration word of the first data to be read; wherein the first registration word is used to identify the first data; querying the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data; obtaining the at least one first address information from the second registration word; and reading the first data from the at least one Flash storage area based on the at least one first address information. In this way, a standardized reading rule is provided by establishing a registration table, and data can be accurately read based on the reading rule, ensuring the orderliness and convenience of data reading.

[0151] In an embodiment of the present application, a data writing device is provided. Figure 6 Schematic diagram of the structure of the data writing device in the embodiment of the present application. Figure 6 As shown, the data writing device comprises:

[0152] The second creation unit 601 is used to pre-create a registration table;

[0153] A second determining unit 602 is used to obtain second data to be written and determine a first registration word of the second data; wherein the first registration word is used to identify the second data;

[0154] The second determination unit 602 is further configured to query the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes second address information of a Flash storage area storing the second data;

[0155] A second acquisition unit 603, configured to acquire the second address information from the second registration word;

[0156] The writing unit 604 is used to write the second data into the Flash storage area based on the address information of the second data.

[0157] In some embodiments, the first registration word includes data attribute information; the second registration word also includes Flash storage area attribute information.

[0158] In some embodiments, the device includes: the second determination unit 602, which is specifically used to query the registry based on the data attribute information of the second data to determine the Flash storage area that matches the data attribute information; based on the data attribute information of the second data and the Flash storage area attribute information, determine whether the Flash storage area can store the second data; if it can be stored, determine the second address information for storing the second data.

[0159] In some embodiments, if storage is not possible, at least one first new Flash storage area is determined outside the Flash storage area indicated by the registration table; attribute information of the at least one first new Flash storage area and address information of the at least one first new Flash storage area are obtained to generate a new second registration word; and the registration table is updated using the new second registration word and the first registration word of the second data.

[0160] In some embodiments, after obtaining the second data to be written and determining the first registration word of the second data, if the first registration word is not found in the registration table, the second data is stored in at least one second new Flash storage area outside the Flash storage area indicated by the registration table; the attribute information of the at least one second new Flash storage area is obtained and the address information of the at least one second new Flash storage area is obtained to generate a new second registration word; and the registration table is updated using the new second registration word and the first registration word of the second data.

[0161] In some embodiments, the data attribute information includes at least one of the following: data type, data size; the Flash storage area attribute information includes at least one of the following: storage area size, storage area erase and write times.

[0162] In some embodiments, the pre-creating a registration table includes: creating the registration table according to a unified storage rule; and storing the registration table in a preset storage area of ​​the Flash storage area.

[0163] The present application discloses a data writing method, which specifically includes: pre-creating a registration table; obtaining the second data to be written, and determining the first registration word of the second data; wherein the first registration word is used to identify the second data; querying the registration table based on the first registration word to determine the second registration word; wherein the second registration word includes the second address information of the Flash storage area storing the second data; obtaining the second address information from the second registration word; and writing the second data to the Flash storage area based on the second address information. In this way, a standardized writing rule is provided by establishing a registration table, and data can be accurately written based on the writing rule, ensuring the orderliness and convenience of data writing; in addition, when storing Flash data, there is no need to solidify the address information in Flash in advance, and the idle Flash storage area can be matched at any time according to the amount of read and write data, thereby improving the Flash utilization rate.

[0164] The present application embodiment provides a data reading device, Figure 7 Schematic diagram of the structure of the data reading device in the embodiment of the present application. Figure 7 As shown, the device includes: a processor 701 and a memory 702 configured to store a computer program that can be run on the processor;

[0165] The processor 701 is configured to execute the steps of the shooting control method in the aforementioned embodiment when running the computer program.

[0166] Of course, in practical applications, Figure 7 As shown, the various components in the data reading device are coupled together via a bus system 703. It is understood that the bus system 703 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 703 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 7 Various buses are labeled as bus system 703.

[0167] The present application embodiment provides a data writing device, Figure 8 Schematic diagram of the structure of the data writing device in the embodiment of the present application. Figure 8 As shown, the device includes: a processor 801 and a memory 802 configured to store a computer program that can be run on the processor;

[0168] The processor 801 is configured to execute the steps of the shooting control method in the aforementioned embodiment when running the computer program.

[0169] Of course, in practical applications, Figure 8As shown, the various components in the data writing device are coupled together via a bus system 803. It is understood that the bus system 803 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 803 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 8 Various buses are labeled as bus system 803.

[0170] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.

[0171] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.

[0172] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.

[0173] Optionally, the computer-readable storage medium can be applied to any one of the methods in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the processor in each method in the embodiments of the present application. For the sake of brevity, they are not repeated here.

[0174] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0175] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0176] In addition, all functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units. A person of ordinary skill in the art may understand that all or part of the steps of implementing the above-mentioned method embodiments may be completed by hardware related to program instructions, and the aforementioned program may be stored in a computer-readable storage medium, which, when executed, executes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks.

[0177] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0178] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0179] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0180] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A data reading method, characterized in that: The method comprises: Pre-create the registration form; Determine a first registration word of first data to be read; wherein the first registration word is used to identify the first data; Based on the first registration word, the registration table is queried to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data; Acquire the at least one first address information from the second registration word; Based on the at least one first address information, reading the first data from the at least one Flash storage area; The reading of the first data from the at least one Flash storage area based on the at least one first address information includes: determining a reading order of the at least one first address information according to a preset reading strategy; reading at least one segmented data from the at least one Flash storage area based on the at least one first address information and the reading order; and using the at least one segmented data to form the first data.

2. The method according to claim 1, characterized in that The method further comprises: The registration table is queried based on the first registration word, and when the first registration word is not found in the registration table, it is determined that the reading fails.

3. The method according to claim 1, characterized in that The first registration word includes data attribute information; The second registration word also includes Flash storage area attribute information.

4. The method according to claim 3, characterized in that The data attribute information includes at least one of the following: data type, data size; The Flash storage area attribute information includes at least one of the following: storage area size, storage area erasure times.

5. The method according to claim 1, characterized in that The pre-created registration table includes: Creating the registry according to a unified storage rule; The registration table is stored in a preset storage area of ​​the Flash storage area.

6. A data writing method, characterized in that: The method comprises: Pre-create the registration form; Acquire second data to be written, and determine a first registration word of the second data; wherein the first registration word is used to identify the second data; and the first registration word includes data attribute information; Querying the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes second address information and Flash storage area attribute information of a Flash storage area storing the second data; Acquire the second address information from the second registration word; Based on the second address information, writing the second data into the Flash storage area; The method of querying the registration table based on the first registration word to determine the second registration word includes: querying the registration table based on data attribute information of the second data to determine a Flash storage area that matches the data attribute information; judging whether the Flash storage area can store the second data based on the data attribute information of the second data and the attribute information of the Flash storage area; and if it can, determining second address information for storing the second data.

7. The method according to claim 6, characterized in that The method further comprises: If storage is not possible, determining at least one first new Flash storage area outside the Flash storage area indicated by the registration table; Acquire the at least one first new Flash storage area attribute information and acquire the at least one first new Flash storage area address information, and generate a new second registration word; The registration table is updated using the new second registration word and the first registration word of the second data.

8. The method according to claim 6, characterized in that After obtaining the second data to be written and determining the first registration word of the second data, the method further includes: If the first registration word is not found in the registration table, storing the second data in at least one second new Flash storage area outside the Flash storage area indicated by the registration table; Acquire attribute information of the at least one second new Flash storage area and acquire address information of the at least one second new Flash storage area, and generate a new second registration word; The registration table is updated using the new second registration word and the first registration word of the second data.

9. The method according to claim 6, characterized in that The data attribute information includes at least one of the following: data type, data size; The Flash storage area attribute information includes at least one of the following: storage area size, storage area erasure times.

10. The method according to claim 6, characterized in that The pre-created registration table includes: Creating the registry according to a unified storage rule; The registration table is stored in a preset storage area of ​​the Flash storage area.

11. A data reading device, characterized in that: The device comprises: A first creation unit, used for pre-creating a registration table; A first determining unit, configured to determine a first registration word of first data to be read; wherein the first registration word is used to identify the first data; The first determination unit is further configured to query the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes at least one first address information corresponding to at least one Flash storage area storing the first data; A first acquiring unit, configured to acquire the at least one first address information from the second registration word; A reading unit, configured to read the first data from the at least one Flash storage area based on the at least one first address information; The reading unit is specifically used to determine the reading order of the at least one first address information according to a preset reading strategy; based on the at least one first address information and the reading order, read at least one segmented data from the at least one Flash storage area; and use the at least one segmented data to form the first data.

12. A data writing device, characterized in that: The device comprises: A second creation unit, used for pre-creating a registration table; A second determining unit is used to obtain second data to be written, and determine a first registration word of the second data; wherein the first registration word is used to identify the second data; and the first registration word includes data attribute information; The second determination unit is further configured to query the registration table based on the first registration word to determine a second registration word; wherein the second registration word includes second address information and Flash storage area attribute information of a Flash storage area storing the second data; A second acquiring unit, configured to acquire the second address information from the second registration word; A writing unit, used for writing the second data into the Flash storage area based on the second address information; The second determination unit is specifically used to query the registry based on the data attribute information of the second data to determine the Flash storage area that matches the data attribute information; based on the data attribute information of the second data and the Flash storage area attribute information, determine whether the Flash storage area can store the second data; if it can be stored, determine the second address information for storing the second data.

13. A data reading device, characterized in that: The data reading device comprises: a processor and a memory configured to store a computer program that can be run on the processor, Wherein, the processor is configured to execute the steps of the method according to any one of claims 1 to 5 when running the computer program.

14. A data writing device, characterized in that: The data writing device comprises: a processor and a memory configured to store a computer program that can be run on the processor. Wherein, the processor is configured to execute the steps of the method according to any one of claims 6 to 10 when running the computer program.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.

Citation Information

Patent Citations

  • Program code running method, program code running device, compiling method and compiling device

    CN111045657A