CN116860546A - Log storage method, vehicle-mounted equipment, storage medium and chip - Google Patents

Log storage method, vehicle-mounted equipment, storage medium and chip Download PDF

Info

Publication number
CN116860546A
CN116860546A CN202310685696.5A CN202310685696A CN116860546A CN 116860546 A CN116860546 A CN 116860546A CN 202310685696 A CN202310685696 A CN 202310685696A CN 116860546 A CN116860546 A CN 116860546A
Authority
CN
China
Prior art keywords
operating system
log data
log
reserved memory
preset counter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310685696.5A
Other languages
Chinese (zh)
Inventor
程标
孙超杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Jiefa Technology Co ltd
Original Assignee
Hefei Jiefa Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hefei Jiefa Technology Co ltd filed Critical Hefei Jiefa Technology Co ltd
Priority to CN202310685696.5A priority Critical patent/CN116860546A/en
Publication of CN116860546A publication Critical patent/CN116860546A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3013Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is an embedded system, i.e. a combination of hardware and software dedicated to perform a certain function in mobile devices, printers, automotive or aircraft systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The application discloses a log storage method, vehicle-mounted equipment, a storage medium and a chip, wherein the method comprises the following steps: in the starting process of the operating system, in response to the detection of the occurrence of the abnormality through the preset counter, the log data from the starting point to the abnormality in the starting process is obtained and stored in the current reserved memory, in response to the restarting instruction of the operating system, the operating system is restarted, and after the operating system is restarted, the log data in the current reserved memory are stored in the reserved partition of the storage device.

Description

