Debugging system and method based on X bus and storage medium

The debugging system based on the X-bus solves the limitations of traditional embedded system debugging scenarios and insufficient data processing, realizes remote, full lifecycle debugging capabilities, improves debugging efficiency and data security, and supports flexible interaction and multi-format export.

CN121900371APending Publication Date: 2026-04-21NEUSOFT RUICHI AUTOMOTIVE TECH (WUHAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NEUSOFT RUICHI AUTOMOTIVE TECH (WUHAN) CO LTD
Filing Date
2025-12-30
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Traditional embedded system debugging suffers from limitations in debugging scenarios, insufficient data processing and display, and a lack of data export and encryption functions. In particular, it cannot be effectively debugged after the device is deployed or in scenarios where it is difficult to access. Furthermore, existing tools lack flexible interactive functions.

Method used

The system employs an X-bus-based debugging system, including a debugging host computer and debugging protocol firmware. Remote debugging is achieved through the X-bus (serial port, CAN bus, Ethernet). It integrates a MAP file parsing module to automatically extract debugging symbols, provides graphical waveform display and SHELL interaction functions, and supports data encryption and multi-format export.

Benefits of technology

It enables remote, full-lifecycle debugging of embedded systems, lowers the debugging threshold, improves debugging efficiency and accuracy, supports flexible interactive operations, and ensures data security and ease of analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121900371A_ABST
    Figure CN121900371A_ABST
Patent Text Reader

Abstract

The invention provides a debugging system and method based on an X bus and a storage medium, in the system, the debugging system formed by a debugging upper computer at a host computer end and debugging protocol firmware on a target MCU through the X bus (serial port / CAN / Ethernet) is constructed, a special simulator is completely separated, and the debugging efficiency is greatly improved. The debugging capability after remote, cross-network and equipment deployment is realized, full-life-cycle debugging of an embedded system is supported, a debugging scene is greatly expanded, a debugging upper computer is integrated with an MAP file analysis module, debugging symbols (a memory address of a global variable, a data type, an entry address of a function and a parameter list) are automatically extracted, and the debugging efficiency is improved. The WYSIWYG symbolization debugging is realized, a user does not need to care about a bottom layer address, the debugging threshold is greatly reduced, the debugging efficiency and accuracy are improved, and the data processing capability is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of embedded system debugging, and in particular to a debugging system, method and storage medium based on the X bus. Background Technology

[0002] In the field of embedded system development and debugging, bus technology, as the core carrier of data transmission, has been widely used. Common bus types currently include serial ports, CAN (Controller Area Network), CAN FD (CAN with Flexible Data-Rate), and Ethernet ports. Among them, serial ports were widely used in early embedded device debugging due to their simple structure and low cost; CAN bus, with its high reliability and real-time performance, is widely used in automotive electronics, industrial control, and other fields; CAN FD bus improves the data transmission rate and data length based on CAN bus, further meeting the needs of high-bandwidth scenarios; and Ethernet ports, relying on their high-speed data transmission capabilities, play an important role in the debugging of embedded systems that require a large amount of data interaction.

[0003] During embedded system debugging, developers need to acquire various data from the MCU (microcontroller unit) during operation, such as global variable values ​​and function execution status, to determine if the system is running normally and to locate potential faults. Traditional debugging methods typically rely on an emulator connected to the MCU and debugging software to read relevant data. However, this approach has limitations in debugging scenarios; for example, it is difficult to perform effective debugging when the device is already installed or when a physical connection to the emulator is not possible. Furthermore, traditional debugging tools have shortcomings in data processing and display. Most can only present data in simple text format, lacking graphical waveform display capabilities, making it difficult for developers to intuitively analyze data trends. In addition, their data export and encryption functions are relatively limited, failing to meet the needs for debugging information security and subsequent data analysis.

[0004] The traditional embedded system debugging process described above has the following drawbacks: Debugging scenario limitations: Traditional simulator-based debugging methods are limited by physical connections and cannot be used for debugging after the device is securely deployed or in scenarios where it is difficult to access, thus failing to meet the debugging needs of embedded systems throughout their entire lifecycle.

[0005] Insufficient data processing and display: Existing debugging tools struggle to parse MAP files to quickly obtain global variables and function addresses, making it difficult to conveniently execute corresponding functions and modify global variables. They also lack graphical waveform display capabilities, failing to intuitively present the dynamic changes in variable data, thus increasing the difficulty of data analysis for developers.

[0006] Lack of data export and encryption functions: Most traditional debugging tools do not have the ability to encrypt debugging information, which leads to security risks during the transmission and storage of debugging data; in addition, the data export format is limited, usually only supporting simple text format, and cannot be exported as Excel files that are easy to analyze in depth, which is not conducive to developers to further organize and analyze debugging data.

[0007] Insufficient interactive functionality: Most debugging tools lack shell-like interactive functionality, preventing developers from flexibly interacting with the MCU via command line to perform custom operations, thus reducing the flexibility and efficiency of debugging.

[0008] In summary, the traditional embedded system debugging process has limitations in terms of debugging scenarios and data processing. Summary of the Invention

[0009] In view of this, the purpose of the present invention is to provide a debugging system, method and storage medium based on the X bus to alleviate the limitations of traditional embedded system debugging processes in terms of debugging scenarios and data processing.

[0010] In a first aspect, the present invention provides a debugging system based on the X bus for remote debugging of a target MCU, the system comprising: A debugging host computer, running on the host computer, includes: A bus interface module is used to establish a communication connection with the target MCU via an X bus, wherein the X bus includes any of the following: serial port, CAN bus, CAN FD bus, or Ethernet; The MAP file parsing module is used to import and parse the MAP file generated by the application compilation of the target MCU to obtain the memory address, data type, function entry address and parameter list of global variables in the application; The debugging interaction module is used to receive the user's debugging operation instructions based on the information provided by the MAP file parsing module, and convert the debugging operation instructions into debugging instruction frames that conform to a predetermined protocol, and send them to the target MCU through the bus interface module; It also includes: debug protocol firmware, running on the target MCU, communicating with the debug host computer via the X bus, and the debug protocol firmware is configured as follows: Receive and parse debugging command frames from the debugging host computer; Execute corresponding debugging operations based on the parsing results, wherein the debugging operations include: reading and writing operations to a specified memory address or calling operations to a specified function; The result of the debugging operation is encapsulated into a response frame and returned to the debugging host computer.

[0011] Furthermore, the debugging operation includes: function call operation; When the debugging operation instruction is a function call, the debugging interaction module is configured to generate a function call instruction frame containing the target function entry address and parameter data based on the function identifier selected by the user and the input parameter values. The debug protocol firmware is configured to: parse the function call instruction frame, obtain the target function entry address and parameter data, call the target function in the current operating environment of the target MCU, and encapsulate the function return value into the response frame.

[0012] Furthermore, the debugging host computer also includes: a graphical waveform display module; The graphical waveform display module is configured to: receive one or more global variable identifiers and sampling periods specified by the user; periodically send read instructions for the memory address of the global variable identifier to the target MCU through the debugging interaction module according to the sampling period; and dynamically display the acquired variable values ​​in the form of waveforms in chronological order.

[0013] Furthermore, the debugging host computer also includes: a SHELL interaction module; The SHELL interaction module provides a command-line interface for receiving user-inputted custom command strings and sending the custom command strings as debug instruction frames to the debug protocol firmware for execution.

[0014] Furthermore, the debugging host computer also includes: a debugging information encryption module and a data export module; The debugging information encryption module is used to encrypt the debugging data using an encryption algorithm during or after the debugging process. The data export module is used to export encrypted or plaintext debugging data into text format or Excel spreadsheet format containing data statistical analysis results.

[0015] Furthermore, the debugging protocol firmware resides in the memory of the target MCU and runs independently of the application. It listens for debugging instruction frames on the X bus through interrupts or polling to achieve non-intrusive debugging of the application.

[0016] Furthermore, the debugging operation includes: global variable modification operation; When the debugging operation instruction is a global variable modification, the debugging interaction module is configured to: generate a global variable modification instruction frame containing the memory address of the global variable and the value of the variable, based on the global variable and the variable value selected by the user; The debugging protocol firmware is configured to: parse the global variable modification instruction frame, obtain the memory address and value of the global variable, determine the corresponding variable storage unit based on the memory address of the global variable, write the variable value, complete the variable modification, and then encapsulate the confirmation information of successful modification into the response frame.

[0017] Furthermore, the debugging host computer can simultaneously establish communication connections with the debugging protocol firmware on multiple target MCUs and perform independent or collaborative debugging operations on multiple target MCUs.

[0018] In a second aspect, the present invention also provides a debugging method using a system as described in any of the first aspects, the method comprising: The debugging host computer establishes a communication connection with the debugging protocol firmware on the target MCU through the selected X bus; The debugging host computer parses the MAP file to obtain debugging symbol information; The user initiates a debugging operation through the debugging host computer, which converts the debugging operation into a debugging instruction frame and sends it to the target MCU; the debugging protocol firmware executes the corresponding operation and returns the debugging result. The debugging host computer receives and displays the debugging results.

[0019] Thirdly, the present invention also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor to perform the method described in the second aspect.

[0020] This invention provides a debugging system based on the X-bus for remote debugging of a target MCU. The system includes: a debugging host computer running on a host computer, comprising: a bus interface module for establishing a communication connection with the target MCU via the X-bus, wherein the X-bus includes any of the following: serial port, CAN bus, CAN FD bus, or Ethernet; a MAP file parsing module for importing and parsing the MAP file generated by the application compiled by the target MCU to obtain the memory addresses, data types, function entry addresses, and parameter lists of global variables in the application; a debugging interaction module for receiving user debugging operation commands based on the information provided by the MAP file parsing module, converting the debugging operation commands into debugging command frames conforming to a predetermined protocol, and sending them to the target MCU via the bus interface module; and a debugging protocol firmware running on the target MCU, communicating with the debugging host computer via the X-bus, the debugging protocol firmware being configured to: receive and parse debugging command frames from the debugging host computer; execute corresponding debugging operations based on the parsing results, wherein the debugging operations include: read / write operations on a specified memory address or call operations on a specified function; and encapsulate the results of the debugging operations into a response frame and return it to the debugging host computer. As described above, the X-bus-based debugging system of this invention constructs a debugging system consisting of a debugging host computer on the host computer and the debugging protocol firmware on the target MCU via the X-bus (serial port / CAN / Ethernet). It completely eliminates the need for a dedicated emulator, achieving remote, cross-network, and post-device deployment debugging capabilities. It supports debugging throughout the entire lifecycle of embedded systems, greatly expanding the debugging scenarios. The debugging host computer integrates a MAP file parsing module, automatically extracting debugging symbols (memory addresses and data types of global variables, function entry addresses, and parameter lists), achieving WYSIWYG symbolic debugging. Users do not need to concern themselves with the underlying addresses, greatly reducing the debugging threshold, improving debugging efficiency and accuracy, and significantly enhancing data processing capabilities. This alleviates the limitations of traditional embedded system debugging processes in terms of debugging scenarios and data processing. Attached Figure Description

[0021] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 A block diagram of a debugging system based on the X bus provided in an embodiment of the present invention; Figure 2 A flowchart illustrating a debugging method based on the X bus provided in an embodiment of the present invention. Detailed Implementation

[0023] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0024] Traditional embedded system debugging processes have limitations in terms of debugging scenarios and data processing.

