A method for determining a restart cause and electronic device

By using the register data clearing characteristics and flag bit judgment after the router is powered off, the reason for the router is accurately determined, which solves the problem of determining the cause of restart in the existing technology, and improves the stability and user experience of the router.

CN117729092BActive Publication Date: 2025-01-03HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310974184.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-02
Publication Date
2025-01-03
Estimated Expiration
2043-08-02

AI Technical Summary

Technical Problem

It is difficult for the prior art to accurately determine the reason for the router to restart, especially if the DDR data is not cleared in time after the power is out, resulting in an error in determining the cause of the restart, affecting the stability and user experience of the router.

Method used

By using the characteristic that the register data is immediately cleared after the power is powered off, the target data in the target register is obtained, the restart reason is judged, including the flag bits of the config register and the watchdog register, the restart type is determined, and the initial restart reason is obtained in the SSBL phase The value is updated to ensure the accuracy of the restart cause.

Benefits of technology

It improves the accuracy of determining the cause of router restart, enhances the stability and user experience of routers, and reduces the problem of inaccurate stability analysis caused by errors in restart cause determination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117729092B_ABST
    Figure CN117729092B_ABST
Patent Text Reader

Abstract

The present application provides a method for determining a restart reason and an electronic device, and relates to the technical field of network devices. When an electronic device is restarted, the electronic device obtains target data corresponding to a target register, wherein the data in the target register is cleared when the electronic device is powered off, and the target data corresponding to the target register is used to verify whether the restart is a power-off restart. Afterwards, when the target data is zero, the electronic device determines that the restart reason information is a power-off restart information. In the present application, the accuracy of determining the restart reason can be improved, thereby providing a basis for improving the stability of subsequent routers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of network equipment, and in particular to a method for determining a restart cause and an electronic device. Background Art

[0002] With the continuous development of computer technology, the Internet has become an indispensable part of people's daily life, and routers, as gateways, have also been integrated into people's daily life. Routers can connect multiple electronic devices (such as mobile phones) to the Internet, that is, electronic devices can connect to the WIFI corresponding to the router to achieve Internet access.

[0003] However, the router may restart during operation. In order to analyze and improve the stability of the router, it is necessary to determine the reason for the router restart. Therefore, a method for determining the reason for the router restart is urgently needed. Summary of the invention

[0004] The embodiments of the present application provide a method for determining a restart cause and an electronic device, which are used to improve the accuracy of determining the restart cause of a router, thereby improving the stability of the operation of the router.

[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a method for determining a restart reason is provided, in which, when an electronic device is restarted, the electronic device obtains target data corresponding to a target register, wherein the data in the target register is cleared when the electronic device is powered off, and the target data corresponding to the target register is used to verify whether the current restart is a power-off restart. Afterwards, the electronic device determines whether the target data is a target value, and if the target data is a target value, the electronic device determines the restart reason information of the electronic device as power-off restart information, wherein the target value is zero.

[0007] In the present application, the characteristic of the system on chip of the electronic device that the register data is immediately cleared after power failure is utilized. After the electronic device is restarted, the restart reason of the electronic device is determined according to the data stored in the target register. In this way, the occurrence of errors in determining the restart reason due to failure to clear the target data in time can be reduced, the accuracy of determining the restart reason can be improved, and a basis for improving the stability of subsequent routers is provided, thereby improving the user experience of the router.

[0008] In a possible implementation of the first aspect, before the electronic device obtains the target data corresponding to the target register, the method further includes: after entering the SSBL phase in the process of starting the electronic device, the electronic device obtains an initial restart reason value (or referred to as initial restart reason information), wherein the initial restart reason value is used to indicate the reason for the electronic device to restart this time, and the initial restart reason value is stored in the target memory area of ​​DDR. Afterwards, if the initial restart reason information is different from the restart reason information, the electronic device can update the initial restart reason information to the restart reason information.

[0009] In this application, since the initial restart reason value is stored in the target memory area of ​​DDR, the complete operation of the restart reason correction function can be guaranteed, so that the electronic device can quickly and accurately read the restart reason value, which provides a basis for the subsequent determination of the restart reason. In addition, if the initial restart reason information is different from the restart reason information, it indicates that the restart reason is determined incorrectly. Therefore, the electronic device can update the initial restart reason information to improve the accuracy of the restart reason determination.

[0010] In a possible implementation manner of the first aspect, the target register is a config register, and the target data corresponding to the config register includes a first flag bit. The above method also includes: when the first flag bit is 1, the electronic device determines that the restart reason information is soft restart information.

[0011] In the present application, since the target data corresponding to the config register includes a first flag bit, and the value corresponding to the first flag bit remains unchanged during the operation of the electronic device, the electronic device can determine the reason for the restart of the electronic device based on the first flag bit. If the first flag bit is 1, it indicates that the value corresponding to the first flag bit has not changed. Therefore, the electronic device can determine that the reason for the restart is a soft restart. In this way, the accuracy of determining the reason for the restart can be improved.

[0012] In a possible implementation manner of the first aspect, the target register is a watchdog register, and the target data corresponding to the watchdog register includes a second flag bit. The method further includes: when the second flag bit is 1, the electronic device determines that the restart reason information is soft restart information.

[0013] In the present application, since the target data corresponding to the watchdog register includes the second flag bit, and the data stored in the watchdog register can detect the operating status of the electronic device in real time, the electronic device can determine the reason for the restart of the electronic device based on the second flag bit. If the second flag bit is 1, that is, the second flag bit is reset, it means that a watchdog restart has occurred in the electronic device, that is, a soft restart. In this way, the accuracy of determining the reason for the restart can be improved.

[0014] In a possible implementation of the first aspect, after the electronic device reads the target data corresponding to the target register, the method further includes: the electronic device starts the watchdog counter corresponding to the watchdog register and initializes the watchdog counter value. Afterwards, during the operation of the electronic device, the electronic device decrements the watchdog counter value according to a preset time. Afterwards, when the watchdog counter value is zero, the electronic device restarts.

[0015] In this application, if the watchdog counter value is zero, it indicates that the electronic device has been in an abnormal state for a long time. Therefore, the electronic device can be restored to a normal operating state by restarting, that is, to ensure the normal operation of the electronic device and improve the user experience.

[0016] In a possible implementation of the first aspect, the method further includes: the electronic device uploading the restart reason information to the cloud platform. Afterwards, the cloud platform can analyze the restart reason of the electronic device according to the restart reason information to obtain an analysis result, wherein the analysis result is used to characterize the stability of the operation of the electronic device.

[0017] In the present application, by analyzing the restart reason of the electronic device, the stability of the operation of the electronic device can be determined, so as to subsequently improve the stability of the router according to the analysis result, thereby improving the user experience.

[0018] In a second aspect, the present application provides an electronic device, comprising a register, a memory and one or more processors; the register, the memory and the processor are coupled; the register is used to temporarily store instructions, data and addresses, the memory is used to store computer program code, and the computer program code comprises computer instructions; when the processor executes the computer instructions, the electronic device executes the method as described above.

[0019] In a third aspect, the present application provides a computer-readable storage medium, comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute the method described above.

[0020] In a fourth aspect, the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the method described above.

[0021] In a fifth aspect, a chip is provided, comprising: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method as described above.

[0022] Among them, the beneficial effects that can be achieved by the electronic device described in the second aspect, the computer-readable storage medium described in the third aspect, the computer program product described in the fourth aspect, and the chip described in the fifth aspect provided above can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A schematic diagram of a router startup process provided in an embodiment of the present application;

[0024] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0025] Figure 3 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0026] Figure 4 A flowchart of a method for determining a restart reason provided in an embodiment of the present application;

