Embedded debugging method and apparatus, and system

By monitoring and comparing information outside the controller chip through the information monitoring module and the comparison module, the problem of difficult online debugging in embedded software debugging is solved, and efficient debugging and dynamic white-box testing are realized, thereby improving the overall debugging and testing efficiency.

WO2026108469A1PCT designated stage Publication Date: 2026-05-28SHENZHEN KANGAO XINGYE TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/127814
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-11-22
Filing Date
2025-10-15
Publication Date
2026-05-28

AI Technical Summary

Technical Problem

Existing technologies for embedded software debugging of controller chips suffer from problems such as inability to debug online, high resource consumption, and low debugging efficiency, especially in situations where debuggers are not available during whole-machine testing and at customer sites. Furthermore, existing methods cannot simultaneously perform dynamic white-box testing and program optimization.

Method used

By employing an information monitoring module and a comparison module, information is captured by monitoring the information of the processor and other functional modules and setting preset trigger conditions, thus avoiding processor intervention and achieving efficient debugging and dynamic white-box testing.

Benefits of technology

In situations where online debugging is not available, this technology enables efficient debugging and dynamic white-box testing, avoiding resource consumption and program complexity, and improving debugging and testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025127814_28052026_PF_FP_ABST
    Figure CN2025127814_28052026_PF_FP_ABST
Patent Text Reader

Abstract

An embedded debugging method and apparatus, and a system. The method comprises: pre-configuring trigger information, the trigger information comprising a trigger data type, comparison content, and a trigger condition; on the basis of the pre-configured trigger data type, monitoring, by means of an information monitoring module, information received or sent by a processor and / or another functional module; by means of a comparison module, comparing the monitored corresponding information with the preset comparison content; and when the comparison result satisfies the preset trigger condition, performing corresponding processing. By using a real-time monitoring method, on the basis of triggering a preset trigger condition, corresponding information is stored or an interrupt signal is generated when the preset trigger condition is met, thereby quickly locating a program address of a related problem during debugging, achieving the purpose of high-efficiency debugging, or storing a related program address, achieving the purpose of software testing for a corresponding program, or storing related time information and testing time performance of a corresponding program, achieving the purpose of quickly optimizing the program.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus and system for embedded debugging Technical Field

[0001] This invention relates to a method, apparatus, and system for embedded debugging, particularly a method, apparatus, and system for debugging a controller chip and its software, and also includes a method, apparatus, and system for testing the controller chip and its software. Background Technology

[0002] With the development of chip technology, more and more functional modules are being integrated into chips. The amount of data processed by controller chips is increasing, and the programs that controller chips need to run are also becoming larger, potentially numbering in the hundreds of thousands or even millions. This presents the following requirements: if errors or exceptions occur during program execution, it is necessary to quickly locate the address of the erroneous program, i.e., efficient debugging; simultaneously, it is necessary to achieve the purpose of embedded software dynamic white-box testing (hereinafter referred to as software dynamic white-box testing); furthermore, it is also necessary to quickly achieve program optimization.

[0003] There are two common methods for debugging embedded software within controller chips: The first method involves using IDE development software with a debugger (e.g., JTAG debugger) to connect to the corresponding debugging pins in the controller chip (these pins are generally not exposed in the product) for online debugging, utilizing the processor breakpoints and debugging functions in the controller chip, referred to as online debugging; The second method involves interactive debugging using serial port printing, or interactive debugging using other communication ports, or debugging by writing logs, referred to as serial port debugging below.

[0004] In existing online debugging methods, the inventors found the following shortcomings: 1. In many scenarios, online debugging is simply unusable. For example, during whole-machine testing, the controller chip is enclosed in a casing, making it impossible to connect a debugger to the controller chip for online debugging. Similarly, at customer sites, disassembly is not possible, preventing the use of a debugger to connect the controller chip for online debugging. 2. Using online debugging methods can consume controller chip resources or prevent the controller chip from operating at its normal frequency or state, leading to discrepancies between test results and actual operating conditions, increasing debugging complexity and inefficiency. Therefore, in many scenarios, online debugging is unusable or too inefficient.

[0005] In existing serial port debugging, the inventors found the following shortcomings: 1. Current serial port debugging requires interaction with the processor, consuming processor resources in the controller chip, leading to discrepancies between test results and actual operating conditions, increasing debugging complexity and inefficiency; 2. Current serial port debugging uses a binary search method to find the address of the erroneous program, requiring multiple segmentations of the running program to gradually narrow down the search until the erroneous address is found. The binary search method requires multiple segmentations of the running program, resulting in a long debugging cycle; furthermore, modifying the program also consumes processor resources and may introduce unexpected situations, increasing debugging difficulty. Therefore, serial port debugging is highly complex and inefficient.

[0006] In existing dynamic white-box testing of software, code instrumentation (hereinafter referred to as code instrumentation) is used to implement dynamic white-box testing. The inventors have found that the existing technology has the following shortcomings: 1. Instrumentation in the program requires the processor resources of the controller chip, resulting in longer execution times for previously used code with the same functionality, potentially introducing unexpected situations, increasing testing difficulty, and being inefficient; 2. Instrumentation requires adding code, which increases the program's length, altering previous program addresses. Calling these absolute addresses within the program can lead to unexpected situations, increasing testing difficulty; 3. In existing software testing, black-box testing, prototype testing, and dynamic white-box testing cannot be performed simultaneously, resulting in low testing efficiency.

[0007] Furthermore, in existing program optimization processes, time performance testing is performed on the corresponding programs, using instrumentation printing in the program to measure program time performance. The inventors have found that the existing technology has the following shortcomings: 1. Instrumentation printing in the program requires adding code, which may introduce unexpected situations, increasing the difficulty of measurement and testing. 2. Instrumentation printing in the program requires consuming processor resources in the controller chip, which may introduce unexpected situations, increasing the difficulty of measurement and testing and is inefficient. Summary of the Invention

[0008] To address the issues of inefficiency and long debugging cycles in embedded software due to the inability to use processor online debugging functions, the time-consuming nature of serial port debugging, and the need for intervention in the program itself; existing dynamic white-box testing for software is inefficient, difficult, and prone to errors due to code additions; and existing time performance testing processes are complex, this application provides a method, apparatus, and system for embedded debugging. The method is as follows:

[0009] Preset trigger information, which includes the trigger data type, comparison content, and trigger conditions;

[0010] Based on the preset trigger data type, the information received or sent by the processor and / or other functional modules is monitored through the information monitoring module, which is a hardware unit located outside the processor.

[0011] The comparison module compares the monitored information with the preset comparison content. The comparison module is a hardware unit located outside the processor.

[0012] When the comparison result meets the preset trigger condition, perform one of the following actions:

[0013] Store the program address values ​​of the processor accessing other functional modules into the memory unit and / or output the program address values ​​of the processor accessing other functional modules;

[0014] Store the data values ​​accessed by the processor from other functional modules into the storage unit and / or output the data values ​​accessed by the processor from other functional modules;

[0015] Store the data address values ​​of the processor accessing other functional modules into the memory unit and / or output the data address values ​​of the processor accessing other functional modules;

[0016] Generate an interrupt signal to the processor;

[0017] Store the relevant time information in the storage unit and / or output the relevant time information.

