Hardware error positioning method, device and system

By obtaining and analyzing the register information when a hardware error occurs in the microcontroller and determining the fault function, remote positioning of the microprocessor hardware error is achieved, solving the problem of low positioning efficiency in the existing technology, and improving the accuracy and efficiency of positioning.

CN119645695APending Publication Date: 2025-03-18SUNWODA ENERGY TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411542936.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

Most hardware error positioning methods need to be carried out at the installation site of the microcontroller, resulting in low positioning efficiency.

Method used

By obtaining the first register information when a hardware error occurs in the microcontroller, obtaining the error value of the linked register, determining the target pointer and target value, obtaining the pre-stored mapping symbol table, and determining the fault function to locate the hardware error.

Benefits of technology

Remote positioning of microprocessor hardware errors is achieved, the accuracy and efficiency of fault positioning is improved, and field debugging is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645695A_ABST
    Figure CN119645695A_ABST
Patent Text Reader

Abstract

The invention discloses a hardware error positioning method, device and system, and belongs to the technical field of fault positioning, the positioning method is applied to a client, and the positioning method comprises the following steps: obtaining first register information in response to a hardware error of a microcontroller; obtaining an error value of a link register from the first register information; determining a target pointer and a target value corresponding to the target pointer from the first register information based on the error value; determining a target address based on the target value in the sub-information corresponding to the target pointer; obtaining a pre-stored mapping symbol table, wherein the mapping symbol table is used for representing a mapping relationship between the address and the function; and determining a function corresponding to the target address in the mapping symbol table as a fault function, wherein the fault function is used for positioning a hardware error of the microcontroller. Therefore, by acquiring the first register information when the hardware fault occurs and performing remote analysis on the first register information, remote positioning of the hardware fault of the microprocessor is realized, and the accuracy and efficiency of fault positioning are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of fault location, and specifically relates to a method, device and system for locating a hardware error. Background Art

[0002] In the process of embedded system development, ARM Cortex-M (Advanced RISC Machine) series MCU (Microcontroller Unit) has been widely used due to its high efficiency and low power consumption. However, in the process of MCU development and application, hardware errors (Hardfault) often occur, causing MCU application system abnormalities.

[0003] Currently, most methods for locating hardware errors need to be performed at the installation site of the microcontroller, resulting in low positioning efficiency. Summary of the invention

[0004] Purpose of the invention: The present application provides a method for locating a hardware error, which is used to solve the problem that most methods for locating a hardware error need to be performed at the installation site of the microcontroller, resulting in low positioning efficiency; another purpose of the present application is to provide a hardware error locating device; another purpose of the present application is to provide a hardware error locating system.

[0005] Technical solution: This application provides a method for locating a hardware error, which is applied to a client. The method includes:

[0006] In response to a hardware error occurring in the microcontroller, first register information is acquired, where the first register information is used to represent register information when the hardware error occurs in the microcontroller;

[0007] Obtaining an error value of a link register from the first register information;

[0008] Determine a target pointer and a target value corresponding to the target pointer from the first register information based on the error value;

[0009] In the sub-information corresponding to the target pointer, a target address is determined based on the target value, the target address being used to represent a correct value of the link register;

[0010] Acquire a pre-stored mapping symbol table, where the mapping symbol table is used to represent a mapping relationship between addresses and functions;

[0011] The function corresponding to the target address in the mapping symbol table is determined as a fault function, and the fault function is used to locate the hardware error of the microcontroller.

[0012] In some embodiments, the target pointer is a main stack pointer or a process stack pointer; and determining the target pointer from the first register information based on the error value includes:

[0013] In response to the error value being a first preset value, selecting the main stack pointer as the target pointer;

[0014] In response to the error value being a second preset value, the process stack pointer is selected as the target pointer.

[0015] In some embodiments, in response to a hardware error occurring in the microcontroller, obtaining first register information includes:

[0016] Acquire second register information of the microcontroller, where the second register information is used to represent register information when a fault occurs in the microcontroller;

[0017] In response to the second register information satisfying a hardware error occurrence condition, the second register information is determined as the first register information.

[0018] In some embodiments, determining that the second register information satisfies a hardware error occurrence condition includes:

[0019] Based on the second register information, determining the fault access bit state of the error confirmation register;

[0020] In response to the fault access bit state being a valid state, traversing the second register information;

[0021] In response to the second register information including an interrupt return value, it is determined that the second register information satisfies the hardware error occurrence condition.

[0022] In some embodiments, obtaining second register information of the microcontroller includes:

[0023] Obtaining a fault message when the microcontroller fails;

[0024] Sending a query instruction to the microcontroller;

[0025] The second register information sent by the microcontroller is acquired, where the second register information is read from the flash memory by the microcontroller in response to the query instruction.

[0026] In some embodiments, the first preset value is configured as xxxxxxxxF9, and the second preset value is configured as xxxxxxxxFD or xxxxxxxxED.

[0027] In some embodiments, after determining the function corresponding to the target address in the mapping symbol table as a fault function, the positioning method further includes:

[0028] Analyze the source code of the fault function to determine the illegal pointer;

[0029] Based on the illegal pointer, repair the source code;

[0030] The repaired source code is run, and in response to the source code not running the fault function, it is confirmed that the source code is repaired successfully.

[0031] Accordingly, the present application also provides a hardware error positioning device, which is configured on a client, and the positioning device includes:

[0032] A first acquisition unit is configured to acquire first register information in response to a hardware error occurring in the microcontroller, wherein the first register information is used to represent register information when the hardware error occurs in the microcontroller;

[0033] A second obtaining unit is configured to obtain an error value of a link register from the first register information;

[0034] A first determining unit is configured to determine a target pointer and a target value corresponding to the target pointer from the first register information based on the error value;

[0035] a second determining unit configured to determine a target address based on the target value in the sub-information corresponding to the target pointer, the target address being used to represent a correct value of the link register;

[0036] A third acquisition unit is configured to acquire a pre-stored mapping symbol table, where the mapping symbol table is used to represent a mapping relationship between an address and a function;

[0037] The third determining unit is configured to determine the function corresponding to the target address in the mapping symbol table as a fault function, where the fault function is used to locate a hardware error of the microcontroller.

[0038] Accordingly, the present application also provides a hardware error positioning system, the positioning system comprising:

[0039] A fault capture module, the fault capture module is configured in the microcontroller, and the fault capture module is configured to store first register information in response to a hardware error occurring in the microcontroller, wherein the first register information is used to represent register information when a hardware error occurs in the microcontroller;

[0040] A client, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; wherein the processor, when executing the computer program, can be used to execute the steps of the method for locating a hardware error as described in any one of the above embodiments;

[0041] A cloud server, communicating with the fault capture module and the client;

[0042] The communication module is configured to realize the communication connection between the fault capture module and the client, between the fault capture module and the cloud server, and between the client and the cloud server.

[0043] In some embodiments, a flash memory is provided in the fault capture module, and the fault capture module is further configured to perform the following steps:

[0044] In response to a fault occurring in the microcontroller, executing a fault function;

[0045] Get the sub-information and target value corresponding to the main stack pointer, as well as the sub-information and target value corresponding to the process stack pointer;

[0046] The sub-information and the target value are used as a starting address, and second register information of a preset length is stored in the flash memory.

[0047] Beneficial effect: Compared with the prior art, a method for locating a hardware error provided by an embodiment of the present application is applied to a client, and the locating method includes: in response to a hardware error occurring in a microcontroller, obtaining first register information, the first register information is used to characterize register information when a hardware error occurs in the microcontroller; obtaining an error value of a link register from the first register information; determining a target pointer and a target value corresponding to the target pointer from the first register information based on the error value; determining a target address based on the target value in the sub-information corresponding to the target pointer, the target address is used to characterize the correct value of the link register; obtaining a pre-stored mapping symbol table, the mapping symbol table is used to represent the mapping relationship between an address and a function; determining the function corresponding to the target address in the mapping symbol table as a fault function, the fault function is used to locate the hardware error of the microcontroller. In this way, by obtaining the first register information when a hardware fault occurs and remotely analyzing the first register information, remote positioning of the microprocessor hardware error is achieved, and the accuracy and efficiency of fault positioning are improved.

[0048] It can be understood that, compared with the prior art, the hardware error locating device provided in the embodiment of the present application includes all the technical features and technical effects of the above-mentioned hardware error locating method, which will not be repeated here.

[0049] It can be understood that, compared with the prior art, the hardware error positioning system provided by the embodiment of the present application includes all the technical features and technical effects of the above-mentioned hardware error positioning method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The technical solution and other beneficial effects of the present application will be made apparent by describing in detail the specific implementation methods of the present application in conjunction with the accompanying drawings.

[0051] Figure 1 A schematic diagram of a first process flow of a method for locating a hardware error provided in an embodiment of the present application;

[0052] Figure 2 A second flow chart of the method for locating a hardware error provided in an embodiment of the present application;

[0053] Figure 3 A schematic diagram of a flow chart of obtaining register information in a method for locating a hardware error provided in an embodiment of the present application;

[0054] Figure 4 A schematic diagram of sub-information of the main stack pointer in the method for locating a hardware error provided in an embodiment of the present application;

[0055] Figure 5 A schematic diagram of sub-information of a process stack pointer in a method for locating a hardware error provided in an embodiment of the present application;

[0056] Figure 6 A schematic diagram of an overflow failure of the method for locating a hardware error provided in an embodiment of the present application;

[0057] Figure 7 A schematic diagram of first register information of a method for locating a hardware error provided in an embodiment of the present application;

[0058] Figure 8 A schematic diagram of sub-information of a method for locating a hardware error provided in an embodiment of the present application;

[0059] Fig. 9 A schematic diagram of a code mapping table of a method for locating a hardware error provided in an embodiment of the present application;

[0060] Fig.10 A schematic diagram of a mapping symbol table for a method for locating a hardware error provided in an embodiment of the present application;

[0061] Fig.11 A schematic diagram of source code of a fault function of a method for locating a hardware error provided in an embodiment of the present application;

[0062] Fig.12 A schematic diagram of the structure of a device for locating a hardware error provided in an embodiment of the present application;

[0063] Fig.13 A schematic diagram of the structure of a hardware error positioning system provided in an embodiment of the present application;

[0064] Fig.14 A flowchart of a fault capture module in a hardware error positioning system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0065] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0066] In the description of the present application, it should be noted that, unless otherwise clearly specified and limited, the terms "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, an electrical connection, or can communicate with each other; it can be directly connected, or indirectly connected through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to the specific circumstances. In the description of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined. In addition, the terms "first" and "second" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more features.

[0067] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application.

[0068] This application embodiment provides a method for locating a hardware error. Figure 1 and Figure 2 , Figure 1 A first flow chart of the method for locating a hardware error provided by an embodiment of the present application is illustrated; Figure 2 The second flow chart of the method for locating a hardware error provided by the embodiment of the present application is illustrated. The method for locating a hardware error provided by the embodiment of the present application is applied to a client, and the locating method includes the following steps 101 to 106 .

[0069] Step 101, in response to a hardware error in the microcontroller, obtain first register information, the first register information is used to characterize register information when a hardware error occurs in the microcontroller. Specifically, the microcontroller includes a plurality of registers, and the registers store the state of the microcontroller and the data of various parameters in the operation of the microcontroller, i.e., register information. It can be understood that when a microcontroller fails, the data of the hardware error or other errors that cause the failure will also be stored in the register. By analyzing these register information, the fault can be accurately diagnosed and located. Therefore, the present application obtains the first register information, and then analyzes the first register information, accurately diagnoses and locates the fault, so as to take corresponding repair measures. At the same time, different from locating the hardware error by simulating and analyzing the microcontroller on site, after the present application obtains the first register information, the first register information is transmitted to the client for subsequent analysis, and the client is set in a more convenient position to realize remote monitoring and maintenance of the microcontroller, and improve the efficiency and accuracy of fault handling.

