Storage method and retrieval method based on single-chip microcomputer platform

By using the bitmap technology on the single -chip computer platform for partitioned marks and block division of the parameter area and the data area, the problem of slow and retrieval speed of the single -chip microcomputer platform storage distribution and retrieval, realize efficient data storage and retrieval, and have load balancing and bad. Block management ability.

CN119336270APending Publication Date: 2025-01-21QINGDAO ITECHENE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411518199.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

In the process of task storage, the microcontroller platform has problems such as slow storage allocation and single data retrieval, and it is impossible to effectively manage load balancing and bad blocks.

Method used

A bitmap-based storage method is adopted to realize efficient storage and retrieval of parameter and task data through partition marking, block division and logical address management of parameter area and data area. At the same time, the parameter margin area and data margin area are used for bad block management.

Benefits of technology

The retrieval speed of the parameter area and the data area has been improved, the time complexity is reduced, the system resources occupation is reduced, it is suitable for the low -end MCU single -chip microcomputer platform, and the load balancing and bad block management have been achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336270A_ABST
    Figure CN119336270A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of single-chip microcomputer platform data storage, in particular to a single-chip microcomputer platform-based storage method and retrieval method.The storage method comprises the steps of calculating the size of a parameter area and the size of a data area, conducting partition marking on the parameter area and the data area through a bitmap, dividing parameters, dividing blocks occupied by tasks and dividing the number of the blocks; a parameter storage logic address and parameter content are stored in the parameter header index area and the parameter content area respectively, and a single task header storage logic address, a task storage logic address and task data are stored in the data general header index area, the single task header index area and the task data storage area respectively. According to the method, the storage management mode of the parameter area and the data area is improved, the retrieval speed is increased, and the time complexity is reduced; the device is small in size, occupies few resources, and can be used in cooperation with an MCU with low resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of single-chip computer platform data storage, in particular to a storage method and a retrieval method based on a single-chip computer platform. Background Art

[0002] When performing task-based storage, the MCU platform has problems with storage allocation and slow single-data retrieval. Currently, databases are often used for data management, but they still have the following disadvantages: (1) Databases occupy a large amount of system resources, which makes them difficult to run on some MCU platforms based on low-end MCUs; (2) When the amount of stored data is large, the retrieval speed is slow on some MCU platforms based on low-end MCUs. At the same time, most MCU platforms based on low-end MCUs cannot solve the load balancing problem and cannot perform bad block management. Summary of the invention

[0003] The present invention aims to solve the above problems and provides a storage method and a retrieval method based on a single-chip microcomputer platform. The technical solution adopted is as follows: A storage method based on a single-chip microcomputer platform, wherein the storage area includes a parameter area and a data area, wherein the parameter area includes a parameter header index area, a parameter content area, and a parameter margin area, and the data area includes a data total header index area, a single task header index area, a task data storage area, and a data margin area, and the method includes: S1. Calculate the size of the parameter area and the data area according to a predetermined value; S2. Use a bitmap to mark the parameter area and data area; S3. According to the size of the parameter, use a bitmap to divide the blocks and number of blocks occupied by each parameter in the parameter content area; according to the storage depth of various types of tasks and the size of a single task, calculate the storage space required for various types and tasks, and use a bitmap to divide the blocks and number of blocks occupied by each task in the task data storage area; S4. When storing parameters, the parameters to be stored are stored in the corresponding positions in the parameter content area according to the division result of step S3, and the identification information of the parameter, the parameter storage location number and the storage logic address are stored in the parameter header index area; S5. When storing tasks, find the location to be stored according to the number and position of blocks occupied by the task in the bitmap, store the task data in the corresponding position of the task data storage area, and divide the single task header index area corresponding to the task at the position, and store the identification information, block number, storage logical address and single task header ID of the task in the single task header index area; S6. The single task header ID, storage logic address and block number of each single task header area are stored in the data total header index area.

[0004] Based on the above scheme, each task needs to apply for storage space when storing, and arrange the task data in the task data storage area in the order of storage; the bitmap allocation record of the task data is stored in the parameter area.

[0005] On the basis of the above solution, when a certain type of task reaches the storage depth, the earliest storage position of the task of this type is overwritten according to the bitmap mark.

[0006] Preferably, the parameter margin area and the data margin area are used for bad block management.

[0007] Based on the above scheme, when writing to a block in the data area or parameter area fails, the block is marked as a bad block and the area where the block is located is initialized. During reallocation, a corresponding number of blocks are extracted from the parameter margin area or data margin area to replace the bad block.