[0025] Based on this, the X-bus-based debugging system of this invention constructs a debugging system consisting of a debugging host computer on the host computer and the debugging protocol firmware on the target MCU via the X-bus (serial port / CAN / Ethernet). It completely eliminates the need for a dedicated emulator, realizing remote, cross-network, and post-device deployment debugging capabilities. It supports debugging throughout the entire lifecycle of embedded systems, greatly expanding the debugging scenarios. The debugging host computer integrates a MAP file parsing module, automatically extracting debugging symbols (memory addresses, data types, function entry addresses, and parameter lists of global variables), realizing WYSIWYG symbolic debugging. Users do not need to care about the underlying addresses, greatly reducing the debugging threshold, improving debugging efficiency and accuracy, and significantly enhancing data processing capabilities.

[0026] To facilitate understanding of this embodiment, a detailed description of a debugging system based on the X bus disclosed in this embodiment of the invention will be provided first.

[0027] Figure 1 This is a block diagram of a debugging system based on the X-bus according to an embodiment of the present invention, such as... Figure 1 As shown, the system for remotely debugging a target MCU includes: Debugging the host computer, which runs on the host computer, includes: The bus interface module is used to establish a communication connection with the target MCU via the X bus, wherein the X bus includes any of the following: serial port, CAN bus, CAN FD bus, Ethernet; The MAP file parsing module is used to import and parse the MAP file generated by the application compilation of the target MCU to obtain the memory address, data type, function entry address and parameter list of global variables in the application; The debug interaction module is used to receive the user's debug operation commands based on the information provided by the MAP file parsing module, and convert the debug operation commands into debug command frames that conform to a predetermined protocol, and send them to the target MCU through the bus interface module; It also includes: debug protocol firmware, which runs on the target MCU and communicates with the debug host computer via the X bus. The debug protocol firmware is configured as follows: Receive and parse debug command frames from the debug host computer; Execute corresponding debugging operations based on the parsing results. Debugging operations include: reading and writing to a specified memory address or calling a specified function. The result of the debugging operation is encapsulated into a response frame and returned to the debugging host computer.