[0018] Furthermore, the preset trigger data types include instructions, program addresses, data, or data addresses;

[0019] When the preset trigger data type is an instruction, the preset comparison content is the instruction content;

[0020] When the preset trigger data type is a program address, the preset comparison content is the program address value;

[0021] When the preset trigger data type is data, the preset comparison content is the data value;

[0022] When the preset trigger data type is a data address, the preset comparison content is the data address value.

[0023] Furthermore, based on preset trigger data types, the information monitoring module monitors the information received or sent by the processor and / or other functional modules, including at least one of the following:

[0024] When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules;

[0025] When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating.

[0026] When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules;

[0027] When the preset trigger data type is a data address, monitor the data address used for communication between the processor and / or other functional modules.

[0028] Furthermore, comparing the monitored corresponding information with the preset comparison content includes at least one of the following:

[0029] The corresponding information monitored at the monitoring time is compared with the preset comparison content;

[0030] The corresponding information monitored at times other than the monitoring time is compared with the preset comparison content.

[0031] Furthermore, when the comparison result meets the preset triggering conditions, at least one of the following is executed:

[0032] Generate a flag signal;

[0033] Output and print.

[0034] Furthermore, monitoring the information received or sent by the processor and / or other functional modules is achieved by monitoring one or more of the program address, data address, instructions, and data on the chip bus.

[0035] Furthermore, monitoring the processor and / or other functional modules includes at least one of the following:

[0036] Monitor one or more of the following: program address, data address, instructions, and data received by the processor;

[0037] Monitor one or more of the following: program address, data address, instructions, and data issued by the processor;

[0038] Monitor one or more of the following received by other functional modules: program address, data address, instructions, and data;

[0039] Monitor one or more of the program address, data address, instructions, and data issued by other functional modules.

[0040] An embedded debugging device, comprising:

[0041] The trigger information configuration module is used to preset trigger information, which includes trigger data type, comparison content, and trigger conditions.

[0042] The information monitoring module is used to monitor the information received or sent by the processor and / or other functional modules according to the preset trigger data type. The information monitoring module is a hardware unit set outside the processor.

[0043] The comparison module is used to compare the detected corresponding information with the preset comparison content. The comparison module is a hardware unit located outside the processor.

[0044] The processing module is used to perform one of the following actions when the comparison result meets a preset trigger condition:

[0045] Store the program address values ​​of the processor accessing other functional modules into the memory unit and / or output the program address values ​​of the processor accessing other functional modules;

[0046] Store the data values ​​accessed by the processor from other functional modules into the storage unit and / or output the data values ​​accessed by the processor from other functional modules;

[0047] Store the data address values ​​of the processor accessing other functional modules into the memory unit and / or output the data address values ​​of the processor accessing other functional modules;

[0048] Generate an interrupt signal to the processor;

[0049] Store the relevant time information in the storage unit and / or output the relevant time information.

[0050] Furthermore, the preset trigger data types in the trigger information configuration module include instructions, program addresses, data, or data addresses;

[0051] When the preset trigger data type is an instruction, the preset comparison content is the instruction content;

[0052] When the preset trigger data type is a program address, the preset comparison content is the program address value;

[0053] When the preset trigger data type is data, the preset comparison content is the data value;

[0054] When the preset trigger data type is a data address, the preset comparison content is the data address value.

[0055] Furthermore, the information monitoring module monitors the information received or sent by the processor and / or other functional modules according to preset trigger data types, including at least one of the following:

[0056] When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules;

[0057] When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating.

[0058] When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules;

[0059] When the preset trigger data type is a data address, monitor the data address used for communication between the processor and / or other functional modules.

[0060] Furthermore, the monitored corresponding information is compared with preset comparison content, including at least one of the following:

[0061] Compare the corresponding information and comparison content monitored at the same time.

[0062] Compare the corresponding information and comparison content detected at any time other than the monitoring time.

[0063] Furthermore, it also includes an execution module, which, when a preset triggering condition is met, performs at least one of the following actions:

[0064] Generate a flag signal;

[0065] Output and print.

[0066] Furthermore, the device monitors information received or sent by the processor and / or other functional modules by monitoring one or more of the program address, data address, instructions, and data on the chip bus.

[0067] Furthermore, the information monitoring module is used to monitor the processor and / or other functional modules, including at least one of the following:

[0068] Monitor one or more of the following: program address, data address, instructions, and data received by the processor;

[0069] Monitor one or more of the following: program address, data address, instructions, and data issued by the processor;

[0070] Monitor one or more of the following received by other functional modules: program address, data address, instructions, and data;

[0071] Monitor one or more of the program address, data address, instructions, and data issued by other functional modules.

[0072] An embedded debugging system includes the embedded debugging apparatus described in any of the above-mentioned embodiments. The embedded debugging system further includes embedded software, a processor, a storage unit, other functional modules, and a debugging terminal. The embedded debugging apparatus monitors information received or sent by the processor and / or other functional modules according to the settings of the debugging terminal, and stores the corresponding information, outputs the corresponding information, or generates an interrupt signal when a preset trigger condition is met.

[0073] Dynamic white-box testing in software testing (short for embedded software testing, hereinafter the same) mainly tests and determines whether a program has been executed, that is, it determines the instructions executed by the processor in the program. These instructions correspond to the program addresses of the instructions executed by the processor. Therefore, this application uses an information monitoring module (a hardware unit located outside the processor) to monitor, a comparison module (a hardware unit located outside the processor) to compare, store and / or output the program address values ​​of processor access memory that meet the conditions, thus determining whether a program has been executed and achieving the purpose of dynamic white-box testing. Applying the method of this application to software testing also falls within the protection scope of this application.

[0074] The beneficial effects of this application are:

[0075] In some scenarios, due to various limitations (such as the controller chip and its related circuits being enclosed in a casing during whole-machine testing; or the inability to use a debugger at the customer's site), we cannot use the debugging functions provided by the processor in the chip. The method in this application simply uses common interfaces (such as USB, UART, CAN, Ethernet, WIFI, Bluetooth, etc.) to preset trigger information and monitor relevant information. As long as our preset trigger conditions are met, information about the relevant problem can be captured; at the same time, it avoids the lengthy and repeated operations of the binary search method. Compared with existing methods, the advantages of this application are: no processor intervention is required; the information monitoring module and comparison module solve the problem of not being able to use online debugging; and compared with the binary search method, it does not require lengthy and repeated operations, achieving the goal of high-efficiency debugging.

[0076] Meanwhile, in other applications, compared to the code instrumentation method used in existing dynamic white-box testing, using an information monitoring module for external monitoring and a comparison module for comparison brings at least the following benefits:

[0077] 1. Existing code instrumentation methods require adding extra code, which consumes additional processor resources, increasing the execution time of each task and effectively slowing down the processor. This added code may also cause problems and conflicts with the existing program, leading to malfunctions. This application, however, requires no modification to the source code. It uses an information monitoring and comparison module located outside the processor to monitor and compare the source code. Compared to existing code instrumentation methods, the execution time of each task remains unchanged, and the processor speed is unaffected.

[0078] 2. Furthermore, existing code instrumentation methods require adding extra code, which alters the code length and changes the memory addresses of some programs. When the program accesses these absolute addresses, it malfunctions. To ensure the program functions correctly after adding this extra code, further adjustments are needed, increasing complexity and the likelihood of errors. This application, however, uses a hardware unit located outside the processor—specifically, an information monitoring and comparison module independent of the source code—to monitor the source code. This requires no modification to the source code, and storage or output remains unaffected by the monitoring. It completely avoids the program complexity and errors caused by existing code instrumentation methods.

[0079] 3. Since no program modification is required, dynamic white-box testing can be used simultaneously in program black-box testing and prototype testing. Compared with existing testing methods (which cannot be performed simultaneously with black-box testing and prototype testing because the program may change due to modifications), this method greatly improves testing and development efficiency.

[0080] Existing code instrumentation methods are based on a combination of software testing and embedded software design (hereinafter referred to as "software design"). This application's method combines chip design and application (hardware design), software testing, and software design. Building upon previous software testing and software design approaches, it innovatively introduces hardware unit monitoring methods, significantly improving testing and development efficiency while achieving the same results.

[0081] In addition, in some applications, when the comparison result meets a preset trigger condition, we store the relevant time information in a storage unit and / or output the relevant time information. This provides the relevant time information for each instance of "when the comparison result meets the preset trigger condition." Existing testing methods use instrumentation to print data within the program to measure program time performance. Compared to existing methods, this approach allows us to obtain relevant time information and calculate the program's time performance without modifying the program, thus achieving rapid program optimization. Attached Figure Description

[0082] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0083] Figure 1 is a flowchart of an embodiment of this application;