[0008] Preferably, the identification information in step S4 is a parameter name.

[0009] Preferably, the identification information of the task in step S5 includes the ID of the task, the record number, the start time, the end time, the storage time of the task and the success flag bitmap of the task.

[0010] Preferably, the parameter header index area is located at the beginning of the parameter area, and the data header index area is located at the beginning of the data area.

[0011] A retrieval method based on a single-chip microcomputer platform, using the above-mentioned storage method based on a single-chip microcomputer platform, comprises the following steps: P1. When searching for parameter content, first search in the parameter header index area, find the specific parameter in the corresponding position of the parameter content area according to the storage logical address of the parameter to be searched, and perform operations such as adding, deleting, modifying and checking.

[0012] P2-1. When searching the task data content, first find the storage logical location of the single task header of the data to be retrieved in the data header index area, and find the corresponding single task header in the corresponding position of the single task header index area; P2-2. Retrieve the storage logical address of the corresponding task data in the above single task header, find and read the task data in the corresponding position of the task data storage area.

[0013] The beneficial effects of the present invention are: 1. Improved the partitioning method and algorithm of parameter area and data area; 2. The storage management method of the parameter area and data area has been improved. The logical addresses of the parameters and task data are partitioned and stored in a hierarchical manner. The logical addresses of the parameters or task data can be directly accessed during retrieval, avoiding the processing of all entries in the database during retrieval, speeding up retrieval and reducing time complexity. 3. Small size, few resources. Since the bitmap is used for data structure design, few resources are occupied. For example, for 32MB storage space, the minimum erase unit is 4KB, and the reallocated block size is designed to be 512KB. The RAM space occupied only needs 32MB / 512KB / 8=8KB. The reallocated block size can be designed as needed to adjust the size of the storage space occupied by the bitmap. It can be used with MCUs with lower resources. 4. The porting difficulty is relatively low. There is no need to port the FAL component. Only the bottom-level FLASH driver read and write functions need to be ported. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 : Schematic diagram of the storage method of the present invention. DETAILED DESCRIPTION

[0015] The present invention will be further described below in conjunction with the accompanying drawings and embodiments: like Figure 1 As shown, a storage method based on a single-chip microcomputer platform, the storage area includes a parameter area and a data area, the parameter area includes a parameter header index area, a parameter content area and a parameter margin area, the data area includes a total data header index area, a single task header index area, a task data storage area and a data margin area, the parameters and task data of each task are stored in the parameter area and the data area respectively, and are identified by specific identification variables, and the parameter margin area and the data margin area are used for bad block management.

[0016] The storage method comprises: S1. Calculate the size of the parameter area and the data area according to a predetermined value, the predetermined value is calculated and determined according to the actual needs of the user; S2. Use a bitmap to mark the parameter area and data area; S3. According to the size of the parameter, use a bitmap to divide the blocks and number of blocks occupied by each parameter in the parameter content area; according to the storage depth of various types of tasks and the size of a single task, calculate the storage space required for various types and tasks, and use a bitmap to divide the blocks and number of blocks occupied by each task in the task data storage area; S4. When storing parameters, the parameters to be stored are stored in the corresponding positions in the parameter content area according to the division results of step S3, and the identification information of the parameter, the parameter storage location label and the storage logical address are stored in the parameter header index area; wherein the identification information is the parameter name; S5. When storing a task, find the location to be stored according to the number and position of blocks occupied by the task in the bitmap, store the task data in the corresponding position of the task data storage area, and divide the single task header index area corresponding to the task at the position, and store the identification information, block number, storage logical address and single task header ID of the task in the single task header index area; wherein the identification information of the task includes the ID, record number, start time, end time, storage time and success flag bitmap of the task; S6. The single task header ID, storage logic address and block number of each single task header area are stored in the data total header index area.

[0017] Each task needs to apply for storage space when it is stored, and the task data is arranged in the task data storage area in the order of storage; the bitmap allocation record of the task data is stored in the parameter area, so that the flash erase and write frequency of tasks with different execution frequencies can be balanced to a certain extent. When a certain type of task reaches the storage depth, the earliest storage location of the task of this type is overwritten according to the bitmap mark, so as to achieve the purpose of cyclic writing.

[0018] When writing to a block in the data area or parameter area fails, the block is marked as a bad block and the area where the block is located is initialized. During reallocation, a corresponding number of blocks are extracted from the parameter margin area or data margin area to replace the bad block, thereby implementing bad block management and preventing data confusion.