[0028] In this embodiment of the invention, the debugging system based on the X bus mainly consists of two parts: a debugging host computer running on the host computer and a debugging protocol firmware running on the target MCU. The debugging host computer establishes a communication connection with the target MCU through the X bus, which can be a serial port, CAN bus, CAN FD bus, or Ethernet.

[0029] Debugging host computer: It has a bus interface module, MAP file parsing module, debugging interaction module, SHELL interaction module, graphical waveform display module, debugging information encryption module and data export module.

[0030] Debug protocol firmware: Matched with the debugging host computer, it runs on the target MCU and is responsible for establishing a communication connection between the target MCU and the debugging host computer to realize bidirectional data transmission. This includes receiving debugging instruction frames (such as function call instructions and global variable modification instructions) sent by the debugging host computer, and feeding back relevant data during the operation of the target MCU (i.e., the results of debugging operations, such as global variable values ​​and function execution status) to the debugging host computer.

[0031] This invention provides a debugging system based on the X-bus for remote debugging of a target MCU. The system includes: a debugging host computer running on a host computer, comprising: a bus interface module for establishing a communication connection with the target MCU via the X-bus, wherein the X-bus includes any of the following: serial port, CAN bus, CAN FD bus, or Ethernet; a MAP file parsing module for importing and parsing the MAP file generated by the application compiled by the target MCU to obtain the memory addresses, data types, function entry addresses, and parameter lists of global variables in the application; a debugging interaction module for receiving user debugging operation commands based on the information provided by the MAP file parsing module, converting the debugging operation commands into debugging command frames conforming to a predetermined protocol, and sending them to the target MCU via the bus interface module; and a debugging protocol firmware running on the target MCU, communicating with the debugging host computer via the X-bus, the debugging protocol firmware being configured to: receive and parse debugging command frames from the debugging host computer; execute corresponding debugging operations based on the parsing results, wherein the debugging operations include: read / write operations on a specified memory address or call operations on a specified function; and encapsulate the results of the debugging operations into a response frame and return it to the debugging host computer. As described above, the X-bus-based debugging system of this invention constructs a debugging system consisting of a debugging host computer on the host computer and the debugging protocol firmware on the target MCU via the X-bus (serial port / CAN / Ethernet). It completely eliminates the need for a dedicated emulator, achieving remote, cross-network, and post-device deployment debugging capabilities. It supports debugging throughout the entire lifecycle of embedded systems, greatly expanding the debugging scenarios. The debugging host computer integrates a MAP file parsing module, automatically extracting debugging symbols (memory addresses and data types of global variables, function entry addresses, and parameter lists), achieving WYSIWYG symbolic debugging. Users do not need to concern themselves with the underlying addresses, greatly reducing the debugging threshold, improving debugging efficiency and accuracy, and significantly enhancing data processing capabilities. This alleviates the limitations of traditional embedded system debugging processes in terms of debugging scenarios and data processing.