Log storage method, vehicle-mounted equipment, storage medium and chip
Technical Field
The present application relates to the field of vehicle-mounted systems, and in particular, to a log saving method, a vehicle-mounted device, a storage medium, and a chip.
Background
Any embedded system needs to take log data when an exception is caused and the problem needs to be solved (debug), so that the problem of debug is convenient. Taking a vehicle-mounted Android system as an example, each manufacturer may generally have a set of log storage mechanism, and logs in the running process of the system can be stored in a certain storage area on the eMMC. When a problem arises that requires debug, the log is taken out of the eMMC for analysis to perform debug.
However, the core of the current log saving mechanism is log services which depend on the Android system. That is, the log saving mechanism needs to wait until the Android system is started, so that the log cannot be saved when the system is abnormal in the starting stage.
Disclosure of Invention
Aiming at the problem that logs cannot be grabbed when the system is abnormal in starting stage, the application aims to provide a log storage method, vehicle-mounted equipment, a storage medium and a chip.
The first aspect of the present application provides a log saving method, which is applied to a vehicle-mounted device, wherein the vehicle-mounted device is provided with an operating system and comprises a storage device; the method comprises the following steps: in the starting process of the operating system, responding to the detection of the occurrence of an abnormality through a preset counter, acquiring log data from a starting point to the abnormality in the starting process, and storing the log data into a current reserved memory, wherein the preset counter is started after the vehicle-mounted equipment is powered on and before the operating system is operated; and responding to a restarting instruction of the operating system, executing the restarting of the operating system, and after the restarting of the operating system, storing the log data in the current reserved memory into a reserved partition of the storage device.
In some embodiments, the responding to the detection of the occurrence of the abnormality by the preset counter, obtaining log data from the starting point in the starting process to the operating system abnormality includes: performing a restarting operation on the preset counter every a first preset time; receiving an interrupt triggered by the preset counter from the preset counter in response to the preset counter not detecting any restarting operation within a second preset time; and responding to the interrupt, and acquiring log data from a starting point to the abnormality in the starting process.
In some embodiments, during the starting process of the operating system, in response to occurrence of another exception, log data from a starting point in the starting process to the other exception is obtained, and the log data is saved to a current reserved memory, wherein the other exception is different from the exception.
In some embodiments, a restart instruction of the operating system is triggered to be generated in response to completion of saving the log data to a current reserved memory; alternatively, the method further comprises: and in the starting process of the operating system, in response to the detection of the occurrence of the abnormality through a preset counter, receiving a system reset instruction triggered by the preset counter from the preset counter so as to restart the operating system.
In some embodiments, the boot process of the operating system includes a first boot phase that is powered on immediately adjacent to the in-vehicle device; the first start-up phase is used for executing a system initialization process, wherein the system initialization process comprises: initializing and starting the preset counter.
In some embodiments, the system initialization procedure further comprises: mapping the current reserved memory and the last reserved memory; copying original content in the current reserved memory to the last reserved memory, and clearing the current reserved memory for storing the log data.
In some embodiments, the saving the log data in the current reserved memory to a reserved partition of the storage device includes: reading the log data from the current reserved memory; and generating an abnormal data packet according to the log data and the information of the reserved partition of the storage device in response to the occurrence of the abnormal state of the log data representation, and storing the abnormal data packet into the reserved partition of the storage device.
A second aspect of the present application provides an in-vehicle device comprising a processor, and a memory and a storage device coupled to the processor, the processor being configured to execute program instructions stored in the memory to implement the method of log saving of any one of the first aspects above, to save a log to the storage device.
A third aspect of the present application provides a non-transitory computer readable storage medium having stored thereon program instructions or a computer program; and/or a computer program which, when executed by a processor, implements the method of log saving of any of the above first aspects.
A fourth aspect of the present application provides a chip, comprising a processor and a preset counter coupled to the processor, where the processor is configured to execute program instructions to implement the method for log saving according to the first aspect through the preset counter, so as to save the log to a storage device.
According to the scheme, in the starting process of the operating system, the abnormal occurrence is detected through the preset counter, the log data from the starting point in the starting process to the abnormal occurrence is obtained and stored in the current reserved memory, in response to receiving the restarting instruction of the operating system, the operating system is restarted, and after the operating system is restarted, the log data in the current reserved memory are stored in the reserved partition of the storage device, so that the problem that the log data cannot be grasped due to the abnormal starting stage of the system is solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic structural view of an in-vehicle apparatus of an embodiment of the present application;
FIG. 2 is a schematic diagram of an operating system boot process in a vehicle-mounted device according to an embodiment of the present application;
FIG. 3 is a flow chart of a log saving method according to an embodiment of the application;
FIG. 4 is a schematic diagram of acquisition log data in accordance with the present application;
FIG. 5 is a schematic diagram of an application scenario of a log saving method according to an embodiment of the present application;
FIG. 6 is a partial flow chart of another log saving method of an embodiment of the present application;
FIG. 7 is another schematic diagram of an operating system boot process in an in-vehicle device according to an embodiment of the present application;
FIG. 8 is a partial schematic diagram of an operating system boot process in an in-vehicle apparatus according to an embodiment of the present application;
FIG. 9 is a partial flow chart of a log saving method of an embodiment of the present application;
FIG. 10 is a schematic diagram of a frame of a non-transitory computer readable storage medium of an embodiment of the application;
fig. 11 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
As can be seen from the above, in an example where an Android system is installed in a certain device, the current log saving mechanism needs to wait until the Android system is started, and the log process corresponding to the native log service on which the log saving mechanism depends is not run in the process of starting the Android system. Thus, if an exception occurs before the log process is ready and the log cannot be started normally, the log saving mechanism does not start working because the log process is not ready, and at this time, the system log in the system starting process cannot be saved in the storage area. Secondly, even if the log saving mechanism is operated, the CPU of the device cannot continue to operate normally due to the occurrence of a deadlock problem, a bus hang-up problem, or the like, and log data cannot be saved at this time. In addition, if an exception occurs in a system operation stage before log process, for example, a stage of Preloader, lk, kernel, the system may not be able to save log data (except the log of the Android system) because the log saving mechanism has not yet started working.
Currently, for the system that cannot be started normally, an abnormality occurs in the starting process, and the software log mechanism cannot acquire log data, and usually, a serial port (for example, UART) is connected to capture the log information. However, the serial port UART captures logs, which is limited by the serial port UART transmission efficiency, and when the system transient log amount is too large, the phenomenon of log loss occurs, thereby affecting the debug problem analysis. In addition, the serial port is inconvenient for some industries, because the serial port needs to be disassembled, taking the vehicle-mounted industry as an example, when the host computer is loaded, the serial port needs to be disassembled, which brings great inconvenience to log grabbing, and a vehicle factory generally does not allow the disassembly. In addition, when the problem of low-probability startup abnormality occurs after the sale is analyzed, the user is used as a non-professional, and no condition or resource is used for grabbing the serial log.
Therefore, the present application provides a log saving method and a vehicle-mounted device, and a scheme of an embodiment of the present application is described in detail below with reference to the accompanying drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present application.
First, in order to facilitate understanding of the present application, the in-vehicle apparatus of the embodiment of the present application will be described. Referring to fig. 1, fig. 1 is a schematic structural diagram of an in-vehicle apparatus 10 according to an embodiment of the present application, where the in-vehicle apparatus 10 may be a chip or a system, such as an application specific integrated chip, which is installed with an operating system, such as an Android operating system, and specifically, the in-vehicle apparatus 10 includes a processor 101, and a memory 102, a storage device 103, and a preset counter 104 connected to the processor. The present application is not limited to the specific hardware in which the operating system is installed in the in-vehicle apparatus 10.
Specifically, the processor 101 is configured to control itself, as well as the memory 102, the storage device 103, and the preset counter 104, to implement the steps of the log saving method of the following embodiments. The processor 101 may also be referred to as a CPU (Central Processing Unit ), and the processor 101 may be an integrated circuit chip with signal processing capabilities. The processor 101 may also be a general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The general purpose processor 101 may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 101 may be commonly implemented by an integrated circuit chip.
The memory 102 may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes. The memory includes two reserved memories (reserved memory), such as reserved memory a102A and reserved memory B102B. Reserved memory a102A may be cache a, i.e., buffer a, and reserved memory B102B may be cache B, i.e., buffer B.
The storage device 103 may include an eMMC storage device or the like, and the present application is described taking the storage device 103 as an eMMC storage device as an example, but the present application is not limited thereto, and the storage device 103 may also include other storage devices, such as a flash memory or the like.
The preset counter 104 is used to detect an abnormality occurring during the starting process of the operating system, where the abnormality may be caused by that the processor cannot normally operate, for example, the processor 101 is suspended, the processor 101 cannot normally operate due to the blocking of the hardware level, etc., that is, the preset counter 104 is used to avoid that the processor 101 is suspended, for example, the software enters the dead loop. The preset counter 104 may be preset before the whole vehicle-mounted device 10 leaves the factory, for example, a Watchdog hardware module, or may be provided in the vehicle-mounted device itself, for example, a Timer (Timer). The Watchdog hardware module may be a Watchdog Counter.
In addition, in order to facilitate understanding of the present application, a description will be given of an operating system start-up process in the in-vehicle apparatus 10 according to the embodiment of the present application. Fig. 2 is a schematic diagram of an operating system startup procedure in a vehicle-mounted device according to an embodiment of the present application. After the vehicle-mounted device 10 is powered on and started, the operating system starts a starting process, specifically including a Bootloader stage, a Kernel starting stage and an Android boot stage, which are sequentially performed. The Bootloader stage is a first starting stage, the immediately adjacent vehicle-mounted equipment is powered on, the Kernel starting stage is a second starting stage, the Android boot stage is a third starting stage, the Bootloader stage and the Kernel starting stage are single in function, the main functions are to load a mirror image, initialize hardware and jump to the next stage, for example, in the Bootloader stage, namely, in the first starting stage, the hardware equipment is initialized, memory mapping and the like are performed. The present application does not describe each startup phase in detail, and those skilled in the art will also understand each startup phase, wherein these startup phases enter the operating system operation after the startup is completed.
During these boot phases, anomalies may occur, resulting in an operating system that does not boot properly. Exceptions to these boot phases include two types, one type being because the processor 101 is not functioning properly, such as the processor 101 seizing itself, etc., for example, the boot time times out. Another type is that the processor 101 may operate normally, and may identify itself as an exception, for example, an abart exception.
The log saving method according to the embodiment of the present application will be described below in conjunction with the above.
Referring to fig. 3, fig. 3 is a flowchart illustrating a log saving method according to an embodiment of the application. The method is applied to an in-vehicle apparatus such as the in-vehicle apparatus 10 in fig. 1 described above.
Specifically, in some possible implementations, the method may be implemented by the manner in which the processor 101 invokes the computer readable instructions stored in the memory 102, and may include the steps of:
step S31: in the starting process of the operating system, in response to detecting that an abnormality occurs through the preset counter 104, log data from a starting point to the abnormality in the starting process is obtained, and the log data is stored in the current reserved memory.
The preset counter may be any starting stage, such as a Bootloader stage, i.e. a first starting stage, in a starting process of the operating system after the vehicle-mounted device is powered on and before the operating system is running, for example, after the vehicle-mounted device is powered on. The operating system running refers to a state that the operating system works normally after the starting process of the operating system is completed.
As can be seen from the above, the abnormality detected by the preset counter 104 may be an abnormality due to the inability of the processor 101 to operate normally. The exception may occur at any one of the startup phases of the startup process, such as the BootLoader phase or the Kernel startup phase.
The log data from the starting point to the abnormality in the starting process refers to all log data in a period from a time point when the operating system starts to start after the vehicle-mounted device 10 is powered on to a time point when the abnormality is detected to occur by the preset counter 104, wherein the log data at least includes information for recording hardware, software and system problems in the system and events occurring in the monitoring system.
The current reserved memory may be one of 2 reserved memories in memory 102, for example, current reserved memory is reserved memory a.
When an abnormality occurs in the starting process of the operating system through the preset counter 104, log data between a starting point in the starting process and the abnormality of the operating system is obtained, and the log data is stored in a current reserved memory. Wherein, the obtaining of the Log data may be performed by calling a Log (Log) interface. Specifically, as shown in fig. 4, fig. 4 is a schematic diagram of acquiring Log data according to the present application, in the starting process, when an abnormality is detected through the preset counter 104, a Log interface is called to acquire Log data, and Log (Log) control is then performed, that is, the Log data is written into the current reserved memory, that is, the reserved memory a in sequence. Of course, if the in-vehicle device 10 is connected to an external device through a serial port at this time, log data may be output from the Uart serial port to the external device according to the level control.
Step S32: in response to a restart instruction of the operating system, the operating system is restarted, and after the operating system is restarted, log data in the current reserved memory is saved in a reserved partition of the storage device 103.
In an example where the storage device 103 is an eMMC storage device 103, the reserved partition of the storage device 103 may be referred to as an ExpDB partition for storing log data, facilitating retrieval of the log data therefrom by a developer to analyze the exception.
When a restart instruction of the operating system is received, the operating system is restarted, namely, the next starting process is performed, and after the restart is completed, the log data of the current reserved memory, namely, the log data from the starting point to the exception in the last starting process (for this restart), is saved in the reserved partition of the storage device 103 from the current reserved memory.
In the following, an application scenario of the log saving method according to the embodiment of the present application is described, as shown in fig. 5, fig. 5 is a schematic diagram of an application scenario of the log saving method according to the embodiment of the present application, and in the starting process, an exception occurs in a Bootloader stage or a Kernel starting stage, and at this time, corresponding log data is saved to a current reserved memory, that is, a reserved memory a. Then, after receiving a restart instruction and executing a restart, the log data in the reserved memory a is saved in the ExpDB partition in the eMMC storage device 103 in the Bootloader stage after power-up.
In this embodiment, during the starting process of the operating system, in response to detecting that an abnormality occurs through the preset counter 104, log data from a starting point to the abnormality in the starting process is obtained and stored in the current reserved memory, in response to receiving a restart instruction of the operating system, the operating system is restarted, and after the operating system is restarted, the log data in the current reserved memory is stored in a reserved partition of the storage device 103, so that the problem that log data cannot be captured due to the abnormality in the starting stage of the system is solved, the problem that log data cannot be captured due to the abnormality in the starting process is solved, and the log can be effectively stored due to the abnormality in the starting process.
As described above, when an occurrence of an abnormality is detected by the counter, log data from the start point to the abnormality in the start process is obtained, and the log data is saved in the current reserved memory, in some embodiments, in response to the occurrence of the abnormality being detected by the preset counter 104, obtaining log data from the start point to the abnormality in the start process includes: performing a restart operation on the preset counter 104 every first preset time; receiving an interrupt triggered by the preset counter 104 from the preset counter 104 in response to the preset counter 104 not detecting any restart operation within the second preset time; in response to the interrupt, log data from a start point to an anomaly in the start-up process is obtained.
In the in-vehicle apparatus 10, a restart operation is performed on the preset counter 104 every first preset time. In the example in which the preset Counter 104 is a Watchdog Counter, the processor 101 in the in-vehicle apparatus 10 executes the operation Restart Watchdog Counter once every the first preset time, that is, restarts the Watchdog Counter once, abbreviated as a dog feeding operation.
The preset counter 104 does not detect any restart operation within the second preset time, which indicates that an abnormality occurs, and at this time, triggers an interrupt to notify the processor 101 in the in-vehicle device 10 to write the log data into the current reserved memory. The processor 101 in the in-vehicle apparatus 10 receives an interrupt from the preset counter 104, and in response to the interrupt, acquires log data to write the log data into the currently reserved memory. For example, in the example in which the preset counter 104 is a Watchdog counter, the Watchdog counter does not detect any restart operation within the second preset time, which indicates that an abnormality occurs, and at this time, the Watchdog counter triggers an NMI (None-Masked Interrupt) Interrupt to notify the processor 101 of the in-vehicle apparatus 10.
The first preset time and the second preset time are different, and the application is not limited to the size relationship between the two.
In the example where the preset counter 104 is a Watchdog counter, taking the first preset time as 1s and the second preset time as 2s as an example, the processor 101 in the vehicle-mounted device 10 performs a dog feeding operation on the preset counter 104 every 1s, and the Watchdog counter detects that no dog feeding operation is performed within 2s, triggers an NMI interrupt to notify the processor 101 in the vehicle-mounted device 10 to write log data into the current reserved memory. The processor 101 in the in-vehicle apparatus 10 receives an interrupt from the preset counter 104, and in response to the interrupt, acquires log data to write the log data into the currently reserved memory.
As described above, in the starting process of the operating system, when an abnormality is detected by the preset counter 104, log data is obtained, and the log data is saved in the current reserved memory. In some embodiments, the method further comprises: in the starting process of the operating system, in response to the occurrence of another abnormality, acquiring log data from a starting point in the starting process to the other abnormality, and storing the log data into a current reserved memory, wherein the other abnormality is different from the abnormality.
Another exception may be referred to as an exception in which an Abort occurs, and as noted above, such an exception is one that the processor 101 may operate normally to identify itself. As shown in fig. 6, fig. 6 is a partial flowchart of another log saving method according to an embodiment of the present application, in which the processor 101 in the in-vehicle apparatus 10 recognizes such an abnormality, and in response to the abnormality, directly acquires log data between the start-up to the abnormality and saves it in the currently reserved memory. The Log interface may be called to obtain Log data, which is not described herein. And then, directly restarting the operating system, namely, performing the next starting process, and after the restarting is completed, saving the log data of the current reserved memory, namely, the log data from the starting point to the exception in the last starting process (for this restarting), from the current reserved memory to the reserved partition of the storage device 103. The operating system restart may be that the processor 101 in the vehicle-mounted device 10 triggers a corresponding restart instruction by itself, and directly performs the operating system restart, or may receive an external restart instruction, for example, a user key, and directly perform the operating system restart in response to the restart instruction.
As described above, when the restart instruction of the operating system is received, the operating system is restarted, and after the operating system is restarted, the log data in the current reserved memory is saved in the reserved partition of the storage device 103. In some embodiments, the operating system restart instruction is triggered in response to completion of saving log data to the current reserved memory.
That is, after log data is saved in the current reserved memory, a restart instruction is triggered, and then an operating system restart is performed, and after the operating system restart, the log data in the current reserved memory is saved in a reserved partition of the storage device 103.
As described above, in the starting process of the operating system, when an abnormality is detected by the preset counter 104, log data is obtained and stored in the current reserved memory, and in some embodiments, the method further includes: during the starting process of the operating system, in response to detecting that an abnormality occurs through the preset counter 104, a system reset instruction triggered by the preset counter 104 is received from the preset counter 104, so that the operating system is restarted.
When detecting that an abnormality occurs in the starting process of the operating System through the preset counter 104, the preset counter 104 directly triggers a System Reset (System Reset) instruction, the processor 101 in the vehicle-mounted device 10 receives the System Reset instruction, and executes the operating System restart in response to the System Reset instruction.
For example, in the example where the preset Counter 104 is a Watchdog Counter, the processor 101 in the in-vehicle apparatus 10 performs an operation of Restart Watchdog Counter once every first preset time, that is, restarts the Watchdog Counter once, abbreviated as a dog feeding operation. The Watchdog counter does not detect any restart operation within the second preset time, which indicates that an exception occurs, at this time, the Watchdog counter directly triggers a System Reset (System Reset) instruction, and the processor 101 in the in-vehicle device 10 receives the System Reset instruction and executes an operating System restart in response to the System Reset instruction.
As described above, the booting process of the operating system includes a Bootloader phase (i.e., a first booting phase), a Kernel booting phase (i.e., a second booting phase), and an Android boot phase (i.e., a third booting phase) that are sequentially performed, where the first booting phase is immediately adjacent to the vehicle device 10 and is used to execute a system initialization procedure, and in some embodiments, the system initialization procedure includes: the preset counter 104 is initialized and started.
That is, as shown in fig. 7, fig. 7 is another schematic diagram of the operating system startup procedure in the vehicle-mounted device 10 according to the embodiment of the present application, in the first startup phase, the preset counter 104 is initialized and started, that is, after the vehicle-mounted device 10 is powered on, the preset counter 104 is initialized and started. Thus, since the preset counter 104 has been initialized and turned on, the processor 101 of the in-vehicle apparatus 10 may perform a restart operation on the preset counter 104 every first preset time in the first start-up phase, or in any start-up phase that follows. In the example in which the preset Counter 104 is a Watchdog Counter, the processor 101 in the in-vehicle apparatus 10 executes the operation Restart Watchdog Counter once every the first preset time, that is, restarts the Watchdog Counter once, abbreviated as a dog feeding operation.
Initializing the preset counter 104 may include setting specific values of a first preset time and a second preset time, for example, setting the first preset time to 1s and setting the second preset time to 2s.
As described above, the first start-up phase is used to perform a system initialization procedure that includes initializing and starting the preset counter 104, and in some embodiments, the system initialization procedure further includes: mapping the current reserved memory and the last reserved memory; copying original content in the current reserved memory to the reserved memory at last time, and emptying the current reserved memory to be used for storing log data.
As shown in fig. 8, fig. 8 is a schematic diagram of a portion of an operating system startup process in the vehicle-mounted device 10 according to an embodiment of the present application, in a system initialization process in a first startup phase, that is, in a Bootloader phase, a current reserved memory and a last reserved memory are mapped, for example, the current reserved memory is reserved memory a, the last reserved memory is reserved memory B, and then original contents in the reserved memory a are copied into the reserved memory B, where the original contents may refer to a log saved with respect to a last startup in the startup process, and then the reserved memory a is cleared, so that the reserved memory a may be used to save log data in the current startup.
As described above, after restarting, log data in the current reserved memory is saved to the reserved partition of storage device 103, which in some embodiments includes: reading log data from a current reserved memory; in response to the log data indicating that an exception has occurred, generating an exception packet from the log data and information of the current reserved memory, and saving the exception packet to a reserved partition of the storage device 103.
Specifically, as shown in fig. 9, fig. 9 is a partial flowchart of a log saving method according to an embodiment of the present application, where log data in a current reserved memory is saved in a reserved partition of a storage device 103, the log data in a last boot process (equivalent to a restart) is first read from the current reserved memory, and when the log data indicates that an abnormality occurs, original log data in the reserved partition of the storage device 103 is loaded into a file, where the original log data in the reserved partition of the storage device 103 may be a log in the last boot process (relative to the boot process). Further, the log data and the information of the reserved partition in the last boot process (corresponding to the restart) are collected to generate an abnormal data packet, so that the abnormal data packet is saved in the reserved partition of the storage device 103.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Referring to fig. 10, fig. 10 is a schematic diagram of a non-transitory computer readable storage medium 100 according to an embodiment of the application. The non-transitory computer readable storage medium 100 stores program instructions or a computer program 1001 that can be executed by a processor, the program instructions or the computer program 1001 being for implementing the steps of the log saving method embodiment as described above.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a chip according to an embodiment of the application. The chip 1100 comprises a processor 1110 and a preset counter 1120 coupled to the processor 1110, wherein the processor 1110 is configured to execute program instructions to implement the steps of any of the method embodiments of log saving by the preset counter 1120 to save the log to a storage device, such as the storage device 103.
In some embodiments, functions or modules included in an apparatus provided by the embodiments of the present disclosure may be used to perform a method described in the foregoing method embodiments, and specific implementations thereof may refer to descriptions of the foregoing method embodiments, which are not repeated herein for brevity.
The foregoing description of various embodiments is intended to highlight differences between the various embodiments, which may be the same or similar to each other by reference, and is not repeated herein for the sake of brevity.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (10)