[0084] Figure 2 is a data storage schematic diagram of an embodiment of this application;

[0085] Figure 3 is a schematic diagram of the triggering and processing timing of an embodiment of this application;

[0086] Figure 4 is a structural framework diagram of an embodiment of this application;

[0087] Figure 5 is another structural framework diagram of an embodiment of this application;

[0088] Figure 6 is a structural framework diagram of another embodiment of this application. Detailed Implementation

[0089] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The following will provide a detailed description with reference to the accompanying drawings and embodiments.

[0090] It should be noted that in the various embodiments, the corresponding functional units are modularized only for the sake of ease of explanation. In fact, these functional units can also be distributed in the various functional modules of the chip and then work together to complete the corresponding functions.

[0091] First, it should be noted that the terms used in the various embodiments are explained as follows:

[0092] Processor: Short for processor core, it serves as the computational and control core of a controller chip. It is the final execution unit for information processing, data processing, and program execution, and is a crucial component of the controller chip. Examples include RISC-V core CPUs, ARM's M3, or other DSP cores. The processor in this application is not a standalone CPU like the Intel Pentium in a traditional PC computer.

[0093] MCU: Microcontroller chip, which is a general term for a processor and other related functional modules (such as program memory, data memory, PWM module, UART, etc.).

[0094] MPU: Microprocessor chip, a processor used in embedded systems, which is different from the CPU used in PCs.

[0095] Controller: An abbreviation for controller chip and embedded controller chip, including: MCU, DSP and MPU.

[0096] Chip: Also known as an integrated circuit (IC). It refers to a silicon wafer containing integrated circuits, which is very small and often part of a computer or other electronic device. The chip in this application is an embedded controller chip.

[0097] Embedded software refers to the operating system and application software embedded in hardware. Generally, in a system, a program is a specific manifestation of embedded software.

[0098] Embedded systems include one of the following: embedded hardware, which includes chips; or embedded software.

[0099] Embedded: is short for embedded system.

[0100] Instruction: Code that tells the processor to perform a specific function. A program is a collection of instructions grouped together to accomplish a particular function; in particular, a single instruction is also a program.

[0101] Address: Includes program address and data address.

[0102] Program address: This refers to the actual address in memory where a program is scheduled to run by the processor. The address of the instruction accessed by the processor can be called the instruction address or the program address.

[0103] Functional module: A unit within a chip that performs a specific function and can be directly or indirectly accessed or updated by the processor at any given time; also known as a peripheral device, peripheral module, peripheral functional module, etc. Generally, within a chip, functional modules include, but are not limited to, memory (e.g., ROM, OTP, FLASH, SRAM, SDRAM, etc.), timers, GPIO modules, PWM modules, etc. In particular, in multiprocessor chips, at any given time, some processors can also act as functional modules, allowing access or updates from other processors.

[0104] Module address: The address at which the content of a functional module is accessed or updated by the processor as data.

[0105] Data includes, but is not limited to: content stored in data storage within a program, or content that the processor can query, update, or perform other operations on.

[0106] Data address: The address corresponding to the processor's operations such as querying and updating data. In particular, programs and data can be stored in memory (including but not limited to ROM, OTP, FLASH, SRAM, SDRAM, etc.). Except for the address of the instruction corresponding to the software execution at a specific moment, which is the program address, the address of other instructions can be used as both program address and data address.

[0107] Memory: A functional module that can store programs and data, including but not limited to ROM, OTP, FLASH, SRAM, SDRAM, etc.

[0108] Debugging terminal: short for intelligent terminal, a device with input / output and information processing capabilities; including but not limited to: PC, mobile phone, tablet, embedded device, etc.

[0109] Information refers to the objects transmitted and processed by audio, messages, and communication systems, broadly encompassing all content disseminated in human society. In the context of chips, information can also be the value of one or more registers on the chip, the value of one or more combinational circuits, the value of one or more memory units, or a combination of the aforementioned.

[0110] Access includes processor queries and update actions on modules (i.e., reads and writes).

[0111] Manipulating data includes the processor's actions of querying and setting data.

[0112] Printing: A common term in embedded systems, referring to the output of information through external interfaces such as UART and USB on the chip.

[0113] Instrumentation: This involves inserting a piece of custom code into the codebase. The purpose of instrumentation is that, since the inserted code is compiled into the executable file, when the processor executes it, we can record / or output any information we want to know.

[0114] Code instrumentation, also known as program instrumentation, was first proposed by Professor JC Huang. It involves inserting probes (also known as "detectors," which are essentially code segments that collect information, such as assignment statements or function calls that collect coverage information) into the program while ensuring the original logical integrity of the program under test. By executing the probes and exposing characteristic data of the program's operation, and by analyzing this data, the control flow and data flow information of the program can be obtained, thereby obtaining dynamic information such as logical coverage, thus achieving the testing purpose.

[0115] Code instrumentation method: The method of using code instrumentation.

[0116] Instrumentation printing: A common term in embedded systems, referring to the method of adding extra code to a program to output relevant information, generally used for testing and debugging; this extra code increases the processor load and may also affect the normal operation of the embedded system.

[0117] Embedded testing: This is short for embedded system testing, encompassing the testing of embedded software and its system. Generally, embedded testing primarily focuses on the testing of embedded software. The embedded testing discussed in this application refers to the testing of such embedded software or systems containing such embedded software. Embedded testing includes embedded white-box testing and embedded black-box testing.

[0118] Black-box testing is a method of testing to determine whether each function works properly.

[0119] White-box testing: Also known as structural testing, transparent box testing, logic-driven testing, or code-based testing. White-box testing is divided into static and dynamic types. Static testing refers to analyzing and inspecting the program and documentation manually or using other tools without running the program.

[0120] Embedded white-box testing includes embedded software static white-box testing and embedded software dynamic white-box testing.

[0121] Static white-box testing of embedded software refers to the analysis and inspection of embedded programs and documentation by manual means or other tools without running the embedded program.

[0122] Embedded software dynamic white-box testing: This term, used in this application, refers to software dynamic white-box testing, a method for testing embedded software that combines the characteristics of dynamic testing and white-box testing. Dynamic testing focuses on the program's runtime state, while white-box testing emphasizes examining the internal structure and logic of the code. Dynamic white-box testing includes: logic coverage testing (including statement coverage testing, decision coverage testing, condition coverage testing, decision / condition coverage testing, condition combination coverage testing, and path coverage testing, etc.), basic path coverage testing, function coverage testing, loop path testing, program instrumentation testing, etc.

[0123] A controller chip contains a processor, which contains the instruction "jump". The chip's internal program addresses correspond to 0~0x1fff; the chip's internal data addresses correspond to 0x2000~0x2fff; the chip's internal peripheral addresses correspond to 0x3000~0x3fff, and address 0x3100 is the address of the I / O output data register. The "jump" instruction corresponds to the first 5 bits of the 32-bit instruction target code as "11100", which we consider equivalent. Additionally, the "jump 0x1000" instruction means "jump to address 0x1000", and its corresponding binary code in the 32-bit instruction target code is "1110 0000 0000 0000 0001 0000 0000 0000", which we also consider equivalent. Please refer to Figure 2. The program memory with the program address value of "0xa00" stores the instruction "jump 0x1000"; the data memory with the data address value of "0x2100" stores the data value "0xff00".

[0124] Please refer to Figure 1, which is a flowchart of a specific embodiment of an embedded debugging method.

[0125] S100, preset trigger information, which includes the trigger data type, comparison content, and trigger conditions.

[0126] These preset trigger information can be used to correspond to the information detected at different times.

[0127] The preset triggering conditions include, but are not limited to: equal to, not equal to, greater than, greater than or equal to, less than, less than or equal to; and their logical combinations.

[0128] The preset trigger data types include instructions, program addresses, data, or data addresses;

[0129] When the preset trigger data type is an instruction, the preset comparison content is the instruction content;

[0130] When the preset trigger data type is a program address, the preset comparison content is the program address value;

[0131] When the preset trigger data type is data, the preset comparison content is the data value;

[0132] When the preset trigger data type is a data address, the preset comparison content is the data address value.

[0133] The instruction content includes: a category of instructions; and a specific instruction. A category of instructions refers to instructions with the same characteristics; for example, "jump" indicates an instruction with address jump functionality. A specific instruction refers to a single, objectively existing instruction that is actually executed; for example, "jump 0x1000" is the specific instruction to "jump to address 0x1000".

[0134] The program address value is the address value of a specific instruction. Please refer to Figure 2. For example, the address "0xa00" of the instruction "jump 0x1000" is the program address value.

[0135] The data value is a specific data value. Please refer to Figure 2. For example, the data "0xff00" is a data value.

[0136] The data address value is the address value of the specific data. Please refer to Figure 2. For example, the address "0x2100" of the data "0xff00" is the data address value.

[0137] When the preset comparison content is instruction content, the implicit preset trigger data type is instruction; when the preset comparison content is program address value, the implicit preset trigger data type is program address; when the preset comparison content is data value, the implicit preset trigger data type is data; when the preset comparison content is data address value, the implicit preset trigger data type is data address.

[0138] The preset trigger information also includes: hidden or implied trigger data types, hidden or implied comparison content, hidden or implied trigger conditions; or other information that can be converted into these three.

[0139] S200, based on the preset trigger data type, monitors the information received or sent by the processor and / or other functional modules through the information monitoring module, which is a hardware unit located outside the processor.

[0140] Other functional modules include modules other than the processor. Examples include: program memory, data memory, UART, SPI, USB, PWM, etc.

[0141] A hardware unit is an objectively existing electronic circuit that performs a certain function; including circuits on a chip, etc.

[0142] The information monitoring module monitors information received or sent by the processor and / or other functional modules when the processor is in normal operating condition, i.e., when the processor is not in debug mode, interrupt mode, or abnormal state, etc. The information monitoring module is located in a hardware unit outside the processor. It operates independently of the processor and can work in parallel with it. Of course, the information monitoring module can also monitor information received or sent by the processor and / or other functional modules when the processor is in abnormal operating condition.

[0143] Based on the preset trigger data type, the information monitoring module monitors the information received or sent by the processor and / or other functional modules, including at least one of the following:

[0144] When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules;

[0145] When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating.

[0146] When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules;

[0147] When the preset trigger data type is a data address, monitor the data address used for communication between the processor and / or other functional modules.

[0148] Monitoring information received or sent by the processor and / or other functional modules is achieved by monitoring one or more of the program address, data address, instructions, and data on the chip bus.

[0149] Monitoring the processor and / or other functional modules includes at least one of the following:

[0150] Monitor one or more of the following: program address, data address, instructions, and data received by the processor;

[0151] Monitor one or more of the following: program address, data address, instructions, and data issued by the processor;

[0152] Monitor one or more of the following received by other functional modules: program address, data address, instructions, and data;

[0153] Monitor one or more of the program address, data address, instructions, and data issued by other functional modules.

[0154] According to the preset trigger data type, the information received or sent by the monitoring processor and / or other functional modules also includes: corresponding information of communication between the processor and / or other functional modules corresponding to the preset trigger data type obtained by other means; and related information of corresponding information of communication between the processor and / or other functional modules corresponding to the preset trigger data type obtained by other means, wherein the information has a definite relationship with the corresponding information.

[0155] S300 compares the monitored information with the preset comparison content through a comparison module, which is a hardware unit located outside the processor.

[0156] When comparing the monitored information with preset comparison criteria, the processor is in normal working condition, i.e., not in debug mode, interrupt mode, or abnormal mode, etc. The comparison module compares the monitored information with the preset comparison criteria. The comparison module and the processor operate independently. The comparison module can perform the comparison when the processor is not in operation or when the processor is not operating normally.

[0157] The monitored information is compared with preset comparison criteria, including at least one of the following:

[0158] The corresponding information monitored at the monitoring time is compared with the preset comparison content;

[0159] The corresponding information monitored at times other than the monitoring time is compared with the preset comparison content.

[0160] For example, as shown in Figure 3, C is the monitoring time, B is the previous time, and A is the previous 100 times. We are currently at monitoring time C. We can compare the corresponding information monitored at time C with the preset comparison content; we can also compare the corresponding information monitored at time B with the preset comparison content; and we can also compare the corresponding information monitored at time A with the preset comparison content.

[0161] The comparison between the monitored corresponding information and the preset comparison content includes: indirectly comparing the monitored corresponding information and the preset comparison content in other ways; and comparing the monitored corresponding information and the preset comparison content in other ways that are equivalent to comparing them.

[0162] S400, when the comparison result meets the preset trigger condition, perform one of the following processes:

[0163] Store the program address values ​​of the processor accessing other functional modules into the memory unit and / or output the program address values ​​of the processor accessing other functional modules;

[0164] Store the data values ​​accessed by the processor from other functional modules into the storage unit and / or output the data values ​​accessed by the processor from other functional modules;