[0032] The above provides a brief overview of the X-bus-based debugging system of the present invention. The specific details involved are described in detail below.

[0033] In an optional embodiment of the present invention, the debugging operation includes: a function call operation; When the debugging operation command is a function call, the debugging interaction module is configured to generate a function call command frame containing the target function entry address and parameter data based on the function identifier selected by the user and the input parameter values. The debug protocol firmware is configured to: parse the function call instruction frame, obtain the target function entry address and parameter data, call the target function in the current operating environment of the target MCU, and encapsulate the function return value into the response frame.

[0034] In an optional embodiment of the present invention, the debugging operation includes: global variable modification operation; When the debugging operation command is to modify a global variable, the debugging interaction module is configured to generate a global variable modification command frame containing the memory address and value of the global variable, based on the global variable and the variable value selected by the user. The debug protocol firmware is configured to: parse the global variable modification instruction frame, obtain the memory address and variable value of the global variable, determine the corresponding variable storage unit based on the memory address of the global variable, write the variable value, complete the variable modification, and then encapsulate the confirmation information of successful modification into the response frame.

[0035] In an optional embodiment of the present invention, the debugging host computer further includes: a graphical waveform display module; The graphical waveform display module is configured to: receive one or more global variable identifiers and sampling periods specified by the user; periodically send read instructions for the memory addresses of the global variable identifiers to the target MCU through the debug interaction module according to the sampling period; and dynamically display the acquired variable values ​​in the form of waveforms in chronological order.