1. The log saving method is characterized by being applied to vehicle-mounted equipment, wherein an operating system is installed in the vehicle-mounted equipment, and the vehicle-mounted equipment comprises a storage device; the method comprises the following steps:
in the starting process of the operating system, responding to the detection of the occurrence of an abnormality through a preset counter, acquiring log data from a starting point to the abnormality in the starting process, and storing the log data into a current reserved memory, wherein the preset counter is started after the vehicle-mounted equipment is powered on and before the operating system is operated;
and responding to a restarting instruction of the operating system, executing the restarting of the operating system, and after the restarting of the operating system, storing the log data in the current reserved memory into a reserved partition of the storage device.
2. The method of claim 1, wherein the obtaining log data from the start point during the boot up to the operating system exception in response to detecting the occurrence of the exception by a preset counter comprises:
performing a restarting operation on the preset counter every a first preset time;
receiving an interrupt triggered by the preset counter from the preset counter in response to the preset counter not detecting any restarting operation within a second preset time;
and responding to the interrupt, and acquiring log data from a starting point to the abnormality in the starting process.
3. The method according to claim 1, wherein the method further comprises:
in the starting process of the operating system, responding to the occurrence of another abnormality, acquiring log data from a starting point in the starting process to the other abnormality, and storing the log data into a current reserved memory, wherein the other abnormality is different from the abnormality.
4. A method according to any one of claims 1 to 3, wherein,
a restart instruction of the operating system is triggered and generated in response to completion of saving the log data to a current reserved memory; or alternatively
The method further comprises the steps of:
and in the starting process of the operating system, in response to the detection of the occurrence of the abnormality through a preset counter, receiving a system reset instruction triggered by the preset counter from the preset counter so as to restart the operating system.
5. A method according to any one of claims 1-3, characterized in that the start-up procedure of the operating system comprises a first start-up phase, which is immediately adjacent to the on-board device power-up;
the first start-up phase is used for executing a system initialization process, wherein the system initialization process comprises:
initializing and starting the preset counter.
6. The method of claim 5, wherein the system initialization procedure further comprises:
mapping the current reserved memory and the last reserved memory;
copying original content in the current reserved memory to the last reserved memory, and clearing the current reserved memory for storing the log data.
7. The method of claim 1, wherein the saving the log data in the current reserved memory to a reserved partition of the storage device comprises:
reading the log data from the current reserved memory;
and generating an abnormal data packet according to the log data and the information of the reserved partition of the storage device in response to the occurrence of the abnormal state of the log data representation, and storing the abnormal data packet into the reserved partition of the storage device.
8. An in-vehicle apparatus comprising a processor, and a memory coupled to the processor, a storage device, and a preset counter, the processor configured to execute program instructions stored in the memory to implement the method of log saving of any one of claims 1 to 7 with the preset counter to save a log to the storage device.
9. A non-transitory computer readable storage medium having stored thereon program instructions or a computer program; and/or a computer program, characterized in that the program instructions or the computer program, when being executed by a processor, implement the method of log saving according to any of claims 1 to 7.
10. A chip comprising a processor and a preset counter coupled to the processor, the processor configured to execute program instructions to implement the method of log saving of any one of claims 1 to 7 with the preset counter to save a log to a storage device.
CN202310685696.5A 2023-06-08 2023-06-08 Log storage method, vehicle-mounted equipment, storage medium and chip Pending CN116860546A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310685696.5A CN116860546A (en) 2023-06-08 2023-06-08 Log storage method, vehicle-mounted equipment, storage medium and chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310685696.5A CN116860546A (en) 2023-06-08 2023-06-08 Log storage method, vehicle-mounted equipment, storage medium and chip