[0070] It should be noted that the multiple registers in the microcontroller of the present application include: an error confirmation register (HFSR), an interrupt access register (UFSR), a basic register (BFAR), a memory management (MMFAR), a main stack pointer (MSP), a process stack pointer (PSP), multiple general registers (R0~R12), a stack pointer (R13(SP)), a link register (R14(LR)) and a program counter (R15(PC)). Among them, the error confirmation register is used to determine whether the fault of the microcontroller is caused by a hardware error, and its main basis is whether the fault access bit state (FORCED) is valid. The interrupt access register is used to indicate that an attempt is made to load an illegal interrupt return value (EXC_RETURN) into the program counter when an abnormal interrupt returns, thereby causing a usage error; the main stack pointer is the default stack pointer; the process stack pointer can only be used in thread mode; the general registers (R0~R12) are general purpose registers; the link register is used to save the return address when a function or subroutine is called.

[0071] See also Figure 3 , Figure 3The present invention illustrates a schematic diagram of the process of obtaining register information in the method for locating a hardware error provided in an embodiment of the present application. In some embodiments, in response to a hardware error in a microcontroller, obtaining first register information includes: obtaining second register information of the microcontroller, the second register information being used to characterize register information when a microcontroller fails; in response to the second register information satisfying a hardware error occurrence condition, determining the second register information as the first register information. It can be understood that the causes of microcontroller failures include more than just hardware errors. The present application first obtains the second register information, and then uses the hardware error occurrence condition to screen whether the current microcontroller failure is caused by a hardware error, thereby avoiding unnecessary debugging and troubleshooting steps and improving the accuracy and efficiency of locating hardware errors.

[0072] In some embodiments, determining that the second register information satisfies the hardware error occurrence condition includes: determining the fault access bit state of the error confirmation register based on the second register information; traversing the second register information in response to the fault access bit state being a valid state; and determining that the second register information satisfies the hardware error occurrence condition in response to the second register information including an interrupt return value. Specifically, the interrupt return value is the register value stored in the interrupt access register. By determining the validity of the fault access bit state and whether the register information includes a terminal return value, the present application can quickly determine whether the second register information satisfies the hardware error occurrence condition, thereby avoiding wasting time on debugging and troubleshooting on irrelevant registers. Furthermore, by determining whether the second register information satisfies the hardware error occurrence condition, the location range of the hardware error is narrowed, unnecessary debugging and troubleshooting steps are reduced, and the efficiency of hardware error location is improved.

[0073] In some embodiments, obtaining the second register information of the microcontroller includes: obtaining a fault message when the microcontroller fails; sending a query instruction to the microcontroller; obtaining the second register information sent by the microcontroller, the second register information is read from the flash memory by the microcontroller in response to the query instruction. Specifically, the present application learns that the microcontroller has failed by obtaining a fault message, and then sends a query instruction to the microcontroller to request the microcontroller to return the second register information to provide the necessary data for subsequent analysis steps. It should be noted that the sending of the query instruction and the second register information can be achieved by communicating with the microcontroller, such as through a serial interface or other communication protocols. In this way, the present application obtains detailed second register information by sending a query instruction, speeds up fault analysis and repair, and reduces the time and cost of troubleshooting.

[0074] Step 102, obtaining the error value of the link register from the first register information. Specifically, the first register information is the register information when a hardware error occurs in the microcontroller, that is, the first register information stores the cause of the hardware error of the microcontroller. The link register is usually used to store the return address of a function call or other important program control information, and the error value of the link register can provide clues about the cause of the hardware error. For example, the error value may indicate an invalid function call or jump address, or may indicate problems such as a stack overflow or a memory access error. The embodiment of the present application quickly locates hardware error problems related to function calls or program control by determining the error value of the link register, thereby accelerating the process of locating and repairing hardware errors.

[0075] Step 103, based on the error value, determine the target pointer and the target value corresponding to the target pointer from the first register information. Specifically, the value in the link register stores the return address, which is used to indicate from which target pointer to return to the current function. The target pointer and the target value can provide specific context information about the occurrence of the hardware error. By determining the target pointer, the location where the hardware error occurs can be more accurately located, which is helpful for further hardware error analysis and repair. By determining the target value corresponding to the target pointer, specific data or information related to the hardware error can be obtained, which is helpful for further analysis of the cause and impact of the hardware error. By selecting the target pointer from the main stack pointer and the process stack pointer, the scope of locating the hardware error is narrowed and the accuracy of positioning is improved. On this basis, by determining the target address through the first address, the hardware error can be located more quickly, unnecessary debugging and troubleshooting steps can be reduced, and the efficiency of positioning can be improved.