[0036] In an optional embodiment of the present invention, the debugging host computer further includes: a SHELL interaction module; The SHELL interactive module provides a command-line interface for receiving user-inputted custom command strings and sending them as debug instruction frames to the debug protocol firmware for execution.

[0037] In an optional embodiment of the present invention, the debugging host computer further includes: a debugging information encryption module and a data export module; The debugging information encryption module is used to encrypt debugging data using encryption algorithms during or after the debugging process. The data export module is used to export encrypted or plaintext debugging data into text format or Excel spreadsheet format containing data statistical analysis results.

[0038] In an optional embodiment of the present invention, the debug protocol firmware resides in the memory of the target MCU and runs independently of the application program. It listens for debug instruction frames on the X bus through interrupts or polling to achieve non-intrusive debugging of the application program.

[0039] In an optional embodiment of the present invention, the debugging host computer can simultaneously establish communication connections with the debugging protocol firmware on multiple target MCUs and perform independent or collaborative debugging operations on multiple target MCUs.

[0040] The workflow of the X-bus-based debugging system of the present invention is described below: Communication connection establishment: Developers select the appropriate X bus type (serial port, CAN bus, CAN FD bus, Ethernet) according to the actual application scenario, configure the corresponding bus parameters (such as baud rate, IP address, port number, etc.) in the debugging host computer, and establish a stable communication connection between the debugging host computer and the target MCU (i.e., the debugging protocol firmware) through the debugging protocol firmware.

[0041] MAP file parsing module: Import the MAP file corresponding to the MCU project into the MAP file parsing module of the debugging host computer. This module parses the MAP file, extracts information such as the memory address, data type, function entry address and parameter list of global variables, and displays it in the debugging host computer interface, providing data support for subsequent function execution and variable modification.

[0042] Debugging Interaction Module: In the debugging host computer interface, developers select the function to be executed (i.e., user-selected function identifier) ​​through the function execution module, input the corresponding parameter values ​​according to the function parameter list, and click the execute button. The debugging host computer encapsulates the target function entry address and parameter data according to the X bus debugging protocol, generates an instruction data packet (i.e., function call instruction frame), and sends it to the target MCU. After receiving the function call instruction frame, the debugging protocol firmware on the target MCU parses it to obtain the target function entry address and parameter data, calls the corresponding target function and passes in the parameter data for execution, and after execution, encapsulates the execution result (such as the function return value) into a data packet (i.e., response frame) and feeds it back to the debugging host computer. After receiving it, the debugging host computer displays the execution result on the interface. For global variable modification, the developer selects the global variable to be modified (i.e., the global variable selected by the user) from the variable list in the debugging host computer interface, enters the new variable value, and clicks the modify button. The debugging host computer encapsulates the memory address and variable value of the global variable into a global variable modification instruction frame according to the protocol and sends it to the target MCU. After parsing the global variable modification instruction frame, the target MCU finds the corresponding variable storage unit according to the memory address of the global variable, writes the variable value, completes the variable modification, and encapsulates the confirmation information of successful modification into a response frame to feed back to the debugging host computer.

[0043] Shell Interactive Operation: Developers can input custom commands (i.e., receive user-inputted custom command strings, such as viewing specific variable values, executing specific functions, or viewing system status) through the shell interactive module of the debugging host computer. The debugging host computer encapsulates the custom command string according to the protocol format and sends it to the target MCU. The target MCU parses the debugging instruction frame and executes the corresponding operation, feeding back the operation result to the debugging host computer. The debugging host computer displays the result in the shell interface, realizing flexible interactive debugging.

[0044] Graphical waveform display: In the debugging host computer, developers select the global variables that need to be displayed as waveforms and set the data sampling period (such as 10ms, 50ms, etc.). The graphical waveform display module sends a read instruction for the memory address of the global variable identifier to the target MCU through the X bus debugging protocol according to the set period to obtain the real-time value of the variable. The module stores the obtained variable values ​​in chronological order and displays them dynamically in the form of a waveform graph in the debugging host computer interface. It supports zooming, panning, annotation and other operations, which makes it easy for developers to intuitively observe the changing trend of the variable values.

[0045] Debugging Information Encryption and Export: When it is necessary to save data during the debugging process, the debugging information encryption module first encrypts the debugging data (including variable values, function execution records, system status information, etc.) (using symmetric encryption algorithms such as AES or asymmetric encryption algorithms such as RSA) to ensure data security. Then, the data export module exports the encrypted debugging data in the format selected by the developer (text format or Excel format). The Excel format export file will perform preliminary data analysis, such as calculating the maximum, minimum, and average values ​​of variables, and present the statistical information in tabular form to facilitate subsequent data analysis by the developers.