[0165] Store the data address values ​​of the processor accessing other functional modules into the memory unit and / or output the data address values ​​of the processor accessing other functional modules;

[0166] Generate an interrupt signal to the processor;

[0167] Store the relevant time information in the storage unit and / or output the relevant time information.

[0168] "The comparison result meets the preset trigger condition" includes: one comparison result meets the preset trigger condition; multiple comparison results all meet the corresponding preset trigger conditions; some of the multiple comparison results meet the corresponding preset trigger conditions; and the case where the combination of "preset trigger condition" and "comparison result does not meet the preset trigger condition" is equivalent to other combinations of "preset trigger condition" and "comparison result meets the trigger condition". For example: setting the "preset trigger condition" to "not equal to" and "when the comparison result does not meet the trigger condition" is actually equivalent to setting the "preset trigger condition" to "equal to" and "the comparison result meets the trigger condition".

[0169] Output refers to the direct or indirect output of information through interfaces such as buses, Bluetooth, SPI, UART, Ethernet, WIFI, and USB on a chip or module. USB includes the Type-C interface.

[0170] When the comparison result meets the preset triggering conditions, the processing is performed by the processing module, which is a hardware unit located outside the processor. The processing module operates independently of the processor. The processing can be performed when the processor is in a normal working state, i.e., when the processor is not in a debug state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc., or when the processor is in an abnormal working state.

[0171] "When the comparison result meets the preset trigger condition" is expressed as: "In the case where the comparison result meets the preset trigger condition".

[0172] The processing time includes: the moment when the comparison result meets the preset trigger condition and any moment after the moment when the comparison result meets the preset trigger condition occurs.

[0173] The time corresponding to the program address value, data value, data address value, and related time information includes: the time corresponding to the information monitored for comparison when "the comparison result meets the preset trigger condition"; the time of storage; and any time between the earliest comparison time and the storage time.

[0174] The program address value, data value, data address value, and the information corresponding to the corresponding time include: direct or indirect corresponding information about monitoring communication between the processor and / or other functional modules at the corresponding time. For example, when we store the program address value in the memory unit, this stored program address value can be either the program address value monitored in S200 when "the comparison result meets the preset trigger condition"; or it can be corresponding information with a fixed correspondence to this value.

[0175] The processing also includes: storing or transmitting program address values, data values, data address values, and corresponding times directly or indirectly in other ways; and storing or transmitting indirect information equivalent to or containing "program address values, data values, data address values, and corresponding times" through other operations, in conjunction with software, interrupts, or other external programmable devices.

[0176] Generating interrupt signals to the processor also includes: generating active trigger signals to the processor and other programmable units; and outputting signals externally. These signals can all trigger the processor and other programmable units to obtain relevant information through programming.

[0177] The method of this application also includes: a method that implicitly includes or implicitly contains the operations of steps S100, S200, S300 and S400; and a method that indirectly implements, is equivalent to or can be transformed into the operations of steps S100, S200, S300 and S400.

[0178] For example, Method A stores the program address value when the processor reads memory with the instruction "jump". Method A implicitly includes steps S100, S200, S300, and S400. Method A is equivalent to: Step S100, setting preset trigger information, which includes a trigger data type of "instruction", a preset comparison content of "jump", and a preset trigger condition of "equal to"; Step S200, monitoring the instruction content read from the processor's memory based on the preset trigger data type of "instruction"; Step S300, comparing the monitored corresponding information with the preset comparison content ("jump"); Step S400, when the comparison result satisfies the preset trigger condition "equal to", performing processing: storing the program address value accessed by the processor's memory into a memory cell. Therefore, Method A is within the scope of this application.

[0179] For example, in method B, when the processor accesses the memory at a data address value of "0x2100", a message is generated externally or output via Wi-Fi. This message has a fixed relationship with the current program address value. Method B implicitly includes steps S100, S200, S300, and S400. Method B is equivalent to: Step S100, setting preset trigger information, which includes a preset trigger data type of "data address", a preset comparison content of "0x2100", and a preset trigger condition of "equal to"; Step S200, monitoring the processor's access to the memory at a data address value based on the preset trigger data type of "data address"; Step S300, comparing the detected corresponding information with the preset comparison content "0x2100"; Step S400, when the comparison result satisfies the preset trigger condition "equal to", performing processing: outputting the program address value accessed by the processor. Although method B generates a message externally or outputs a message via Wi-Fi at this time, this message has a fixed relationship with the current program address value; therefore, "generating a message externally or outputting a message via Wi-Fi" is equivalent to outputting the message "the program address value when the processor accesses the memory data address value of 0x2100". Therefore, method B is within the scope of this application.

[0180] For example, in method C, an interrupt signal is generated to the processor when the processor accesses a memory data address value of "0x2100". Method C implicitly includes steps S100, S200, S300, and S400. Method C is equivalent to: Step S100, setting preset trigger information, which includes a trigger data type of "data address", a preset comparison content of "0x2100", and a preset trigger condition of "equal to"; Step S200, monitoring the processor's memory data address value based on the preset trigger data type of "data address"; Step S300, comparing the monitored corresponding information with the preset comparison content "0x2100"; Step S400, when the comparison result satisfies the preset trigger condition "equal to", processing is performed: an interrupt signal is generated to the processor. In method C, after generating an interrupt signal to the processor, the processor can obtain relevant information (e.g., program address value) when the preset trigger condition is met through interrupt-related actions. Therefore, method C is within the scope of this application.

[0181] A storage unit includes at least one of the following two cases:

[0182] Internal storage units;

[0183] External storage unit.

[0184] Internal storage units refer to units with storage functions inside the chip; these include: registers, FIFO, SRAM, FLASH, etc.

[0185] External storage units refer to units with storage functions located outside the chip; these include: external FLASH, SRAM, USB flash drives, SD cards, hard drives, and other units with storage functions connected to the external chip.

[0186] For example, as shown in Figure 3, C is the monitoring time, B is the previous time, and A represents the previous 100 cycles. We can preset the trigger information as follows: the first trigger information is a data type of "instruction", the preset comparison content is the instruction content "jump 0x1000", and the preset trigger condition is "equal". Based on "data type is instruction", we monitor the instructions communicating between the processor and / or other functional modules in the previous cycle (C is the monitoring time, and B in Figure 3 represents the previous cycle), and compare the monitored instructions with "jump 0x1000". The comparison is performed on "0x1000". If the comparison result is equal, the first trigger information comparison result satisfies the preset trigger condition. The second trigger information is a data type of "data address", the preset comparison content is the data address value "0x2100", and the preset trigger condition is "equal". According to "data type is data address", the data address of the processor and / or other functional modules communicating during the previous 100 cycle times (C is the monitoring time, A in Figure 3 is the previous 100 cycle times) is monitored, and the monitored data address is compared with "0x2100". If the comparison result is equal, the second trigger information comparison result satisfies the preset trigger condition. When both the first trigger information comparison result satisfies the first trigger condition and the second trigger information comparison result satisfies the second trigger condition, the "processor access to program memory program address value" at monitoring time C is stored in the memory unit at the next time.

[0187] When the preset trigger conditions are met, execute at least one of the following:

[0188] Generate a flag signal;

[0189] Output and print.

[0190] A flag signal is a signal used by internal or external programmable devices (including processors) to query relevant information via software, interrupts, or other means.