[0076] In some embodiments, the target pointer is a main stack pointer or a process stack pointer; determining the target pointer from the first register information based on the error value includes: selecting the main stack pointer as the target pointer in response to the error value being a first preset value; selecting the process stack pointer as the target pointer in response to the error value being a second preset value. Specifically, by checking the error value of the link register, it can be determined whether to restore the register value from the stack of the main station pointer or the link register value from the stack of the process stack pointer. The main stack pointer and the process stack pointer are registers for storing important information during program execution in the microcontroller. The main stack pointer is usually used to save context information during program execution, and the process stack pointer is usually used to save context information during interrupt processing or task switching. When the error value matches the first preset value, the main stack pointer is selected as the target pointer, and when the error value matches the second preset value, the process stack pointer is selected as the target pointer, thereby locating the hardware error in the stack directly related to the error, so as to more accurately locate the source of the error and improve the accuracy of hardware error positioning.

[0077] In some embodiments, the first preset value is configured as xxxxxxxxF9, and the second preset value is configured as xxxxxxxxFD or xxxxxxxxED. That is, if the error value of the link register is xxxxxxxxF9, the main stack pointer is selected as the target pointer, that is, the register value is restored from the stack of the main stack pointer. Similarly, if the register value of the link register is xxxxxxxxFD or xxxxxxxxED, the process stack pointer is selected as the target pointer, that is, the register value is restored from the stack of the process stack pointer. For example, the first preset value can be configured as 0xFFFFFFF9, and the second preset value can be configured as 0xFFFFFFFD or 0xFFFFFFED.

[0078] Step 104, in the sub-information corresponding to the target pointer, the target address is determined based on the target value, and the target address is used to represent the correct value of the link register. Specifically, by determining the target address, the present application can accurately find the correct value of the link register, which can also be said to be the recovery value of the link register. By determining the correct value of the link register, the value of the link register corresponding to the function that caused the hardware error can be quickly located, thereby preparing for the subsequent location analysis and repair of the hardware error, and improving the accuracy and efficiency of hardware error location.

[0079] Please refer to the figure. The following describes step 104 when the target pointer is the main stack pointer and the process station pointer. When the target pointer is the main stack pointer, first check the register data information with the target value of the main stack pointer as the address. For example, the register data information is 53byte data information. Figure 4 , Figure 4 The following is a schematic diagram of the sub-information of the main stack pointer in the method for locating hardware errors provided by the embodiment of the present application. The address of the link register found in the register data information is the target address. The general format of the target address is 0x080xxxxx. Similarly, when the target pointer is a process station pointer, first check the register data information with the target value of the process stack pointer as the address. For example, the register data information is 53byte data information. Figure 5 , Figure 5 A schematic diagram of the sub-information of the process stack pointer in the method for locating a hardware error provided in an embodiment of the present application is illustrated. The address of the link register found in the register data information is the target address, and the general format of the target address is 0x080xxxxx.

[0080] Step 105, obtain a pre-stored mapping symbol table, the mapping symbol table is used to represent the mapping relationship between addresses and functions. The mapping symbol table (Image Symbol Table) is information pre-stored in the code mapping table (.map file), which is used to represent the mapping relationship between addresses and functions. When the current microcontroller is initially configured or scheduled, the mapping symbol table and the code mapping table are already stored in the client.

[0081] Step 106, the function corresponding to the target address in the mapping symbol table is determined as a fault function, and the fault function is used to locate the hardware error of the microcontroller. Specifically, after a function in the mapping symbol table causes a hardware error of the microcontroller, it is necessary to first find the target address that causes the hardware error from the first register information, and then locate all functions that may cause the hardware error from the mapping symbol table through the target address, which is the fault function. It can be understood that the target address is the key information for locating the hardware error, and directly indicates the nearby address where the hardware error occurs.