[0046] The debugging system of the present invention has the following advantages: Breaking through the limitations of debugging scenarios and improving debugging flexibility: This invention realizes communication between the debugging host computer and the target MCU through the X bus (serial port, CAN, CAN FD, network port), without relying on the physical connection of the emulator. Debugging can be carried out after the device is installed and deployed or in scenarios that are difficult to access, meeting the debugging needs of the entire life cycle of embedded systems and greatly improving the flexibility and applicability of debugging.

[0047] Efficient MAP file parsing for convenient function execution and variable modification: The MAP file parsing module for debugging the host computer can quickly extract key information about global variables and functions. Developers can directly execute functions and modify variables based on this information without manually searching for addresses and configuring parameters, simplifying the debugging process and improving debugging efficiency. Graphical waveform display for intuitive data analysis: The graphical waveform display function dynamically presents the changing trends of variable values, supports various operations, and allows developers to quickly identify abnormal data fluctuations, reducing the difficulty of fault location.

[0048] Encryption and diversified export options ensure data security and subsequent analysis: The debug information encryption module ensures the security of debug data during transmission and storage, preventing data leakage; it supports both text and Excel export formats, and the Excel format file contains preliminary data analysis results, providing convenience for developers to conduct subsequent data analysis and troubleshooting.

[0049] SHELL interaction functionality enhances debugging autonomy: The SHELL interaction module allows developers to input custom commands and interact flexibly with the target MCU. It can perform specific operations according to actual debugging needs, meet personalized debugging requirements, and further improve the flexibility and efficiency of debugging.

[0050] The present invention mainly includes the following technical points: The debugging communication architecture between the debugging host computer and the target MCU is built based on the X bus (serial port, CAN, CAN FD, network port). It realizes bidirectional data transmission through the matching X bus debugging protocol (i.e., debugging protocol firmware), breaking through the scenario limitations of traditional emulator debugging. This architecture is the foundation for realizing full-scenario debugging.

[0051] The MAP file parsing module in the debugging host computer can automatically extract information such as the memory address, data type, function entry address, and parameter list of global variables, providing accurate data support for function execution and variable modification. The parsing algorithm and data processing logic of this module simplify debugging operations and improve debugging efficiency.

[0052] The graphical waveform display module of the host computer is debugged. It acquires real-time values ​​of variables according to the set sampling period and displays them in the form of dynamic waveform graphs. It supports operations such as zooming, panning, and annotation, and realizes an intuitive presentation of the trend of variable data changes. The display logic and data update mechanism of this module solve the shortcomings of traditional text display of data.

[0053] The combination of the debugging information encryption module and the data export module uses encryption algorithms to encrypt the debugging data and supports exporting in text and Excel formats containing preliminary data analysis results, ensuring data security while providing convenience for subsequent analysis.

[0054] The SHELL interaction module for debugging the host computer allows developers to input custom commands to interact with the target MCU, enabling personalized debugging operations. The command parsing and execution feedback mechanism of this module enhances the autonomy of debugging and effectively complements the core debugging functions.

[0055] The main contents of this invention are as follows: Core architecture: Upper and lower computer collaboration X-bus host computer (i.e., debugging host computer, debugging client): Comprehensive debugging software running on a PC. It is not a simple serial port tool, but a debugging integrated development environment (IDE) that integrates six core functions.

[0056] X-bus debug protocol (i.e., debug protocol firmware, debug server): A lightweight firmware program running on the target MCU. It resides in memory and is responsible for listening for debug commands on the bus and performing corresponding debug operations (such as reading and writing memory, calling functions).

[0057] X-bus (communication channel): As a physical medium, it can be one of the most common communication interfaces in embedded systems, such as serial port, CAN, CAN FD, and Ethernet. This allows the debugging system to reuse the existing communication links of the device without the need for additional simulation interfaces (such as JTAG / SWD), thus enabling remote debugging.

[0058] 1. Connection Establishment: The user selects an available physical bus (such as CAN) and sets parameters (such as baud rate) on the debugging host computer. The debugging host computer then establishes a connection with the debugging protocol firmware within the target MCU via the bus. This overcomes the limitations of the emulator's physical connection.

[0059] 2. MAP File Parsing: The MAP file generated when the user imports and compiles the MCU program. The debugging host computer automatically parses this file, extracts the memory addresses and data types of all global variables, the entry addresses of functions, and parameter lists, and generates an interactive symbol table. This eliminates the tedious and error-prone process of manually looking up addresses.