[0027] Figure 5 A schematic diagram of a MIPS architecture provided in an embodiment of the present application;

[0028] Figure 6 A schematic diagram of an ARM architecture provided in an embodiment of the present application;

[0029] Figure 7 A flowchart of a method for determining a restart cause provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] The technical scheme in the embodiment of the present application will be described below in conjunction with the accompanying drawings in the embodiment of the present application. Wherein, in the description of the present application, unless otherwise specified, the "and / or" in the present application is only a kind of association relationship describing the associated object, indicating that there can be three kinds of relationships, for example, A and / or B, which can be represented by: A exists alone, A and B exist at the same time, and B exists alone, wherein A, B can be singular or plural. And, in the description of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following (individuals)" or its similar expressions refers to any combination of these items, including any combination of single items (individuals) or plural items (individuals). For example, at least one of a, b, or c (individuals) can be represented by: a, b, c, ab, ac, bc, or abc, wherein a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical scheme of the embodiment of the present application, in the embodiment of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art will appreciate that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference. At the same time, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way for easy understanding.

[0031] As a home gateway, users need to connect to the Internet through a router for remote office, home entertainment, social networking, online shopping, etc. Long-term stable operation of the router is the basis for ensuring the Internet experience. Therefore, the stability of the router needs to be guaranteed, and the restart of the router may affect the stability of the router. Therefore, it is necessary to accurately identify the type of router restart (or the reason for the restart) so as to analyze the stability problem of the router by using the restart type of the router, and then better improve the router and improve the performance of the router.

[0032] Unlike devices that support power management, such as mobile phones, tablets, and PCs, the hardware design of the router is to directly connect to the 220V household power through a power adapter. When the power is disconnected, it stops working immediately and cannot save the restart event and device status information, where the device status information is used to indicate whether the router is in working state. Therefore, the restart type of the router cannot be directly determined. In some embodiments, since the double data rate synchronous dynamic random access memory (DDR) cannot store data after the router is disconnected from the power supply, the DDR can save data by restarting the router through a soft restart, where a soft restart means restarting the router when the router is connected to the power supply. For example, the router can be restarted by remote control, and after the restart, the DDR has data. Optionally, when performing a soft restart, the router will save the restart event, that is, the reason for the restart is recorded.

[0033] Therefore, the router can use whether the data in the DDR is empty to determine the reason for the router restart. When the router restarts, the router can read the data stored in the DDR location.

[0034] If the data is empty, that is, no data is read from the DDR, it means that this restart is a power-off restart. If the data is not empty, for example, user data, logs (such as operation logs, DDR logs), etc. are read from the DDR, it means that this restart is not a power-off restart, but may be a soft restart. The DDR records the restart reason, so that the restart reason can be determined.

[0035] Afterwards, after determining that the reason for this restart is a power-off restart, the router can write the restart reason into the DDR. It should be understood that if the router is restarted for other reasons (such as a soft restart), the DDR already has the restart reason and does not need to be rewritten.

[0036] Afterwards, the router can report the restart reason in the DDR to the cloud platform (or big data platform) so that the router can be analyzed and improved according to the restart reason and the stability of the router can be improved.