[0191] Output printing is a process of outputting relevant information to external devices via interfaces such as UART and USB.

[0192] Although there may be many "jump 0x1000" instructions in the program, in this embodiment, by pre-setting trigger information, we can capture the relevant program address when the chip executes this instruction at the time the condition is met, thereby achieving our debugging and location purpose. In many scenarios, due to various limitations (such as the controller chip and its related circuits being sealed by the casing during whole-machine testing; or the inability to use a debugger at the customer's site, etc.), we cannot connect the chip to an emulator and cannot use the debugging function of the chip's internal processor; this method is very beneficial because it can quickly locate problems in an environment where the processor is working normally. At the same time, because steps S200, S300, and S400 work in parallel with the processor, they do not occupy processor resources and do not require processor intervention, solving the problem of not being able to use online debugging; and compared with traditional serial port debugging, this method uses real-time monitoring and comparison, which, compared with the binary search method, does not require multiple long-term operations, making it very efficient. This method can quickly locate the program address of the relevant problem and perform high-efficiency debugging.

[0193] The following is yet another embodiment of an embedded debugging method.

[0194] S100, Preset trigger information, which includes the preset trigger data type, comparison content, and trigger conditions.

[0195] The preset trigger conditions include: equal to, not equal to, greater than, greater than or equal to, less than, and less than or equal to. For example, the preset trigger condition in our preset trigger information is "equal to".

[0196] The preset trigger data types include instructions, program addresses, data, or data addresses;

[0197] When the preset trigger data type is an instruction, the preset comparison content is the instruction content;

[0198] When the preset trigger data type is a program address, the preset comparison content is the program address value;

[0199] When the preset trigger data type is data, the preset comparison content is the data value;

[0200] When the preset trigger data type is a data address, the preset comparison content is the data address value.

[0201] For example, we preset the data type in the trigger information to "program address"; the preset comparison content in the trigger information is the program address value "0xa00" at the program instrumentation point.

[0202] S200, based on the preset trigger data type, monitors the information received or sent by the processor and / or other functional modules through the information monitoring module, which is a hardware unit located outside the processor.

[0203] Other functional modules include modules other than the processor. Examples include: program memory, data memory, UART, SPI, USB, PWM, etc.

[0204] Based on the preset trigger data type, the information monitoring module monitors the information received or sent by the processor and / or other functional modules, including at least one of the following:

[0205] When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules;

[0206] When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating.

[0207] When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules;

[0208] When the preset trigger data type is a data address, monitor the data address used for communication between the processor and / or other functional modules.

[0209] For example: Based on the preset trigger data type "program address", monitor the program address of communication between the processor and / or other functional modules.

[0210] S300 compares the monitored information with the preset comparison content through a comparison module, which is a hardware unit located outside the processor.

[0211] The monitored information is compared with preset comparison criteria, including at least one of the following:

[0212] Compare the corresponding information and comparison content monitored at the same time.

[0213] Compare the corresponding information and comparison content detected at any time other than the monitoring time.

[0214] For example: compare the program address of the processor and / or other functional modules that were monitored in the previous moment with the program address value "0xa00" at the program instrumentation point of the comparison content.

[0215] By comparing the monitored information with the comparison content, and querying and / or modifying the relevant variables (which are in registers and memory), complex tests in dynamic white-box testing (such as condition combination coverage tests) can be achieved.

[0216] S400, when the comparison result meets the preset trigger condition, perform one of the following processes:

[0217] Store the program address values ​​of the processor accessing other functional modules into the memory unit and / or output the program address values ​​of the processor accessing other functional modules;

[0218] Store the data values ​​accessed by the processor from other functional modules into the storage unit and / or output the data values ​​accessed by the processor from other functional modules;

[0219] Store the data address values ​​of the processor accessing other functional modules into the memory unit and / or output the data address values ​​of the processor accessing other functional modules;

[0220] Generate an interrupt signal to the processor;

[0221] Store the relevant time information in the storage unit and / or output the relevant time information.

[0222] For example, when the comparison result meets the preset trigger condition, the program address value "0xa00" that the processor accesses the program memory is stored in the memory unit at the next moment.

[0223] As shown in Figure 2, although there may be many "jump 0x1000" instructions in the program, in this embodiment, by using preset trigger information (data type is "program address", comparison content is the program address value "0xa00" at the program instrumentation point and the preset trigger condition is "equal"), we can determine that when the condition is met, the chip executes the instruction with program address value "0xa00", which involves storing the program address value "0xa00" accessed by the processor into a memory cell. We read this information (program address value "0xa00") from the memory cell, thus knowing that the program has executed the instruction with program address value "0xa00" (instruction "jump 0x1000"), achieving the purpose of statement coverage testing in dynamic white-box software testing.

[0224] The method of this application uses an information monitoring module and a comparison module to monitor the program address values ​​accessed by the processor to memory, and stores the program address values ​​that meet the conditions into the memory unit and / or outputs them, without adding code to the program or occupying additional processor resources. The information monitoring module and the comparison module are hardware units set outside the processor and work independently of the processor; the information monitoring module, the comparison module and the processor work in parallel.

[0225] Dynamic white-box testing in software testing requires testing and judging the executed program, that is, judging the instructions executed by the processor in the program; these instructions correspond to the program addresses of the instructions executed by the processor; therefore, by monitoring, comparing, storing and / or outputting the program address values ​​of the processor accessing memory that meet the conditions, the executed program can be judged, thus achieving the purpose of dynamic white-box testing.

[0226] Existing code instrumentation methods require adding extra code, which consumes additional processor resources. This addition may cause problems and conflicts with existing programs. For example, if a program originally took 200 clock cycles to complete one task loop, adding this code might increase the time to complete the loop to 220 clock cycles, effectively slowing down the processor. This is equivalent to a 20MHz processor outputting a pulse every 10µs before becoming 11µs after instrumentation, leading to program malfunction. This application, however, requires no modification to the source code. It uses an information monitoring and comparison module located outside the processor to monitor the source code. Compared to existing code instrumentation methods, the program's execution per task cycle remains unchanged, the processor speed remains the same, and no new problems or conflicts are introduced.

[0227] Furthermore, existing code instrumentation methods require adding extra code, which alters the code length and changes the memory addresses of some programs. When the program accesses these absolute addresses, it can malfunction. For example, in a program with remote upgrade capabilities, using remote communication to update a section of the program at absolute memory addresses (0x500-0x800), existing code instrumentation requires adding extra code, changing the address range to 0x510-0x810. This causes the program to malfunction after upgrading the code at addresses originally in the 0x500-0x800 range. To ensure the program functions correctly after adding this extra code, further adjustments are needed, further increasing the program's complexity and the likelihood of errors. By using information monitoring and comparison modules located outside the processor, that is, using information monitoring and comparison modules independent of the source program to monitor the source program, no changes are required to the source program, and storage or output will not be affected by the monitoring. This can completely avoid the program complexity caused by existing code instrumentation methods, as well as the program errors caused by existing code instrumentation methods.

[0228] Since no program modifications are required, dynamic white-box testing of the software can be performed simultaneously during program black-box testing and prototype testing, which greatly improves testing and development efficiency compared to existing testing methods.

[0229] The following is yet another embodiment of an embedded debugging method.

[0230] Preset trigger information, which includes the trigger data type, comparison content, and trigger conditions;

[0231] Based on the preset trigger data type, monitor the information received or sent by the processor and / or other functional modules;

[0232] The monitored information is compared with the preset comparison content;

[0233] When the comparison result meets the preset trigger condition, perform one of the following actions:

[0234] Store the relevant time information in the storage unit and / or output the relevant time information.

[0235] By using preset trigger information, when the comparison result meets the preset trigger conditions, we store the relevant time information in the storage unit and / or output the relevant time information. This allows us to obtain the relevant time information each time the comparison result meets the preset trigger conditions, thus enabling us to calculate the time performance of the relevant program. Compared to existing testing methods, this method calculates the time performance of the relevant program without modifying the program, improving testing efficiency and achieving rapid program optimization.

[0236] The embedded debugging method described in the above embodiments is also applicable to embedded testing, and its basic methods and steps are the same, so they will not be repeated here. Using the method of this application for testing also falls within the protection scope of this application.

[0237] Please refer to Figures 4 and 5 for a specific embodiment of an embedded debugging device.

[0238] An embedded debugging device, comprising:

[0239] Trigger information configuration module M100 is used to preset trigger information, which includes trigger data type, comparison content and trigger conditions;

[0240] The preset trigger data types in the trigger information configuration module M100 include instructions, program addresses, data, or data addresses;

[0241] When the preset trigger data type is an instruction, the preset comparison content is the instruction content;

[0242] When the preset trigger data type is a program address, the preset comparison content is the program address value;

[0243] When the preset trigger data type is data, the preset comparison content is the data value;

[0244] When the preset trigger data type is a data address, the preset comparison content is the data address value.

[0245] The information monitoring module M200 is used to monitor information received or sent by the processor and / or other functional modules according to preset trigger data types. The information monitoring module is a hardware unit located outside the processor.

[0246] The information monitoring module M200 operates when the processor is in normal working condition, i.e., when the processor is not in debug mode, interrupt mode, or abnormal mode, etc. The information monitoring module M200 operates independently of the processor. The information monitoring module and the processor work in parallel. Of course, the information monitoring module can also operate when the processor is in an abnormal working condition.

[0247] The information monitoring module M200 monitors information received or sent by the processor and / or other functional modules according to preset trigger data types, including at least one of the following:

[0248] When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules;

[0249] When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating.

[0250] When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules;

[0251] When the preset trigger data type is a data address, monitor the data address used for communication between the processor and / or other functional modules.

[0252] The comparison module M300 is used to compare the detected corresponding information with the preset comparison content. The comparison module is a hardware unit located outside the processor.

[0253] The comparison module M300 operates when the processor is in normal working condition, i.e., when the processor is not in debug mode, interrupt mode, or abnormal mode, etc. The comparison module M300 operates independently of the processor. The comparison module M300 and the processor can also work in parallel. Of course, the comparison module M300 can also operate when the processor is in an abnormal working condition.

[0254] The monitored information is compared with preset comparison criteria, including at least one of the following:

[0255] Compare the corresponding information monitored at the same time with the preset comparison content;

[0256] Compare the corresponding information detected at any time other than the monitoring time with the preset comparison content.

[0257] Processing module M400 is used to perform one of the following processes when the comparison result meets the trigger condition:

[0258] Store the program address values ​​of the processor accessing other functional modules into the memory unit and / or output the program address values ​​of the processor accessing other functional modules;

[0259] Store the data values ​​accessed by the processor from other functional modules into the storage unit and / or output the data values ​​accessed by the processor from other functional modules;

[0260] Store the data address values ​​of the processor accessing other functional modules into the memory unit and / or output the data address values ​​of the processor accessing other functional modules;

[0261] Generate an interrupt signal to the processor;

[0262] Store the relevant time information in the storage unit and / or output the relevant time information.

[0263] The processing module M400 is a hardware unit located outside the processor. The processing module M400 operates when the processor is in normal working condition, i.e., when the processor is not in debug mode, interrupt mode, or abnormal mode, etc. The processing module M400 operates independently of the processor. The processing module M400 and the processor can also work in parallel. Of course, the processing module M400 can also operate when the processor is in an abnormal working condition.

[0264] A storage unit includes at least one of the following two cases:

[0265] Internal storage units;

[0266] External storage units. For example, external EEPROM, FLASH, SRAM, and other storage units.

[0267] Execution module M500 is used to perform at least one of the following:

[0268] Generate a flag signal;

[0269] Output and print.

[0270] In Figure 5, Device 1#, Device 2#, Device 3#...Device n# are all the same embedded debugging device, i.e., the embedded debugging device in this application. They are all located outside the processor and function normally. The embedded debugging device can be set up independently or within other hardware. The embedded debugging device can be placed in different locations depending on the structural requirements. The device numbers in Figure 5 are only to distinguish the different locations of the embedded debugging device. As shown in Figure 5, the embedded debugging device monitors the information received or sent by the processor and / or other functional modules by monitoring one or more of the program address, data address, instructions, and data on the chip bus.

[0271] An information monitoring module in an embedded debugging device is used to monitor the processor and / or other functional modules, including at least one of the following:

[0272] Monitor one or more of the following: program address, data address, instructions, and data received by the processor;

[0273] Monitor one or more of the following: program address, data address, instructions, and data issued by the processor;

[0274] Monitor one or more of the following received by other functional modules: program address, data address, instructions, and data;

[0275] Monitor one or more of the program address, data address, instructions, and data issued by other functional modules.

[0276] The modules in this application include, but are not limited to: software, chip circuits, FPGAs, electrical circuits, electronic circuits, and other objectively existing things that can perform certain functions.

[0277] The devices in this application include, but are not limited to: software, chip circuits, FPGAs, electrical circuits, electronic circuits, and other objectively existing things that can perform certain functions.

[0278] In this embodiment, by using the trigger information configuration module of the preset debugging device, we can know the relevant information when the comparison result meets the preset trigger conditions. The device of this application, operating in a normal processor state, can: quickly locate the program address of the relevant problem; perform efficient dynamic white-box testing; and measure program time performance. Furthermore, because the information monitoring module M200, comparison module M300, and processing module M400 are hardware units located outside the processor, these hardware units work in parallel with the processor, without consuming processor resources, allowing the processor to operate very efficiently.

[0279] Figure 6 is a schematic diagram of an embedded debugging system according to another embodiment. The device in Figure 6 is the embedded debugging device of this application. The embedded debugging device is located inside the chip, but it can also be located in other hardware or set up separately, as long as it is located outside the processor and can work normally.

[0280] An embedded debugging system includes an embedded debugging device, embedded software, a processor, a storage unit, other functional modules, and a debugging terminal. The embedded software is stored in the memory. The chip in Figure 6 includes the embedded debugging device, a processor, a program memory (a type of memory in which the embedded software resides), a data memory (a type of storage unit), and other modules. The other functional modules include the program memory, data memory, and other modules shown in Figure 6. The embedded debugging device, according to the settings of the debugging terminal, monitors the corresponding communication information between the processor and other functional modules. When preset trigger conditions are met, it stores the corresponding information, outputs the corresponding information, or generates an interrupt signal. Here, the corresponding information refers to the processing information of the processing module M400 or the execution information of the execution module M500. Other functional modules include modules other than the processor, such as program memory, data memory, UART, SPI, USB, PWM, etc. The embedded debugging system of this application can: quickly locate the program address of related problems during debugging, achieving high-efficiency debugging; perform efficient dynamic white-box testing; and measure program time performance, achieving rapid program optimization.

[0281] Obviously, the embodiments described above are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort should fall within the scope of protection of this application.

Claims

1. An embedded debugging method, characterized in that, include: Preset trigger information, which includes trigger data type, comparison content, and trigger conditions; According to the preset trigger data type, the information received or sent by the processor and / or other functional modules is monitored by the information monitoring module. The information monitoring module is a hardware unit set outside the processor and works independently of the processor. The comparison module compares the monitored information with the preset comparison content. The comparison module is a hardware unit located outside the processor. When the comparison result meets the preset triggering condition, one of the following processes is performed: Store the program address values ​​of the processor accessing the other functional modules into the storage unit and / or output the program address values ​​of the processor accessing the other functional modules; The data values ​​of the processor accessing the other functional modules are stored in the storage unit and / or the data values ​​of the processor accessing the other functional modules are output; Store the data address values ​​of the processor accessing the other functional modules into the storage unit and / or output the data address values ​​of the processor accessing the other functional modules; Generate an interrupt signal to the processor; Store the relevant time information into the storage unit and / or output the relevant time information; The embedded debugging method presets the trigger information through common interfaces, including USB, Ethernet, WIFI, UART, CAN, and Bluetooth. The information monitoring module monitors the information received or sent by the processor and / or other functional modules when the processor is in a normal working state or an abnormal working state. The normal working state of the processor includes the processor not being in a debugging state, the processor not being in an interrupted state, or the processor not being in an abnormal state.

2. The embedded debugging method according to claim 1, characterized in that, The preset trigger data types include instructions, program addresses, data, or data addresses; When the preset trigger data type is an instruction, the preset comparison content is the instruction content; When the preset trigger data type is a program address, the preset comparison content is the program address value; When the preset trigger data type is data, the preset comparison content is data value; When the preset trigger data type is a data address, the preset comparison content is a data address value.

3. The embedded debugging method according to claim 2, characterized in that, Based on the preset trigger data type, the information received or sent by the processor and / or other functional modules is monitored by the information monitoring module, including at least one of the following: When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules; When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating; When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules; When the preset trigger data type is a data address, monitor the data address of the communication between the processor and / or other functional modules.

4. The embedded debugging method according to claim 1, characterized in that, When the comparison result meets the preset triggering condition, at least one of the following is also executed: Generate a flag signal; Output and print.

5. The embedded debugging method according to claim 1, characterized in that, Monitoring the corresponding information of communication between the processor and / or other functional modules is achieved by monitoring one or more of the program address, data address, instructions, and data on the chip bus.

6. The embedded debugging method according to claim 1, characterized in that, Monitor information received or transmitted by the processor and / or other functional modules, including at least one of the following: Monitor one or more of the following: program address, data address, instructions, and data received by the processor; Monitor one or more of the program address, data address, instructions, and data issued by the processor; Monitor one or more of the program address, data address, instructions, and data received by the other functional modules; Monitor one or more of the program address, data address, instructions, and data issued by the other functional modules.

7. An embedded debugging device, characterized in that, include: A trigger information configuration module is used to preset trigger information, which includes trigger data type, comparison content, and trigger conditions. An information monitoring module is used to monitor information received or sent by the processor and / or other functional modules according to the preset trigger data type. The information monitoring module is a hardware unit located outside the processor and operates independently of the processor. A comparison module is used to compare the monitored corresponding information with the preset comparison content. The comparison module is a hardware unit located outside the processor. The processing module is configured to perform one of the following processes when the comparison result meets the preset triggering condition: Store the program address values ​​of the processor accessing the other functional modules into the storage unit and / or output the program address values ​​of the processor accessing the other functional modules; The data values ​​of the processor accessing the other functional modules are stored in the storage unit and / or the data values ​​of the processor accessing the other functional modules are output; Store the data address values ​​of the processor accessing the other functional modules into the storage unit and / or output the data address values ​​of the processor accessing the other functional modules; Generate an interrupt signal to the processor; Store the relevant time information into the storage unit and / or output the relevant time information; The embedded debugging device presets the trigger information through common interfaces, including USB, UART, Ethernet, WIFI, CAN, and Bluetooth. The information monitoring module monitors the information received or sent by the processor and / or other functional modules when the processor is in a normal working state or an abnormal working state. The normal working state of the processor includes the processor not being in a debugging state, the processor not being in an interrupted state, or the processor not being in an abnormal state.

8. The embedded debugging apparatus according to claim 7, characterized in that, The preset trigger data types in the trigger information configuration module include instructions, program addresses, data, or data addresses; When the preset trigger data type is an instruction, the preset comparison content is the instruction content; When the preset trigger data type is a program address, the preset comparison content is the program address value; When the preset trigger data type is data, the preset comparison content is data value; When the preset trigger data type is a data address, the preset comparison content is a data address value.

9. The embedded debugging apparatus according to claim 8, characterized in that, The information monitoring module monitors the information received or sent by the processor and / or other functional modules according to the preset trigger data type, including at least one of the following: When the preset trigger data type is an instruction, monitor the instructions communicated between the processor and / or other functional modules; When the preset trigger data type is a program address, monitor the program address of the processor and / or other functional modules communicating; When the preset trigger data type is data, monitor the data communicated between the processor and / or other functional modules; When the preset trigger data type is a data address, monitor the data address of the communication between the processor and / or other functional modules.

10. The embedded debugging apparatus according to claim 7, characterized in that, It also includes an execution module, which, when the preset triggering condition is met, performs at least one of the following actions: Generate a flag signal; Output and print.

11. The embedded debugging apparatus according to claim 7, characterized in that, The device monitors the corresponding information of communication between the processor and / or other functional modules by monitoring one or more of the program address, data address, instructions, and data on the chip bus.

12. The embedded debugging apparatus according to claim 7, characterized in that, The information monitoring module is used to monitor information received or sent by the processor and / or other functional modules, including at least one of the following: Monitor one or more of the following: program address, data address, instructions, and data received by the processor; Monitor one or more of the program address, data address, instructions, and data issued by the processor; Monitor one or more of the program address, data address, instructions, and data received by the other functional modules; Monitor one or more of the program address, data address, instructions, and data issued by the other functional modules.

13. An embedded debugging system, characterized in that, The embedded debugging apparatus includes the embedded debugging system according to any one of claims 7 to 12, the embedded debugging system further includes embedded software, a processor, a storage unit, other functional modules and a debugging terminal, the embedded debugging apparatus monitors the information received or sent by the processor and / or the other functional modules according to the settings of the debugging terminal.

Citation Information

Patent Citations

  • Microcontroller chip and debug method thereof

    CN101458725B

  • Embedded debugging method and system for integrated circuit chip

    CN115794513A

  • Embedded debugging method, device and system

    CN119201749A

  • Embedded system and real-time monitoring and processing method thereof

    CN1885275A

  • Debugging apparatus and method

    US20020152427A1