[0082] In some embodiments, after determining the function corresponding to the target address in the mapping symbol table as a fault function, the positioning method further includes: analyzing the source code of the fault function to determine the illegal pointer; repairing the source code based on the illegal pointer; running the repaired source code, and confirming that the source code repair is successful in response to the source code not running the fault function. Since the target address is a peripheral address corresponding to the address of the function that actually causes the hardware error, there are still functions in the fault function that do not cause the hardware error. By analyzing the source code of the fault function, the interference items can be finally eliminated to determine the fault function that actually causes the hardware error and the illegal pointer in the fault function. Then the source code is repaired based on the illegal pointer, and the repaired source code is re-run. If the source code does not run the fault function, it is confirmed that the source code repair is successful, thereby repairing the hardware error problem of the microcontroller.

[0083] The following is a specific example of the method for locating a hardware error in the present application. Figures 6 to 11 , Figure 6 A schematic diagram illustrating an overflow failure of the method for locating a hardware error provided in an embodiment of the present application; Figure 7 A schematic diagram illustrating first register information of a method for locating a hardware error provided in an embodiment of the present application; Figure 8 A schematic diagram illustrating sub-information of a method for locating a hardware error provided in an embodiment of the present application; Fig. 9 A schematic diagram illustrating a code mapping table of a method for locating a hardware error provided in an embodiment of the present application; Fig.10 A schematic diagram illustrating a mapping symbol table of a method for locating a hardware error provided in an embodiment of the present application; Fig.11A schematic diagram of source code of a fault function of the method for locating a hardware error provided in an embodiment of the present application is illustrated.

[0084] First, create an overflow fault to make the microcontroller program run abnormally and enter the HardFault function. Get the error value of the link register, which is 0xFFFFFFED, indicating that the register value is restored from the stack of the main stack pointer. The target value of the main stack pointer is 0x20007620. Check the 53-byte data information with 0x20007620 as the address, that is, the sub-information, and find the correct value of the link register, which is the target address, which is 0x08016AA3. Open the code mapping table, find the mapping symbol table, and find the function address whose address range includes 0x08016AA3 in the mapping symbol table. Through the code mapping table, it can be determined that the address 0x08016AA3 is inside the Test_MainFunction function (test function), and the Test_MainFunction function is the fault function. Find the Test_MainFunction function, and by analyzing the source code of the Test_MainFunction function, determine that "u8*pData;" (local variable) is an illegal pointer, and cause the source code to enter HardFault. Fix the source code based on the illegal pointer mentioned above.

[0085] In summary, a method for locating a hardware error provided by an embodiment of the present application is applied to a client, and the locating method includes: in response to a hardware error in a microcontroller, obtaining first register information, the first register information is used to characterize the register information when a hardware error occurs in the microcontroller; obtaining the error value of the link register from the first register information; determining the target pointer and the target value corresponding to the target pointer from the first register information based on the error value; in the sub-information corresponding to the target pointer, determining the target address based on the target value, the target address is used to characterize the correct value of the link register; obtaining a pre-stored mapping symbol table, the mapping symbol table is used to represent the mapping relationship between the address and the function; determining the function corresponding to the target address in the mapping symbol table as a fault function, and the fault function is used to locate the hardware error of the microcontroller. In this way, by obtaining the first register information when a hardware fault occurs and remotely analyzing the first register information, the remote positioning of the microprocessor hardware error is realized, and the accuracy and efficiency of fault positioning are improved. Specifically, the present application integrates a specific fault capture module on the microcontroller end and develops a corresponding analysis computer program on the client (remote end) to realize remote automatic tracking and positioning of the microcontroller, remotely locate the hardware error of the microcontroller, avoid on-site debugging, and improve the efficiency of troubleshooting the microcontroller. At the same time, through detailed analysis of the causes of hardware errors, it helps users quickly find and solve the problems that cause hardware errors and reduce maintenance costs.