[0037] However, the above method for detecting the power failure and restart of the router is only applicable to most scenarios with long power failures, and for short or instantaneous power failures, the restart cause may be incorrectly determined. Due to factors such as the DDR chip process and hardware circuit design, after the router is powered off, the DDR in the router may not be powered off immediately, but may be delayed, resulting in the data in the DDR not being cleared immediately, that is, there is still data in the DDR. When the router restarts, the router detects that there is still data in the DDR, and then determines that the reason for this restart is not a power failure and restart, which leads to an error in determining the restart cause, resulting in an error in recording the restart cause of the router, which in turn affects the accuracy of subsequent stability analysis.

[0038] Considering that after the system on chip (SOC) is powered off, the data stored in the register of the system on chip will be immediately cleared. Therefore, in order to solve the problem that the above-mentioned DDR cannot immediately delete the stored data, the present application provides a method for determining the cause of restart. In this method, the router obtains the target data stored in the target register, wherein the target register includes a configuration register and / or a watchdog register, the target data in the configuration register is a register feature bit, and the target data in the watchdog register includes a register flag bit. Afterwards, the router determines whether the target data is a target value. If the target data is a target value, the restart cause information of the router is determined as power-off restart information, wherein the target value is zero.

[0039] In the embodiment of the present application, the characteristic of the router's system on chip that the register data is immediately cleared after power failure is utilized. After the router is restarted, it is determined whether the router is restarted after power failure based on the target data stored in the target register. In this way, the accuracy of determining the cause of the restart can be improved, thereby providing a basis for improving the stability of subsequent routers and improving the user experience of the router.

[0040] It should be noted that the above-mentioned SOC chip includes a central processing unit (CPU), a memory, and peripheral circuits. Among them, the central processing unit is the computing and control core of the computer system and is the final execution unit for information processing and program running. The central processing unit includes an arithmetic unit, a controller, and a register. The arithmetic unit is used to perform relevant logical operations. The controller is used to analyze the received instructions and send corresponding control signals according to the analysis results. The register is used to temporarily store instructions, data, and addresses. Exemplarily, the register may include the above-mentioned config register and / or watchdog register.

[0041] In a possible implementation, the router boot process includes five stages: memory code (ROM code) loading stage, first stage bootloader (FSBL), second stage bootloader (SSBL), kernel startup (kernel) and user service operation (user). For example, Figure 1 As shown, the rom code stage is executed in a read-only memory (ROM), wherein the ROM works in a non-destructive read mode, data can be read but not written, and once the data is written into the memory, the data will not be lost even if the power is cut off. The FSBL stage is executed in a static random access memory (SRAM), wherein whether there is data in the SRAM can be used to determine whether the router is powered off and restarted. If the router is not powered off, the data in the SRAM will not be cleared; if the router is powered off, the data stored in the SRAM may be cleared, that is, the data stored in the SRAM is empty. The SSBL stage, the kernel stage, and the user stage are executed in DDR.

[0042] The above-mentioned rom code stage may include executing the instructions (or programs) in the rom code when the SOC is reset. The SOC reset refers to resetting the system integrated on a chip (or system on chip). The reset operation can restore the modules included in the SOC to the initial state to solve problems such as abnormal operation or freezing of the system on chip. Afterwards, the SOC can initialize the basic clock, check the CPU information (identification, ID), load and verify the FSBL code, and jump to the FSBL stage for execution. The basic clock is the reference clock signal in the computer system, which is used to synchronize the operation and data transmission of each hardware module in the system. The basic clock determines the operating speed of the system and plays an important role in the stability and performance of the system.

[0043] Among them, the CPU ID includes CPU model, CPU type, etc. The CPU type may include reduced instruction set computing (RISC) type and complex instruction set computer (CISC) type. The architecture of the RISC microinstruction set type CPU may be ARM architecture, MIPS architecture or Power architecture. The ARM architecture CPU is applied to mobile devices (such as mobile phones, tablet computers, etc.) and embedded devices (such as routers, rice cookers, TVs, etc.). The MIPS architecture CPU is applied to embedded devices. The Power architecture CPU is applied to high-performance computing, servers and embedded systems, such as game consoles, etc. The architecture of the CISC microinstruction set type CPU may be an x86 architecture CPU. The x86 architecture CPU is applied to personal computers and servers.

[0044] It should be noted that the instructions in the rom code are a program fixed inside the SOC, generally stored in a small non-volatile memory (nor flash). The rom code supports the local execution (executed in place, XIP) feature, which means that the rom code can be executed directly in the non-volatile memory without copying the rom code to the memory to run, reducing the copying time and improving the execution efficiency.

[0045] The FSBL stage may include the SOC initializing the SOC clock tree, which may be the advanced high-performance bus (AHB) on the advanced RISC machine (ARM) architecture, the advanced peripheral bus (APB) clock on the ARM architecture, etc. After that, the SOC may initialize the external DDR controller. After that, the SOC may load the SSBL code from the flash memory chip (FLASH) to the DDR and jump to the SSBL stage for execution.

[0046] The above-mentioned SSBL stage may include SOC initializing some SOC peripherals, such as data volatile memory, data non-volatile memory, etc. Afterwards, SOC can load the root file system from FLASH and decompress the kernel to the target location of DDR, wherein the target location is the first memory area included in the kernel management area in the following Table 1. Afterwards, SOC can jump to the kernel entry function to start the kernel. Among them, the kernel is the core of the operating system, which is used to control all contents in the system. In this embodiment, the kernel can be a Linux kernel. In other embodiments, the kernel can also be a real-time operating system (RTOS) kernel, etc.

[0047] The above kernel stage may include SOC initializing kernel resources, wherein the kernel resources may include scheduler, memory subsystem, file system, network subsystem, resources used by inter-process communication (IPC) (such as pipes, shared memory, message queues, etc.) and protocol stacks, etc. Afterwards, SOC may start the initialization (init) process. It can be understood that the kernel stage is mainly responsible for router resource management and allocation, as well as starting subsystems such as scheduler, memory management, file system, IPC, protocol stack, etc., which provides a basis for the subsequent operation of various services of the router.

[0048] The user stage may include the SOC starting the target service process, wherein the target task process may include the dhcps process, the dns process and the dhcpc process, etc. The target service may be a service that provides Internet access. In this way, the router can use the network service normally, ensuring the normal operation of each service function of the router.

[0049] Exemplarily, the electronic device in the embodiment of the present application may be a router, which may be a home router, and can usually be connected to devices such as mobile phones and tablet computers. The electronic device in other embodiments may also be other embedded devices, such as refrigerators, televisions, rice cookers, etc., which cannot work after power failure. It can be simply understood that the embedded device may be a device without a battery. The following embodiments do not impose any special restrictions on the specific form of the electronic device.

[0050] Take the above-mentioned electronic device as an example, which is a router. Figure 2 A schematic structural diagram of an electronic device 100 is shown.

[0051] The electronic device 100 may include a processor 110, an antenna, a wireless communication module 160, at least one communication interface 150, an external memory 121, a universal serial bus (USB) interface 130, a button 190, an indicator 192, and the like.

[0052] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0053] The processor 110 may include a device with processing capability such as a CPU or a single chip microcomputer.

[0054] The processor may be the nerve center and command center of the electronic device 100. The processor may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0055] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0056] Wherein, optionally, the CPU is located on a SOC chip. The SOC chip may also include a memory and peripheral circuits. The CPU includes an arithmetic unit, a controller and a register. The arithmetic unit is used to perform relevant logical operations. The controller is used to analyze the received instructions and send corresponding control signals according to the analysis results. The register is used to temporarily store instructions, data and addresses.

[0057] The wireless communication function of the electronic device 100 can be implemented through an antenna, a wireless communication module 160, a modem processor, a baseband processor, and the like.

[0058] The antenna is used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. For example, the antenna can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0059] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the wireless communication module 160 or other functional modules.

[0060] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as WIFI (wireless fidelity) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via an antenna, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna. In some embodiments, at least some functional modules of the wireless communication module 160 can be set in the processor 110.

[0061] In some embodiments, the antenna of the electronic device 100 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS) and / or satellite based augmentation system (SBAS).

[0062] The communication interface 150 uses any device such as a transceiver for communicating with other devices.

[0063] The USB interface 130 is an interface that complies with USB standard specifications, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device.

[0064] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0065] The external memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the external memory 121. The external memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data (such as audio data, etc.) created during the use of the electronic device 100. In addition, the external memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0066] In some embodiments, the external memory 121 may include ROM memory, SRAM memory, DDR memory, etc.

[0067] The key 190 includes a power key, a function key, etc. The key 190 can be a mechanical key or a touch key. The electronic device 100 can receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0068] Take the above-mentioned electronic device as an example, which is a router. Figure 3 A schematic diagram of an application scenario is shown. Figure 3 As shown, a router can be used as a link between a terminal device and the Internet to forward data (such as data streams) between the terminal device and the Internet. For example, a router can be connected to a terminal device via a wired connection or a wireless connection. After the router and the terminal device are connected, the terminal device can access the router's WIFI signal to achieve Internet access (such as playing online videos, playing online games, etc.). It should be noted that Figure 3 The routers and terminal devices in the illustrated scenario, as well as the number of the terminal devices, are merely examples and are not limited in this application.

[0069] Exemplarily, the above-mentioned terminal device can be a mobile phone, a smart watch, a smart bracelet, a tablet computer, a desktop computer, a laptop computer, a smart refrigerator, a smart TV, a printer, etc. The embodiments of the present application do not impose any restrictions on the specific type of electronic device.

[0070] The present application embodiment provides a method for determining a restart reason, which can be applied to an electronic device. For example, the electronic device is a router. Figure 4 As shown, the method for determining the restart reason may include S401-S406.

[0071] S401, after being powered on or receiving a restart command, the router restarts.

[0072] In one case, the router will stop working immediately after it is not powered by an external power source. For example, if the power source to which the router is connected cannot provide power, or if the router is not connected to a power source, the router will stop working. After that, when the router is connected to an external power source, the router can continue to use the power of the power source to complete the boot and restart work.

[0073] In another case, the router will restart after receiving the restart command. For example, when the router is turned on, the user can press the power button on the router to turn off the router, and the router responds to the shutdown command, stops working, and shuts down. After that, after the router is turned off, the user can continue to press the power button on the router to turn on the router, and the router responds to the power command (or restart command) and restarts. Alternatively, the user can send a restart command to the router through other devices (such as mobile phones, computers), and after receiving the restart command, the router responds to the restart command and restarts.

[0074] S402: During the restart, the router obtains a restart reason value, wherein the restart reason value is used to indicate the reason why the router restarts this time.

[0075] In some embodiments, during the process of restarting the router, in the above-mentioned SSBL stage, the router can obtain the above-mentioned restart reason value (or referred to as the initial restart reason information). It can be understood that if the router is not shut down and restarted due to power failure, the router will record the corresponding restart reason before shutting down. Exemplarily, the restart reason can be a hardware problem, such as a problem with the power supply or processor, or a software problem, such as a software update, or an excessive network load, such as a router crashing due to processing too much network traffic. It should be noted that the router can only determine the power failure restart reason based on the target data in the target register, and cannot determine it before the router restarts.

[0076] It should be noted that, since the business logic of the above-mentioned SSBL stage can be changed, the target data corresponding to the target register is read in the SSBL stage, and the target data can be used for subsequent determination of the cause of the router restart, instead of determining the cause of the router restart by the original method of determining whether the data in a specific DDR position is empty, thereby improving the accuracy of determining the cause of the restart.

[0077] In some embodiments, the router may store the restart reason value in a target memory area of ​​the memory, wherein the target memory area is used to store the restart reason value, and the restart reason value is an identifier corresponding to the restart reason, indicating the corresponding restart reason.

[0078] Exemplarily, referring to Table 1, a 128M DDR memory is used as an example, the initial address of the DDR is 0x8000000, and the DDR may include a kernel management area, a startup parameter area, a log memory area, and a target memory area.

[0079] Among them, the address range of the kernel management area includes 0x00000000~0x7EE1000, and the kernel management area includes a first memory area and a second memory area. The first memory area is the memory occupied (or called used) by the kernel image itself, and the address range of the first memory area includes 0x00000000~0x6F9A00. The second memory area is the memory managed after the kernel is started, and the second memory area is mainly provided for the kernel and each business module.

[0080] The address range of the boot parameter area includes 0x7E01000 to 0x100000. The boot parameter area is mainly used to store the kernel boot parameter address and the file system partition table. The file system is a system that organizes and allocates the space of the memory device, is responsible for file storage, and protects and retrieves the stored files. The file system is used to define the methods and data structures of files on the memory device (such as a disk) or partition. The partition table refers to the data in the table divided into multiple small subsets according to the type. The type can include range, list, and hash partitions. The division is mainly based on the internal attributes of the partition table.

[0081] The address range of the above-mentioned log memory area includes 0x7F01000~0xFC000. The log memory area is a memory-based log system storage area, which is mainly used to store logs recorded during the operation of the system, the kernel and the upper-layer business modules, so that other devices can analyze the logs in the log memory area to troubleshoot and locate problems in the operation of the router or the business module.

[0082] The address range of the target memory area includes 0x7FFD000 to 0x3000, and the target memory area is used to store the restart reason value.

[0083] Table 1

[0084]

[0085]

[0086] In this implementation, a target memory area is separately allocated in the DDR to store the restart reason value, so that the complete operation of the restart reason correction function can be guaranteed and the accuracy of restart reason determination can be improved.

[0087] In some embodiments, after the router is restarted, the router may directly obtain the corresponding restart reason value from the target memory area, so as to facilitate subsequent modification of the restart reason value.

[0088] In other embodiments, the router may obtain the restart reason value after executing the following step S403. That is, the router may obtain the restart reason value and modify the restart reason value to power failure restart when determining that the target data meets the preset conditions.

[0089] S403, the router reads the target data corresponding to the target register, wherein the target register includes a config register and / or a watchdog register. The target data corresponding to the target register is used to verify whether the reason for this restart is a power-off restart.

[0090] Specifically, after the router obtains the restart reason value, the router can read the target data corresponding to the target register (or the data located in the target register) in the SSBL phase of the above router startup process. The target register may include a config register and / or a watchdog register, the target data corresponding to the config register (or the data located in the config register) is a register feature bit (or the first flag bit), and the target data corresponding to the watchdog register (or the data located in the watchdog register) is a register flag bit (or the second flag bit).

[0091] Exemplarily, if the target register is a config register, the target data corresponding to the target register is a register characteristic bit; if the target register is a watchdog register, the target data corresponding to the target register is a register flag bit; if the target register includes a config register and a watchdog register, the target data corresponding to the target register may include a register characteristic bit corresponding to the config register and a register flag bit corresponding to the watchdog register.

[0092] In some embodiments, since different SOC chips are designed by different SOC manufacturers, the registers on different SOC chips may be different. Therefore, the register on the SOC chip may be a watchdog register, that is, the target register may be a watchdog register. The running state of the router can be detected in real time according to the data stored in the watchdog register, that is, the router can determine the running state of the router according to the target data corresponding to the target register. Accordingly, the target data corresponding to the target register may include a register flag bit and a counter value, so that the router can use the register flag bit and the counter value to determine the reason for the restart of the router.

[0093] Exemplarily, after the above-mentioned kernel startup phase, the router can start the watchdog counter of the SOC and initialize the watchdog counter value, for example, configure the watchdog counter value to 0xFFF. Afterwards, during the operation of the router, the watchdog counter will be decremented according to the preset time (such as 1s), that is, the watchdog counter value will be reduced by 1 every 1s that the router runs, and if the watchdog counter value is decremented to 0, it means that the router has been in an abnormal state for a long time (such as freezing, etc.), that is, the SOC stops working due to an abnormality, therefore, the SOC can generate a reset signal, and according to the reset signal, reset the watchdog counter value to restart the SOC, that is, restart the router. That is to say, if the watchdog counter value is not 0, it indicates that the router is operating normally, therefore, there is no need to restart the router, that is, the SOC will not generate a reset signal.

[0094] Afterwards, the SOC can set the register flag bit corresponding to the watchdog register, that is, set the register flag bit to 1. Among them, the register flag bit is 1, which means that the router has undergone a watchdog restart, that is, the router has undergone a non-power-off restart. Afterwards, after the router enters the SSBL stage, the router can read the register flag bit. It should be understood that the watchdog counter value is 0, indicating that the SOC has restarted, that is, the router has restarted. Since the data in the watchdog register will be cleared immediately after the router is powered off, that is, the register flag bit is not set to 1, that is, the register flag bit is 0. If the restart is not caused by a power outage, such as a soft restart (such as a watchdog restart), since the SOC will set the register flag bit to 1 before shutting down and restarting, it will not be cleared, and the register flag bit read by the router is still 1.