[0060] 3. Core debugging operations (function execution and variable modification): Variable Modification: The user selects a variable and enters a new value on the debugging host computer interface. The debugging host computer generates a "write memory" instruction frame based on the address obtained from the MAP file and sends it to the target MCU via the bus. After protocol parsing at the target MCU, it directly writes the new value to the specified memory address.

[0061] Function execution: The user selects a function and inputs parameters. The host computer generates a "function call" instruction frame (containing the function address and parameters). After the target MCU parses the protocol, it directly calls and executes the function in the target MCU's current context, and finally returns the return value to the host computer. This is a non-intrusive, dynamic execution of MCU code.

[0062] 4. Enhanced features: Waveform display: The debugging host computer automatically polls the values ​​of one or more variables at a configurable period (e.g., 10ms) and displays them as a real-time waveform graph for easy observation of dynamic changes.

[0063] SHELL Interaction: Provides a command-line interface where users can send custom commands. The target MCU's protocol can be extended to parse these commands to execute specific debugging tasks, offering great flexibility.

[0064] Encrypted Export: All debugging data (variable values, logs) can be encrypted (AES / RSA) before being exported as text or an Excel file with statistical information (maximum value, average value, etc.), ensuring security and facilitating analysis.

[0065] The inventive points of this invention are as follows: Invention Point 1: Non-intrusive remote debugging system architecture based on X bus.

[0066] The technical problem to be solved: Traditional simulator debugging relies heavily on physical connections and debugging scenarios.

[0067] Technical approach: Construct a debugging system consisting of a PC-side host computer (i.e., a debugging host computer) and an MCU-side debugging protocol firmware connected via a general-purpose bus (serial port / CAN / Ethernet), completely independent of a dedicated emulator.

[0068] Technical benefits: It enables remote, cross-network, and post-device deployment debugging capabilities, supports debugging of embedded systems throughout their entire lifecycle, and greatly expands the debugging scenarios.

[0069] Invention Point Two: A symbolic automatic debugging mechanism integrating MAP file parsing.

[0070] Technical problems solved: Manually finding variable / function addresses is inefficient and error-prone, and the debugging preparation process is complex.

[0071] Technical means: The host computer is integrated with a MAP file parser (i.e., MAP file parsing module) to automatically extract debugging symbols (variable addresses, function addresses and prototypes) and provide a graphical interface for users to perform debugging operations directly based on symbol names.

[0072] Technical benefits: It enables "what you see is what you get" symbolic debugging, eliminating the need for users to worry about underlying addresses, greatly reducing the debugging threshold and improving debugging efficiency and accuracy.

[0073] Invention Point 3: An instruction-based runtime control mechanism that supports dynamic function calls.

[0074] The technical problem solved: Traditional debugging methods make it difficult to dynamically execute arbitrary functions in the MCU without shutting down the system.

[0075] Technical means: Design an instruction protocol that allows the host computer (i.e., the debugging host computer) to encapsulate function identifiers (addresses) and parameters into instruction frames. After receiving the protocol, the MCU can directly create a stack frame and execute the function in the current operating environment.

[0076] Technical benefits: It achieves truly non-intrusive online testing, which can dynamically test function functionality while the system is running, greatly enhancing the flexibility and depth of debugging.

[0077] Invention Point 4: Enhanced security of debugging data and intelligent post-processing pipeline.

[0078] Technical problems to be solved: plaintext transmission and storage of debugging data is insecure, and the single export format is not conducive to analysis.

[0079] Technical measures: An encryption module is introduced into the data export path, and it supports exporting to structured Excel files with built-in preliminary statistical analysis (such as maximum value and average value).

[0080] Technical benefits: It ensures the security of debugging data and greatly facilitates subsequent offline data analysis, thereby enhancing the value of debugging data.

[0081] Example 2: A debugging method using any of the systems described in Embodiment 1, with reference to Figure 2 The method includes: Step S202: The debugging host computer establishes a communication connection with the debugging protocol firmware on the target MCU through the selected X bus; Step S204: The host computer parses the MAP file and obtains debugging symbol information; In step S206, the user initiates a debugging operation through the debugging host computer, which converts the debugging operation into a debugging command frame and sends it to the target MCU; the debugging protocol firmware executes the corresponding operation and returns the debugging result. Step S208: The host computer receives and displays the debugging results.

[0082] The method provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned system embodiment. For the sake of brevity, any part not mentioned in the method embodiment can be referred to the corresponding content in the aforementioned system embodiment.