[0086] Accordingly, the embodiment of the present application provides a hardware error positioning device, which is configured on the client. Fig.12 , Fig.12 The structure diagram of the hardware error positioning device provided by the embodiment of the present application is illustrated. The positioning device includes: a first acquisition unit, a second acquisition unit, a first determination unit, a second determination unit, a third acquisition unit and a third determination unit. Among them, the first acquisition unit is configured to acquire first register information in response to a hardware error of the microcontroller, and the first register information is used to characterize the register information when the microcontroller has a hardware error; the second acquisition unit is configured to acquire the error value of the link register from the first register information; the first determination unit is configured to determine the target pointer and the target value corresponding to the target pointer from the first register information based on the error value; the second determination unit is configured to determine the target address based on the target value in the sub-information corresponding to the target pointer, and the target address is used to characterize the correct value of the link register; the third acquisition unit is configured to acquire a pre-stored mapping symbol table, and the mapping symbol table is used to represent the mapping relationship between the address and the function; the third determination unit is configured to determine the function corresponding to the target address in the mapping symbol table as a fault function, and the fault function is used to locate the hardware error of the microcontroller.

[0087] It can be understood that, compared with the prior art, the hardware error locating device provided in the embodiment of the present application includes all the technical features and technical effects of the above-mentioned hardware error locating method, which will not be repeated here.

[0088] Accordingly, the present application embodiment provides a hardware error positioning system, see Fig.13 , Fig.13 The structural diagram of the hardware error positioning system provided in the embodiment of the present application is illustrated. The positioning system includes: a fault capture module, a client, a cloud server and a communication module. The fault capture module is configured on a microcontroller, and the fault capture module is configured to store first register information in response to a hardware error in the microcontroller, and the first register information is used to characterize the register information when a hardware error occurs in the microcontroller. The client includes a memory, a processor and a computer program stored on the memory and can be run on the processor; wherein, when the processor executes the computer program, it can be used to execute the steps of the hardware error positioning method as in any one of the above embodiments. The cloud server is connected to the fault capture module and the client in communication, and is used to back up relevant data or assist the client in relevant analysis. The communication module is configured to realize the communication connection between the fault capture module and the client, between the fault capture module and the cloud server, and between the client and the cloud server. The communication module supports multiple communication protocols, such as Ethernet, Wi-Fi, etc., to adapt to different application scenarios and network environments.

[0089] Specifically, this application integrates a specific fault capture module on the microcontroller side and develops a corresponding analysis computer program on the client (remote side), so that the microcontroller can be remotely automatically tracked and located only through the network, and the hardware error of the microcontroller can be remotely located to avoid on-site debugging, thereby improving the troubleshooting efficiency of the microcontroller. At the same time, through detailed hardware error cause analysis, it helps users quickly find and solve the problem that causes the hardware error and reduce maintenance costs.

[0090] See also Fig.14 , Fig.14 The flowchart of the fault capture module in the hardware error positioning system provided by the embodiment of the present application is illustrated. In some embodiments, a flash memory is set in the fault capture module, and the fault capture module is also configured to perform the following steps: in response to a fault in the microcontroller, run the fault function; obtain the sub-information and target value corresponding to the main stack pointer, and the sub-information and target value corresponding to the process stack pointer; use the sub-information and target value as the starting address, and store the second register information of a preset length in the flash memory. In this way, there is no need to observe the register information in the microcontroller in real time, and the fault capture module automatically captures and records it, and the most recent first register information can be obtained at any time.

[0091] It can be understood that, compared with the prior art, the hardware error positioning system provided by the embodiment of the present application includes all the technical features and technical effects of the above-mentioned hardware error positioning method, which will not be repeated here.

[0092] The above is a detailed introduction to a hardware error positioning method, device and system provided in the embodiments of the present application. Specific examples are used in the present application to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the technical solution and its core idea of ​​the present application. Ordinary technicians in this field should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or replace some of the technical features therein with equivalents; and these modifications or replacements do not make the essence of the corresponding technical solution deviate from the scope of the technical solution of the embodiments of the present application.

Claims

1. A method for locating a hardware error, characterized in that: Applied to the client, the positioning method includes: In response to a hardware error occurring in the microcontroller, first register information is acquired, where the first register information is used to represent register information when the hardware error occurs in the microcontroller; Obtaining an error value of a link register from the first register information; Determine a target pointer and a target value corresponding to the target pointer from the first register information based on the error value; In the sub-information corresponding to the target pointer, a target address is determined based on the target value, the target address being used to represent a correct value of the link register; Acquire a pre-stored mapping symbol table, where the mapping symbol table is used to represent a mapping relationship between addresses and functions; The function corresponding to the target address in the mapping symbol table is determined as a fault function, and the fault function is used to locate the hardware error of the microcontroller.

