Embedded USMART serial port debugging method and system

Through the embedded USMART serial debugging method, obtain and match the target function, and perform the feedback of the entry and compliance check and return value. Embedded software debug.

CN119357027APending Publication Date: 2025-01-24ANHUI ZHONGKE ZHONGHUAN INTELLIGENT EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411246744.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The traditional USMART serial debugging scheme cannot effectively identify the legitimacy of function input, and cannot trace software process data. It lacks adaptability and flexibility, making it difficult to adapt to complex embedded software development needs.

Method used

Put forward a embedded USMART serial debugging method. By obtaining the user and parameters of the user input, the information extraction and byte comparison are performed, the target function is matched and the participation regulations are performed, the parameters are passed, and the return value is extracted, feedback Debug results.

Benefits of technology

The flexible parameter verification of embedded software and the intuitive tracking of the software operation process, improved the efficiency and quality of software debugging, and reduced the dependence on different chips and physical underlying layers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357027A_ABST
    Figure CN119357027A_ABST
Patent Text Reader

Abstract

The invention discloses an embedded USMART serial port debugging method and system, and the method comprises the steps: obtaining a to-be-recognized function and parameters inputted by a user, and carrying out the information extraction of the to-be-recognized function, so as to obtain a first function name corresponding to the to-be-recognized function; performing byte comparison on the first function name and a plurality of second function names stored in a preset to-be-tested database one by one so as to match a target function name; extracting a function corresponding to the target function name from the database to be tested, and performing in-parameter compliance check on the function to obtain a pointer of the function; transmitting a parameter input by the user to a function pointed by the pointer to extract a return value executed by the function; and feeding back a returned value of function execution obtained by debugging and a debugging process to the terminal. According to the embedded USMART serial port debugging method and system, transplantation of programs on different chips is achieved, repeated work is reduced, and the software debugging efficiency and quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of embedded software debugging, and in particular to an embedded USMART serial port debugging method and system. Background Art

[0002] In the process of embedded software development, software debugging is an important part of ensuring software quality. The traditional USMART serial port debugging solution is mainly designed for a single chip, with a narrow debugging object range and a single data processing method, which cannot trace the software process data. In addition, the traditional solution often relies on the underlying data and cannot effectively identify the legality of the function input. Therefore, a new debugging method is needed to solve these problems. Summary of the invention

[0003] In order to solve the technical problems existing in the background technology, the present invention proposes an embedded USMART serial port debugging method and system.

[0004] An embedded USMART serial port debugging method proposed by the present invention comprises the following steps:

[0005] S1, obtaining a function to be identified and parameters input by a user, and extracting information from the function to be identified to obtain a first function name corresponding to the function to be identified;

[0006] S2, comparing the first function name with a plurality of second function names stored in a preset database to be tested one by one to match the target function name;

[0007] S3. Extract the function corresponding to the target function name from the database to be tested, and perform parameter compliance check on the function to obtain a pointer to the function;

[0008] S4, passing the parameters input by the user to the function pointed to by the pointer to extract the return value of the function execution;

[0009] S5. Feedback the return value of the debugged function execution and the debugging process to the terminal.

[0010] Preferably, before step S1, the method further includes:

[0011] Transplant the USMART debugger into the software to be tested, and modify the configuration register corresponding to the defined DMA port to initialize the software by directly controlling the register.

[0012] Preferably, the database to be tested is pre-configured with a one-to-one mapping relationship between a plurality of second function names, a plurality of functions, a plurality of pointers, and the functions pointed to by the plurality of pointers.

[0013] Preferably, step S2 specifically includes:

[0014] Performing byte comparison and matching on the first function name and a plurality of second function names stored in a preset database to be tested one by one;

[0015] When there is a second function name matching the first function name among the multiple second function names, the second function name is used as the target function name;

[0016] When the database to be tested does not have a second function name matching the first function name, debugging is terminated and the debugging result is fed back to the terminal.

[0017] Preferably, step S3 specifically includes:

[0018] Extract the function corresponding to the target function name from the database to be tested. When the function corresponding to the target function name is extracted, if the function is a function with a return value type, perform a match check between the function parameter type and the function input parameter type.

[0019] When it is detected that the function input parameter type is consistent with the parameter type in the function, the pointer of the function is extracted from the database to be tested;

[0020] When it is detected that the function input parameter type is inconsistent with the parameter type in the function, an exception record is made for this input process, and the function returns Argument_Error through the serial port to inform that this parameter input is not compliant.

[0021] Preferably, it also includes:

[0022] Get the expected value of the input, compare the expected value with the return value of the function execution, and generate a debugging success instruction when the return value of the function execution is consistent with the expected value.

[0023] An embedded USMART serial port debugging system proposed by the present invention comprises:

[0024] A data acquisition module, used to acquire the function to be identified and the parameters input by the user, and to extract information from the function to be identified to obtain a first function name corresponding to the function to be identified;

[0025] A first processing module is used to compare the first function name with a plurality of second function names stored in a preset database to be tested one by one by bytes, so as to match the target function name;

[0026] The second processing module is used to extract the function corresponding to the target function name from the database to be tested, and perform parameter compliance check on the function to obtain a pointer to the function;

[0027] The third processing module is used to pass the parameters input by the user to the function pointed to by the pointer to extract the return value of the function execution;

[0028] The serial port communication module is used to feed back the return value of the debugged function execution and the debugging process to the terminal.

[0029] Preferably, it also includes: a debugging comparison module, which is used to obtain an expected value of the input, compare the expected value with the return value of the function execution, and generate a debugging success instruction when the return value of the function execution is consistent with the expected value.

[0030] In the present invention, the proposed embedded USMART serial port debugging method and system obtains the function to be identified and the parameters input by the user, and extracts information from the function to be identified to obtain the first function name corresponding to the function to be identified; the first function name is byte-by-byte compared with multiple second function names stored in the preset database to be tested one by one to match the target function name; the function corresponding to the target function name is extracted from the database to be tested, and the function is checked for parameter compliance to obtain the pointer of the function; the parameters input by the user are passed to the function pointed to by the pointer to extract the return value of the function execution; the return value of the function execution obtained by debugging and the debugging process are fed back to the terminal. The debugging method uses the serial port to perform flexible parameter verification or solve period values, and feeds back the intermediate results of the software operation to intuitively track the software operation process. By modifying the chip serial port position and timer configuration in usmart_trapl.h, the program is transplanted on different chips, reducing repetitive work and improving the efficiency and quality of software debugging. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A schematic diagram of the work flow structure of an embedded USMART serial port debugging method proposed by the present invention;

[0032] Figure 2 A schematic diagram of the implementation process of an embedded USMART serial port debugging method proposed by the present invention;

[0033] Figure 3 A schematic diagram of the operation structure of internal clock selection of an embedded USMART serial port debugging method proposed by the present invention;

[0034] Figure 4 This is a schematic diagram of the system architecture of an embedded USMART serial port debugging system proposed by the present invention. DETAILED DESCRIPTION

[0035] Reference Figure 1-4 The present invention proposes an embedded USMART serial port debugging method, comprising the following steps:

[0036] S0. Transplant the USMART debugging program into the software to be tested, and modify the configuration register corresponding to the defined DMA port to initialize the software by directly controlling the register.

[0037] In this embodiment, the USMART debugging program is transplanted into the software to be tested. The USMART debugging program is referred to as the serial port debugging method, which is a method for software testing through a serial port debugging tool. During the implementation process, the configuration register corresponding to the defined DMA port is modified and initialized by directly controlling the register. The expected function name and parameters are input using the serial port tool to directly put the data received by the serial port into the memory through the DMA port without being processed by the CPU.

[0038] In this embodiment, when debugging embedded software, the diversified design of the product leads to the need to customize the corresponding test program for debugging different software, which increases the repetitiveness of the work. Through a highly integrated application data processing method, the dependence on different chips and physical bottom layers is eliminated. Figure 3 As shown in the figure, during the program transplantation process, by modifying the port position corresponding to the chip serial port in usmart_trapl.h, the timer's reference time is modified according to the different frequency division times of the clock frequency of different chips. And add the conversion function of different clock frequencies and reference times. Only by setting the input clock frequency can the function parameter configuration be automatically completed to complete the automation parameters.

[0039] In this embodiment, the calculation process of the counter clock frequency f and the timer clock period T is as follows:

[0040]

[0041] Among them, psc is the pre-division coefficient (16-bit register, valid value 1-65535); arr is the automatic reload value (16-bit register, valid value 65535); Tclk is the input clock frequency of the timer (MHZ); Uclock is the time conversion factor; f is the counter clock frequency (KHZ); T is the timer clock period (timer base value s); ck_cnt is the divided frequency.

[0042] S1. Obtain the function to be identified and the parameters input by the user, and extract information from the function to be identified to obtain a first function name corresponding to the function to be identified.

[0043] S2. Perform byte comparison on the first function name and multiple second function names stored in a preset database to be tested one by one to match the target function name.

[0044] In this embodiment, a plurality of second function names, a plurality of functions, a plurality of pointers, and a one-to-one mapping relationship between the functions pointed to by the plurality of pointers are pre-configured in the database to be tested.

[0045] In this embodiment, step S2 specifically includes:

[0046] Performing byte comparison and matching on the first function name and a plurality of second function names stored in a preset database to be tested one by one;

[0047] When there is a second function name matching the first function name among the multiple second function names, the second function name is used as the target function name;

[0048] When the database to be tested does not have a second function name matching the first function name, debugging is terminated and the debugging result is fed back to the terminal.

[0049] S3. Extract the function corresponding to the target function name from the database to be tested, and perform parameter compliance check on the function to obtain a pointer to the function.

[0050] In this embodiment, step S3 specifically includes:

[0051] Extract the function corresponding to the target function name from the database to be tested. When the function corresponding to the target function name is extracted, if the function is a function with a return value type, perform a match check between the function parameter type and the function input parameter type.

[0052] When it is detected that the function input parameter type is consistent with the parameter type in the function, the pointer of the function is extracted from the database to be tested;

[0053] When it is detected that the function input parameter type is inconsistent with the parameter type in the function, an exception record is made for this input process, and the function returns Argument_Error through the serial port to inform that this parameter input is not compliant.

[0054] In this embodiment, the flexible parameter configuration is not limited by the specification restrictions of the compiler, making the function input parameters richer, and the expected parameters can also be obtained by modifying the parameter configuration. At the same time, the illegal input of the black box test of the function in the software testing process is more flexible. The function inputs the function parameters through the serial port. When the corresponding function is received and matched, if the function has a return value type, the function parameter type is checked to match the function parameter type. If it is detected that the function parameter type is inconsistent with the parameter type in the function, and the parameter input is not intercepted during this process, only the abnormal input process will be recorded. The function returns Argument_Error through the serial port to inform that the parameter input is not compliant. After the program is completed, the return value of the function is called to view the function execution status. If the function parameter input is wrong and the function can still run, it can be checked whether the software design logic of the function can meet the software design specifications.

[0055] S4. Pass the parameters input by the user to the function pointed to by the pointer to extract the return value of the function execution.

[0056] S5. Feedback the return value of the debugged function execution and the debugging process to the terminal.

[0057] S6. Obtain the expected value of the input, and compare the expected value with the return value of the function execution. When the return value of the function execution is consistent with the expected value, a debugging success instruction is generated.

[0058] In this embodiment, the dependency on the program to be tested is eliminated, and there is no need to download the application program. The convenient operation of entering the function name and corresponding parameters through the serial port tool to complete the function input greatly optimizes the system space occupied by the function. Since some functions are non-computing types and only call and execute functions without return value types, the execution process of the function cannot be directly controlled during the program testing process. The function return value after each function call can be printed and added to the (CALLED FACTIONG NAME+RETURN DATA) composition. The task and result of each function execution can be directly returned through the serial port. The operator can observe the execution process of the function and whether the result is a value through intuitive feedback.

[0059] Reference Figure 1-4 The present invention proposes an embedded USMART serial port debugging system, comprising:

[0060] A data acquisition module, used to acquire the function to be identified and the parameters input by the user, and to extract information from the function to be identified to obtain a first function name corresponding to the function to be identified;

[0061] A first processing module is used to compare the first function name with a plurality of second function names stored in a preset database to be tested one by one by bytes, so as to match the target function name;

[0062] The second processing module is used to extract the function corresponding to the target function name from the database to be tested, and perform parameter compliance check on the function to obtain a pointer to the function;