[0083] Corresponding to the above-described X-bus-based debugging method, this application also provides a computer-readable storage medium storing machine-executable instructions. When these machine-executable instructions are invoked and executed by a processor, they cause the processor to perform the steps of the above-described X-bus-based debugging method.

[0084] The X-bus-based debugging system provided in this application embodiment can be specific hardware on a device or software or firmware installed on the device. The system provided in this application embodiment has the same implementation principle and technical effects as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.

[0085] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0086] For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0087] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0088] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0089] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the X-bus-based debugging method described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0090] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0091] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A debugging system based on the X bus, characterized in that, The system is used for remote debugging of a target MCU, and includes: A debugging host computer, running on the host computer, includes: A bus interface module is used to establish a communication connection with the target MCU via an X bus, wherein the X bus includes any of the following: serial port, CAN bus, CAN FD bus, or Ethernet; The MAP file parsing module is used to import and parse the MAP file generated by the application compilation of the target MCU to obtain the memory address, data type, function entry address and parameter list of global variables in the application; The debugging interaction module is used to receive the user's debugging operation instructions based on the information provided by the MAP file parsing module, and convert the debugging operation instructions into debugging instruction frames that conform to a predetermined protocol, and send them to the target MCU through the bus interface module; It also includes: debug protocol firmware, running on the target MCU, communicating with the debug host computer via the X bus, the debug protocol firmware being configured as follows: Receive and parse debugging instruction frames from the debugging host computer; Execute corresponding debugging operations based on the parsing results, wherein the debugging operations include: reading and writing operations to a specified memory address or calling operations to a specified function; The result of the debugging operation is encapsulated into a response frame and returned to the debugging host computer.

2. The system according to claim 1, characterized in that, The debugging operations include: function call operations; When the debugging operation instruction is a function call, the debugging interaction module is configured to generate a function call instruction frame containing the target function entry address and parameter data based on the function identifier selected by the user and the input parameter values. The debug protocol firmware is configured to: parse the function call instruction frame, obtain the target function entry address and parameter data, call the target function in the current operating environment of the target MCU, and encapsulate the function return value into the response frame.

3. The system according to claim 1, characterized in that, The debugging host computer also includes: a graphical waveform display module; The graphical waveform display module is configured to: receive one or more global variable identifiers and sampling periods specified by the user; periodically send read instructions for the memory address of the global variable identifier to the target MCU through the debugging interaction module according to the sampling period; and dynamically display the acquired variable values ​​in the form of waveforms in chronological order.

4. The system according to claim 1, characterized in that, The debugging host computer also includes: a SHELL interaction module; The SHELL interaction module provides a command-line interface for receiving user-inputted custom command strings and sending the custom command strings as debug instruction frames to the debug protocol firmware for execution.

5. The system according to claim 1, characterized in that, The debugging host computer also includes: a debugging information encryption module and a data export module; The debugging information encryption module is used to encrypt the debugging data using an encryption algorithm during or after the debugging process. The data export module is used to export encrypted or plaintext debugging data into text format or Excel spreadsheet format containing data statistical analysis results.

6. The system according to claim 1, characterized in that, The debugging protocol firmware resides in the memory of the target MCU and runs independently of the application. It listens for debugging instruction frames on the X bus through interrupts or polling to achieve non-intrusive debugging of the application.

7. The system according to claim 1, characterized in that, The debugging operations include: global variable modification operations; When the debugging operation instruction is a global variable modification, the debugging interaction module is configured to: generate a global variable modification instruction frame containing the memory address of the global variable and the value of the variable, based on the global variable and the variable value selected by the user; The debugging protocol firmware is configured to: parse the global variable modification instruction frame, obtain the memory address and value of the global variable, determine the corresponding variable storage unit based on the memory address of the global variable, write the variable value, complete the variable modification, and then encapsulate the confirmation information of successful modification into the response frame.

8. The system according to claim 1, characterized in that, The debugging host computer can simultaneously establish communication connections with the debugging protocol firmware on multiple target MCUs and perform independent or collaborative debugging operations on multiple target MCUs.

9. A debugging method using the system as described in any one of claims 1 to 8, characterized in that, The method includes: The debugging host computer establishes a communication connection with the debugging protocol firmware on the target MCU through the selected X bus; The debugging host computer parses the MAP file to obtain debugging symbol information; The user initiates a debugging operation through the debugging host computer, which converts the debugging operation into a debugging instruction frame and sends it to the target MCU; the debugging protocol firmware executes the corresponding operation and returns the debugging result. The debugging host computer receives and displays the debugging results.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the method described in claim 9.