System on chip, debugging method and device thereof, electronic equipment and storage medium
By introducing debug registers and inter-core communication components into the system-on-a-chip, the storage and transmission of error location information were realized, solving the problem of peripheral errors being unable to be located in multiprocessor architectures and improving the stability and reliability of the system.
Patent Information
- Application Number
- CN202411112778.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-26
AI Technical Summary
In a multi-processor architecture system-on-a-chip, when a peripheral device malfunctions, the first processor cannot obtain the relevant information, leading to a decrease in system stability and reliability.
By introducing a first debug register and a second processor into the system-on-a-chip, the storage and transmission of error location information are realized using the inter-core communication component. The second processor stores the error location information in the memory so that the first processor can access it. It supports heartbeat and interrupt mechanisms to ensure the timeliness and accuracy of information transmission.
This improves the stability and reliability of the on-chip system, allowing the first processor to locate problems and take remedial measures in a timely manner, thus avoiding an increase in system risk.
Smart Images

Figure CN119025318A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of chip technology, and in particular to a system on chip and a debugging method, device, electronic device and storage medium thereof. Background Art
[0002] The multi-processor architecture of System on a Chip (SoC) integrates multiple processor cores on a single chip to achieve higher performance, lower power consumption, and more compact system design. This architecture is often used in applications that need to process a large number of parallel tasks or require higher computing power. In the multi-processor architecture of the system on a chip, each processor core can run programs and perform tasks independently, and communicate and collaborate through shared memory or other communication mechanisms.
[0003] For multi-processor system-on-chip (SoC) at stages such as customer applications, certain system information (e.g., device information, etc.) will be completely taken over by a specific processor for security reasons. After an error occurs, the system cannot obtain the cause of the error related to such information and cannot locate the problem point, which increases system risks and affects system stability. Summary of the invention
[0004] In view of this, the present disclosure provides a system on chip and a debugging method, device, electronic device and storage medium thereof, which can facilitate each processor to find errors and locate problem points in a multi-processor architecture to improve system stability.
[0005] According to a first aspect of the present disclosure, a debugging method for a system on chip is provided, the system on chip comprising a first processor, a second processor, a memory and a first debugging register, wherein the first debugging register and the memory can be accessed by the first processor and the second processor;
[0006] The method includes: in response to a first error, the second processor stores error location information of the first peripheral device into the memory according to a memory address pre-configured in the first debug register, so that the error location information of the first peripheral device can be obtained by the first processor, and the first debug register and the first error are both related to the first peripheral device.
[0007] In some implementations of the first aspect of the present disclosure, the second processor stores error location information of the first peripheral into the memory according to the memory address pre-configured in the first debug register, including: the second processor arranges multiple error location information of the first peripheral in sequence in the memory space pointed to by the memory address.
[0008] In some implementations of the first aspect of the present disclosure, the second processor stores error location information of the first peripheral into the memory according to the memory address pre-configured in the first debug register, including: the second processor determines the offset memory address according to the current value of the offset flag in the first debug register and the memory address, and writes the error location information into the memory space pointed to by the offset memory address.
[0009] In some implementations of the first aspect of the present disclosure, the second processor determines the offset memory address according to the current value of the offset flag bit in the first debug register, including:
[0010] The second processor reads the value of the offset flag bit in the first debug register and the memory address;
[0011] When the value of the offset flag indicates that an offset is required, determining the offset according to the length of the error location information written in the storage space pointed to by the memory address;
[0012] An offset is added to the memory address to obtain an offset memory address.
[0013] In some implementations of the first aspect of the present disclosure, the error location information of the first peripheral device includes one or more of the following:
[0014] Register information, the register information including a register address and a register value;
[0015] Debugging information, the debugging information includes a type identifier, a peripheral identifier and information content, and the type identifier is used to indicate the type of the debugging information.
[0016] In some implementations of the first aspect of the present disclosure, the system on chip also includes: a first interrupt register, the first interrupt register corresponding to the first peripheral; the method also includes: the second processor writes the interrupt control bit of the first interrupt register to trigger a first interrupt request; in response to the first interrupt request, the first processor accesses the first debug register to obtain a memory address, and reads error location information of the first peripheral from the memory according to the memory address.
[0017] In some implementations of the first aspect of the present disclosure, the method further comprises:
[0018] The second processor periodically detects a heartbeat flag bit pre-configured in the first debugging register, where the heartbeat flag bit is used to indicate whether the first processor is down;
[0019] In response to the heartbeat flag indicating that the first processor is down, the second processor reads error location information of the first peripheral device from the memory according to the memory address configured in the first debug register and outputs the error location information to the debug serial port.
[0020] In some implementations of the first aspect of the present disclosure, the further includes: in response to the heartbeat flag indicating that the first processor is down, the second processor reads information of part or all of the registers in the register group of the first peripheral controller and outputs it to the debugging serial port.
[0021] According to a second aspect of the present disclosure, a debugging device is provided, wherein the debugging device is deployed in a system on chip, wherein the system on chip includes a first processor, a second processor, a memory and a first debugging register, wherein both the first debugging register and the memory can be accessed by the first processor and the second processor; the debugging device includes: an error reporting unit, wherein the error reporting unit is used to store error location information of a first peripheral device into the memory in response to a first error according to a memory address preconfigured in the first debugging register, wherein both the first debugging register and the first error are related to the first peripheral device.
[0022] According to a third aspect of the present disclosure, a system on chip is provided, comprising: a first processor, a second processor, a memory and a first debug register, wherein the first debug register and the memory can both be accessed by the first processor and the second processor; the second processor is used to, in response to a first error, store error location information of a first peripheral device into the memory according to a memory address preconfigured in the first debug register, so that the error location information of the first peripheral device can be acquired by the first processor, and the first debug register and the first error are both related to the first peripheral device.
[0023] In some embodiments of the second aspect of the present disclosure, the on-chip system includes an inter-core communication component, the first processor and the second processor communicate through the inter-core communication component, the inter-core communication component includes multiple register groups, different register groups correspond to different peripherals, each of the register groups includes a debug register, and the register group corresponding to the first peripheral includes the first debug register.
[0024] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a memory storing a program, wherein the program comprises instructions, and when the instructions are executed by the processor, the processor executes the above method.
[0025] According to a fifth aspect of the present disclosure, there is provided a computer-readable storage medium storing a program, wherein the program includes instructions, and when the instructions are executed by a processor, the processor executes the above method.
[0026] It can be seen from the above technical scheme that in the embodiment of the present disclosure, when an error occurs in a peripheral device, the second processor can store the error location information of the peripheral device into the memory by reading the pre-configured memory address in the debug register of the peripheral device. Since the memory and the debug register can be accessed by the first processor and the second processor, the first processor or the second processor can timely access the memory based on the memory address in the debug register as needed to read the error location information of the peripheral device for subsequent error analysis and problem location. In this way, the first processor or the debugger can analyze the cause of the error through the error location information, locate the problem point, and take timely remedial measures for the error, thereby improving the stability and reliability of the system on chip without changing the original multi-processor architecture of the system on chip. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 An exemplary architecture diagram of a system on a chip applicable to the embodiments of the present disclosure;
[0029] Figure 2 A flowchart of a system-on-chip debugging method provided by an embodiment of the present disclosure;
[0030] Figure 3 A schematic diagram of a specific implementation process of the system-on-chip debugging method involved in an embodiment of the present disclosure;
[0031] Figure 4 It is a schematic diagram of the debugging process of the first processor under normal circumstances involved in the embodiment of the present disclosure;
[0032] Figure 5 A schematic diagram of a debugging process when a first processor is down in an embodiment of the present disclosure;
[0033] Figure 6 A modular structural block diagram of a debugging device provided in an embodiment of the present disclosure;
[0034] Figure 7 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0036] The terms used in the embodiments of the present disclosure are only for the purpose of describing specific embodiments, and are not intended to limit the present disclosure. The singular forms "a", "said" and "the" used in the embodiments of the present disclosure and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0037] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0038] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0039] Terminology explanation:
[0040] RV core: a processor core based on the RISC-V instruction set architecture. RISC-V is an open instruction set architecture (ISA) based on the principles of Reduced Instruction Set Computing (RISC). The design of RISC-VISA is concise, modular, and scalable, and can support different application requirements. It defines a set of basic instruction sets and also provides standard extensions, such as floating point, vector, encryption, etc., so that users can choose the appropriate instruction set extension according to their needs. The second processor of the disclosed embodiment is constructed using the RV core.
[0041] ARM (Advanced RISC Machine): is a Reduced Instruction Set Computing (RISC) Instruction Set Architecture (ISA) designed by ARM Holdings of the United Kingdom. This architecture was first introduced in 1983 and has been widely used since then.
[0042] Peripherals: External hardware devices connected to the SoC, including but not limited to serial port devices, audio devices, storage devices, etc.
[0043] First peripheral: any type of peripheral or any one peripheral.
[0044] First error: corresponds to the error of the first peripheral.
[0045] First debug register: corresponds to the debug register of the first peripheral.
[0046] Overview
[0047] If the system on chip includes a first processor and a second processor, for security reasons, the peripheral information of the system on chip (for example, peripheral drivers, addition and deletion of peripherals, etc.) may be completely taken over by the second processor. After an error occurs in the system, the first processor will not be able to obtain the cause of the error related to such information and will not be able to locate the problem point, resulting in increased system risk and affecting system stability. In view of this, the embodiments of the present disclosure provide the following system on chip and its debugging method, device, electronic device and storage medium.
[0048] System on Chip
[0049] An embodiment of the present disclosure provides a system on chip, which includes a first processor, a second processor, a memory, and a first debug register. Both the debug register and the memory can be accessed by the first processor and the second processor.
[0050] The system on chip may include multiple debug registers, different debug registers may correspond to different peripherals, the first debug register is a debug register corresponding to the first peripheral among the multiple debug registers, and the structure of multiple debug registers may effectively avoid read-write conflicts.
[0051] Among them, the second processor can be used to respond to the first error and store the error location information of the first peripheral into the memory according to the memory address pre-configured in the first debug register, so that the error location information of the first peripheral can be obtained by the first processor, and the first debug register and the first error are both related to the first peripheral.
[0052] Figure 1 FIG. 1 shows an exemplary architecture diagram of a system on a chip provided by an embodiment of the present application. Figure 1 As shown, the system on chip 100 may include: a first processor, a second processor, a memory (not shown in the figure) and an inter-core communication component. The first processor and the second processor communicate through the inter-core communication component, and the memory can be accessed by the first processor and the second processor.
[0053] The memory may be a memory of a system on chip, or may be other memory built into the system on chip. For example, because DDR has a higher data transmission rate and efficiency, and can transmit data twice in each clock cycle, providing a higher bandwidth, the memory of the embodiment of the present disclosure is preferably a double data rate synchronous dynamic random access memory (DDR, Double Data Rate Synchronous Dynamic Random Access Memory) or the like. It is understandable that the memory may also be any other type of random access memory (RAM), such as a static random access memory (SRAM, Static Random Access Memory), a synchronous dynamic random access memory (SDRAM, Synchronous Dynamic Random Access Memory), a dynamic random access memory (DRAM, Dynamic Random Access Memory), etc., and this is not limited by the embodiment of the present disclosure.
[0054] The first processor may be a single-core processor or a multi-core processor, and the core of the first processor may be, but is not limited to, an ARM core, an RV core, or various other types of processor cores.
[0055] The second processor may be a single-core processor. The second processor may adopt a processor core based on the RISC-V instruction set architecture (referred to herein as RV core), an ARM core, or the same processor core as the first processor.
[0056] The communication between the first processor and the second processor may be implemented, for example, through an inter-core communication component, a low-speed serial bus, a high-speed serial bus, or any other feasible manner, wherein the inter-core communication component may include but is not limited to a register file (regfile), a shared memory group (share mem, shared memory), and the like.
[0057] When multiple peripherals use a register group at the same time, conflicts often occur. To avoid such conflicts, in one example, multiple register groups can be set in the inter-core communication component, and different register groups correspond to different peripherals. Among them, the register groups in the inter-core communication component and the peripherals can correspond one to one, one to many, or many to one. For example, multiple register groups are set in the inter-core communication component, each register group corresponds to a peripheral, and different register groups correspond to different peripherals.
[0058] Each register group includes an interrupt register, and the register group corresponding to the first peripheral includes a first interrupt register. In the embodiment of the present disclosure, in order to facilitate debugging of the system on chip, each register group also includes a debug register, and the register group corresponding to the first peripheral includes a first debug register. For specific details about the debug register, please refer to the method section below, which will not be repeated here.
[0059] Similarly, in an example, multiple shared memory groups can be set in the inter-core communication component, each shared memory group corresponds to a peripheral, and different shared memory groups correspond to different peripherals.
[0060] See also Figure 1 , the peripherals of the SoC may include but are not limited to serial port devices, audio devices, storage devices, etc. The embodiments of the present disclosure do not limit the types and quantities of the peripherals of the SoC.
[0061] Exemplarily, the first processor may adopt a large core, and the second processor may adopt a small core. The first processor may serve as the main processor of the system on chip, and the second processor may serve as the slave processor of the system on chip. All kinds of tasks in the application layer of the system on chip may be handled by the first processor, and the second processor may be used to execute related processing of specific components in the system on chip, such as peripherals, input and output interfaces, etc.
[0062] In some embodiments, see Figure 1 The first processor can be used to execute application layer tasks, and preferably a multi-core processor is used, including but not limited to core 1, core 2, ..., core n, where n is an integer greater than 2, and the cores in the first processor can be the same or different.
[0063] In some embodiments, see Figure 2 The second processor may be a processor (IOP, IO Processor) for processing input and output (I / O) operations, which may be used to manage external hardware devices (hereinafter referred to as peripherals) of the SoC. The second processor may directly access the peripherals, and the first processor may complete access operations to the peripherals by communicating with the second processor.
[0064] See also Figure 1 The second processor can integrate, have built-in or externally connect various types of peripheral controllers (also called peripheral controller interfaces). The processor core of the second processor can be connected to the peripheral controllers through the internal bus of the second processor. These peripheral controllers can communicate with corresponding external hardware devices through different standard bus protocols. Thus, the processor core of the second processor can interact with the peripherals through the peripheral controllers.
[0065] See also Figure 1, the peripheral controller may include but is not limited to: Universal Asynchronous Receiver-Transmitter (UART), Inter-Integrated Circuit (I2C), Serial Peripheral Interface (SPI), High Definition Audio (HAD), Secure Digital / Multimedia Card (SD / MMC), Gigabit Media Access Control (GMAC), Neural Processing Unit (NPU), Inter-IC Sound (I2S), Coder-Decoder (CODEC), Enhanced Serial Peripheral Interface (eSPI), etc. In specific applications, the peripheral controller integrated, built-in or connected to the second processor can also be flexibly expanded according to the needs of actual applications, and the embodiments of the present disclosure do not limit this.
[0066] UART can be used for serial data transmission between computer systems and external devices, and is used to connect peripherals such as modems and serial printers.
[0067] I2C can be used to connect communications between integrated circuits and to connect peripherals such as sensors, storage, and displays.
[0068] SPI can be used for high-speed data transmission between computer systems and external devices, and is used to connect peripherals such as flash memory, sensors, and displays.
[0069] HAD can be used to connect audio devices as peripherals (such as speakers, microphones, sound cards, etc.) to achieve high-definition audio transmission and processing.
[0070] SD / MMC can be used to connect external storage devices (i.e., peripherals) such as flash memory cards and multimedia cards, and is used in digital cameras, mobile phones, etc. GMAC is used to connect computer systems to Gigabit Ethernet networks to achieve high-speed network communications.
[0071] NPU can be used to perform artificial neural network calculations for deep learning and artificial intelligence applications.
[0072] I2S can be used to connect peripherals such as audio codecs and digital signal processors to achieve high-quality audio transmission. CODEC is used for encoding and decoding of digital signals and is used in audio and video processing.
[0073] eSPI is used to connect computer systems and peripherals, supporting high-speed data transmission and function expansion.
[0074] It should be noted that although Figure 1 The peripheral controller is in the second processor, but those skilled in the art should understand that in a specific application, the peripheral controller can be arranged outside the second processor as needed.
[0075] The system on chip 100 of the embodiment of the present disclosure may include other processors in addition to the aforementioned first processor and second processor. Figure 1 , the system on chip 100 may also include a third processor, which may also be used as a slave processor, and may be used to perform processing such as system control and security tasks, the security tasks may include but are not limited to encryption and decryption, security authentication, etc., and the system control may include but is not limited to system power on and off, system configuration, etc. The third processor may communicate with the first processor through an inter-core communication component between itself and the first processor, and the inter-core communication component may include but is not limited to shared memory, etc.
[0076] It should be noted that the above system 100 is only for illustration, and the system architecture applicable to the embodiments of the present disclosure is not limited thereto. It should be understood by those skilled in the art that the following methods, devices, etc. of the embodiments of the present disclosure may also be applicable to other forms of on-chip systems, as long as the on-chip system includes two processors, the following methods and devices of the embodiments of the present disclosure may be applicable.
[0077] Exemplary Methods
[0078] Figure 2 FIG. 2 is a flow chart of a system-on-chip debugging method 200 provided in an embodiment of the present disclosure. Figure 2 The system-on-chip debugging method 200 provided in the embodiment of the present disclosure may include the following steps:
[0079] Step 202: In response to the first error, the second processor stores error location information of the first peripheral device into a memory according to a memory address preconfigured in the first debug register, so that the error location information of the first peripheral device can be acquired by the first processor.
[0080] According to the method of the embodiment of the present disclosure, when an error occurs in a peripheral device, the second processor can store the error location information of the peripheral device into the memory by reading the memory address pre-configured in the debug register of the peripheral device. Since both the memory and the debug register can be accessed by the first processor and the second processor, the first processor or the second processor can read the memory address from the debug register in a timely manner to access the memory as needed, thereby reading the error location information of the peripheral device for subsequent error analysis and problem location. In this way, the first processor or the debugger can analyze the cause of the error through the error location information, locate the problem point, and take timely remedial measures for the error, thereby improving the stability and reliability of the system on chip without changing the original multi-processor architecture of the system on chip.
[0081] The first debug register and the first error are both related to the first peripheral. It should be noted that, in this article, the first peripheral refers to any one of all the peripherals of the system on chip, and the first debug register refers to the debug register corresponding to the first peripheral. Specifically, if the system on chip is provided with multiple debug registers, and each peripheral is provided with a corresponding debug register, then the first debug register is a dedicated debug register for the first peripheral. If the system on chip is provided with only one debug register, and all peripherals or multiple peripherals share one debug register, then the first debug register is a debug register responsible for storing information such as the memory address of the first peripheral.
[0082] In the method of the embodiment of the present disclosure, the memory address of the first peripheral is pre-configured in the first debugging register corresponding to the first peripheral, which can effectively avoid conflicts caused by multiple peripherals accessing one register at the same time and improve efficiency.
[0083] Figure 3 FIG. 2 is an example diagram showing a specific implementation process of the on-chip system debugging method 200 according to an embodiment of the present disclosure. Figure 3Assume that there are 6 peripherals, namely Dev1, Dev2, ..., Dev6, the first processor includes 6 corresponding peripheral driver modules (represented as Dev1, Dev2, ..., Dev6), the second processor is integrated or connected with 6 corresponding peripheral controllers (also represented as Dev1, Dev2, ..., Dev6), the system on chip also has debug registers corresponding to the 6 peripherals (respectively represented as Dev1, Dev2, ..., Dev6), and the system on chip debugging method 200 of the embodiment of the present disclosure is applied to the system on chip of the structure, and the log containing the error location information can be formatted and stored in DDR (i.e., the memory in the previous text), and the logs of the 6 peripherals in DDR correspond to 6 different storage spaces (respectively represented as Dev1, Dev2, ..., Dev6), and the first processor can capture the log of a peripheral from DRR when needed and clear the corresponding space in DDR, thereby realizing the real-time acquisition of the 6 peripheral related errors by the first processor.
[0084] In step 201, the "first error" refers to an error related to the first peripheral device. The peripheral device related errors may include but are not limited to: protocol parsing error, peripheral device driver error, peripheral device controller error, interrupt exception, stack exception, RTOS error, etc.
[0085] Specifically, a protocol parsing error refers to an error that occurs when a peripheral controller attempts to parse received data according to a predetermined protocol rule in network communication or an application, but cannot correctly complete the parsing process for some reason. A peripheral driver error refers to an error caused by a driver problem when a peripheral controller interacts with an external device (such as a printer, scanner, hard disk, etc.). An interrupt exception refers to an interrupt exception related to a peripheral controller, which includes but is not limited to: interrupt loss, interrupt conflict, interrupt delay, software interrupt exception, hardware interrupt exception, etc. A controller error refers to an error in which a peripheral controller cannot work properly due to a hardware failure or software problem. A stack exception refers to an error caused by insufficient stack space or improper stack operation during program execution. A real-time operating system (RTOS) is a special type of operating system designed specifically for real-time task processing. It focuses more on the guarantee of real-time performance, ensuring that the system can respond to external events accurately and promptly under strict time constraints. An RTOS error refers to an error that occurs during the operation of the RTOS.
[0086] The error location information of the peripheral device depends on the error type. The error location information of the peripheral device is usually included in the log. In view of this, in some embodiments of the present disclosure, in step 201, the error location information of the first peripheral device may include log information related to the first peripheral device, or may be a part of the log information related to the first peripheral device that can be used for error analysis and problem location, and may also include information obtained by parsing the log information related to the first peripheral device that can be used for error analysis and problem location. Among them, the log information related to the first peripheral device may include but is not limited to the operation log of the peripheral controller of the first peripheral device, the log of the interaction between the core of the second processor and the peripheral controller of the first peripheral device, etc. The specific content of the error location information of the peripheral device is not limited in the embodiments of the present disclosure.
[0087] In some implementations, the error location information of the embodiments of the present disclosure may include, but is not limited to: register information, debugging information, etc. Among them, the register information includes the register address and the register value, the debugging information may include a type identifier, a peripheral identifier, and information content, the type identifier may be used to indicate the type of debugging information, the information content may be generated according to the error that occurs in the peripheral controller, and the peripheral identifier may be the identifier of the peripheral itself (for example, the peripheral name, the peripheral ID, the peripheral number, etc.), or the identifier of the peripheral controller (for example, the name, ID, number, etc. of the peripheral controller).
[0088] To reduce the physical space occupied by the error location information, the error location information can be written into the memory in the form of an ASCII code string. Specifically, in step 201, the second processor first formats the error location information into an ASCII code string, and then the second processor writes the ASCII code string obtained by formatting the error location information into the corresponding memory space according to the memory address pre-configured in the first debug register.
[0089] In some implementations, the second processor may format the error location information using, for example, a C language formatting function or other similar methods. The embodiment of the present disclosure does not limit the formatting method of the error location information.
[0090] The format of the error location information in the embodiment of the present disclosure is exemplarily described below.
[0091] Table 1 shows an exemplary format of register information. Referring to Table 1, the size of the register identifier is fixed at 5 bytes (B), the register address is of variable length, the size of the symbol is fixed at 1B, the register value is of variable length, and the size of the line terminator is fixed at 1B.
[0092] Logo address symbol value Space address symbol value Space Line terminator 5B Indefinite length 1B Indefinite length 1B Indefinite length 1B Indefinite length 1B 1B
[0093] Table 1
[0094] Exemplarily, a piece of register information can be expressed as follows: "[REG] Register address 1: Register value 1 + space + Register address 2: Register value 2 + space..." For example, assuming a piece of register information is "0x10: 0x18 0x14: 0x26", it means the following: the value of register 0x10 is 0x18, and the value of register 0x14 is 0x26.
[0095] Table 2 shows an exemplary format of debugging information. Referring to Table 2, the debugging information may include fields such as identification, module name, symbol, formatted string, and line terminator.
[0096] Logo Peripheral name symbol The formatted string Line terminator 5B Indefinite length 1B Indefinite length 1B
[0097] Table 2
[0098] Exemplarily, debugging information can be expressed in the following forms: [ERR] string, [DBG] string, etc. Among them, the characters in "[]" indicate the information type of debugging information, "ERR" indicates error information, and ERR can be used to mark the error location in the program; "DEG" indicates debugging information, and in Python code, DBG can be used to mark debugging information, such as output-debug statements, etc., which can help developers track the execution flow of the program, the value of variables, the call of functions and other information.
[0099] For example, a piece of debugging information can be expressed as "[DBG]dev1:hello888", "DEG" is the type identifier, "dev1" is the peripheral identifier, and "hello888" is the information content of the debugging information.
[0100] The length of the ASCII code string written into the memory is the sum of the length of the ASCII code string and the length of the terminator. For example, the debugging information "[DBG]dev1:hello888" in the previous text is the ASCII code string obtained after the debugging information is formatted. The length written into the memory is the length of the ASCII code string 18 plus the length of the terminator 1, that is, 19.
[0101] Before step 201, it may also include: the second processor configures a memory address in the first debug register. The memory address may be related to the first peripheral. Specifically, different memory addresses may be configured for different peripherals, and different memory addresses may point to different storage spaces in the memory. In other words, each peripheral may correspond to a storage space in the memory, and the address of the storage space is the memory address corresponding to the peripheral. Thus, the error location information of each peripheral will be written into the storage space corresponding to the peripheral in the memory, which can avoid read-write conflicts between multiple peripherals, facilitate debugging related to multiple peripherals for the on-chip system at the same time, and improve the processing efficiency of debugging and the space utilization of the memory.
[0102] Those skilled in the art should understand that the same memory address can be configured for multiple peripherals according to various factors such as the requirements of the actual application scenario and the hardware configuration, so as to save storage space and reduce hardware costs.
[0103] Both the first processor and the second processor can obtain the memory address of a peripheral by accessing the debug register of the peripheral. In a specific application, the same debug register can correspond to one or more peripherals and is used to store information such as the memory addresses of these peripherals. Preferably, in order to avoid conflicts when multiple peripherals are accessed at the same time, each peripheral can be set with a debug register, that is, the debug register and the peripheral can be in a one-to-one correspondence, and one debug register is dedicated to storing information such as the memory address of one peripheral.
[0104] The correspondence between the peripherals and the debug registers can be expressed as a "mapping relationship between the peripheral identifier (e.g., peripheral ID, peripheral name, peripheral number, etc.) and the debug register address", and the mapping relationship can be pre-configured in the second processor and the first processor. When an error occurs in a peripheral, the second processor can directly access the corresponding debug register by reading the mapping relationship of the peripheral, thereby executing the processing of step 201.
[0105] In addition to storing the memory address, the debug register can also store other information related to the peripherals and debugging. In some examples, the debug register can also be configured with one or more of the following: 1) offset information indicating whether there is error location information in the space corresponding to the memory address; 2) heartbeat information indicating whether the first processor is down; 3) heartbeat enable information indicating whether the heartbeat mechanism of the current peripheral is turned on; 4) debug enable information indicating whether the debug function of the peripheral controller of the current peripheral is turned on. 5) The size of the physical space occupied by the peripheral obstacle information in the memory; 6) custom information.
[0106] In a specific application, the memory address and other information of the peripheral can be stored by configuring the bits in the debug register. For example, the following Table 3 shows an example of field configuration of a debug register, in which the debug register has 32 bits (bit0 to bit31) and contains 6 fields (debug_enable, alive_enable, alive, have_log, size(k), DDR_addr, Reserve).
[0107]
[0108] Table 3
[0109] Bit 0 is a debug enable bit (debug_enable), and the debug enable bit and its value are the debug enable information described above. The first processor can write the value of the debug enable bit in the debug register to turn on or off the debug function of the peripheral. Specifically, when debug_enable is set to 0, the debug function related to the current peripheral is turned off, and when debug_enable is set to 1, the debug function related to the current peripheral is turned on.
[0110] Bit 1 is a heartbeat enable bit (alive_enable), and the heartbeat enable bit and its value are the aforementioned heartbeat enable information. The first processor can turn on or off the heartbeat mechanism of the corresponding peripheral by rewriting the heartbeat enable bit in the debug register. Specifically, when alive_enable is set to 0, the heartbeat mechanism related to the current peripheral is turned off, and when alive_enable is set to 1, the heartbeat mechanism related to the current peripheral is turned on.
[0111] Bit 2 is a heartbeat flag, and the heartbeat flag and its value are the aforementioned heartbeat information. The heartbeat flag can maintain the heartbeat mechanism between the first processor and the second processor. Specifically, the first processor regularly sets the heartbeat flag from 0 to 1, and the second processor regularly sets the heartbeat flag from 1 to 0. Thus, the first processor and the second processor can maintain the heartbeat mechanism through the heartbeat flag in the debug register, so that the second processor can know in real time whether the first processor is down or normal.
[0112] Bit 3 is the offset flag (have_log), the function of which is to identify whether the second processor starts recording the error location information of the peripheral device after the memory address is offset. Specifically, the value of the offset flag is the aforementioned offset information. If the value of the offset flag is the initial value, i.e., 0, it indicates that there is no error location information of the peripheral device in the memory space corresponding to the memory address. At this time, the second processor can start recording the error location information of the peripheral device from the memory address. If the value of the offset flag is a non-initial value, i.e., 1, it indicates that there is error location information of the peripheral device in the memory space corresponding to the memory address. The second processor can start recording the current error location information of the peripheral device after offsetting a certain amount (for example, the length of the error location information in the memory space pointed to by the memory address) based on the memory address. In a specific application, after the error location information in the memory space corresponding to the memory address is cleared, the first processor can restore the value of the offset flag to the initial value.
[0113] Bit 4 to bit 7 (bit 4 to bit 7) are size flags (size(k)), and the value of the size flag indicates the size of the storage space occupied by the peripheral error location information in the memory. Specifically, the value of the size flag can be specified by the second processor, and the first processor can read the value of the size flag.
[0114] Bit8 to bit29 (bit 8 to bit 29) is the storage address bit (DDR_addr), and the value of the storage address bit is the aforementioned memory address, which can be the entire domain or a partial domain of the physical address base address of the memory. In one example, the memory address represented by the value of the storage address bit can be the upper 22 bits of the physical address base address used to store peripheral error location information. In a specific application, the value of the storage address bit (i.e., the memory address of the peripheral) can be specified by the second processor, and the first processor can read the value of the storage address bit (i.e., the memory address of the peripheral).
[0115] Bit30 to bit31 (bit 30 to bit 31) are reserved bits (Reserve), and the value of the reserved bits is the aforementioned custom information.
[0116] Exemplarily, assuming that the system on chip has 6 peripherals (Dev1 to Dev6), 6 debug registers may be correspondingly provided in the system on chip, and the addresses of the 6 debug registers are respectively: Addr1 to Addr6, then the field configuration in each debug register may be as shown in Table 4 below.
[0117]
[0118] Table 4
[0119] In the examples of Table 3 and Table 4, Addr1 represents the debug register address of peripheral Dev1, Addr2 represents the debug register address of peripheral Dev2, and so on. The size flag bit of each peripheral is set to "8".
[0120] In some implementations, in step 201, in response to the first error, when the debug enable bit pre-configured in the first debug register indicates that the debug function of the first peripheral is turned on, the second processor writes the error location information of the first peripheral into the corresponding memory space according to the memory address pre-configured in the first debug register. If the debug enable bit pre-configured in the first debug register indicates that the debug function of the first peripheral is turned off, the second processor may not perform the operation of "writing the error location information of the first peripheral into the corresponding space in the memory".
[0121] In a specific application, the value of the debug enable bit in the first debug register can be rewritten by the first processor and / or the second processor in response to user instructions, task instructions and other information. Thus, the debugging function of one or more peripherals can be flexibly controlled to be turned on or off by rewriting the debug enable bit in combination with various factors such as the requirements of actual application scenarios and user requirements.
[0122] To avoid read-write conflicts, in step 201, when storing the error location information of the first peripheral into the memory, the second processor can arrange multiple pieces of error location information of the first peripheral in order in the memory space pointed to by the memory address. Thus, a large amount of error location information can be stored in order in the memory, effectively avoiding read-write conflicts, realizing parallel reading and writing of error location information, and improving the debugging efficiency of the system on chip.
[0123] There are many specific implementations for the second processor to sequentially arrange multiple pieces of error location information of the first peripheral in the memory space pointed to by the memory address. For example, the size of the physical space occupied by each piece of error location information in the memory and the first address of the memory space can be preset. For another example, an offset flag bit can be set in the debug register, and the memory address can be automatically offset through the offset flag bit, thereby realizing the orderly storage of multiple pieces of error location information.
[0124] In some implementations, in step 201, the second processor may determine the offset memory address according to the current value of the offset flag bit in the first debug register and the memory address, and write the error location information into the corresponding space in the memory pointed to by the offset memory address. Thus, the error location information of the peripheral device may be written to the corresponding space of the memory in an orderly manner by setting the offset flag bit in the debug register, effectively avoiding read-write conflicts, reducing the error probability of the error location information written into the memory, and improving the accuracy of the error location information in the memory.
[0125] Specifically, the second processor reads the value of the offset flag bit in the first debug register and the memory address, and when the value of the offset flag bit indicates that an offset is required, determines the offset amount according to the length of the existing error location information in the memory space pointed to by the memory address, and adds the offset amount to the memory address to obtain the offset memory address. Thus, the offset memory address can be obtained efficiently, quickly and automatically by setting the offset flag bit in the debug register, avoiding read-write conflicts when multiple error location information of the same peripheral device or multiple error location information of different peripheral devices are written into the memory.
[0126] For example, the initial value of the offset flag have_log is set to 0, indicating that the memory space pointed to by the memory address in the initial state does not have the error location information of the peripheral, and the Ascii code string "[DBG]dev1:hello888" representing the first error location information of the current peripheral is written to the memory space pointed to by the memory address "addr1+0". At this time, the length of the Ascii code string written is 19. After that, the offset flag is set to 1, and the offset value (the offset value can be recorded in the offset flag or calculated in real time) can be determined to be 19. After that, the offset "19" is added to the memory address "addr1" to obtain the offset memory address, and then the Ascii code string "[REG]0x26fe0010:0x18 0x26fe0014:0x26" representing the second error location information of the current peripheral is written to the memory space pointed to by the offset memory address. The length of the Ascii code string written this time is 36+1=37, 36 is the original length of the Ascii code string, then the offset flag is kept set to 1, and the offset value is updated to "19+37=56". After that, the offset "56" is added to the memory address "addr1" to obtain the offset memory address, and then the Ascii code string representing the third error location information of the current peripheral is written to the memory space pointed to by the offset memory address, and so on. This rule can be used to arrange the error location information of the peripherals in order in the memory space pointed to by the memory address.
[0127] In the embodiment of the present disclosure, after step 201, method 200 may further include: a step of the first processor acquiring error location information. Specifically, the step of the first processor acquiring error location information may be implemented in a variety of ways. For example, if the first processor can work normally, the first processor may read the error location information of the peripheral device from the memory. For example, if the first processor crashes, the second processor may send the error location information to the debugging serial port.
[0128] In some implementations, after step 201, method 200 may include: the second processor writes the interrupt control bit in the corresponding first interrupt register to trigger the first interrupt request, the first interrupt register corresponds to the first peripheral; and, in response to the first interrupt request, the first processor accesses the first debug register to obtain the memory address, and reads the error location information of the first peripheral from the memory according to the memory address. Thus, when the first processor is working normally, the second processor may initiate an interrupt, and the first processor reads the error location information of the peripheral from the memory in response to the interrupt, so as to perform error analysis and problem location through the error location information, and prompt the user so that the user can take remedial measures in time, thereby improving the stability and reliability of the system on chip.
[0129] The first processor may use the memory address or the offset memory address to read the error location information of the first peripheral device from the corresponding space of the memory. Specifically, the specific implementation method of the first processor reading the error location information of the first peripheral device from the memory is similar to the implementation method of the second processor storing the error location information of the first peripheral device in the memory, and will not be repeated.
[0130] Furthermore, in the above implementation, the method 200 may also include: after reading the error location information of the first peripheral device, the first processor may clear the error location information of the size of the value of the size flag in the first debug register in the memory space pointed to by the memory address or the offset memory address. Thus, the first processor may clear the error location information in a timely manner according to the size flag in the debug register, which not only reduces the space occupied by the error location information in the memory and improves the storage space utilization of the memory, but also clears according to the value of the size flag in the debug register to avoid erroneous clearing of other information.
[0131] In some implementations, after step 201, method 200 may further include: the second processor periodically detects a pre-configured heartbeat flag in the first debug register; in response to the heartbeat flag indicating that the first processor is down, the second processor reads the error location information of the first peripheral from the memory according to the memory address configured in the first debug register and outputs it to the debug serial port. In this way, when an error occurs in the system and the cause of the error cannot be obtained, the second processor can output the error location information of the peripheral to the debug serial port of the first processor immediately when it detects that the system is down (i.e., the first processor is down), thereby assisting the system debugging to locate the problem point.
[0132] Furthermore, the method 200 may also include: in response to the heartbeat flag indicating that the first processor is down, the second processor reads information of some or all registers in the register group of the first peripheral controller and outputs it to the debugging serial port. In this way, when the second processor detects that the system is down (i.e., the first processor is down), it can immediately output the register information of the peripheral to the debugging serial port of the first processor, thereby assisting the system debugging to locate the problem.
[0133] In some implementations, the second processor periodically detects the pre-configured heartbeat flag in the first debug register, which may include: the second processor first queries the heartbeat enable bit configured in the first debug register, and when the heartbeat enable bit indicates that the heartbeat mechanism of the first peripheral is turned on, the second processor periodically detects the heartbeat flag in the first debug register to timely discover the downtime of the first processor. If the heartbeat enable bit indicates that the heartbeat mechanism of the first peripheral is turned off, monitoring the heartbeat flag and subsequent operations may not be performed. In this way, the heartbeat enable bit can be set in the debug register to flexibly control the turning on and off of the heartbeat mechanism of a certain peripheral or some peripherals, so as to timely combine the heartbeat mechanism to complete the debugging of the system on chip.
[0134] In some implementations, the method 200 of the embodiment of the present disclosure may further include: the first processor periodically writes the heartbeat flag bit of the first debug register, so that the second processor can timely know whether the first processor is down through the value of the heartbeat flag bit. Thus, by setting the heartbeat flag bit in the debug register, a heartbeat mechanism between the first processor and the second processor can be implemented, so that the second processor can timely know whether the first processor is down.
[0135] The specific implementation of the embodiment of the present disclosure is exemplarily described below.
[0136] Embodiment 1
[0137] See also Figure 4 As shown, the exemplary specific implementation process of the on-chip system debugging method when the first processor works normally may include the following steps:
[0138] Step 401, the driver engine running in the core of the first processor rewrites the debug enable bit debug_enable in the first debug register to 1 to enable the debugging function related to the first peripheral;
[0139] Step 402, after the core of the second processor detects an error related to the first peripheral device, it writes the error location information of the first peripheral device into a designated space of the memory;
[0140] Specifically, after the core of the second processor detects an error regarding the first peripheral, the second processor queries the value of the debug enable bit in the first debug register and finds that the debug function regarding the first peripheral is turned on, then queries the storage address bit and the offset flag bit in the first debug register to obtain the memory address or the offset memory address, and writes the error location information of the first peripheral into the designated space of the memory based on the memory address or the offset memory address.
[0141] Step 403, the second processor writes the interrupt control bit of the first interrupt register to trigger a first interrupt request for the first peripheral device;
[0142] Step 404: the first processor retrieves error location information of the first peripheral device from a designated space of the memory in response to the first interrupt request.
[0143] Specifically, the first processor queries the storage address bit and the offset flag bit in the first debug register to obtain the memory address or the offset memory address, and reads the error location information of the first peripheral device from the designated space of the memory based on the memory address or the offset memory address.
[0144] Step 405, if necessary, after the first processor obtains the error location information, it can clear the information stored in the designated space of the memory;
[0145] Specifically, the first processor queries the value of the size flag in the first debug register, and uses the value of the size flag as the clear content size to clear the specified space of the memory (ie, the memory space pointed to by the memory address or the offset memory address).
[0146] Step 406: If the designated space of the memory is cleared, the first processor rewrites the value of the offset flag in the first debug register to restore the offset flag to an initial value.
[0147] As can be seen from the above, this embodiment provides an error feedback mechanism when the first processor is working normally. Through this error feedback mechanism, the second processor can provide the error location information of the peripheral device to the first processor through the memory in real time, so that the first processor can locate and analyze the cause of the error through the error location information of the peripheral device, so that the relevant programs can return to normal as soon as possible, thereby improving the stability and reliability of the on-chip system.
[0148] Embodiment 2
[0149] After the first processor crashes, the debugger may not be able to obtain the error location information in the memory in time to perform error analysis and problem location, nor can it view the register information of each peripheral after the crash, which will bring great difficulty to the debugging of the on-chip system.
[0150] See also Figure 5 As shown, an exemplary specific implementation process of the on-chip system debugging method when the first processor is down may include the following steps:
[0151] Step 501, the driver engine running in the core of the first processor rewrites the heartbeat enable bit in the first debug register to 1 to enable the second processor to detect the heartbeat;
[0152] Step 502, when the first processor is checked, write 1 to the heartbeat enable bit of the first debug register;
[0153] Step 503, the core of the second processor periodically detects the heartbeat enable bit in the first debug register;
[0154] Step 504: if the heartbeat enable bit value in the first debug register is 1, the core of the second processor rewrites the heartbeat enable bit in the first debug register to 0;
[0155] Specifically, if the core of the second processor detects that the heartbeat enable bit value in the first debug register is 1, the core of the second processor rewrites the heartbeat enable bit of the first debug register to 0, so that the heartbeat enable bit changes from 1 to 0, and returns to step 502. If the heartbeat enable bit value in the first debug register is 1, the heartbeat process of steps 502 to 504 is repeated;
[0156] Step 505, if the heartbeat enable bit value in the first debug register is 1, the core of the second processor determines that the first processor is down;
[0157] Step 506: the core of the second processor reads all error location information of the first peripheral device from the designated space of the memory and outputs it to the debugging serial port, and reads all register information of the first peripheral device and outputs it to the debugging serial port, so that the debugger can obtain all error location information of the first peripheral device and the register information of the first peripheral device through the debugging serial port to perform error analysis and problem location.
[0158] Step 507: After completing the above operations, the core of the second processor rewrites the debug enable bit in the first debug register to 0 to disable the debug function of the first peripheral device.
[0159] As can be seen from the above, this embodiment provides an error feedback mechanism in the event that the first processor crashes. In the error feedback mechanism, this embodiment adds a heartbeat mechanism (i.e., steps 502 to 505). The second processor can obtain the working status of the first processor in real time through the heartbeat mechanism. After determining that the first processor crashes through the heartbeat mechanism, the second processor can read the error location information of the peripheral device and the register information of the peripheral device and output them to the debugging serial port, so that the error location information and register information of the peripheral device can be obtained by the debugger together with the crash information of the first processor as auxiliary debugging information. The debugger can use this information to perform error analysis and problem location, and take remedial measures to enable the relevant programs to return to normal as soon as possible, thereby improving the stability and reliability of the on-chip system.
[0160] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0161] According to an embodiment of another aspect, a debugging device is provided. Figure 6 FIG. 1 is a schematic block diagram of a debugging device in the form of a computer program according to an embodiment, and the debugging device may be arranged in the aforementioned system on chip. Figure 6 As shown, the device 600 includes: an error reporting unit 601, etc. The main functions of each component unit are as follows:
[0162] The error reporting unit 601 may be configured to, in response to a first error, store error location information of a first peripheral device into the memory according to a memory address preconfigured in a first debug register, wherein both the first debug register and the first error are related to the first peripheral device.
[0163] In some embodiments, the device 600 may also include: an error reading unit 602 and an interrupt unit 603; wherein the interrupt unit 603 is arranged in the second processor, and is used to write the interrupt control bit of the first interrupt register to trigger the first interrupt request; the error reading unit 602 is arranged in the first processor, and is used to respond to the first interrupt request, access the first debug register to obtain the memory address, and read the error location information of the first peripheral from the memory according to the memory address.
[0164] In some embodiments, the device 600 may further include: a second heartbeat detection unit 604 and an error output unit 605; wherein the second heartbeat detection unit 604 is arranged in the second processor, and is used to periodically detect the heartbeat flag in the first debug register, and notify the error output unit when the heartbeat flag indicates that the first processor is down; the error output unit 605 is arranged in the second processor, and is used to respond to the heartbeat flag indicating that the first processor is down, and read the error location information of the first peripheral from the memory according to the memory address configured in the first debug register and output it to the debugging serial port.
[0165] In some implementations, the device 600 may further include: a first heartbeat detection unit 606, which is arranged in the first processor and is used to periodically rewrite the heartbeat flag in the first debug register so that the second processor can know whether the first processor is down.
[0166] In some implementations, the error output unit 605 may also be configured to read information of some or all registers in the register group of the first peripheral controller and output the information to the debugging serial port in response to the heartbeat flag indicating that the first processor is down.
[0167] The specific details of the functions of the above-mentioned components can be found in the previous method section and will not be repeated here.
[0168] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0169] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The program includes instructions. When the instructions are executed by one or more processors of a computing device, the steps of the method described in the aforementioned method embodiment are executed.
[0170] The present disclosure also provides an electronic device, such as Figure 7As shown, the electronic device 700 includes one or more processors 701, and also includes a memory 702 for storing one or more programs, which are executed by the one or more processors 701 to implement the method flow shown in the above embodiments of the present disclosure and / or the program units corresponding to each unit in the device.
[0171] The various components are interconnected using different buses and can be mounted on a common motherboard or in other ways as needed. The processor 701 can process instructions executed within the electronic device, including instructions stored in or on the memory to display graphical information of the user interface on an external input / output device (such as a display device coupled to the interface). In other embodiments, if desired, multiple processors and / or multiple buses can be used with multiple memories and multiple memories.
[0172] The processor 701 may include one or more single-core processors or multi-core processors. The processor 701 may include any combination of general-purpose processors or dedicated processors (such as image processors, application processors, baseband processors, etc.).
[0173] The memory 702 is a computer-readable storage medium provided by the present disclosure, which can be used to store non-transient software programs, non-transient computer executable programs and units, such as the following in the embodiments of the present disclosure: Figure 2 The processor 701 executes the non-transient software programs, instructions and units stored in the memory 702, thereby executing the above method embodiments. Figure 2 The programs, instructions and units corresponding to the methods shown.
[0174] The electronic device 700 may further include: an input device 703 and an output device 704. The processor 701, the memory 702, the input device 703 and the output device 704 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0175] The input device 703 can receive input digital or character information, and generate signal input related to user settings and function control related to the debugging device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 704 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0176] The above-mentioned programs (also referred to as software, software applications, or codes) include machine instructions for programmable processors, and these computer programs can be implemented using object-oriented programming languages, assembly or machine languages.
[0177] With the development of time and technology, the meaning of medium is becoming more and more extensive, and the propagation path of computer programs is no longer limited to tangible media, and can also be downloaded directly from the network, etc. Any combination of one or more computer-readable storage media can be used. Computer-readable storage media can be used but not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing programs, which can be used by or in combination with instruction execution systems, devices or devices.
[0178] The technical solution provided by the present disclosure is described in detail above. The principles and implementation methods of the present disclosure are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present disclosure. At the same time, for those skilled in the art, according to the idea of the present disclosure, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present disclosure.
[0179] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the present disclosure. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A debugging method for a system on chip, characterized in that: The system on chip includes a first processor, a second processor, a memory and a first debug register, wherein the first debug register and the memory can be accessed by the first processor and the second processor; The method includes: in response to a first error, the second processor stores error location information of the first peripheral device into the memory according to a memory address pre-configured in the first debug register, so that the error location information of the first peripheral device can be obtained by the first processor, and the first debug register and the first error are both related to the first peripheral device.
2. The method according to claim 1, characterized in that: The second processor stores the error location information of the first peripheral into the memory according to the memory address preconfigured in the first debug register, including: the second processor arranges multiple error location information of the first peripheral in sequence in the memory space pointed to by the memory address.
3. The method according to claim 2, characterized in that The second processor stores the error location information of the first peripheral into the memory according to the memory address pre-configured in the first debug register, including: the second processor determines the offset memory address according to the current value of the offset flag bit in the first debug register and the memory address, and writes the error location information into the memory space pointed to by the offset memory address.
4. The method according to claim 3, characterized in that The second processor determines the offset memory address according to the current value of the offset flag bit in the first debug register, including: The second processor reads the value of the offset flag bit in the first debug register and the memory address; When the value of the offset flag indicates that an offset is required, determining the offset according to the length of the error location information written in the storage space pointed to by the memory address; An offset is added to the memory address to obtain an offset memory address.
5. The method according to claim 1, characterized in that: The error location information of the first peripheral device includes one or more of the following: Register information, the register information including a register address and a register value; Debugging information, the debugging information includes a type identifier, a peripheral identifier and information content, and the type identifier is used to indicate the type of the debugging information.
6. The method according to any one of claims 1 to 5, characterized in that: The system on chip further includes: a first interrupt register, the first interrupt register corresponding to the first peripheral; The method further comprises: The second processor writes the interrupt control bit of the first interrupt register to trigger the first interrupt request; In response to the first interrupt request, the first processor accesses the first debug register to obtain a memory address, and reads error location information of the first peripheral device from the memory according to the memory address.
7. The method according to claim 1, characterized in that The method further comprises: The second processor periodically detects a heartbeat flag bit pre-configured in the first debugging register, where the heartbeat flag bit is used to indicate whether the first processor is down; In response to the heartbeat flag indicating that the first processor is down, the second processor reads error location information of the first peripheral device from the memory according to the memory address configured in the first debug register and outputs the error location information to the debug serial port.
8. The method according to claim 7, characterized in that Also includes: In response to the heartbeat flag indicating that the first processor is down, the second processor reads information of part or all of the registers in the register group of the first peripheral controller and outputs the information to the debugging serial port.
9. A debugging device, characterized in that: The debugging device is deployed in a system on chip, the system on chip includes a first processor, a second processor, a memory and a first debugging register, and the first debugging register and the memory can be accessed by the first processor and the second processor; The debugging device includes: an error reporting unit, which is used to store error location information of a first peripheral device into the memory according to a memory address preconfigured in a first debugging register in response to a first error, and the first debugging register and the first error are both related to the first peripheral device.
10. A system on chip, characterized in that: include: A first processor, a second processor, a memory and a first debug register, wherein the first debug register and the memory are both accessible by the first processor and the second processor; The second processor is used to store error location information of the first peripheral device into the memory according to the memory address preconfigured in the first debug register in response to the first error, so that the error location information of the first peripheral device can be obtained by the first processor, and the first debug register and the first error are both related to the first peripheral device.
11. The system on chip according to claim 10, characterized in that: The system on chip includes an inter-core communication component, the first processor and the second processor communicate through the inter-core communication component, the inter-core communication component includes multiple register groups, different register groups correspond to different peripherals, each of the register groups includes a debug register, and the register group corresponding to the first peripheral includes the first debug register.
12. An electronic device, characterized in that: include: A memory storing a program, the program comprising instructions which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 8.
13. A computer-readable storage medium storing a program, the program comprising instructions which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 8.