[0063] The third processing module is used to pass the parameters input by the user to the function pointed to by the pointer to extract the return value of the function execution;

[0064] The serial port communication module is used to feed back the return value of the debugged function execution and the debugging process to the terminal.

[0065] The debugging comparison module is used to obtain the expected value of the input, compare the expected value with the return value of the function execution, and generate a debugging success instruction when the return value of the function execution is consistent with the expected value.

[0066] During the specific working process of the embedded USMART serial port debugging method and system of this embodiment, the data in the memory is taken out for comparison and judgment of the search function. The program receives the instruction and performs byte comparison between the identification function and the function name in the program to be tested. If a function matching the function name is found in the program to be tested, it is called and the input parameter compliance is checked. After the function input parameter type is limited and the function name and input parameter compliance are judged, the pointer to the function is obtained, and then the parameters are passed to the function pointed to by the pointer to extract the result of the function execution. The user's required result can also be obtained by modifying the input parameter value.

[0067] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. An embedded USMART serial port debugging method, characterized in that: The following steps are involved: S1, obtaining a function to be identified and parameters input by a user, and extracting information from the function to be identified to obtain a first function name corresponding to the function to be identified; S2, comparing the first function name with a plurality of second function names stored in a preset database to be tested one by one to match the target function name; S3. Extract the function corresponding to the target function name from the database to be tested, and perform parameter compliance check on the function to obtain a pointer to the function; S4, passing the parameters input by the user to the function pointed to by the pointer to extract the return value of the function execution; S5. Feedback the return value of the debugged function execution and the debugging process to the terminal.

2. The embedded USMART serial port debugging method according to claim 1, characterized in that: Before step S1, the method further includes: Transplant the USMART debugger into the software to be tested, and modify the configuration register corresponding to the defined DMA port to initialize the software by directly controlling the register.

3. The embedded USMART serial port debugging method according to claim 1, characterized in that: The database to be tested is pre-configured with a plurality of second function names, a plurality of functions, a plurality of pointers, and a one-to-one mapping relationship between the functions pointed to by the plurality of pointers.

4. The embedded USMART serial port debugging method according to claim 1, characterized in that: Step S2 specifically includes: Performing byte comparison and matching on the first function name and a plurality of second function names stored in a preset database to be tested one by one; When there is a second function name matching the first function name among the multiple second function names, the second function name is used as the target function name; When the database to be tested does not have a second function name matching the first function name, debugging is terminated and the debugging result is fed back to the terminal.

5. The embedded USMART serial port debugging method according to claim 1, characterized in that: Step S3 specifically includes: Extract the function corresponding to the target function name from the database to be tested. When the function corresponding to the target function name is extracted, if the function has a return value type, perform a match check between the function parameter type and the function input parameter type. When it is detected that the function input parameter type is consistent with the parameter type in the function, the pointer of the function is extracted from the database to be tested; When it is detected that the function input parameter type is inconsistent with the parameter type in the function, an exception record is made for this input process, and the function returns Argument_Error through the serial port to inform that this parameter input is not compliant.

6. The embedded USMART serial port debugging method according to claim 1, characterized in that: Also includes: Get the expected value of the input, compare the expected value with the return value of the function execution, and generate a debugging success instruction when the return value of the function execution is consistent with the expected value.

7. An embedded USMART serial port debugging system, characterized in that: include: A data acquisition module, used to acquire the function to be identified and the parameters input by the user, and to extract information from the function to be identified to obtain a first function name corresponding to the function to be identified; A first processing module is used to compare the first function name with a plurality of second function names stored in a preset database to be tested one by one by bytes, so as to match the target function name; The second processing module is used to extract the function corresponding to the target function name from the database to be tested, and perform parameter compliance check on the function to obtain a pointer to the function; The third processing module is used to pass the parameters input by the user to the function pointed to by the pointer to extract the return value of the function execution; The serial port communication module is used to feed back the return value of the debugged function execution and the debugging process to the terminal.

8. The embedded USMART serial port debugging system according to claim 7, characterized in that: Also includes: The debugging comparison module is used to obtain the expected value of the input, compare the expected value with the return value of the function execution, and generate a debugging success instruction when the return value of the function execution is consistent with the expected value.