Publications (1)

Publication Number Publication Date
CN116860546A true CN116860546A (en) 2023-10-10

Family

ID=88227654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310685696.5A Pending CN116860546A (en) 2023-06-08 2023-06-08 Log storage method, vehicle-mounted equipment, storage medium and chip

Country Status (1)

Country Link
CN (1) CN116860546A (en)

Similar Documents

Publication Publication Date Title
EP1638000B1 (en) Method, apparatus and program for performing panic memory dump
CN104536875A (en) Automatic server restart testing method based on IPMI
WO2017059721A1 (en) Information storage method, device and server
US10831467B2 (en) Techniques of updating host device firmware via service processor
JP5609242B2 (en) Information processing apparatus and memory dump collection method
US11704198B2 (en) Method and apparatus for providing recovery from a computing device boot up error
CN116775141A (en) Abnormality detection method, abnormality detection device, computer device, and storage medium
US20050033952A1 (en) Dynamic scheduling of diagnostic tests to be performed during a system boot process
US10642646B1 (en) Techniques of securely performing logic as service in BMC
CN116383012B (en) Method and device for acquiring boot log and method for transmitting boot log
US20160179626A1 (en) Computer system, adaptable hibernation control module and control method thereof
CN115904793B (en) Memory transfer method, system and chip based on multi-core heterogeneous system
CN112131043A (en) Method and device for detecting and recovering abnormity of basic input and output system
JP5348120B2 (en) Program, method and mechanism for collecting panic dump
CN116860546A (en) Log storage method, vehicle-mounted equipment, storage medium and chip
CN115951949A (en) Recovery method and device for configuration parameters of BIOS (basic input output System) and computing equipment
CN115421960A (en) UE memory fault recovery method, device, electronic equipment and medium
TWI554876B (en) Method for processing node replacement and server system using the same
JPH09223046A (en) Computer system having damp collecting function
WO2018036318A1 (en) Method and device for collecting abnormality information during startup of operating system
CN113645056B (en) Method and system for positioning fault of intelligent network card
JP2010102441A (en) Information processing apparatus and information processing program
US20230350755A1 (en) Coordinated operating system rollback
US20240036896A1 (en) Generating installation images based upon dpu-specific capabilities
CN114327972A (en) Data processing method and device based on solid state disk

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination