Firmware event record and freezing record storage method and device, equipment and medium
By combining a unified record-writing interface in event recording and freezing records, the problem of complex interface duplication and maintenance in the prior art is solved, rapid data processing is achieved and storage costs is reduced, and the system response speed and stability is improved.
Patent Information
- Application Number
- CN202411572727.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, event recording and freezing records use independent read and write interfaces, resulting in duplication of interfaces, complex system maintenance and high cost, and when storage objects are configurable, independent storage IDs need to be allocated to each object, resulting in a significant increase in the demand for nonvolatile memory space.
By combining event records and freezing records into a unified record-writing interface, the demand for independent interfaces is eliminated, and different record requirements are expanded without adding new code blocks. By building a total table of storage objects, the attributes and storage locations of storage objects are managed, and the storage IDs are avoided separately allocating storage IDs for each storage object.
It realizes rapid data reading and storage, improves the system's response speed and stability, reduces interface redundancy, reduces the demand for MCU and nonvolatile memory space, and avoids the increase in costs caused by the storage object ID taking up a large amount of space.
Smart Images

Figure CN119512457A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of event storage, and in particular to a storage method, device, equipment and medium for firmware event records and freeze records. Background Art
[0002] In today's electronic devices, event records and freeze records are widely used to track and monitor various operating states. Event records usually contain information about the time when an event occurs and the time when it ends, and are used to record the complete life cycle of a process, while freeze records only record the time of occurrence, and are used to record instantaneous states. Existing single-chip microcomputer systems usually call their respective interfaces during event and freeze records, and store this information in non-volatile memory respectively to ensure that data is not lost after power failure.
[0003] The existing event recording and freezing recording schemes have the following main defects:
[0004] Event records and freeze records use their own independent read and write interfaces, even if they contain the same record attributes. This design leads to duplication of interfaces, increases the MCU's flash memory space requirements, and thus increases the system's storage cost. When the requirements change, the prior art needs to add new code blocks to meet different record requirements. This approach makes system maintenance complicated and costly, and it is difficult to flexibly expand functions without changing the code. When the storage object is configurable, the existing solution needs to assign an independent storage ID to each storage object, which leads to a significant increase in the space requirements of the non-volatile memory, further increasing the system cost. Summary of the invention
[0005] Purpose of the invention: The purpose of the present invention is to solve the problems of duplication of interfaces, complicated maintenance, high cost and greatly increased space requirements in the prior art, and to provide a storage method, device, equipment and medium for firmware event records and frozen records, which are realized by merging event records and frozen records into a unified record writing interface. The present invention eliminates the need for independent interfaces, avoids repeated design of interfaces, and the design of a unified interface allows the expansion of different record requirements under the same interface. The record requirements of different scenarios can be met without adding new code blocks, and the properties and storage locations of storage objects can be managed by configuring the storage object master table, without the need to separately allocate storage IDs for each storage object.
[0006] One or more embodiments of the present specification also relate to a storage device for firmware event records and freeze records, an electronic device, a computer-readable storage medium, and a computer program product to solve the technical defects existing in the prior art.
[0007] Technical solution:
[0008] In a first aspect, the present application proposes a method for storing firmware event records and freeze records, comprising the steps of:
[0009] Constructing a storage object master table with the specific contents of all object events, wherein the specific contents include the sequence number of the object event in the storage object master table, the specific data information of the object event, and the starting address of the object event in the non-volatile memory;
[0010] When any of the object events, freezing and ending occurs, the event attributes are obtained and stored and recorded uniformly in the write interface;
[0011] The write interface obtains the sequence number of the object event in the storage object master table through the event attribute;
[0012] Find the corresponding data item in the storage object table through the sequence number and read the specific data information of the object event through the write interface;
[0013] The specific data information of the read object event is stored in non-volatile storage.
[0014] Preferably, the event attributes include the maximum length of the storage information, the address of the object event in the non-volatile memory, the address of the storage object master table, the starting address of the object event in the non-volatile memory, and the address of the management information in the non-volatile memory.
[0015] As a preferred embodiment, the write interface obtains the sequence number of the object event in the storage object master table through the event attribute, including:
[0016] The serial number in the storage object master table is obtained through the address of the object event in the non-volatile memory.
[0017] Preferably, storing the specific data information of the object event read into a non-volatile storage includes:
[0018] By storing the maximum length of the information, when each object event is stored in the non-volatile storage, a fixed offset distance is set between the object event and the previous record.
[0019] Preferably, storing the specific data information of the object event read into a non-volatile storage includes:
[0020] The area allocated to the object event in the non-volatile memory is found through the starting address of the object event in the non-volatile memory for storage.
[0021] As a preferred embodiment, it also includes:
[0022] The management information is acquired and updated in the non-volatile memory by the address of the management information in the non-volatile memory.
[0023] As a preferred embodiment, the write interface obtains the sequence number of the object event in the storage object general table through the event attribute, and further includes:
[0024] The number of storage objects is obtained by storing the addresses of the storage objects in the non-volatile memory.
[0025] In a second aspect, the present application further provides a storage device for firmware event records and freeze records, characterized in that it includes:
[0026] A construction unit is used to construct a storage object master table with the specific contents of all object events, wherein the specific contents include the sequence number of the object event in the storage object master table, the specific data information of the object event, and the starting address of the object event in the non-volatile memory; when any of the occurrence, freezing and termination of the object event occurs, the event attributes are obtained and stored and uniformly recorded in the write interface;
[0027] An acquisition unit, used for writing an interface to acquire the sequence number of an object event in a storage object master table through an event attribute;
[0028] A reading unit, used to find the corresponding data item in the storage object general table through the sequence number and read the specific data information of the object event through the write interface;
[0029] The storage unit is used to store the specific data information of the read object event into non-volatile storage.
[0030] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory is used to store one or more computer programs; when the one or more computer programs stored in the memory are executed by the processor, the electronic device can implement any possible design method of the first aspect.
[0031] In a fourth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method as described in any one of the above embodiments is implemented.
[0032] In a fifth aspect, an embodiment of the present invention further provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute any possible design method of any of the above aspects.
[0033] Beneficial effect: When an object event occurs, freezes or ends, the system can automatically obtain event attributes and uniformly record them to the write interface. The corresponding data items can be quickly located in the storage object master table through the event attributes, thereby realizing rapid reading and storage of data. This efficient data processing method not only improves the response speed of the system, but also enhances the stability and reliability of the system. By merging the event occurrence, freezing and end records into a unified record write interface, the present invention eliminates the need for independent interfaces and avoids repeated interface design. Compared with the traditional method of separately designing event record and freezing record interfaces, this solution reduces interface redundancy, thereby reducing the demand for MCU and non-volatile memory space; by constructing a storage object master table, the specific contents of all object events are uniformly managed and configured, thereby avoiding the cost increase caused by the storage object id occupying a large amount of space. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 Provide a schematic diagram of the method framework for the present invention;
[0035] Figure 2 Provide a schematic diagram of the structure of the storage object master table for the present invention;
[0036] Figure 3 Provide a schematic diagram of the write interface structure for the present invention;
[0037] Figure 4 Provide a schematic diagram of the management information structure for the present invention;
[0038] Figure 5 is a schematic diagram of the structure of a device provided by an embodiment of the present application;
[0039] Figure 6 This is a structural block diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the technical solution of the present invention clearer, the present invention is further described in detail below with reference to the specific embodiments of the accompanying drawings.
[0041] Example 1
[0042] In order to make the purpose, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Unless otherwise defined, the technical terms or scientific terms used herein should be understood by people with general skills in the field to which the present invention belongs. "Including" and similar words used in this article mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0043] In view of the problems existing in the existing technology, such as Figure 1 As shown, a method for storing firmware event records and freeze records includes the steps of:
[0044] S101, constructing a storage object master table with the specific contents of all object events, wherein the specific contents include the sequence number of the object event in the storage object master table, the specific data information of the object event, and the starting address of the object event in the non-volatile memory;
[0045] Specifically, the detailed contents of all object events are summarized and a storage object master table is constructed, and the specific contents include the sequence number of each object event in the master table, the specific data information of the event and the starting address of the event in the non-volatile memory.
[0046] In some embodiments, in combination Figure 2 , the storage object list also includes:
[0047] Data item ID: used to uniquely identify each data item, which facilitates quick search and location in the storage object table. For example, 0x0001 and 0x0002 represent two different data items respectively.
[0048] Data length: specifies the length of each data item (the unit may be bytes). In this table, the data item length of 0x0001 is 0x04 (4 bytes), and the data item length of 0x0002 is 0x02 (2 bytes). This helps to correctly parse the boundaries of each data item when reading data.
[0049] Data format: used to describe the format of data, such as encoding method or data type. In the figure, the data format is 0xff, which may be a specific format identifier;
[0050] Data offset: specifies the offset of the data item in the memory. Here, the offset is 0x00, which indicates the relative position of the data item in the storage space. If different data items have different offsets, it can ensure that the distribution of data in the storage does not overlap.
[0051] Event sequence number: identifies the order of events and is used to distinguish records of different events. For example, the event sequence number corresponding to the data item 0x0001 is 1, and the event sequence number corresponding to 0x0002 is 2. This may be to record the events in the order in which they occurred during storage.
[0052] In some specific embodiments, Figure 3 The event attributes include the maximum length of the storage information, the address of the object event in the non-volatile memory, the address of the storage object list, the starting address of the object event in the non-volatile memory, and the address of the management information in the non-volatile memory.
[0053] Specifically, event sequence number / freeze type: used to identify the type or sequence number of the current event or freeze operation so that the system can distinguish different events or freeze records;
[0054] Maximum length of stored information: specifies the maximum length of information that can be stored, ensuring that the write interface does not exceed the predetermined memory limit when storing data;
[0055] Management information storage start address (EEPROM): points to the start location in the non-volatile memory (EEPROM) for storing management information. Figure 3 ,The management information includes the number of records, pointers and checksums, which are used to track and manage the stored data. The number of records indicates the number of ,records stored. Through this field, the total number of records currently stored in the ,system can be tracked, which is convenient for managing and retrieving records. ,The current record pointer points to the location or address of the current ,record. When new data is written, the record pointer will be updated to ensure that the new ,data is stored in the correct location. Checksums are used to verify the integrity of ,data. The checksum field ensures the correctness and consistency of the ,record data, which helps prevent data errors or damage.
[0056] Data content storage start address (EEPROM): points to the start address in the EEPROM used to store the actual data content, so that the system knows the specific location of the data storage;
[0057] Number of stored objects: indicates the number of objects contained in the total table, which is used to ensure that all objects can be processed correctly during write operations;
[0058] Actual configuration capture object address (EEPROM): points to the actual capture object address in the EEPROM. This address is used to record the captured data content, which helps to ensure the accuracy of event recording.
[0059] The maximum number of objects that can actually be configured: indicates the maximum number of objects that the system allows to be configured, so that storage allocation planning can be done well during initialization to avoid exceeding storage limits;
[0060] The maximum number of objects that can actually be configured: indicates the maximum number of objects that the system allows to be configured, which facilitates reasonable planning during storage allocation and initialization to avoid exceeding storage limits.
[0061] In some specific embodiments, the storage object master table address is used to indicate the location of the storage object master table in the non-volatile memory. Through this address, the unified record write interface can accurately find the storage object master table, thereby further locating the specific storage object data item.
[0062] In some specific embodiments,
[0063] S102, when any of the object events occurs, is frozen, and ends, the event attributes are obtained and stored, and the event attributes are uniformly recorded in the write interface;
[0064] Specifically, the system monitors the status of object events in real time, including the occurrence, freezing and end of events. Whenever any of these situations occurs, the system will trigger the corresponding processing flow. Once a change in the event status is detected, the system first obtains the attributes of the event. Event attributes may include key information such as event type, occurrence time, and data storage address. These attributes are used to describe and record the details of the event. After obtaining the event attributes, they are uniformly stored in the write interface. The write interface serves as a general recording entry that can receive various event attribute data and perform storage operations. Regardless of whether the event occurs, is frozen or ends, it can be recorded through this write interface, thereby achieving unified management of different event states.
[0065] S103, the write interface obtains the sequence number of the object event in the storage object master table through the event attribute;
[0066] In some specific embodiments, the write interface obtains the sequence number of the object event in the storage object master table through the event attribute, including:
[0067] The serial number in the storage object master table is obtained through the address of the object event in the non-volatile memory.
[0068] Specifically, using the address of the object event in the non-volatile memory, the write interface searches in the storage object master table to find the object event corresponding to the address. After finding the corresponding data item, the serial number of the object event in the master table is extracted. This serial number is used to identify the location of the event in the storage system to facilitate subsequent data read and write operations.
[0069] S104, find the corresponding data item in the storage object general table through the sequence number and read the specific data information of the object event through the write interface;
[0070] Specifically, the corresponding entry is searched in the storage object master table through the obtained serial number. The serial number acts as a unique identifier in the master table, guiding the system to find the location of a specific data item. Once the corresponding data item is found, the system extracts the specific data information of the object event from the master table. The data information includes the time of event occurrence, data length, data format, etc., depending on the application requirements.
[0071] S105: storing the specific data information of the read object event into non-volatile storage.
[0072] In some specific embodiments, storing the specific data information of the read object event into non-volatile storage includes:
[0073] By storing the maximum length of the information, when each object event is stored in the non-volatile storage, a fixed offset distance is set between the object event and the previous record.
[0074] Specifically, the storage offset distance of each object event is set by using the "maximum length of storage information", that is, when the data of each object event is stored in the non-volatile memory, it will maintain a fixed offset distance from the previous record. This offset distance design can prevent data overlap and ensure that each record has an independent space in the memory, which is convenient for subsequent retrieval and management.
[0075] In some specific embodiments, storing the specific data information of the read object event into non-volatile storage includes:
[0076] The area allocated to the object event in the non-volatile memory is found through the starting address of the object event in the non-volatile memory for storage.
[0077] Specifically, using the starting address of the object event in the non-volatile memory, the system finds the corresponding area in the non-volatile memory. This area is the storage space reserved for the specific object event. Once the storage area of the event is located, the system writes the specific data information of the object event into the area. This ensures that the data is stored in the predetermined location to avoid conflicts with other data.
[0078] In some specific embodiments, it also includes:
[0079] The management information is acquired and updated in the non-volatile memory by the address of the management information in the non-volatile memory.
[0080] Specifically, each piece of management information has a specific storage address in the non-volatile memory. The system first locates the position of the management information in the non-volatile memory through this address, and the system reads the content of the management information at this address. The management information includes the current number of records, the current record pointer, the check value, etc., which are used to track and manage the stored data status. According to the current operation of the system (such as adding new records or deleting records), the system will make necessary updates to the management information. For example, when adding a record, the current number of records and the record pointer will be updated to reflect the latest storage status. The updated management information is written back to the non-volatile memory to ensure that it remains in the latest status even after the system is powered off.
[0081] In some specific embodiments, the write interface obtains the sequence number of the object event in the storage object general table through the event attribute, and further includes:
[0082] The number of storage objects is obtained by storing the addresses of the storage objects in the non-volatile memory.
[0083] Specifically, the unified record write interface determines the total number of stored objects by storing the addresses of the objects in the non-volatile memory, which helps to understand how many objects are currently stored to facilitate data management and storage operations.
[0084] In some embodiments, a storage device for firmware event records and freeze records is also provided, combined with Figure 5 ,include:
[0085] The construction unit 301 is used to construct a storage object master table with the specific contents of all object events, wherein the specific contents include the sequence number of the object event in the storage object master table, the specific data information of the object event, and the starting address of the object event in the non-volatile memory; when any of the occurrence, freezing and termination of the object event occurs, the event attributes are obtained and stored and uniformly recorded in the write interface;
[0086] An acquisition unit 302 is used to write an interface to acquire a sequence number of an object event in a storage object master table through an event attribute;
[0087] A reading unit 303, used to find the corresponding data item in the storage object general table through the sequence number and read the specific data information of the object event through the write interface;
[0088] The storage unit 304 is used to store the specific data information of the read object event in a non-volatile storage.
[0089] All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0090] In some other embodiments of the present invention, the present invention discloses an electronic device, such as Figure 6 As shown, the electronic device may include: one or more processors 401; a memory 402; a display 403; one or more applications (not shown); and one or more computer programs 404. The above components may be connected via one or more communication buses 405. The one or more computer programs 404 are stored in the memory 402 and configured to be executed by the one or more processors 401. The one or more computer programs 404 include instructions, which may be used to execute the following: Figure 1 to Figure 2 And each step in the corresponding embodiment.
[0091] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0092] Each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0093] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: flash memory, mobile hard disk, read-only memory, random access memory, disk or optical disk and other media that can store program codes.
[0094] The above is only a specific implementation of the embodiment of the present invention, but the protection scope of the embodiment of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiment of the present invention should be included in the protection scope of the embodiment of the present invention. Therefore, the protection scope of the embodiment of the present invention should be based on the protection scope of the claims.
Claims
1. A method for storing firmware event records and freeze records, characterized in that: Includes steps: Constructing a storage object master table with the specific contents of all object events, wherein the specific contents include the sequence number of the object event in the storage object master table, the specific data information of the object event, and the starting address of the object event in the non-volatile memory; When any of the object events, freezing and ending occurs, the event attributes are obtained and stored and recorded uniformly in the write interface; The write interface obtains the sequence number of the object event in the storage object master table through the event attribute; Find the corresponding data item in the storage object table through the sequence number and read the specific data information of the object event through the write interface; The specific data information of the read object event is stored in non-volatile storage.
2. The method according to claim 1, characterized in that The event attributes include the maximum length of the storage information, the address of the object event in the non-volatile memory, the address of the storage object master table, the starting address of the object event in the non-volatile memory, and the address of the management information in the non-volatile memory.
3. The method according to claim 2, characterized in that The write interface obtains the serial number of the object event in the storage object table through the event attributes, including: The serial number in the storage object master table is obtained through the address of the object event in the non-volatile memory.
4. The method according to claim 2, characterized in that: Storing the specific data information of the object event read into non-volatile storage includes: By storing the maximum length of the information, when each object event is stored in the non-volatile storage, a fixed offset distance is set between the object event and the previous record.
5. The method according to claim 2, characterized in that: Storing the specific data information of the object event read into non-volatile storage includes: The area allocated to the object event in the non-volatile memory is found through the starting address of the object event in the non-volatile memory for storage.
6. The method according to claim 2, characterized in that Also includes: The management information is acquired and updated in the non-volatile memory by the address of the management information in the non-volatile memory.
7. The method according to claim 2, characterized in that: The write interface obtains the serial number of the object event in the storage object table through the event attribute, which also includes: The number of storage objects is obtained by storing the addresses of the storage objects in the non-volatile memory.
8. A storage device for firmware event records and freeze records, characterized in that: include: A construction unit is used to construct a storage object master table with the specific contents of all object events, wherein the specific contents include the sequence number of the object event in the storage object master table, the specific data information of the object event, and the starting address of the object event in the non-volatile memory; when any of the occurrence, freezing and termination of the object event occurs, the event attributes are obtained and stored and uniformly recorded in the write interface; An acquisition unit, used for writing an interface to acquire the sequence number of an object event in a storage object master table through an event attribute; A reading unit, used to find the corresponding data item in the storage object general table through the sequence number and read the specific data information of the object event through the write interface; The storage unit is used to store the specific data information of the read object event into non-volatile storage.
9. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program executable on the processor, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.