[0095] In other embodiments, since the processor architectures corresponding to different routers may be different, the processor architectures may include reduced instruction set (RISC) processor architectures such as MIPS architecture and ARM architecture, and the registers corresponding to different processor architectures may be different, the registers on the SOC chip may also be config registers, that is, the target register may be a config register. The config register is a register whose basic configuration information is no longer modified after the boot software initialization configuration is completed. The basic configuration information may include the value corresponding to the configuration of the config register, for example, the last 4 bits in the config register represent the location of the startup file that the router must use when starting up.

[0096] For example, taking the MIPS architecture SOC as an example, the config register included in the CP0 coprocessor can be initialized and configured to 1 by the router through the above boot software after the above SSBL stage. Afterwards, during the operation of the router, the value corresponding to the register feature bit remains unchanged. Afterwards, if the router is powered off, the data in the config register will be cleared, so that the register feature bit is empty, that is, becomes 0. Afterwards, in the SSBL stage of the router startup, the boot software can read the register feature bit corresponding to the config register.

[0097] It should be noted that if the above processor architecture is a MIPS architecture, then after the SOC is started, the registers (such as the above config registers), ROM, and random access memory (RAM) addresses in the SOC are mapped to the 0xA0000000-0xC0000000 address space, and the CPU does not need to go through the memory management unit (MMU) mapping when accessing the addresses in this space. Afterwards, in the above SSBL stage, the router can directly access the addresses in this space and read and store the corresponding data. It can be understood that the MMU is a hardware component in the router that is used to manage memory access and allocation. It is responsible for converting virtual memory addresses into physical memory addresses and providing memory protection and permission control.

[0098] For example, see Figure 5 As shown, the address space of the MIPS architecture may include at least one of the four areas of kuseg, kseg0, kseg1, and kseg2. Different areas are used for memory mapping of different types of data.

[0099] The kuseg area is an area available in user mode. The kuseg area is used to map the code and data of the user process. For example, the virtual address range of the area may include 0x00000000~0x7fffffff, and the size may be 2GB. When the MMU is turned on, the kuseg area can be accessed.

[0100] The kseg0 area is an unmapped cached area. The kseg0 area is used to convert the virtual address of the area into a physical address. The physical address mapped to the virtual address of the area is used to store code and data. For example, the virtual address range of the area can include 0x80000000~0x9fffffff, and the size can be 512MB. Regardless of whether the MMU is turned on, this area can be accessed.

[0101] The Kseg1 area is an unmapped uncached area. The kseg1 area is used to map physical addresses. The physical addresses mapped by the kseg1 area are the same as those mapped by the kseg0 area, but the virtual addresses are different. For example, the virtual address range of this area can include 0xA0000000~0xbfffffff, and the size can be 512MB. This area can be accessed regardless of whether the MMU is turned on.

[0102] The Kseg2 area is a mapped area (mapped), which is used to map the code and data of the core process. For example, the virtual address range of this area may include 0xC0000000~0xffffffff, and the size may be 1GB. When the MMU is turned on, the Kseg2 area can be accessed.

[0103] In another example, the processor architecture is an ARM architecture, and accordingly, in the SSBL stage, the router can first disable MMU mapping. After that, the CPU can directly access the register address to obtain the target data corresponding to the register. In this way, by disabling MMU mapping, the router restart caused by CPU access error can be avoided, and the probability of router restart can be reduced.

[0104] Among them, optionally, the above ARM architecture can refer to Figure 6 As shown in FIG. 1 , the ARM architecture is divided into four layers: hardware layer, driver layer, kernel layer, and service layer. The hardware layer may include SOC, FLASH, DDR, key (KEY), and port physical layer (PHY). The port physical layer is a chip for an external signal interface, that is, the Ethernet data frame can be sent and received through the port physical layer.

[0105] The driver layer may include FLASH, generic interrupt controller (GIC), watchdog, universal asynchronous receiver / transmitter (UART), PHY, KEY, indicator light (LED), memory device, peripheral component interconnect express (PCIe), inter-integrated circuit (IIC), and serial peripheral interface (SPI).

[0106] The kernel layer may include a file system, a memory management module, a protocol stack, and a scheduler.

[0107] The business layer may include log processes, special processes, dns processes, dhcpc processes, and dhcps processes. The log process is a system log recording process that is responsible for recording various events, errors, and warnings during system operation.

[0108] The special process is the process responsible for reading and modifying the restart reason value.

[0109] The DNS process is responsible for domain name resolution. It converts the domain name provided by the user into the corresponding IP address.

[0110] The dhcpc process is a DHCP client process. DHCP is a network protocol that automatically assigns parameters such as IP addresses, subnet masks, and gateways, allowing devices to connect to the network without manual configuration. The dhcpc process is responsible for communicating with the DHCP server to obtain and configure network parameters.

[0111] The dhcps process is a DHCP server process. The DHCP server is responsible for providing network configuration information such as IP address, subnet mask, gateway, etc. to the device. The dhcps process listens to DHCP requests in the network and assigns appropriate network parameters to the requester according to the configuration rules.

[0112] It should be noted that for ARM architecture SOC, before the MMU is turned on, the SOC can directly access the physical memory address. However, after the MMU is turned on, the SOC needs to establish a mapping between the physical memory address and the virtual memory address before it can access the corresponding physical memory address through the virtual memory address.

[0113] In some embodiments, the router divides the target memory area for the restart reason value at the above-mentioned driver layer, and creates a memory device driver for the target memory area to provide a memory read and write interface for the target memory area. Afterwards, when the router starts, the SOC in the router can register the memory device driver. Afterwards, after the special process is started, the router can open the memory device driver file and call the read and write interface to read and modify the above-mentioned restart reason value from the target memory area. Afterwards, after reading the restart reason value, the special process can trigger the upload of the restart event so that the log process collects the restart log corresponding to the restart event, wherein the restart log is stored in the log memory area in the above-mentioned Table 1. Afterwards, the router can upload the restart log and the restart reason value to the cloud platform (or big data platform) to facilitate the subsequent analysis of the stability of the router.

[0114] S404, the router determines whether the target data is a target value.

[0115] Exemplarily, when the target data is a target value, it indicates that this restart is a power-off restart, and the router can execute S405. When the target data is not a target value, it indicates that this restart is not a power-off restart, and the router can execute S406.

[0116] In some embodiments, the target register is a config register. Correspondingly, the target data is a register feature bit, and the target value is a first target value (such as 0). If the register feature bit is set, that is, if the register feature bit is 1, indicating that the data in the config register has not been cleared, the router can determine that the target data is not the first target value, and therefore, it can be determined that the reason for the current restart of the router is a soft restart, not a power-off restart, that is, there is no need to modify the above-mentioned restart reason value. If the register feature bit is reset, that is, if the register feature bit is 0, indicating that the data in the config register is cleared, the router can determine that the target data is the first target value, and therefore, it can be determined that the restart reason information of the router is a power-off restart information, that is, it is necessary to modify the above-mentioned restart reason value to the identifier corresponding to the power-off restart reason, that is, when the above-mentioned initial restart reason information is different from the restart reason information, the router can update the initial restart reason information to the restart reason information.

[0117] In other embodiments, the target register is a watchdog register. Correspondingly, the target data is a register flag, and the target value is a first target value (such as 0). If the register flag is reset, that is, the register flag is 0, indicating that the data in the watchdog register is cleared, then the router can determine that the target data is the first target value, and therefore, it can be determined that the restart reason of the router is a power-off restart, that is, it is necessary to modify the above-mentioned restart reason value to an identifier corresponding to the power-off restart reason. If the register flag is set, that is, the register flag is 1, indicating that the data in the watchdog register is not cleared, then the router can determine that the target data is not the first target value, and therefore, it can be determined that the restart reason of the router is a soft restart (such as a watchdog restart), not a power-off restart, that is, there is no need to modify the above-mentioned restart reason value.

[0118] In other embodiments, the target registers are a config register and a watchdog register. Correspondingly, the target data includes a register characteristic bit corresponding to the config register and a register flag bit corresponding to the watchdog register, and the target value is a first target value (such as 0). If the register characteristic bit corresponding to the config register is 0, and / or the register flag bit corresponding to the watchdog register is 0, indicating that the target data corresponding to any target register in the router is cleared, the router can determine that the target data is the first target value, and therefore, it can be determined that the restart reason of the router is a power failure restart, that is, it is necessary to modify the above-mentioned restart reason value to the identifier corresponding to the power failure restart reason. If the register characteristic bit corresponding to the config register is 1, and the register flag bit corresponding to the watchdog register is 1, indicating that the data in the config register and the watchdog register are not cleared, the router can determine that the target data is not the first target value, and therefore, it can be determined that the restart reason of the router is not a power failure restart, that is, there is no need to modify the above-mentioned restart reason value.

[0119] S405: The router modifies the restart reason value to an identifier corresponding to a power failure restart.

[0120] Specifically, after determining that the target data is the target value, it indicates that the restart reason value recorded in the router is wrong, so the router can modify the restart reason value to the identifier corresponding to the power failure restart reason (or called power failure restart information), that is, determine the restart reason information as the power failure restart information. Afterwards, the router can update the initial restart reason information to the restart reason information if the restart reason information is different from the initial restart reason information.

[0121] It should be noted that if the router (such as the target memory area in the router) does not have a restart reason value, that is, the restart reason value is empty, the identifier corresponding to the power off restart can be directly written to the target memory area, instead of modifying the original restart reason value in the target memory area to the power off restart value, that is, the identifier corresponding to the power off restart.

[0122] S406: The router does not modify the above restart reason value.

[0123] Specifically, after determining that the target data is not the target value, it indicates that the restart reason value recorded in the router is correct, and the router does not need to modify the restart reason value, that is, does not need to modify the restart reason.

[0124] In some embodiments, after the router is restarted, the SOC in the router can determine whether the restart reason is a power failure restart according to the target data corresponding to the target register, so as to modify the restart reason in time if the restart reason is a power failure restart. Figure 2 The structure shown and Figure 7 The restart reason determination process shown in the figure details the process of reading and modifying the restart reason value by the SOC in the router.

[0125] S701: In response to power-on or a received restart command, the SOC in the router starts.

[0126] S702: After entering the SSBL phase, the SOC reads the restart reason value from the target memory area of ​​the DDR.

[0127] S703. The SOC reads the target data corresponding to the target register.

[0128] S704: When the target data is a target value, if the restart reason value is not an identifier corresponding to a power-off restart, the SOC modifies the restart reason value to an identifier corresponding to a power-off restart.

[0129] In some embodiments, when the target register is a config register, the target data is a register feature bit, and the target value is a first target value (such as 0). If the register feature bit is 0, it means that the router has experienced a power outage and restart, so the SOC can modify the above restart reason value to an identifier corresponding to the power outage and restart. If the register feature bit is 1, it means that the router has not experienced a power outage and restart, so the SOC does not need to modify the above restart reason value.

