Swap mechanism repairing method and device, equipment, medium and product
By detecting the index consistency of the UCB area and performing corresponding repair operations, the Swap mechanism error problem caused by unexpected interruption of UCB write data is solved, ensuring the stability and efficiency of the OTA upgrade and fault recovery functions of the MCU chip.
Patent Information
- Application Number
- CN202411698196.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-05-02
AI Technical Summary
When UCB writes data unexpectedly, it causes Swap mechanism errors between BankA and BankB, which in turn affects the OTA upgrade and failure recovery functions of the MCU chip.
By reading the configuration data of the first and second regions in the UCB, the index of the latest data of the two regions is detected, and whether to perform repair of the Swap mechanism. Specific steps include: if the index is invalid or inconsistent, write the configuration data of the backup area into the main area, and repeat the write operation until it is successful, or perform repair after the chip is powered off and then powered on.
It ensures the integrity and consistency of configuration data in the UCB area, avoids Swap mechanism errors, and improves the operation efficiency of OTA upgrade and failure recovery of MCU chips.
Smart Images

Figure CN119917339A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data detection technology, and in particular to a swap mechanism repair method, device, equipment, medium and product. Background Art
[0002] At present, most MCU (Microcontroller Unit) chips have the ability to divide Pflash (ProgramFlash) into BankA (A area) and BankB (B area) to implement OTA (Over-the-Air Technology) upgrade function. The switching mechanism between Bank A and Bank B is the Swap mechanism, which is a mechanism for security upgrades and fault recovery, and is commonly used in automotive and industrial applications.
[0003] The swap mechanism is to switch between BankA and BankB by configuring the specified UCB (User Configuration Blocks). When you want to switch banks, you just need to write a new configuration data. When it is full, all data will be erased and writing will start from the 0th row.
[0004] However, if the writing of data in the UCB is interrupted unexpectedly, the data in the two areas of the UCB will be inconsistent, and the wrong Bank will be executed, resulting in an error in the Swap mechanism. Summary of the invention
[0005] The main purpose of the present application is to provide a swap mechanism repair method, device, equipment, medium and product to solve the problem of swap mechanism error caused by unexpected interruption of existing UCB writing data.
[0006] In order to achieve the above objectives, in a first aspect, the present application provides a swap mechanism repair method, comprising:
[0007] Reading configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area;
[0008] Traversing each piece of data in the configuration data of the first region and the configuration data of the second region, detecting a first index corresponding to a latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region;
[0009] Based on the first index and the second index, it is determined whether to perform repair of the swap mechanism, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
[0010] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0011] If the first index is invalid or the first index is less than the second index, writing the configuration data of the second area into the first area;
[0012] It is detected whether the configuration data of the second area is successfully written into the first area, and it is determined whether to perform the repair of the swap mechanism based on the first detection result.
[0013] In a possible implementation, determining whether to perform repair of the swap mechanism based on the first detection result includes:
[0014] If the first detection result is successful, the repair of the swap mechanism is not performed;
[0015] If the first detection result is failure, repeatedly write the configuration data of the second area into the first area M times, where M is an integer greater than 1;
[0016] If the configuration data of the second area is written into the first area repeatedly for M times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0017] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0018] If the second index is invalid or the first index is greater than the second index, writing the configuration data of the first area into the second area;
[0019] It is detected whether the configuration data of the first area is successfully written into the second area, and it is determined whether to perform the repair of the swap mechanism based on the second detection result.
[0020] In a possible implementation, determining whether to perform repair of the swap mechanism based on the second detection result includes:
[0021] If the second detection result is successful, the repair of the swap mechanism is not performed;
[0022] If the second detection result is failure, repeatedly write the configuration data of the first area into the second area N times, where N is an integer greater than 1;
[0023] If the configuration data of the first area is written into the second area repeatedly for N times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0024] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0025] If the first index is equal to the second index, the repair of the swap mechanism is not performed.
[0026] In a second aspect, an embodiment of the present invention provides a swap mechanism repair device, including:
[0027] A data reading module, used to read configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area;
[0028] A detection module, configured to traverse each piece of data in the configuration data of the first region and the configuration data of the second region, and detect a first index corresponding to the latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region;
[0029] The repair module is used to determine whether to perform repair of the swap mechanism based on the first index and the second index, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
[0030] In a third aspect, an embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above swap mechanism repair methods when executing the computer program.
[0031] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of any of the above swap mechanism repair methods are implemented.
[0032] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above swap mechanism repair methods.
[0033] The embodiment of the present invention provides a swap mechanism repair method, device, equipment, medium and product, including: first reading the configuration data of the first area and the configuration data of the second area in the UCB, then traversing each data in the configuration data of the first area and the configuration data of the second area, detecting the first index corresponding to the latest data in the configuration data of the first area and the second index corresponding to the latest data in the configuration data of the second area, and then judging whether to perform the repair of the swap mechanism based on the first index and the second index, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism. The present application judges whether the swap mechanism needs to be repaired by detecting the index of the latest data in the first area and the second area in the UCB, thereby ensuring the integrity and consistency of the configuration data of the first area and the second area, avoiding the problem of Swap mechanism errors caused by the unexpected interruption of UCB writing data, and improving the operating efficiency of the Swap mechanism. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0035] Figure 1 is a data comparison diagram of the first region and the second region provided by an embodiment of the present invention;
[0036] Figure 2 It is a flow chart of an implementation method of a swap mechanism operation method provided by an embodiment of the present invention;
[0037] Figure 3 It is a flow chart of an implementation method of a swap mechanism repair method provided by an embodiment of the present invention;
[0038] Figure 4 is a flow chart of an implementation method of a swap mechanism repair method provided by another embodiment of the present invention;
[0039] Figure 5 is a data comparison diagram of the first region and the second region provided by another embodiment of the present invention;
[0040] Figure 6 is a data comparison diagram of the first region and the second region provided by another embodiment of the present invention;
[0041] Figure 7 It is a structural schematic diagram of a swap mechanism repair device provided by an embodiment of the present invention;
[0042] Figure 8 It is a schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not 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.
[0044] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein.
[0045] It should be understood that in various embodiments of the present invention, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0046] It should be understood that in the present invention, "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0047] It should be understood that in the present invention, "plurality" refers to two or more than two. "And / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "Contains A, B and C", "Contains A, B, C" means that A, B, and C are all included, "Contains A, B or C" means that one of A, B, and C is included, and "Contains A, B and / or C" means that any one, any two, or any three of A, B, and C are included.
[0048] It should be understood that in the present invention, "B corresponding to A", "B corresponding to A", "A corresponds to B" or "B corresponds to A" means that B is associated with A and B can be determined based on A. Determining B based on A does not mean determining B based only on A, but B can also be determined based on A and / or other information. A and B match when the similarity between A and B is greater than or equal to a preset threshold.
[0049] Depending on the context, "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting."
[0050] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0051] In order to make the purpose, technical solutions and advantages of the present invention more clear, specific embodiments will be described below in conjunction with the accompanying drawings.
[0052] At present, most MCU chips have the ability to divide Pflash into BankA and BankB to implement OTA upgrade function. The switching mechanism between BankA and BankB is the Swap mechanism, which is a mechanism for security upgrade and fault recovery, commonly used in automotive and industrial applications.
[0053] SWAP (swap partition) plays an important role in Linux systems, similar to Windows virtual memory, which is used to provide additional storage space when physical memory is insufficient. When the system physical memory (RAM) is exhausted, SWAP will transfer some infrequently used data to the swap space on the hard disk, thereby freeing up physical memory for other programs to use. In this way, the system can continue to run without crashing due to insufficient memory. In other words, when the system physical memory is insufficient, the operating system will transfer infrequently used data from the memory to the SWAP partition, and when the data needs to be accessed, it will be restored from the SWAP partition to the memory.
[0054] The swap mechanism is to switch between BankA and BankB by configuring the specified UCB. When you want to switch banks, you just need to write a new configuration data. When it is full, all data will be erased and writing will start from the 0th row.
[0055] Take Infineon TC3xx chip (except TC33x and TC33xED) as an example. Figure 1As shown, the Swap mechanism of Infineon TC3xx chip is to realize the switching between BankA and BankB by configuring the specified UCB area, where the UCB area includes the first area (UCB_SWAP_ORIG) and the second area (UCB_SWAP_COPY). A total of 16 pieces of information can be written into each area, and each piece of information starts with 0x00000055 or 0x000000AA.
[0056] like Figure 2 As shown, when the software starts, the chip will first determine the data in UCB_SWAP_ORIG. If the latest information is 0x0000000055, BankA will be run; if the latest information is 0x000000AA, BankB will be run.
[0057] If the data in UCB_SWAP_ORIG is invalid, then check the data in UCB_SWAP_COPY. When you want to switch banks, just write a new configuration information. When 16 data are full, erase all data and start writing from the 0th data.
[0058] However, if the writing of data in the UCB is interrupted unexpectedly, the data in the two areas of the UCB will be inconsistent, and the wrong Bank will be executed, resulting in an error in the Swap mechanism.
[0059] Therefore, the present application proposes a swap mechanism repair method to solve the above problems.
[0060] In one embodiment, Figure 3 As shown, a swap mechanism repair method is provided, comprising the following steps:
[0061] Step S301: Read configuration data of the first region and configuration data of the second region in the UCB.
[0062] The second area is a backup area of the first area.
[0063] Each time the software is started, the present application reads the configuration data of the first area (UCB_SWAP_ORIG) and the second area (UCB_SWAP_COPY) through a fixed address, thereby checking the integrity and correctness of each data, and determining the index (Index) of the latest data in UCB_SWAP_ORIG and UCB_SWAP_COPY, so that the configuration data in the two areas are always consistent through the index (Index) of the latest data in UCB_SWAP_ORIG and UCB_SWAP_COPY.
[0064] Step S302: traverse each piece of data in the configuration data of the first region and the configuration data of the second region, and detect a first index corresponding to the latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region.
[0065] The index of the latest data in the first area UCB_SWAP_ORIG is the first index Index_ORIG, and the index of the latest data in the second area UCB_SWAP_COPY is the second index Index_COPY. Whether the configuration data of the first area and the second area are consistent is determined by detecting the first index Index_ORIG and the second index Index_COPY.
[0066] Step S303: Based on the first index and the second index, determine whether to perform repair of the swap mechanism.
[0067] The configuration data of the first area and the configuration data of the second area are associated with a swap mechanism.
[0068] In one embodiment, in a possible implementation method, based on the first index and the second index, it is determined whether to perform a repair of the swap mechanism, including: if the first index is invalid or the first index is smaller than the second index, writing the configuration data of the second area into the first area; detecting whether the configuration data of the second area is successfully written into the first area, and determining whether to perform a repair of the swap mechanism based on the first detection result.
[0069] Wherein, judging whether to perform the repair of the swap mechanism based on the first detection result includes: if the first detection result is successful, then not performing the repair of the swap mechanism; if the first detection result is failed, then repeatedly performing M times to write the configuration data of the second area into the first area, wherein M is an integer greater than 1; if repeatedly performing M times to write the configuration data of the second area into the first area fails, then performing the repair of the swap mechanism after the chip is powered off and then powered on. Wherein, M can be set according to the specific situation, and is preferably 3.
[0070] like Figure 4 As shown, based on the first index and the second index, determining whether to execute the repair of the swap mechanism includes: if the first index Index_ORIG is invalid or the first index Index_ORIG is smaller than the second index Index_COPY, writing the configuration data of the second area UCB_SWAP_COPY into the first area UCB_SWAP_ORIG; detecting whether the configuration data of the second area UCB_SWAP_COPY is successfully written into the first area UCB_SWAP_ORIG, and determining whether to execute the repair of the swap mechanism based on the first detection result.
[0071] If the first detection result is successful, the swap mechanism repair is not executed; if the first detection result is failed, the execution is repeated (retry) 3 times to write the configuration data of the second area UCB_SWAP_COPY into the first area UCB_SWAP_ORIG; if the execution fails to write the configuration data of the second area UCB_SWAP_COPY into the first area UCB_SWAP_ORIG after repeating 3 times, the swap mechanism repair is executed after the chip is powered off and then powered on.
[0072] In another embodiment, based on the first index and the second index, it is determined whether to perform a repair of the swap mechanism, including: if the second index is invalid or the first index is greater than the second index, writing the configuration data of the first area into the second area; detecting whether the configuration data of the first area is successfully written into the second area, and determining whether to perform a repair of the swap mechanism based on the second detection result.
[0073] Wherein, judging whether to perform the repair of the swap mechanism based on the second detection result includes: if the second detection result is successful, then the repair of the swap mechanism is not performed; if the second detection result is failed, then the configuration data of the first area is written into the second area repeatedly for N times, wherein N is an integer greater than 1; if the configuration data of the first area is written into the second area repeatedly for N times and fails, then the repair of the swap mechanism is performed after the chip is powered off and then powered on. Wherein, N can be set according to the specific situation, and is preferably 3.
[0074] like Figure 4 As shown, if the second index Index_COPY is invalid or the first index Index_ORIG is greater than the second index Index_COPY, the configuration data of the first area UCB_SWAP_ORIG is written into the second area UCB_SWAP_COPY; detect whether the configuration data of the first area UCB_SWAP_ORIG is successfully written into the second area UCB_SWAP_COPY, and determine whether to perform the repair of the swap mechanism based on the second detection result.
[0075] If the second test result is successful, the swap mechanism repair is not performed; if the second test result is failed, the execution is repeated (retry) 3 times to write the configuration data of the first area UCB_SWAP_ORIG into the second area UCB_SWAP_COPY; if the execution fails to write the configuration data of the first area UCB_SWAP_ORIG into the second area UCB_SWAP_COPY after repeating 3 times, the swap mechanism repair is performed after the chip is powered off and then powered on.
[0076] In another embodiment, based on the first index and the second index, determining whether to perform the repair of the swap mechanism includes: if the first index is equal to the second index, not performing the repair of the swap mechanism.
[0077] like Figure 4 As shown, if the first index Index_ORIG is equal to the second index Index_COPY, the repair of the swap mechanism is not performed.
[0078] like Figure 5 As shown in the figure, the No. 1 data 0x000000AA is successfully written into UCB_SWAP_ORIG, while the data in the UCB_SWAP_COPY backup has not been written yet and remains at 0x00000000. The software starts normally, and the data in UCB_SWAP_ORIG is judged to be 0x0x000000AA, and Bank B is run. When the data in the UCB_SWAP_ORIG area fails abnormally, the data in the UCB_SWAP_COPY area is judged, and the valid data in UCB_SWAP_COPY is 0x00000055, and Bank A is run. At this time, an unexpected bank switch occurs, and the running software cannot guarantee correctness.
[0079] Through this application method, such as Figure 6 As shown, the No. 1 data 0x000000AA in UCB_SWAP_ORIG can be copied and written into UCB_SWAP_COPY to ensure the consistency of the configuration data in UCB_SWAP_ORIG and UCB_SWAP_COPY, which can effectively avoid incorrect Bank switching.
[0080] An embodiment of the present invention provides a method for repairing a swap mechanism, comprising: first reading configuration data of a first area and configuration data of a second area in a UCB, then traversing each piece of data in the configuration data of the first area and the configuration data of the second area, detecting a first index corresponding to the latest piece of data in the configuration data of the first area and a second index corresponding to the latest piece of data in the configuration data of the second area, and then judging whether to perform repair of the swap mechanism based on the first index and the second index, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism. The present application judges whether the swap mechanism needs to be repaired by detecting the index of the latest piece of data in the first area and the second area in the UCB, thereby avoiding the problem of Swap mechanism errors caused by an unexpected interruption of UCB writing data, and improving the operating efficiency of the Swap mechanism.
[0081] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0082] The following is an embodiment of the device of the present invention. For details not described in detail therein, reference may be made to the corresponding method embodiment described above.
[0083] Figure 7 A schematic diagram of the structure of a swap mechanism repair device provided by an embodiment of the present invention is shown. For the sake of convenience, only the part related to the embodiment of the present invention is shown. A swap mechanism repair device includes a data reading module 701, a detection module 702 and a repair module 703, which are as follows:
[0084] A data reading module 701 is used to read configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area;
[0085] A detection module 702, configured to traverse each piece of data in the configuration data of the first region and the configuration data of the second region, and detect a first index corresponding to the latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region;
[0086] The repair module 703 is used to determine whether to perform repair of the swap mechanism based on the first index and the second index, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
[0087] In a possible implementation, the repair module 703 is further configured to write the configuration data of the second area into the first area if the first index is invalid or the first index is smaller than the second index;
[0088] It is detected whether the configuration data of the second area is successfully written into the first area, and it is determined whether to perform the repair of the swap mechanism based on the first detection result.
[0089] In a possible implementation, the repair module 703 is further configured to not perform repair of the swap mechanism if the first detection result is successful;
[0090] If the first detection result is failure, repeatedly write the configuration data of the second area into the first area M times, where M is an integer greater than 1;
[0091] If the configuration data of the second area is written into the first area repeatedly for M times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0092] In a possible implementation, the repair module 703 is further configured to write the configuration data of the first area into the second area if the second index is invalid or the first index is greater than the second index;
[0093] It is detected whether the configuration data of the first area is successfully written into the second area, and it is determined whether to perform the repair of the swap mechanism based on the second detection result.
[0094] In a possible implementation, the repair module 703 is further configured to not perform repair of the swap mechanism if the second detection result is successful;
[0095] If the second detection result is failure, repeatedly write the configuration data of the first area into the second area N times, where N is an integer greater than 1;
[0096] If the configuration data of the first area is written into the second area repeatedly for N times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0097] In a possible implementation, the repair module 703 is further configured to not perform repair of the swap mechanism if the first index is equal to the second index.
[0098] The embodiment of the present invention provides a swap mechanism repair device, which is specifically used to: first read the configuration data of the first area and the configuration data of the second area in the UCB, then traverse each data in the configuration data of the first area and the configuration data of the second area, detect the first index corresponding to the latest data in the configuration data of the first area and the second index corresponding to the latest data in the configuration data of the second area, and then determine whether to perform the repair of the swap mechanism based on the first index and the second index, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism. The present application determines whether the swap mechanism needs to be repaired by detecting the index of the latest data in the first area and the second area in the UCB, thereby avoiding the problem of Swap mechanism errors caused by unexpected interruption of UCB writing data, and improving the operating efficiency of the Swap mechanism.
[0099] Figure 8 Schematic diagram of a computer device provided by an embodiment of the present invention. Figure 8 As shown, the computer device 8 of this embodiment includes: a processor 801, a memory 802, and a computer program 808 stored in the memory 802 and executable on the processor 801. When the processor 801 executes the computer program 808, the steps in the above-mentioned swap mechanism repair method embodiments are implemented, for example Figure 3Alternatively, when the processor 801 executes the computer program 808, the functions of each module / unit in the above-mentioned swap mechanism repair device embodiments are implemented, for example Figure 7 Functionality of modules / units 701-703 is shown.
[0100] The present invention further provides a readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement a swap mechanism repair method provided in the above various embodiments, including:
[0101] Reading configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area;
[0102] Traversing each piece of data in the configuration data of the first region and the configuration data of the second region, detecting a first index corresponding to a latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region;
[0103] Based on the first index and the second index, it is determined whether to perform repair of the swap mechanism, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
[0104] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0105] If the first index is invalid or the first index is less than the second index, writing the configuration data of the second area into the first area;
[0106] It is detected whether the configuration data of the second area is successfully written into the first area, and it is determined whether to perform the repair of the swap mechanism based on the first detection result.
[0107] In a possible implementation, determining whether to perform repair of the swap mechanism based on the first detection result includes:
[0108] If the first detection result is successful, the repair of the swap mechanism is not performed;
[0109] If the first detection result is failure, repeatedly write the configuration data of the second area into the first area M times, where M is an integer greater than 1;
[0110] If the configuration data of the second area is written into the first area repeatedly for M times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0111] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0112] If the second index is invalid or the first index is greater than the second index, writing the configuration data of the first area into the second area;
[0113] It is detected whether the configuration data of the first area is successfully written into the second area, and it is determined whether to perform the repair of the swap mechanism based on the second detection result.
[0114] In a possible implementation, determining whether to perform repair of the swap mechanism based on the second detection result includes:
[0115] If the second detection result is successful, the repair of the swap mechanism is not performed;
[0116] If the second detection result is failure, repeatedly write the configuration data of the first area into the second area N times, where N is an integer greater than 1;
[0117] If the configuration data of the first area is written into the second area repeatedly for N times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0118] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0119] If the first index is equal to the second index, the repair of the swap mechanism is not performed.
[0120] Among them, the readable storage medium can be a computer storage medium or a communication medium. The communication medium includes any medium that facilitates the transmission of a computer program from one place to another. The computer storage medium can be any available medium that can be accessed by a general or special-purpose computer. For example, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist in a communication device as discrete components. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0121] The present invention also provides a program product, which includes an execution instruction, and the execution instruction is stored in a readable storage medium. At least one processor of the device can read the execution instruction from the readable storage medium, and at least one processor executes the execution instruction so that the device implements a swap mechanism repair method provided by the various embodiments described above, including:
[0122] Reading configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area;
[0123] Traversing each piece of data in the configuration data of the first region and the configuration data of the second region, detecting a first index corresponding to a latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region;
[0124] Based on the first index and the second index, it is determined whether to perform repair of the swap mechanism, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
[0125] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0126] If the first index is invalid or the first index is less than the second index, writing the configuration data of the second area into the first area;
[0127] It is detected whether the configuration data of the second area is successfully written into the first area, and it is determined whether to perform the repair of the swap mechanism based on the first detection result.
[0128] In a possible implementation, determining whether to perform repair of the swap mechanism based on the first detection result includes:
[0129] If the first detection result is successful, the repair of the swap mechanism is not performed;
[0130] If the first detection result is failure, repeatedly write the configuration data of the second area into the first area M times, where M is an integer greater than 1;
[0131] If the configuration data of the second area is written into the first area repeatedly for M times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0132] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0133] If the second index is invalid or the first index is greater than the second index, writing the configuration data of the first area into the second area;
[0134] It is detected whether the configuration data of the first area is successfully written into the second area, and it is determined whether to perform the repair of the swap mechanism based on the second detection result.
[0135] In a possible implementation, determining whether to perform repair of the swap mechanism based on the second detection result includes:
[0136] If the second detection result is successful, the repair of the swap mechanism is not performed;
[0137] If the second detection result is failure, repeatedly write the configuration data of the first area into the second area N times, where N is an integer greater than 1;
[0138] If the configuration data of the first area is written into the second area repeatedly for N times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
[0139] In a possible implementation, judging whether to perform repair of the swap mechanism based on the first index and the second index includes:
[0140] If the first index is equal to the second index, the repair of the swap mechanism is not performed.
[0141] In the embodiments of the above-mentioned devices, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in the present invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0142] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A swap mechanism repair method, characterized in that: include: Reading configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area; Traversing each piece of data in the configuration data of the first region and the configuration data of the second region, detecting a first index corresponding to a latest piece of data in the configuration data of the first region and a second index corresponding to the latest piece of data in the configuration data of the second region; Based on the first index and the second index, it is determined whether to perform repair of a swap mechanism, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
2. A swap mechanism repair method according to claim 1, characterized in that: The determining whether to perform repair of the swap mechanism based on the first index and the second index includes: If the first index is invalid or the first index is smaller than the second index, writing the configuration data of the second area into the first area; It is detected whether the configuration data of the second area is successfully written into the first area, and it is determined whether to perform repair of the swap mechanism based on the first detection result.
3. A swap mechanism repair method according to claim 2, characterized in that: The determining whether to perform the repair of the swap mechanism based on the first detection result includes: If the first detection result is successful, the repair of the swap mechanism is not performed; If the first detection result is failure, repeatedly writing the configuration data of the second area into the first area M times, where M is an integer greater than 1; If the configuration data of the second area is written into the first area repeatedly for M times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
4. A swap mechanism repair method according to claim 1, characterized in that: The determining whether to perform repair of the swap mechanism based on the first index and the second index includes: If the second index is invalid or the first index is greater than the second index, writing the configuration data of the first area into the second area; It is detected whether the configuration data of the first area is successfully written into the second area, and it is determined whether to perform the repair of the swap mechanism based on the second detection result.
5. A swap mechanism repair method according to claim 4, characterized in that: The determining whether to perform the repair of the swap mechanism based on the second detection result includes: If the second detection result is successful, the repair of the swap mechanism is not performed; If the second detection result is failure, repeatedly writing the configuration data of the first area into the second area N times, where N is an integer greater than 1; If the configuration data of the first area is written into the second area repeatedly for N times and fails, the swap mechanism is repaired after the chip is powered off and then powered on.
6. A swap mechanism repair method according to claim 1, characterized in that: The determining whether to perform repair of the swap mechanism based on the first index and the second index includes: If the first index is equal to the second index, the repair of the swap mechanism is not performed.
7. A swap mechanism repair device, characterized in that: include: A data reading module, used to read configuration data of a first area and configuration data of a second area in the UCB, wherein the second area is a backup area of the first area; a detection module, configured to traverse each piece of data in the configuration data of the first area and the configuration data of the second area, and detect a first index corresponding to a latest piece of data in the configuration data of the first area and a second index corresponding to the latest piece of data in the configuration data of the second area; A repair module is used to determine whether to perform a repair of a swap mechanism based on the first index and the second index, wherein the configuration data of the first area and the configuration data of the second area are associated with the swap mechanism.
8. A computer device, characterized in that: comprising a memory, and one or more processors communicatively connected to the memory; The memory stores instructions that can be executed by the one or more processors, and the instructions are executed by the one or more processors to enable the one or more processors to implement the swap mechanism repair method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The invention comprises a program or an instruction, which, when executed on a computer, implements the swap mechanism repair method as claimed in any one of claims 1 to 6.
10. A computer program product, characterized in that It includes a computer program, which, when executed by a processor, implements the swap mechanism repair method described in any one of claims 1 to 6.