2. The method for locating a hardware error according to claim 1, characterized in that: The target pointer is a main stack pointer or a process stack pointer; The determining a target pointer from the first register information based on the error value comprises: In response to the error value being a first preset value, selecting the main stack pointer as the target pointer; In response to the error value being a second preset value, the process stack pointer is selected as the target pointer.

3. The method for locating a hardware error according to claim 1, characterized in that: The step of obtaining first register information in response to a hardware error occurring in the microcontroller comprises: Acquire second register information of the microcontroller, where the second register information is used to represent register information when a fault occurs in the microcontroller; In response to the second register information satisfying a hardware error occurrence condition, the second register information is determined as the first register information.

4. The method for locating a hardware error according to claim 3, characterized in that: Determining that the second register information satisfies a hardware error occurrence condition includes: Based on the second register information, determining the fault access bit state of the error confirmation register; In response to the fault access bit state being a valid state, traversing the second register information; In response to the second register information including an interrupt return value, it is determined that the second register information satisfies the hardware error occurrence condition.

5. The method for locating a hardware error according to claim 3, characterized in that: Acquiring second register information of the microcontroller includes: Obtaining a fault message when the microcontroller fails; Sending a query instruction to the microcontroller; The second register information sent by the microcontroller is acquired, where the second register information is read from the flash memory by the microcontroller in response to the query instruction.

6. The method for locating a hardware error according to claim 2, characterized in that: The first preset value is configured as xxxxxxxxF9, and the second preset value is configured as xxxxxxxxFD or xxxxxxxxED.

7. The method for locating a hardware error according to claim 1, characterized in that: After determining the function corresponding to the target address in the mapping symbol table as a fault function, the positioning method further includes: Analyze the source code of the fault function to determine the illegal pointer; Based on the illegal pointer, repair the source code; The repaired source code is run, and in response to the source code not running the fault function, it is confirmed that the source code is repaired successfully.

8. A device for locating hardware errors, characterized in that: Configured on the client, the positioning device includes: A first acquisition unit is configured to acquire first register information in response to a hardware error occurring in the microcontroller, wherein the first register information is used to represent register information when the hardware error occurs in the microcontroller; A second obtaining unit is configured to obtain an error value of a link register from the first register information; A first determining unit is configured to determine a target pointer and a target value corresponding to the target pointer from the first register information based on the error value; a second determining unit configured to determine a target address based on the target value in the sub-information corresponding to the target pointer, the target address being used to represent a correct value of the link register; A third acquisition unit is configured to acquire a pre-stored mapping symbol table, where the mapping symbol table is used to represent a mapping relationship between an address and a function; The third determining unit is configured to determine the function corresponding to the target address in the mapping symbol table as a fault function, where the fault function is used to locate a hardware error of the microcontroller.

9. A hardware error location system, characterized in that: The positioning system comprises: A fault capture module, the fault capture module is configured in the microcontroller, and the fault capture module is configured to store first register information in response to a hardware error occurring in the microcontroller, wherein the first register information is used to represent register information when a hardware error occurs in the microcontroller; A client, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor; wherein the processor can be used to execute the steps of the method for locating a hardware error according to any one of claims 1 to 7 when executing the computer program; A cloud server, communicating with the fault capture module and the client; The communication module is configured to realize the communication connection between the fault capture module and the client, between the fault capture module and the cloud server, and between the client and the cloud server.

10. The hardware error location system according to claim 9, characterized in that: A flash memory is provided in the fault capture module, and the fault capture module is further configured to perform the following steps: In response to a fault occurring in the microcontroller, executing a fault function; Get the sub-information and target value corresponding to the main stack pointer, as well as the sub-information and target value corresponding to the process stack pointer; The sub-information and the target value are used as a starting address, and second register information of a preset length is stored in the flash memory.