[0130] In other embodiments, when the target register is a watchdog register, the target data is a register flag, and the target value is a first target value (such as 0). If the watchdog register flag is 0, it means that the router has a power outage and restart, so the SOC can modify the above restart reason value to an identifier corresponding to the power outage and restart. If the watchdog register flag is 1, it means that the router has not a power outage and restart, so the SOC does not need to modify the above restart reason value.

[0131] In other embodiments, when the target register includes a config register and a watchdog register, the target data includes a register characteristic bit corresponding to the config register and a register flag bit corresponding to the watchdog register, and the target value is a first target value (such as 0). If the register characteristic bit corresponding to the config register is 0, and / or the register flag bit corresponding to the watchdog register is 0, it means that the router has experienced a power outage and restart, so the SOC can modify the above-mentioned restart reason value to an identifier corresponding to the power outage and restart. If the register characteristic bit corresponding to the config register is 1, and the register flag bit corresponding to the watchdog register is 1, it means that the router has not experienced a power outage and restart, so the SOC does not need to modify the above-mentioned restart reason value.

[0132] S705. The SOC initializes and configures the target data.

[0133] In some embodiments, if the target register is a config register, then after the SSBL stage, the boot software corresponding to the SOC can initialize the register feature bit to 1, that is, set the register feature bit, so that when the router restarts next time, it can determine the reason for the router restart according to the register feature. If the target register is a watchdog register, then after the kernel startup stage, the SOC can start the watchdog counter and initialize the watchdog counter value. Afterwards, when the watchdog counter value decreases to zero, the SOC initializes the watchdog register flag bit to 1, that is, sets the watchdog register flag bit.

[0134] It should be noted that the execution order of the above-mentioned process of determining the restart reason value and the above-mentioned process of initializing the configuration target data is not limited. For example, the SOC may first execute the above-mentioned step S704 and then execute the above-mentioned step S705, or the SOC may first execute the above-mentioned step S705 and then execute the above-mentioned step S704, or the SOC may execute the above-mentioned step S704 and S705 at the same time.

[0135] S706. After entering the user stage, the SOC uploads the above restart reason value to the cloud platform.

[0136] S707. The cloud platform may analyze the restart reason of the router according to the restart reason value to obtain an analysis result.

[0137] The above analysis results are used to characterize the stability of the router operation, so as to improve the stability of the router according to the analysis results, thereby improving the user experience.

[0138] In some embodiments, the present application provides a computer storage medium including computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method for determining a restart cause as described above.

[0139] In some embodiments, the present application provides a computer program product, which, when executed on an electronic device, enables the electronic device to execute the method for determining a restart cause as described above.

[0140] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

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

[0142] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0143] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0144] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0145] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for determining a restart reason, characterized in that: include: During the restart of the router, the router reads the target data corresponding to the target register; wherein the data in the target register is cleared when the router is powered off, and when the router is restarted after power failure, the data in the target register has been cleared, and the data in the target register cannot be read, and the target data is a target value; the target data corresponding to the target register is used to determine whether the current restart is a power failure restart; In a case where the target data is a target value, the router determines that the restart reason information is power-off restart information; In a case where the target data is a non-target value, the router determines that the restart reason information is soft restart information; Wherein, the target value indicates that the data in the target register is empty during the restart period, and the non-target value indicates that the data in the target register is not empty during the restart period; The method further comprises: After being powered on or receiving a restart command, the router restarts; During the restart, initial restart reason information is obtained; wherein the initial restart reason information is used to indicate the reason why the router is restarted this time, and the initial restart reason information is stored in a target memory area of ​​a double data rate synchronous dynamic random access memory DDR; In the case where the router determines that the restart reason information is power-off restart information, determining whether to modify the initial restart reason information according to the restart reason information and the initial restart reason information; When the restart reason information is different from the initial restart reason information, updating the initial restart reason information to the restart reason information; In the case where the restart reason information is the same as the initial restart reason information, the initial restart reason information is not modified; During the restarting period, obtaining the initial restarting reason information includes: After entering the second stage loader SSBL stage in the router startup process, the router reads the initial restart reason information from the target memory area of ​​the DDR; The method further comprises: During the last startup of the router, the target data was configured to be the non-target value, and during the operation of the router, the target data remained unchanged; in the event of a power outage in the router, the target data was set to the target value; in the event of a power outage in the router, the target data was maintained to be the non-target value.

2. The method according to claim 1, characterized in that The target register is a configuration config register, and the target data corresponding to the config register includes a first flag bit.

3. The method according to claim 2, characterized in that The method further comprises: When the first flag bit is 0, the restart reason information of the router is power-off restart information; When the first flag bit is 1, the restart reason information of the router is soft restart information.

4. The method according to claim 1, characterized in that: The target register is a watchdog register, and the target data corresponding to the watchdog register includes a second flag bit.

5. The method according to claim 4, characterized in that The method further comprises: When the second flag bit is 0, the restart reason information of the router is power-off restart information; When the second flag bit is 1, the restart reason information of the router is soft restart information.

6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: The router uploads the restart reason information to a cloud platform; wherein the cloud platform is used to analyze the restart reason information and determine the operation stability result of the router.

7. A router, characterized in that: The router comprises a register, a memory and one or more processors; the register, the memory and the processor are coupled; the register is used to temporarily store instructions, data and addresses, the memory is used to store computer program codes, and the computer program codes include computer instructions; when the processor executes the computer instructions, the router executes the method according to any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that: The method comprises computer instructions, which, when executed on a router, cause the router to execute the method according to any one of claims 1 to 6.