Embedded debugging method, device and system
By setting up information monitoring modules and comparison modules outside the controller chip, monitoring processor information and comparing, the problems of low debugging efficiency and high complexity of embedded software in the prior art are solved, and fast positioning program errors and efficient dynamic white box testing are realized.
Patent Information
- Application Number
- CN202411678112.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2044-11-22
AI Technical Summary
The prior art has problems of low efficiency and high complexity in embedded software debugging of controller chips, especially when the processor online debugging function cannot be used or software dynamic white box testing is required.
By preset trigger information, the information of the processor and other functional modules is monitored by the information monitoring module and the comparison module, and the monitored information is compared with the preset comparison content. When the preset trigger conditions are met, corresponding processing is performed, such as storing or outputting program address value, data value or generating an interrupt signal.
It realizes the rapid positioning of the wrong program address without occupying processor resources, improves debugging efficiency, reduces debugging complexity, and supports dynamic white box testing and program time performance measurement.
Smart Images

Figure CN119201749B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an embedded debugging method, device and system, in particular to a debugging method, device and system for a controller chip and its software, and also includes a testing method, device and system for the controller chip and its software. Background Art
[0002] With the development of chip technology, more and more functional modules are integrated into the chip, the amount of computing data of the controller chip is getting larger and larger, and the number of programs that the controller chip needs to run is also getting larger and larger, which may be hundreds of thousands or even millions. There are the following requirements: if an error or exception occurs during program operation, it is necessary to quickly find the address of the program where the error occurs, that is, high-efficiency debugging; at the same time, it is necessary to achieve the purpose of embedded software dynamic white box testing (hereinafter referred to as software dynamic white box testing); in addition, it is also necessary to quickly achieve the effect of optimizing the program.
[0003] There are two commonly used methods for debugging embedded software in controller chips: the first is to use IDE development software with a debugger (such as JTAG debugger, etc.) to connect the corresponding debugging pins in the controller chip (these pins are generally not brought out in the product) for online debugging, using the processor breakpoints and debugging functions in the controller chip, referred to as online debugging; the second is to use serial port printing for interactive debugging, or use other communication ports for interactive debugging, or debug by writing logs and printing, hereinafter referred to as serial port debugging.
[0004] In the existing online debugging, the inventors found that the existing technology has the following deficiencies: 1. In many scenarios, online debugging cannot be used at all. For example, when testing the whole machine, the controller chip has been sealed by the shell, and the debugger cannot be used to connect the controller chip for online debugging. For example, at the customer site, the machine cannot be disassembled, and the debugger cannot be used to connect the controller chip for online debugging, etc.; 2. Using the online debugging method will occupy the controller chip resources or the controller chip cannot work at the normal frequency or state, resulting in inconsistency between the test situation and the actual working situation, increasing the complexity of debugging and inefficiency. Therefore, in many scenarios, online debugging cannot be used or the efficiency is too low.
[0005] In the existing serial port debugging, the inventors found that the existing technology has deficiencies in the following situations: 1. The existing technology uses serial port debugging, which requires information exchange with the processor and occupies the processor resources in the controller chip, resulting in inconsistencies between the test situation and the actual working situation, increasing the complexity of debugging and inefficiency; 2. The existing technology uses serial port debugging and uses binary search to find the address of the erroneous program. It is necessary to split the running program multiple times and gradually narrow the scope until the address of the erroneous program is finally found. The use of binary search requires multiple splits of the running program, and the debugging cycle is long; at the same time, because the program is modified, it will also occupy the processor's running resources, which may introduce other unexpected situations and increase the difficulty of debugging. Therefore, serial port debugging is complex and inefficient.
[0006] In the existing software dynamic white box testing process, a method of adding code stubs in the program (hereinafter referred to as the code stub method) is used to implement software dynamic white box testing. The inventors found that the existing technology has the following deficiencies: 1. Inserting stubs in the program requires occupying the processor running resources in the controller chip, and it takes longer to run the same functional code as before, which may introduce other unexpected situations, increase the difficulty of testing and have low efficiency; 2. Inserting stubs in the program requires adding code. These additional codes make the program itself longer, and the previous program address changes. Calling these program absolute addresses in the program will cause unexpected situations, which increases the difficulty of testing; 3. In the existing software testing, program black box testing, prototype testing and software dynamic white box testing cannot be performed at the same time, and the testing efficiency is not high.
[0007] In addition, in the existing program optimization process, the corresponding program will be tested for time performance, and the program time performance measurement is achieved by inserting stub printing in the program. The inventors found that the prior art has the following deficiencies: 1. Inserting stub printing in the program requires adding code, and these additional codes may introduce other unexpected situations, increasing the difficulty of measurement and testing. 2. Inserting stub printing in the program requires occupying the processor running resources in the controller chip, which may introduce other unexpected situations, increasing the difficulty of measurement and testing and inefficiency. Summary of the invention
[0008] In order to solve the problems that the online debugging function of the processor cannot be used, the serial port debugging takes a long time, and the program itself must be intervened, resulting in low efficiency and long debugging cycle of embedded software debugging; the existing software dynamic white box testing efficiency is very low, the testing is difficult and may cause program errors due to the addition of code; and the existing program time performance testing process is complicated. The present application provides a method, device and system for embedded debugging. The method is as follows:
[0009] Preset trigger information, the trigger information includes trigger data type, comparison content and trigger condition;
[0010] 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, and the information monitoring module is a hardware unit arranged outside the processor;
[0011] The monitored corresponding information is compared with the preset comparison content through a comparison module, and the comparison module is a hardware unit arranged outside the processor;
[0012] When the comparison result meets the preset trigger condition, one of the following processes is performed:
[0013] Storing program address values for the processor to access other functional modules in a storage unit and / or outputting program address values for the processor to access other functional modules;
[0014] Storing data values accessed by the processor to other functional modules in a storage unit and / or outputting data values accessed by the processor to other functional modules;
[0015] Storing data address values accessed by the processor to other functional modules in a storage unit and / or outputting data address values accessed by the processor to other functional modules;
[0016] Generates an interrupt signal to the processor;
[0017] The relevant time information is stored in a storage unit and / or the relevant time information is output.
[0018] Further, the preset trigger data type includes instruction, program address, data or data address;
[0019] When the preset trigger data type is instruction, the preset comparison content is the instruction content;
[0020] When the preset trigger data type is 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 data value;
[0022] When the preset trigger data type is a data address, the preset comparison content is a data address value.
[0023] Further, 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, including at least one of the following situations:
[0024] When the preset trigger data type is an instruction, monitoring instructions of the processor and / or other functional modules for communication;
[0025] When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating;
[0026] When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules;
[0027] When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
[0028] Furthermore, comparing the monitored corresponding information with the preset comparison content includes at least one of the following situations:
[0029] Compare the corresponding information monitored at the monitoring moment with the preset comparison content;
[0030] The corresponding information monitored at a time other than the monitoring time is compared with the preset comparison content.
[0031] Furthermore, when the comparison result meets a preset trigger condition, at least one of the following is also performed:
[0032] generating a flag signal;
[0033] Output print.
[0034] Furthermore, the information received or sent by the processor and / or other functional modules is monitored by monitoring one or more of the program address, data address, instruction and data on the chip bus.
[0035] Further, monitoring the processor and / or other functional modules includes at least one of the following situations:
[0036] monitoring one or more of a program address, a data address, an instruction, and data received by the processor;
[0037] monitoring one or more of a program address, a data address, an instruction, and data issued by a processor;
[0038] monitoring one or more of program addresses, data addresses, instructions and data received by other functional modules;
[0039] Monitor one or more of program addresses, data addresses, instructions and data issued by other functional modules.
[0040] An embedded debugging device, comprising:
[0041] A trigger information configuration module, which is used to preset trigger information, including trigger data type, comparison content and trigger condition;
[0042] An information monitoring module, which is used to monitor information received or sent by the processor and / or other functional modules according to a preset trigger data type. The information monitoring module is a hardware unit arranged outside the processor;
[0043] A comparison module, the comparison module is used to compare the monitored corresponding information with the preset comparison content, and the comparison module is a hardware unit arranged outside the processor;
[0044] The processing module is used to perform one of the following processing when the comparison result meets the preset trigger condition:
[0045] Storing program address values for the processor to access other functional modules in a storage unit and / or outputting program address values for the processor to access other functional modules;
[0046] Storing data values accessed by the processor to other functional modules in a storage unit and / or outputting data values accessed by the processor to other functional modules;
[0047] Storing data address values accessed by the processor to other functional modules in a storage unit and / or outputting data address values accessed by the processor to other functional modules;
[0048] Generates an interrupt signal to the processor;
[0049] The relevant time information is stored in a storage unit and / or the relevant time information is output.
[0050] Further, 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 instruction, the preset comparison content is the instruction content;
[0052] When the preset trigger data type is 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 data value;
[0054] When the preset trigger data type is a data address, the preset comparison content is a data address value.
[0055] Furthermore, the information monitoring module monitors information received or sent by the processor and / or other functional modules according to a preset trigger data type, including at least one of the following situations:
[0056] When the preset trigger data type is an instruction, monitoring instructions of the processor and / or other functional modules for communication;
[0057] When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating;
[0058] When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules;
[0059] When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
[0060] Furthermore, the monitored corresponding information is compared with the preset comparison content, including at least one of the following situations:
[0061] Compare the corresponding information and comparison contents monitored at the monitoring time;
[0062] Compare the corresponding information and comparison content monitored at any time except the monitoring time.
[0063] Furthermore, it also includes an execution module, which is used to execute at least one of the following situations when a preset trigger condition is met:
[0064] generating a flag signal;
[0065] Output print.
[0066] Furthermore, the device monitors information received or sent by the processor and / or other functional modules by monitoring one or more of program addresses, data addresses, instructions and data on the chip bus.
[0067] Further, the information monitoring module is used to monitor the processor and / or other functional modules, including at least one of the following situations:
[0068] monitoring one or more of a program address, a data address, an instruction, and data received by the processor;
[0069] monitoring one or more of a program address, a data address, an instruction, and data issued by a processor;
[0070] monitoring one or more of program addresses, data addresses, instructions and data received by other functional modules;
[0071] Monitor one or more of program addresses, data addresses, instructions and data issued by other functional modules.
[0072] An embedded debugging system comprises any of the embedded debugging devices described above, wherein the embedded debugging system further comprises embedded software, a processor, a storage unit, other functional modules and a debugging terminal, wherein the embedded debugging device monitors information received or sent by the processor and / or other functional modules according to the settings of the debugging terminal, and is used to store or output corresponding information or generate an interrupt signal when a preset trigger condition is met.
[0073] The dynamic white box test in software testing (the abbreviation of embedded software testing, the same below) mainly tests and judges the executed programs, that is, judges the instructions executed by the processor in the program, and these instructions correspond to the program addresses corresponding to the instructions executed by the processor. Therefore, this application monitors through the information monitoring module (a hardware unit set outside the processor), compares, stores and / or outputs the program address value of the processor accessing the memory that meets the conditions through the comparison module (a hardware unit set outside the processor), and can judge the executed program, thus achieving the purpose of dynamic white box testing. The use of the method of this application for software testing also falls within the scope of protection of this application.
[0074] Beneficial effects of this application:
[0075] 1. In some scenarios, due to various restrictions (for example, when testing the whole machine, the controller chip and its related circuits have been sealed by the shell; for example, the debugger cannot be used at the customer site, etc.), we cannot use the debugging function provided by the processor in the chip. The method of this application is only to preset the trigger information through the commonly used interface (for example: USB, UART, CAN, Bluetooth, etc. external interface) and monitor the relevant information. As long as our preset trigger conditions are met, the information of the relevant problem can be captured; at the same time, it avoids the long-term and multiple operations of the program by the binary search method. Compared with the existing methods, the beneficial effects of this application are: no processor intervention is required, and the problem of not being able to use online debugging is solved through the information monitoring module and the comparison module; at the same time, compared with the binary search method, it does not require long-term and multiple operations, so as to achieve the purpose of high-efficiency debugging.
[0076] At the same time, in some other applications, compared with the code plugging method used in the existing dynamic white box testing, the use of the information monitoring module for external monitoring and the comparison module for comparison can at least bring the following beneficial effects:
[0077] The use of existing code stubbing methods requires the addition of additional code, which requires additional processor running resources, so that the time for each task processing of the program will be longer after the additional code is added, just like the processor processing speed has slowed down; the addition of these codes may also cause some problems and conflicts with the existing program, causing the program to run abnormally. However, this application does not need to change the source program, and uses an information monitoring module and a comparison module that are set outside the processor, that is, an information monitoring module and a comparison module that are independent of the source program are used to monitor and compare the source program. Compared with the existing code stubbing method, the time for each task processing of the program does not change, and the processor processing speed does not change.
[0078] 2. At the same time, the use of the existing code plugging method requires the addition of additional code. After the addition of these codes, the code length has changed, and the storage addresses of some programs have changed from before. When there is a situation in the program where the absolute addresses of these programs are accessed, the program cannot run normally. In order to ensure the normal operation of the program after adding the additional code, the program after adding these codes needs to be further adjusted, which will further increase the complexity of the program and the possibility of error. However, the present application uses a hardware unit arranged outside the processor, that is, an information monitoring module and a comparison module independent of the source program to monitor the source program. There is no need to modify the source program, and the storage or output will not be affected by the monitoring. It can completely avoid the program complexity caused by the existing code plugging method, and also avoid the program error problem caused by the existing code plugging method.
[0079] 3. Since there is no need to modify the program, software dynamic white box testing can also be used simultaneously in program black box testing and prototype testing. Compared with the existing testing methods (the existing testing methods cannot be tested simultaneously with black box testing and prototype testing because the program may change due to program modification), the testing efficiency and R&D efficiency are further greatly improved.
[0080] The existing code stub method is based on the combination of software testing and embedded software design (hereinafter referred to as "software design"). The method of this application is a method that combines chip design and application (hardware design), software testing and software design. On the basis of previous software testing and software design, the innovative introduction of hardware unit monitoring methods greatly improves the testing efficiency and R&D efficiency while achieving the same effect.
[0081] In addition, in some applications, when the comparison result meets the preset trigger condition, we store the relevant time information in the storage unit and / or output the relevant time information. Thus, the relevant time information of "when the comparison result meets the preset trigger condition" is obtained each time. The existing test method uses stub printing in the program to achieve program time performance measurement. Compared with the existing test method, the relevant time information can be obtained without modifying the program, and the time performance of the relevant program can be calculated, so as to achieve the purpose of quickly optimizing the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0083] Figure 1 is a flow chart of an embodiment of the present application;
[0084] Figure 2 This is a schematic diagram of data storage according to an embodiment of the present application;
[0085] Figure 3 is a schematic diagram of triggering and processing timing of an embodiment of the present application;
[0086] Figure 4 It is a structural framework diagram of an embodiment of the present application;
[0087] Figure 5 is another structural framework diagram of an embodiment of the present application;
[0088] Figure 6 It is a structural framework diagram of another embodiment of the present application. DETAILED DESCRIPTION
[0089] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The following will be described in detail with reference to the accompanying drawings and in combination with the embodiments.
[0090] It should be pointed out that, in each embodiment, only for the convenience of explanation, each corresponding functional unit is modularized. In fact, these functional units can also be distributed in various functional modules of the chip, and then complete the corresponding functions together.
[0091] First of all, it should be noted that in each embodiment, the terms involved are explained as follows:
[0092] Processor: It is the abbreviation of processor core. As the computing and control core of the controller chip, it is the final execution unit of information processing, data processing, and program running. It is an important component of the controller chip, such as RISC-V core CPU, ARM's M3, or other DSP cores, etc. The processor in this application is not a separate CPU like INTEL Pentium in a traditional PC computer.
[0093] MCU: A general term for a microcontroller chip, which includes 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, different from the CPU used in PCs.
[0095] Controller: The abbreviation of controller chip and embedded controller chip, including: MCU, DSP and MPU.
[0096] Chip: Also known as integrated circuit (IC). It refers to a small silicon chip containing an integrated circuit, which is often part of a computer or other electronic device. The chip in this application is an embedded controller chip.
[0097] Embedded software: It is the operating system and application software embedded in the hardware. Generally speaking, in the system, the program is a specific embodiment of embedded software.
[0098] Embedded system: includes one of the following: embedded hardware, embedded hardware includes chips; embedded software.
[0099] Embedded: is the abbreviation of embedded system.
[0100] Instruction: A code that tells the processor to do something. A program is a collection of instructions grouped together to perform a specific function; in particular, individual instructions are also part of a program.
[0101] Address: includes program address and data address.
[0102] Program address: refers to the actual address of the program in storage when it 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 in a chip that performs a specific function and can be directly or indirectly accessed or updated by a processor at a specific time; also known as peripherals, peripheral modules, peripheral functional modules, etc. Generally, in a chip, functional modules include but are not limited to storage (e.g. ROM, OTP, FLASH, SRAM, SDRAM, etc.), TIMER, GPIO module, PWM module, etc. In particular, in a multi-processor chip, at a specific time, some processors can also be accessed or updated by other processors as functional modules.
[0104] Module address: The address where the content of a functional module is accessed or updated as data by the processor.
[0105] Data includes but is not limited to: content stored in a data storage device during a program, or content that can be queried, updated, etc. by a processor.
[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 the memory (including but not limited to ROM, OTP, FLASH, SRAM, SDRAM, etc.). In addition to the address of the instruction corresponding to the software running at a specific moment as the program address, the addresses of other instructions can be used as both program addresses and data addresses.
[0107] Memory: A functional module that can store programs and data, including but not limited to ROM, OTP, FLASH, SRAM, SDRAM, etc.
[0108] Debug terminal: short for intelligent terminal, a device with input and 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, and generally refers to all content disseminated by human society. For chips, information can also be the values of one or more registers on the chip, the values of one or more combinational circuits, the values of one or more memories, or a combination of the above.
[0110] Access, including processor query and update actions on the module (i.e., read and write).
[0111] Manipulate data, including the processor's query and set actions on data.
[0112] Print: A commonly used embedded term, which refers to outputting information through external interfaces such as UART, USB, etc. on the chip.
[0113] Stub: It is to insert a piece of our custom code into the code. The purpose of stub: Since the code we insert will be compiled into the executable file together, when the processor executes the custom code we insert during operation, we can record and / or output any information we want to know, etc.
[0114] Code stubbing, also known as program stubbing, was first proposed by Professor JC Huang. It inserts some probes (also known as "detectors", which are essentially code segments for information collection, which can be assignment statements or function calls for collecting coverage information) into the program on the basis of ensuring the original logical integrity of the program under test. The probes are executed and throw out characteristic data of the program running. By analyzing these data, the control flow and data flow information of the program can be obtained, and then dynamic information such as logic coverage can be obtained, thereby achieving the testing purpose.
[0115] Code instrumentation method: Use code instrumentation method.
[0116] Insertion printing: A common term in embedded systems, it refers to the method of adding additional code to the program to output relevant information, which is generally used for testing and debugging; these additional codes will increase the processor load and may also affect the normal operation of the embedded system.
[0117] Embedded testing: It is the abbreviation of embedded system testing, including embedded software and its system testing; generally, embedded testing mainly focuses on the testing of embedded software. The embedded testing in this application refers to the testing of such embedded software or the system containing such embedded software. Embedded testing includes embedded white box testing and embedded black box testing.
[0118] Black box testing is to test whether each function can be used normally.
[0119] White box testing: White box testing is also called structural testing, transparent box testing, logic-driven testing or code-based testing. There are two types of white box testing: static and dynamic. Static testing refers to analyzing and checking programs and documents manually or with 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] Embedded software static white box testing: refers to analyzing and checking embedded programs and documents manually or with other tools without running the embedded program.
[0122] Embedded software dynamic white box testing: referred to as software dynamic white box testing, dynamic white box testing or white box testing, referred to as software dynamic white box testing in this application, is an embedded software testing method that combines the characteristics of dynamic testing and white box testing. Dynamic testing focuses on the running status of the program, while white box testing focuses on checking 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 stub testing, etc.
[0123] A controller chip includes a processor, and the processor includes the instruction "jump"; the internal program address of the chip corresponds to: 0~0x1fff; the internal data address of the chip corresponds to 0x2000~0x2fff; the internal peripheral address of the chip corresponds to 0x3000~0x3fff, and the address 0x3100 is the IO output data register address. The "jump" instruction corresponds to the first 5 bits of binary code "11100" in the 32-bit instruction target code, and we regard these two as equivalent. In addition, the "jump 0x1000" instruction refers to the instruction of "jump to address 0x1000", and the corresponding binary code in the 32-bit instruction target code is "1110 0000 0000 0000 00010000 0000 0000", and we regard these two as equivalent. Please refer to Figure 2 As shown, the program memory with the program address value "0xa00" stores the instruction "jump 0x1000"; and the data memory with the data address value "0x2100" stores the data value "0xff00".
[0124] See also Figure 1 The figure is a flowchart of a specific embodiment of an embedded debugging method.
[0125] S100, preset trigger information, the trigger information includes trigger data type, comparison content and trigger condition.
[0126] These preset trigger information can be used to correspond to the corresponding information monitored at different times.
[0127] The preset trigger 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 instruction, program address, data or data address;
[0129] When the preset trigger data type is instruction, the preset comparison content is the instruction content;
[0130] When the preset trigger data type is 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 data value;
[0132] When the preset trigger data type is a data address, the preset comparison content is a data address value.
[0133] The content of the instruction includes: a certain type of instruction; a specific instruction. A certain type of instruction refers to instructions with the same characteristics; for example, "jump" means an instruction with address jump function. A specific instruction refers to an instruction that objectively exists and is specifically executed; for example, "jump 0x1000" means the specific instruction "jump to address 0x1000".
[0134] The program address value is the address value of a specific instruction. Figure 2 As shown, for example: the address "0xa00" of the instruction "jump 0x1000" is the program address value.
[0135] The data value is the specific data. Figure 2 As shown, for example: the data "0xff00" is the data value.
[0136] The data address value is the address value of the specific data. Figure 2 As shown, for example: the address "0x2100" of the data "0xff00" is the data address value.
[0137] When the preset comparison content is the instruction content, the implicit preset trigger data type is the instruction; when the preset comparison content is the program address value, the implicit preset trigger data type is the program address; when the preset comparison content is the data value, the implicit preset trigger data type is data; when the preset comparison content is the data address value, the implicit preset trigger data type is the data address.
[0138] The preset trigger information also includes: invisible or implicit trigger data type, invisible or implicit comparison content, invisible or implicit trigger condition; or others that can be converted into these three.
[0139] S200, according to a preset trigger data type, monitoring information received or sent by the processor and / or other functional modules through an information monitoring module, where the information monitoring module is a hardware unit arranged outside the processor.
[0140] Other functional modules include: modules other than the processor, such as program memory, data memory, UART, SPI, USB, PWM, etc.
[0141] A hardware unit is an objective electronic circuit that performs certain functions; it includes circuits on chips, etc.
[0142] 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, that is, the processor is not in a debugging state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc. The information monitoring module is set in a hardware unit outside the processor. The information monitoring module works independently of the processor, and the information monitoring module can work in parallel with the processor. Of course, the information monitoring module can also monitor the information received or sent by the processor and / or other functional modules when the processor is in an abnormal working state.
[0143] 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, including at least one of the following situations:
[0144] When the preset trigger data type is an instruction, monitoring instructions of the processor and / or other functional modules for communication;
[0145] When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating;
[0146] When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules;
[0147] When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
[0148] The information received or sent by the processor and / or other functional modules is monitored by monitoring one or more of the program address, data address, instruction and data on the chip bus.
[0149] The monitoring processor and / or other functional modules include at least one of the following:
[0150] monitoring one or more of a program address, a data address, an instruction, and data received by the processor;
[0151] monitoring one or more of a program address, a data address, an instruction, and data issued by a processor;
[0152] monitoring one or more of program addresses, data addresses, instructions and data received by other functional modules;
[0153] Monitor one or more of program addresses, data addresses, 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 communicated by the processor and / or other functional modules corresponding to the preset trigger data type obtained in other ways; related information of the corresponding information communicated by the processor and / or other functional modules corresponding to the preset trigger data type obtained in other ways, and the information has a definite relationship with the corresponding information.
[0155] S300, comparing the monitored corresponding information with preset comparison content through a comparison module, where the comparison module is a hardware unit arranged outside the processor;
[0156] When the monitored corresponding information is compared with the preset comparison content, the processor is in a normal working state, that is, the processor is not in a debugging state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc. The monitored corresponding information is compared with the preset comparison content through the comparison module, and the comparison module and the processor work independently. When the comparison module performs the comparison work, the comparison module can be performed in the non-working state of the processor, and can also be performed in the abnormal working state of the processor.
[0157] Compare the monitored corresponding information with the preset comparison content, including at least one of the following situations:
[0158] Compare the corresponding information monitored at the monitoring moment with the preset comparison content;
[0159] The corresponding information monitored at a time other than the monitoring time is compared with the preset comparison content.
[0160] For example: Figure 3 As shown, C is the monitoring moment, B is the previous moment, and A is the previous 100 moments. We are now at monitoring moment C, and we can compare the corresponding information monitored at moment C with the preset comparison content; we can also compare the corresponding information monitored at moment B with the preset comparison content; we can also compare the corresponding information monitored at moment A with the preset comparison content.
[0161] Comparing the monitored corresponding information with the preset comparison content includes: indirectly comparing the monitored corresponding information with the preset comparison content in other ways; and equivalent to comparing the monitored corresponding information with the preset comparison content in other ways.
[0162] S400: When the comparison result meets the preset trigger condition, one of the following processes is performed:
[0163] Storing program address values for the processor to access other functional modules in a storage unit and / or outputting program address values for the processor to access other functional modules;
[0164] Storing data values accessed by the processor to other functional modules in a storage unit and / or outputting data values accessed by the processor to other functional modules;
[0165] Storing data address values accessed by the processor to other functional modules in a storage unit and / or outputting data address values accessed by the processor to other functional modules;
[0166] Generates an interrupt signal to the processor;
[0167] The relevant time information is stored in a storage unit and / or the relevant time information is output.
[0168] "The comparison result satisfies the preset trigger condition" includes: one comparison result satisfies the preset trigger condition; multiple comparison results all satisfy the corresponding preset trigger condition; some of the multiple comparison results satisfy the corresponding preset trigger condition; and the combination of "preset trigger condition" and "comparison result does not satisfy the preset trigger condition" is equivalent to other combinations of "preset trigger condition" and "comparison result satisfies the trigger condition" after transformation. For example: setting the "preset trigger condition" to "not equal to", "when the comparison result does not satisfy the trigger condition", it is actually equivalent to: setting the "preset trigger condition" to "equal to", "the comparison result satisfies the trigger condition".
[0169] Output refers to the direct or indirect output of information through the bus, Bluetooth, SPI, UART, USB and other interfaces on the chip or module.
[0170] When the comparison result meets the preset trigger condition, the processing is performed by the processing module, which is a hardware unit arranged outside the processor. The processing module works independently of the processor. The processing work can be performed when the processor is in a normal working state, that is, the processor is not in a debugging state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc. The processing work can be performed when the processor is in an abnormal working state.
[0171] “When the comparison result satisfies the preset trigger condition” is expressed as: in the case where the comparison result satisfies the preset trigger condition.
[0172] The processing time includes: the moment when the comparison result satisfies the preset trigger condition and any moment after the occurrence of "when the comparison result satisfies the preset trigger condition".
[0173] The time corresponding to the program address value, data value, data address value, and related time information includes: when the "comparison result meets the preset trigger condition", the time corresponding to the corresponding information monitored is used for comparison; the time of the storage moment; any time between the earliest comparison time and the storage moment.
[0174] The information corresponding to the program address value, data value, data address value, and corresponding time includes: at the corresponding time, the direct corresponding information of the communication of the monitoring processor and / or other functional modules or the corresponding information that can be obtained indirectly. For example, we store the program address value in the storage unit, and this stored program address value can be the program address value of the communication of the monitoring processor and / or other functional modules in S200 when the "comparison result meets the preset trigger condition"; it can also be the corresponding information that has a fixed corresponding relationship with this value.
[0175] The processing also includes: directly or indirectly storing or transmitting the program address value, data value, data address value, and corresponding time in other ways; storing or transmitting indirect information equivalent to or containing "program address value, data value, data address value, and corresponding time" through other operations, in conjunction with software, interrupts, or other external programmable devices.
[0176] Generating an interrupt signal to the processor also includes: generating an active trigger signal to the processor and other programmable units; and outputting a signal to the outside. These signals can trigger the processor and other programmable units to obtain relevant information through programming.
[0177] The method of the present application also includes: a method that is invisible or includes the operations of step S100, step S200, step S300 and step S400; a method that is indirectly implemented, equivalent to or can be converted into the operations of step S100, step S200, step S300 and step S400.
[0178] For example: Method A, stores the program address value when the instruction of the processor to read the memory is "jump". In Method A, step S100, step S200, step S300 and step S400 are implicitly included. Method A is equivalent to: step S100, preset trigger information, the preset trigger information includes a trigger data type of "instruction", a preset comparison content of "jump" and a preset trigger condition of "equal"; step S200, according to the preset trigger data type of "instruction", monitor the instruction content of the processor reading the memory; step S300, compare the monitored corresponding information with the preset comparison content ("jump"); step S400, when the comparison result meets the preset trigger condition "equal", perform processing work: store the program address value of the processor accessing the memory in the storage unit. Therefore, method A is within the scope of this application.
[0179] Another example: Method B, when the data address value of the processor accessing the memory is "0x2100", a message is generated externally or output through WIFI, and the message has a fixed relationship with the program address value at this time. In Method B, steps S100, S200, S300 and S400 are already implicitly included. Method B is equivalent to: Step S100, preset trigger information, the trigger information includes a preset trigger data type of "data address", a preset comparison content of "0x2100" and a preset trigger condition of "equal"; Step S200, according to the preset trigger data type of "data address", monitor the data address value of the processor accessing the memory; Step S300, compare the monitored corresponding information with the preset comparison content "0x2100"; Step S400, when the comparison result meets the preset trigger condition "equal", perform processing: output the program address value of the processor accessing the memory. Although method B generates a message to the outside or outputs a message via WIFI at this time, the message has a fixed relationship with the program address value at this time; therefore, "generating a message to the outside or outputting a message via WIFI" at this time is equivalent to outputting the information "the program address value when the data address value of the processor accessing the memory is 0x2100". Therefore, method B is within the scope of this application.
[0180] Another example: Method C, when the data address value of the processor accessing the memory is "0x2100", an interrupt signal is generated to the processor. In Method C, steps S100, S200, S300 and S400 are implicitly included. Method C is equivalent to: Step S100, preset trigger information, the preset trigger information includes a trigger data type of "data address", a preset comparison content of "0x2100" and a preset trigger condition of "equal"; Step S200, according to the preset trigger data type of "data address", monitor the data address value of the processor accessing the memory; Step S300, compare the monitored corresponding information with the preset comparison content "0x2100"; Step S400, when the comparison result meets the preset trigger condition "equal", process: generate an interrupt signal to the processor. In Method C, after an interrupt signal is generated to the processor, the processor can obtain relevant information (for example: program address value) when the preset trigger condition is met with the help of interrupt-related actions. Therefore, Method C is within the scope of this application.
[0181] The storage unit includes at least one of the following two situations:
[0182] Internal storage unit;
[0183] External storage unit.
[0184] Internal storage units refer to units with storage functions inside the chip, including registers, FIFO, SRAM, FLASH, etc.
[0185] An external storage unit refers to a unit with storage function outside the chip, including: FLASH, SRAM, U disk, SD card, hard disk and other units with storage function outside the external chip.
[0186] For example: Figure 3 As shown, C is the monitoring moment, B is the previous moment, and A is the moment of the previous 100 cycles. We can preset the trigger information as follows: the first trigger information is that the data type is "instruction", the preset comparison content is the instruction content "jump 0x1000" and the preset trigger condition is "equal". According to "the data type is instruction", the previous cycle moment (C is the monitoring moment, Figure 3 B is the moment of the previous cycle) and the processor and / or other functional modules communicate with the monitored instruction, and compare the monitored instruction with "jump 0x1000". If the comparison result is equal, the comparison result of the first trigger information meets the preset trigger condition; the second trigger information is that the data type is "data address", the preset comparison content is the data address value "0x2100" and the preset trigger condition is "equal". According to the "data type is data address", the first 100 cycle moments are monitored (C is the monitoring moment, Figure 3 A is the data address of the processor and / or other functional modules communicating at the previous 100 cycle moments, and the monitored data address is compared with "0x2100". If the comparison result is equal, it means that the second trigger information comparison result meets the preset trigger condition; when the first trigger information comparison result satisfies the first trigger condition and the second trigger information comparison result satisfies the second trigger condition, the "program address value of the processor accessing the program memory" at the monitoring moment C is stored in the storage unit at the next moment.
[0187] When the preset trigger condition is met, at least one of the following is executed:
[0188] generating a flag signal;
[0189] Output print.
[0190] A flag signal is a signal used by internal or external programmable devices (including processors) to query relevant information through software, interrupts, etc.
[0191] Output printing is a method of outputting relevant information to the outside through UART, USB and other interfaces.
[0192] Although there may be many "jump 0x1000" instructions in the program, in this embodiment, by presetting the trigger information, we can capture the relevant program address of the chip executing the instruction at the time when the condition is met, so as to achieve our debugging and positioning purpose. In many scenarios, due to various restrictions (for example, when the whole machine is tested, the controller chip and its related circuits have been sealed by the shell; for example, the debugger cannot be used at the customer site, etc.), we cannot connect the emulator to the chip and cannot use the debugging function of the processor in the chip; this method can quickly locate the problem in an environment where the processor works in a normal working state, which is very beneficial. At the same time, because steps S200, S300 and S400 work in parallel with the processor, they do not occupy the processor's running resources and do not require the processor to intervene, which solves the problem of being unable to use online debugging; at the same time, compared with traditional serial port debugging, this method uses real-time monitoring and comparison methods. Compared with the binary method, it does not require multiple long-term and multiple operations, which is very efficient. This method can quickly locate the program address of related problems and perform efficient debugging.
[0193] The following is another embodiment of an embedded debugging method.
[0194] S100, preset trigger information, the trigger information includes preset trigger data type, comparison content and trigger condition.
[0195] The preset trigger conditions include: equal, not equal, greater than, greater than or equal to, less than, less than or equal to. For example, the preset trigger condition in the preset trigger information is "equal".
[0196] The preset trigger data types include instruction, program address, data or data address;
[0197] When the preset trigger data type is instruction, the preset comparison content is the instruction content;
[0198] When the preset trigger data type is 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 data value;
[0200] When the preset trigger data type is a data address, the preset comparison content is a data address value.
[0201] For example, we preset the data type in the trigger information as "program address"; the preset comparison content in the trigger information is the program address value "0xa00" at the program insertion point.
[0202] S200, according to a preset trigger data type, monitoring information received or sent by the processor and / or other functional modules through an information monitoring module, where the information monitoring module is a hardware unit arranged outside the processor.
[0203] Other functional modules include: modules other than the processor, such as program memory, data memory, UART, SPI, USB, PWM, etc.
[0204] 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, including at least one of the following situations:
[0205] When the preset trigger data type is an instruction, monitoring instructions of the processor and / or other functional modules for communication;
[0206] When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating;
[0207] When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules;
[0208] When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
[0209] For example: according to the preset trigger data type of "program address", the program address of the communication of the processor and / or other functional modules is monitored.
[0210] S300, comparing the monitored corresponding information with preset comparison content through a comparison module, where the comparison module is a hardware unit arranged outside the processor;
[0211] Compare the monitored corresponding information with the preset comparison content, including at least one of the following situations:
[0212] Compare the corresponding information and comparison contents monitored at the monitoring time;
[0213] Compare the corresponding information and comparison content monitored at any time except the monitoring time.
[0214] For example, the program address of the processor and / or other functional modules communicated monitored at the last moment is compared with the program address value "0xa00" at the comparison content program insertion point.
[0215] While comparing the monitored corresponding information and the comparison content, the relevant variables (variables in registers and memories) are queried and / or modified; thus, complex tests in dynamic white box testing (for example: conditional combination coverage testing, etc.) can be implemented.
[0216] S400: When the comparison result meets the preset trigger condition, one of the following processes is performed:
[0217] Storing program address values for the processor to access other functional modules in a storage unit and / or outputting program address values for the processor to access other functional modules;
[0218] Storing data values accessed by the processor to other functional modules in a storage unit and / or outputting data values accessed by the processor to other functional modules;
[0219] Storing data address values accessed by the processor to other functional modules in a storage unit and / or outputting data address values accessed by the processor to other functional modules;
[0220] Generates an interrupt signal to the processor;
[0221] The relevant time information is stored in a storage unit and / or the relevant time information is output.
[0222] For example, at the next moment when the comparison result satisfies the preset trigger condition, the program address value "0xa00" of the processor accessing the program memory is stored in the storage unit.
[0223] like Figure 2 As shown, although there may be many "jump 0x1000" instructions in the program, in this embodiment, by presetting the trigger information (the data type is "program address", the comparison content is the program address value "0xa00" at the program plug-in, and the preset trigger condition is "equal"), we can determine that when the condition is met, the chip executes the instruction with the program address value "0xa00", and then: the program address value "0xa00" of the processor accessing the program memory is stored in the storage unit. We read this information (program address value "0xa00") from the storage unit, so that we can know that the program executes the instruction with the program address value "0xa00" (instruction "jump 0x1000"), and achieve the purpose of statement coverage test in software dynamic white box testing.
[0224] The method of the present application uses an information monitoring module and a comparison module to monitor the program address value of the processor accessing the memory, and stores the program address value that meets the conditions in a storage unit and / or outputs it, without adding code to the program and without occupying additional processor running resources. The information monitoring module and the comparison module are hardware units arranged 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 programs, that is, judging the instructions executed by the processor in the program; these instructions correspond to the program addresses corresponding to the instructions executed by the processor; therefore, by monitoring, comparing, storing and / or outputting the program address values of the processor accessing the memory that meet the conditions, it is possible to judge the executed programs and achieve the purpose of dynamic white box testing.
[0226] Using the existing code stubbing method requires adding additional code, which requires additional processor running resources; adding these codes may cause some problems and conflicts with existing programs. For example, the original program needs 200 clock cycles to run one task cycle. After adding these codes, it becomes 220 clock cycles for one task cycle, which makes the program task cycle run longer after adding the additional code, just like the processor processing speed is slowed down; this is equivalent to: the 20Mhz processor used to output a pulse in 10us, and after the code stubbing, it becomes 11us to output a pulse, which will cause the program to run abnormally. However, the present application does not need to change the source program, and uses an information monitoring module and a comparison module set outside the processor, that is, uses an information monitoring module and a comparison module independent of the source program to monitor the source program. Compared with the existing code stubbing method, the program runs each task cycle without changes, the processor processing speed does not change, and no new problems and conflicts are introduced.
[0227] At the same time, the use of the existing code stub method requires the addition of additional code. After adding these codes, the code length changes, and some program storage addresses change from before. When there is a situation in the program that accesses the absolute addresses of these programs, the program will not run normally. For example: in a program with a remote upgrade function, a program with an absolute storage address in the program is updated using remote communication technology; the address of the program to be upgraded is 0x500~0x800, and the use of the existing code stub method requires the addition of additional code, and its program address becomes 0x510~0x810; in this way, the program cannot run normally after upgrading the original program at 0x500~0x800. In order to ensure the normal operation of the program after adding the additional code, the program after adding these codes needs to be further adjusted, which will further increase the complexity of the program and the possibility of errors. By using an information monitoring module and a comparison module outside the processor, that is, using an information monitoring module and a comparison module independent of the source program to monitor the source program, there is no need to change the source program, and the storage or output will not be affected by the monitoring. The program complexity caused by the existing code insertion method can be completely avoided, and the program error problem caused by the existing code insertion method can also be avoided.
[0228] Since there is no need to modify the program, dynamic white box testing of the software can be performed simultaneously during program black box testing and prototype testing. Compared with existing testing methods, this greatly improves testing efficiency and R&D efficiency.
[0229] The following is another embodiment of an embedded debugging method.
[0230] Preset trigger information, the trigger information includes trigger data type, comparison content and trigger condition;
[0231] Monitoring information received or sent by the processor and / or other functional modules according to preset trigger data types;
[0232] Compare the monitored corresponding information with the preset comparison content;
[0233] When the comparison result meets the preset trigger condition, one of the following processes is performed:
[0234] The relevant time information is stored in a storage unit and / or the relevant time information is output.
[0235] By presetting trigger information, when the comparison result meets the preset trigger condition, we store the relevant time information in the storage unit and / or output the relevant time information. Thus, we can obtain the relevant time information each time "when the comparison result meets the preset trigger condition", so as to calculate the time performance of the relevant program. Compared with the existing test method, the time performance of the relevant program can be calculated without modifying the program, which improves the test efficiency and achieves the effect of quickly optimizing the program.
[0236] The embedded debugging method in the above embodiment is also applicable to embedded testing, and its basic method and steps are the same, which will not be repeated here. Using the method of the present application for testing also falls within the protection scope of the present application.
[0237] See also Figure 4 and Figure 5 As shown, a specific embodiment of an embedded debugging device is shown.
[0238] An embedded debugging device, comprising:
[0239] The trigger information configuration module M100 is used to preset trigger information, and the trigger information includes trigger data type, comparison content and trigger condition;
[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 instruction, the preset comparison content is the instruction content;
[0242] When the preset trigger data type is 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 data value;
[0244] When the preset trigger data type is a data address, the preset comparison content is a data address value.
[0245] The information monitoring module M200 is used to monitor the information received or sent by the processor and / or other functional modules according to a preset trigger data type. The information monitoring module is a hardware unit arranged outside the processor.
[0246] The information monitoring module M200 works when the processor is in a normal working state, that is, the processor is not in a debugging state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc. The information monitoring module M200 works independently of the processor. The information monitoring module and the processor work in parallel. Of course, the information monitoring module can also work when the processor is in an abnormal working state.
[0247] The information monitoring module M200 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 situations:
[0248] When the preset trigger data type is an instruction, monitoring instructions of the processor and / or other functional modules for communication;
[0249] When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating;
[0250] When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules;
[0251] When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
[0252] Comparison module M300: The comparison module M300 is used to compare the monitored corresponding information with the preset comparison content. The comparison module is a hardware unit arranged outside the processor.
[0253] The comparison module M300 works when the processor is in a normal working state, that is, the processor is not in a debugging state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc. The comparison module M300 works independently of the processor. The comparison module M300 and the processor work in parallel. Of course, the comparison module M300 can also work when the processor is in an abnormal working state.
[0254] Compare the monitored corresponding information with the preset comparison content, including at least one of the following situations:
[0255] Compare the corresponding information monitored at the monitoring moment with the preset comparison content;
[0256] Compare the corresponding information monitored at any time except the monitoring time with the preset comparison content.
[0257] The processing module M400 is used to perform one of the following processes when the comparison result meets the trigger condition:
[0258] Storing program address values for the processor to access other functional modules in a storage unit and / or outputting program address values for the processor to access other functional modules;
[0259] Storing data values accessed by the processor to other functional modules in a storage unit and / or outputting data values accessed by the processor to other functional modules;
[0260] Storing data address values accessed by the processor to other functional modules in a storage unit and / or outputting data address values accessed by the processor to other functional modules;
[0261] Generates an interrupt signal to the processor;
[0262] The relevant time information is stored in a storage unit and / or the relevant time information is output.
[0263] The processing module M400 is a hardware unit arranged outside the processor. The processing module M400 works when the processor is in a normal working state, that is, the processor is not in a debugging state, or the processor is not in an interrupt state, or the processor is not in an abnormal state, etc. The processing module M400 works independently of the processor. The processing module M400 and the processor work in parallel. Of course, the processing module M400 can also work when the processor is in an abnormal working state.
[0264] The storage unit includes at least one of the following two situations:
[0265] Internal storage unit;
[0266] External storage unit. For example: EEPROM, FLASH, SRAM and other units with storage functions outside the chip.
[0267] The execution module M500 is used to execute at least one of the following situations:
[0268] generating a flag signal;
[0269] Output print.
[0270] exist Figure 5 In the embodiment, device 1#, device 2#, device 3#, ... device n# are all the same embedded debugging devices, that is, the embedded debugging devices in the present application are all arranged outside the processor and can work normally. The embedded debugging devices can be arranged separately or in other hardware. The embedded debugging devices can be arranged in different positions according to the needs of the structure. Figure 5 The device numbers in the table are only used to distinguish the different locations of the device settings for embedded debugging. Figure 5 As shown, 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, instruction and data on the chip bus.
[0271] The information monitoring module in the embedded debugging device is used to monitor the processor and / or other functional modules, including at least one of the following situations:
[0272] monitoring one or more of a program address, a data address, an instruction, and data received by the processor;
[0273] monitoring one or more of a program address, a data address, an instruction, and data issued by a processor;
[0274] monitoring one or more of program addresses, data addresses, instructions and data received by other functional modules;
[0275] Monitor one or more of program addresses, data addresses, 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 objective things that can achieve certain functions.
[0277] The device in this application includes but is not limited to: software, chip circuit, FPGA, electrical circuit, electronic circuit and other objective things that can realize certain functions.
[0278] In this embodiment, by presetting the trigger information configuration module of the debugging device, when the comparison result meets the preset trigger condition, we can know the relevant information. In an environment where the processor works in a normal working state, the device of the present application can achieve: quickly locate the program address of the relevant problem; perform efficient dynamic white box testing; and measure the program time performance. At the same time, because the information monitoring module M200, the comparison module M300 and the processing module M400 are hardware units arranged outside the processor; these hardware units work in parallel with the processor and do not occupy the processor's operating resources, the processor can work very efficiently.
[0279] Figure 6 It is a schematic diagram of an embedded debugging system provided by another embodiment. Figure 6 The device in is the embedded debugging device in this application. The embedded debugging device is set in the chip. Of course, it can also be set in other hardware or set separately, as long as it is set outside the processor and can work normally.
[0280] An embedded debugging system comprises an embedded debugging device, embedded software, a processor, a storage unit, other functional modules and a debugging terminal, wherein the embedded software is in the memory. Figure 6 The chip includes an embedded debugging device, a processor, a program memory (a program memory is a type of memory, and the embedded software is in the program memory), a data memory (a data memory is a type of storage unit) and other modules; other functional modules include Figure 6 The program memory, data memory and other modules in it. The embedded debugging device monitors the corresponding information of the communication between the processor and other functional modules according to the settings of the debugging terminal, and is used to store the corresponding information or output the corresponding information or generate an interrupt signal when the preset trigger condition is met. The corresponding information here 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. For example: program memory, data memory, UART, SPI, USB, PWM, etc. The embedded debugging system of the present application can achieve: quickly locate the program address of related problems during debugging to achieve the purpose of high-efficiency debugging; perform efficient dynamic white box testing; measure the program time performance to achieve the effect of quickly optimizing the program.
[0281] Obviously, the embodiments described above are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
Claims
1. An embedded debugging method, characterized in that: include: Preset trigger information, the trigger information including trigger data type, comparison content and trigger condition; According to the preset trigger data type, the information received or sent by the processor and / or other functional modules is monitored by an information monitoring module, wherein the information monitoring module is a hardware unit arranged outside the processor, and the information monitoring module works independently of the processor; Comparing the monitored corresponding information with the preset comparison content through a comparison module, wherein the comparison module is a hardware unit arranged outside the processor; When the comparison result meets the preset trigger condition, one of the following processes is performed: storing the program address value for the processor to access the other functional modules in a storage unit and / or outputting the program address value for the processor to access the other functional modules; storing the data value accessed by the processor to the other functional modules in a storage unit and / or outputting the data value accessed by the processor to the other functional modules; Storing the data address value accessed by the processor to the other functional modules in a storage unit and / or outputting the data address value accessed by the processor to the other functional modules; Generates an interrupt signal to the processor; Storing the relevant time information in a storage unit and / or outputting the relevant time information; Wherein, the embedded debugging method presets the trigger information through a common interface, and the common interface includes USB, UART, CAN, and Bluetooth; Among them, the information monitoring module monitors the information received or sent by the processor and / or the other functional modules when the processor is in a normal working state or an abnormal working state. The processor being in a normal working state includes that the processor is not in a debugging state, the processor is not in an interrupt state, or the processor is not in an abnormal state.
2. The embedded debugging method according to claim 1, characterized in that: The preset trigger data type includes instruction, program address, data or data address; When the preset trigger data type is instruction, the preset comparison content is instruction content; When the preset trigger data type is a program address, the preset comparison content is a program address value; When the preset trigger data type is data, the preset comparison content is a 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: 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, including at least one of the following situations: When the preset trigger data type is an instruction, monitoring instructions communicated by the processor and / or other functional modules; When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating; When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules; When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
4. The embedded debugging method according to claim 1, characterized in that: When the comparison result satisfies the preset trigger condition, at least one of the following is further performed: generating a flag signal; Output print.
5. The embedded debugging method according to claim 1, characterized in that: Monitoring the corresponding information of the processor and / or other functional modules is achieved by monitoring one or more of the program address, data address, instruction and data on the chip bus.
6. The embedded debugging method according to claim 1, characterized in that: The monitoring processor and / or other functional modules receive or send information, including at least one of the following situations: monitoring one or more of a program address, a data address, an instruction, and data received by the processor; monitoring one or more of a program address, a data address, an instruction, and data issued by the processor; monitoring one or more of a program address, a data address, an instruction and data received by the other functional modules; Monitor one or more of the program address, data address, instruction and data issued by the other functional modules.
7. An embedded debugging device, characterized in that: include: A trigger information configuration module, the trigger information configuration module is used to preset trigger information, the trigger information includes trigger data type, comparison content and trigger condition; An information monitoring module, 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 arranged outside the processor, and the information monitoring module works independently of the processor; A comparison module, the comparison module is used to compare the monitored corresponding information with the preset comparison content, and the comparison module is a hardware unit arranged outside the processor; A processing module, wherein the processing module is used to perform one of the following processing when the comparison result meets the preset trigger condition: storing the program address value for the processor to access the other functional modules in a storage unit and / or outputting the program address value for the processor to access the other functional modules; storing the data value accessed by the processor to the other functional modules in a storage unit and / or outputting the data value accessed by the processor to the other functional modules; Storing the data address value accessed by the processor to the other functional modules in a storage unit and / or outputting the data address value accessed by the processor to the other functional modules; Generates an interrupt signal to the processor; Storing the relevant time information in a storage unit and / or outputting the relevant time information; Wherein, the embedded debugging device presets the trigger information through a common interface, and the common interface includes USB, UART, CAN, and Bluetooth; Among them, the information monitoring module monitors the information received or sent by the processor and / or the other functional modules when the processor is in a normal working state or an abnormal working state. The processor being in a normal working state includes that the processor is not in a debugging state, the processor is not in an interrupt state, or the processor is not in an abnormal state.
8. The embedded debugging device according to claim 7, characterized in that: The trigger data type preset in the trigger information configuration module includes instructions, program addresses, data or data addresses; When the preset trigger data type is instruction, the preset comparison content is instruction content; When the preset trigger data type is a program address, the preset comparison content is a program address value; When the preset trigger data type is data, the preset comparison content is a 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 device 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 situations: When the preset trigger data type is an instruction, monitoring instructions communicated by the processor and / or other functional modules; When the preset trigger data type is a program address, monitoring the program address of the processor and / or other functional modules communicating; When the preset trigger data type is data, monitoring the data communicated by the processor and / or other functional modules; When the preset trigger data type is a data address, the data address of the communication between the processor and / or other functional modules is monitored.
10. The embedded debugging device according to claim 7, characterized in that: The system further includes an execution module, which is used to execute at least one of the following situations when the preset trigger condition is met: generating a flag signal; Output print.
11. The embedded debugging device according to claim 7, characterized in that: The device monitors the corresponding information communicated by the processor and / or other functional modules by monitoring one or more of program addresses, data addresses, instructions and data on the chip bus.
12. The embedded debugging device 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 situations: monitoring one or more of a program address, a data address, an instruction, and data received by the processor; monitoring one or more of a program address, a data address, an instruction, and data issued by the processor; monitoring one or more of a program address, a data address, an instruction and data received by the other functional modules; Monitor one or more of the program address, data address, instruction and data issued by the other functional modules.
13. An embedded debugging system, characterized in that: The embedded debugging device comprises any one of claims 7 to 12, wherein the embedded debugging system further comprises embedded software, a processor, a storage unit, other functional modules and a debugging terminal, and the embedded debugging device 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