[0019] Preferably, the parameter header index area is located at the beginning of the parameter area, and the data header index area is located at the beginning of the data area. By fixing the position, the time complexity is reduced and the time required for retrieval is shortened.

[0020] A retrieval method based on a single-chip microcomputer platform, using the above-mentioned storage method based on a single-chip microcomputer platform, comprises the following steps: P1. When searching for parameter content, first search in the parameter header index area, find the specific parameter in the corresponding position of the parameter content area according to the storage logical address of the parameter to be searched, and perform operations such as adding, deleting, modifying, and checking.

[0021] P2-1. When searching the task data content, first find the storage logical location of the single task header of the data to be retrieved in the data total header index area, and find the corresponding single task header in the corresponding position of the single task header index area; P2-2. Retrieve the storage logical address of the corresponding task data in the above single task header, find and read the task data in the corresponding position of the task data storage area.

[0022] The present invention is described above by way of examples, but the present invention is not limited to the above specific embodiments, and any changes or modifications made based on the present invention belong to the scope of protection claimed by the present invention.

Claims

1. A storage method based on a single-chip microcomputer platform, characterized in that: The storage area includes a parameter area and a data area, the parameter area includes a parameter header index area, a parameter content area and a parameter margin area, the data area includes a data total header index area, a single task header index area, a task data storage area and a data margin area, and the method includes: S1. Calculate the size of the parameter area and the data area according to the predetermined value; S2. Use a bitmap to mark the parameter area and data area; S3. According to the size of the parameter, use a bitmap to divide the blocks and number of blocks occupied by each parameter in the parameter content area; according to the storage depth of various types of tasks and the size of a single task, calculate the storage space required for various types and tasks, and use a bitmap to divide the blocks and number of blocks occupied by each task in the task data storage area; S4. When storing parameters, the parameters to be stored are stored in the corresponding positions in the parameter content area according to the division result of step S3, and the identification information of the parameter, the parameter storage location number and the storage logic address are stored in the parameter header index area; S5. When storing tasks, find the location to be stored according to the number and position of blocks occupied by the task in the bitmap, store the task data in the corresponding position of the task data storage area, and divide the single task header index area corresponding to the task at the position, and store the identification information, block number, storage logical address and single task header ID of the task in the single task header index area; S6. The single task header ID, storage logic address and block number of each single task header area are stored in the data total header index area.

2. A storage method based on a single chip microcomputer platform according to claim 1, characterized in that: Each task needs to apply for storage space when it is stored, and arrange the task data in the task data storage area in the order of storage; the bitmap allocation record of the task data is stored in the parameter area.

3. The storage method based on a single chip microcomputer platform according to claim 2, characterized in that: When a task of a certain type reaches the storage depth, the earliest storage location of the task of this type is overwritten according to the bitmap mark.

4. The storage method based on a single chip microcomputer platform according to claim 1, characterized in that: The parameter margin area and the data margin area are used for bad block management.

5. The storage method based on a single chip microcomputer platform according to claim 4 is characterized in that: When writing to a block in the data area or parameter area fails, the block is marked as a bad block and the area where the block is located is initialized. During reallocation, a corresponding number of blocks are extracted from the parameter margin area or data margin area to replace the bad block.

6. The storage method based on a single chip microcomputer platform according to claim 1, characterized in that: The identification information described in step S4 is the parameter name.

7. The storage method based on a single chip microcomputer platform according to claim 1, characterized in that: The identification information of the task in step S5 includes the ID of the task, the record number, the start time, the end time, the storage time of the task and the success flag bitmap of the task.

8. The storage method based on a single chip microcomputer platform according to claim 1, characterized in that: The parameter header index area is located at the beginning of the parameter area, and the data header index area is located at the beginning of the data area.

9. A retrieval method based on a single-chip microcomputer platform, characterized in that: The storage method based on the single-chip microcomputer platform as claimed in any one of claims 1 to 8 comprises the following steps: P1. When searching for parameter content, first search in the parameter header index area, find the specific parameter in the corresponding position of the parameter content area according to the storage logical address of the parameter to be searched, and perform operations such as adding, deleting, modifying, and checking. P2-1. When searching the task data content, first find the storage logical location of the single task header of the data to be retrieved in the data total header index area, and find the corresponding single task header in the corresponding position of the single task header index area; P2-2. Retrieve the storage logical address of the corresponding task data in the above single task header, find and read the task data in the corresponding position of the task data storage area.