CN110502439B - Debugging method, device, electronic equipment and storage medium - Google Patents

Debugging method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110502439B
CN110502439B CN201910726510.XA CN201910726510A CN110502439B CN 110502439 B CN110502439 B CN 110502439B CN 201910726510 A CN201910726510 A CN 201910726510A CN 110502439 B CN110502439 B CN 110502439B
Authority
CN
China
Prior art keywords
code
hardware
debugging
pseudo
software
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910726510.XA
Other languages
Chinese (zh)
Other versions
CN110502439A (en
Inventor
周明君
方攀
陈岩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201910726510.XA priority Critical patent/CN110502439B/en
Publication of CN110502439A publication Critical patent/CN110502439A/en
Application granted granted Critical
Publication of CN110502439B publication Critical patent/CN110502439B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code

Abstract

The application discloses a debugging method, a debugging device, electronic equipment and a storage medium, and relates to the technical field of electronic equipment. The method comprises the following steps: and acquiring a pseudo code, performing software code debugging on the pseudo code, determining that the software code has a problem and modifying the pseudo code when the software code fails to debug, converting the pseudo code into a test code when the software code fails to debug, performing hardware code debugging on the test code, and determining that the hardware code has a problem and modifying the hardware code when the hardware code fails to debug. According to the debugging method, device, electronic equipment and storage medium, the coupling relation between software and hardware in the development process of hardware based on an instruction set is relieved by introducing the pseudo code, and the development and debugging efficiency in the development process of hardware based on the instruction set is improved.

Description

Debugging method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the technical field of electronic devices, and in particular, to a debugging method, a device, an electronic device, and a storage medium.
Background
With the development of science and technology, electronic devices are increasingly widely used, and have more and more functions, and become one of the necessities in daily life. At present, when the electronic equipment has problems in factory setting or in the using process, the process of searching and debugging the problems is complex, and the efficiency is low.
Disclosure of Invention
In view of the above, the present application proposes a debugging method, a device, an electronic apparatus, and a storage medium, so as to solve the above problem.
In a first aspect, an embodiment of the present application provides a debugging method, acquiring a pseudo code, and performing software code debugging on the pseudo code; when the software code debugging fails, determining that the software code has problems and modifying the pseudo code; when the software code is successfully debugged, converting the pseudo code into a test code; performing hardware code debugging on the test code; when the debugging of the hardware code fails, determining that the hardware code has problems and modifying the hardware code.
In a second aspect, embodiments of the present application provide a debugging device, where the device includes: the software code debugging module is used for acquiring a pseudo code and carrying out software code debugging on the pseudo code; the pseudo code modification module is used for determining that the software code has problems and modifying the pseudo code when the software code fails to debug; the pseudo code conversion module is used for converting the pseudo code into a test code when the software code is successfully debugged; the hardware code debugging module is used for carrying out hardware code debugging on the test code; and the hardware code modification module is used for determining that the hardware code has a problem and modifying the hardware code when the hardware code fails to debug.
In a third aspect, embodiments of the present application provide an electronic device comprising a memory coupled to a processor and a processor, the memory storing instructions that when executed by the processor perform the above-described method.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having program code stored therein, the program code being callable by a processor to perform the above method.
According to the debugging method, the device, the electronic equipment and the storage medium, the pseudo code is obtained, software code debugging is carried out on the pseudo code, when software code debugging fails, the occurrence of problems of the software code is determined, the pseudo code is modified, when the software code debugging is successful, the pseudo code is converted into the test code, hardware code debugging is carried out on the test code, when the hardware code debugging fails, the occurrence of problems of the hardware code is determined, the hardware code is modified, and therefore the coupling relation between software and hardware in the hardware development process based on an instruction set is relieved through introducing the pseudo code, and the development and debugging efficiency in the hardware development process based on the instruction set is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow diagram of a debugging method according to one embodiment of the present application;
fig. 2 is a flow chart illustrating a debugging method according to another embodiment of the present application;
FIG. 3 illustrates a schematic diagram of pseudo code provided by an embodiment of the present application;
fig. 4 is a flowchart illustrating step S210 of the debugging method shown in fig. 2 of the present application;
FIG. 5 is a flow chart illustrating a debugging method according to still another embodiment of the present application;
FIG. 6 shows a block diagram of a debugging device provided by an embodiment of the present application;
FIG. 7 shows a block diagram of an electronic device for performing a debugging method according to an embodiment of the present application;
fig. 8 shows a storage unit for holding or carrying program code implementing a debugging method according to an embodiment of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application.
The instruction set-based hardware may also be stored program-type computing hardware, typically based on von neumann or harvard architectures. The hardware has the characteristics of a general-purpose turing machine, and has the following characteristics in engineering: (1) centering on an arithmetic unit; (2) employing stored program principles; (3) The memory is a space accessed by address and linearly offset; (4) the control stream is generated from the instruction stream; (5) the instruction consists of an operation code and an operand; (6) data and instructions are encoded in binary. Because of these features, debug validation of such hardware necessitates running software stack collaboration on the hardware, where the portion of the software stack includes test code, compilers, hardware models, and the like.
Based on this, the inventors have found through long-term studies that verification can be performed in the following manner:
s1: writing test codes by using corresponding instruction sets;
s2: compiling the test code into binary code using a compiler;
s3: loading binary code using a hardware model;
s4: simultaneously performing software debugging and hardware debugging;
s5: if the debugging result represents that the software has a problem, modifying the software code;
s6: and if the debugging result represents that the hardware has a problem, modifying the hardware code.
In the verification process based on the mode, a hardware developer prepares a hardware model capable of running binary codes, and a software developer prepares test codes and compiles the test codes into the binary codes capable of running on the hardware model. Then, the inventors have found through studies that, when the above-described manner is adopted for verification, once the test code can be run and problems are found, two results, namely, problems with the software code or problems with the hardware model, occur. If the software code has problems, the software developer needs to modify the software code; if a problem occurs with the hardware model, the hardware developer needs to modify the hardware model. In this process, problems may occur in both (software code and hardware model), so the difficulty of debugging and positioning may be very high, and in addition, if the hardware with a completely new architecture is very likely to lack necessary tool chain support, such as lack of debugger, advanced voice compiler, etc., the difficulty of software debugging may be increased, resulting in lower development efficiency.
In order to solve the problems, the inventor discovers through long-term research and provides the debugging method, the device, the electronic equipment and the storage medium, and the coupling relation between software and hardware in the development process of the hardware based on the instruction set is relieved by introducing the pseudo code, so that the development and debugging efficiency in the development process of the hardware based on the instruction set is improved. The specific debugging method is described in detail in the following embodiments.
Referring to fig. 1, fig. 1 is a flow chart illustrating a debugging method according to an embodiment of the present application. According to the debugging method, the coupling relation between software and hardware in the development process of the hardware based on the instruction set is relieved by introducing the pseudo code, and the development and debugging efficiency in the development process of the hardware based on the instruction set is improved. In a specific embodiment, the debugging method is applied to the debugging device 200 shown in fig. 6 and the electronic apparatus 100 (fig. 7) configured with the debugging device 200. The specific flow of the present embodiment will be described below by taking an electronic device as an example, and it will be understood that the electronic device applied in the present embodiment may be a smart phone, a tablet computer, a wearable electronic device, a desktop computer, or other devices capable of running codes, which is not limited herein. The following details about the flow shown in fig. 1, the debugging method may specifically include the following steps:
step S110: and acquiring a pseudo code, and performing software code debugging on the pseudo code.
Wherein the Pseudocode (Pseudocode) is an informal, english-like structure language for describing the block structure. In addition, pseudocode is an algorithmic description language that is interposed between natural and programming languages, and is more natural-like, straightforward, than programming languages (e.g., java, C++, C, dephi, etc.). Also, pseudocode is an intermediate representation (code) between commands that are conveniently interpretable by a user, e.g., pseudocode may include commands in a programming language in which scripts are written (e.g., autoIt programming language), and commands that are understood to be their processing tools, in this case interpreters within the script emulator. In programming parlance, pseudocode is also referred to as byte code or p-code. Pseudo code is a compact representation of a script, compared to the original script code, which is easy for a user to analyze and understand, and which can be obtained, for example, by decompilation. Technically, pseudocode is machine-independent low-level code that is generated by a translator from original script code. The use of pseudo code runs an interpreter that operates more easily and faster.
In this embodiment, the pseudocode is a simplified code, which is most different from the actual code in that some higher level semantics can be used when writing the pseudocode, greatly improving code readability and development and debugging efficiency, for example, python programming language can be used as the basis of the pseudocode, so as to obtain some higher level semantics provided by python, such as the semantics of generating initialized test data by python, using loops, jumps provided by python, and the like.
In some embodiments, pseudocode is first obtained and software code debugging is performed on the pseudocode. In particular, a software developer may implement a test program through an electronic device using pseudocode, and debug the correctness of the software code using a simulator that may run the pseudocode. As one way, a simulator that can run this pseudocode can be used to run the pseudocode and monitor whether the pseudocode is running properly, wherein when the pseudocode is monitored to run properly, software code debugging can be determined to be successful, and when the pseudocode is monitored to run failed, e.g., an interrupt, stop, crash, etc. occurs during the running of the pseudocode, software debugging can be determined to be failed.
In some embodiments, the pseudo code may be pre-written and stored locally in the electronic device, and accordingly, when the software code is debugged, a developer may directly read the pseudo code from the local by the electronic device and debug the software code on the pseudo code; in some embodiments, the pseudo code may be pre-written and stored in the server, and accordingly, when the software code is debugged, a developer may download the pseudo code from the server through the electronic device and debug the software code on the pseudo code; in some embodiments, the pseudocode may be written at the time of software code debugging, and accordingly, a developer may write the pseudocode through the electronic device and perform software code debugging on the pseudocode after the pseudocode writing is completed. Of course, in this embodiment, other ways of obtaining the pseudo code may be further included, which will not be described herein.
Step S120: when the software code debugging fails, determining that the software code has problems and modifying the pseudo code.
In some embodiments, when a pseudocode fails to run, for example, an interrupt, a stop, a crash, etc., occurs during the running of the pseudocode, the software code may be determined to have failed debugging, and thus, the software code may be determined to have failed and the pseudocode may be modified. When the problem of the pseudo code is determined, the pseudo code can be directly modified and stored in the electronic equipment for debugging the pseudo code; the pseudo code can be sent to other electronic equipment through a near field communication technology to modify the pseudo code, and the modified pseudo code fed back by the other electronic equipment is received; the pseudo code may also be sent to the server through a wireless network or a data network, downloaded from the server by other electronic devices, modified, uploaded to the server, and fed back to the electronic device by the server, which is not limited herein. The wireless network may include, but is not limited to, wireless fidelity (WIFI), and the data network includes, but is not limited to, a 2G network, a 3G network, a 4G network, and a 5G network.
In this embodiment, after the electronic device obtains the pseudo code after modification, the electronic device may further debug the software code again until the debug result indicates that the software code is successfully debugged.
In addition, in some embodiments, when determining that the software code debugging fails, hardware code debugging can be omitted, so that on one hand, power consumption caused by the fact that the electronic device performs hardware code debugging can be avoided, and on the other hand, misjudgment caused by the fact that the hardware code debugging fails due to the problem of the software code can be avoided.
Step S130: and when the software code is successfully debugged, converting the pseudo code into test code.
In some embodiments, when the pseudocode is operating normally, it may be determined that the software code debugging was successful, and thus, it may be determined that the pseudocode is not problematic, and hardware code debugging may continue. Specifically, in this embodiment, when the software code is successfully debugged, the pseudo code may be converted into test code, so that the hardware code is debugged through the test code.
Step S140: and performing hardware code debugging on the test code.
In this embodiment, after the test code is acquired, hardware code debugging may be performed on the test code. Specifically, a hardware developer may implement a test program by using a test code through an electronic device, and run the test code using a hardware model that can run the test code, and monitor whether the test code is running normally, wherein when the test code is monitored to run normally, it may be determined that the hardware code is successfully debugged, and when it is monitored that the test code is failed to run, for example, an interrupt, a stop, a crash, or the like occurs during the running of the test code, it may be determined that the hardware debugging is failed.
In some embodiments, the test code may be pseudo code stored in the local of the electronic device after the electronic device is converted in advance, and accordingly, when the hardware code is debugged, a developer may directly read the test code from the local through the electronic device and debug the hardware code on the test code; in some embodiments, the test code may be pseudo code stored in the server after the server is converted, and accordingly, when the hardware code is debugged, a developer may download the test code from the server through the electronic device and debug the hardware code of the test code; in some embodiments, the test code may be converted by a pseudo code when the hardware code is debugged, and accordingly, a developer may convert the pseudo code into the test code through an electronic device and debug the hardware code after the test code conversion is completed.
Step S150: when the debugging of the hardware code fails, determining that the hardware code has problems and modifying the hardware code.
In some embodiments, when the test code fails to run, for example, an interrupt, a stop, a crash, etc. occurs during the running of the test code, the hardware code may be determined to have failed debugging, and thus, the hardware code may be determined to have a problem and modified. When the problem of the test code is determined, the hardware code can be directly modified and stored in the electronic equipment for debugging the test code; the hardware codes can be sent to other electronic equipment through a near field communication technology to modify the hardware codes and receive the modified hardware codes fed back by the other electronic equipment; the hardware codes may also be sent to the server through a wireless network or a data network, downloaded from the server by other electronic devices, modified, uploaded to the server, and fed back to the electronic device by the server, which is not limited herein.
In this embodiment, after the electronic device obtains the modified hardware code, the electronic device may further execute the test code to debug the hardware code through the hardware code again until the debug result indicates that the hardware code is successfully debugged. The hardware code may include a module such as a hardware model that may run test code. It can be understood that by the above manner of adding the pseudo code, the software code can be debugged first, and the hardware code is debugged when the software code is determined to run successfully, so that the coupling relation between software and hardware in the development process of the hardware based on the instruction set is relieved, and the development and debugging efficiency in the development process of the hardware based on the instruction set is improved.
According to the debugging method provided by the embodiment of the application, the pseudo code is obtained, software code debugging is carried out on the pseudo code, when the software code debugging fails, the occurrence of a problem of the software code is determined, the pseudo code is modified, when the software code debugging is successful, the pseudo code is converted into the test code, the hardware code debugging is carried out on the test code, when the hardware code debugging fails, the occurrence of the problem of the hardware code is determined, the hardware code is modified, therefore, the coupling relation between software and hardware in the hardware development process based on an instruction set is relieved through introducing the pseudo code, and the development and debugging efficiency in the hardware development process based on the instruction set is improved.
Referring to fig. 2, fig. 2 is a flow chart illustrating a debugging method according to another embodiment of the present application. The following details about the flow shown in fig. 2, the debugging method may specifically include the following steps:
step S210: and acquiring a pseudo code based on the python programming language, and performing software code debugging on the pseudo code through a pseudo code simulator.
In some embodiments, the python programming language may be used as the basis for pseudo code, thereby obtaining some of the high-level semantics provided by python, such as the semantics of generating initialized test data by python, using loops, jumps, etc. provided by python. In pseudocode, the portions that are strongly related to hardware are implemented using a pseudocode simulator, such as a hardware-implemented acceleration instruction or the like, which can interpret such instructions and simulate the logic of the hardware using software, producing the same results as the hardware. As an example, referring to fig. 3, the final pseudocode may have a form as shown in fig. 3, specifically, in fig. 3, line 39 is pseudocode using python loop semantics; line 41 is pseudocode using python addition and assignment semantics; lines 44 and 45 are key codes that use a pseudo code simulator.
In some embodiments, the pseudo code may be stored locally in the electronic device after being pre-written using the python programming language, and accordingly, when software code debugging is performed, a developer may directly read the pseudo code from the local by the electronic device and perform software code debugging on the pseudo code; in some embodiments, the pseudo code may be pre-written in python programming language and stored in the server, and accordingly, when the software code is debugged, a developer may download the pseudo code from the server through the electronic device and debug the software code on the pseudo code; in some embodiments, the pseudocode may be written using the python programming language at the time of software code debugging, and accordingly, a developer may write the pseudocode through an electronic device and perform software code debugging on the pseudocode after the pseudocode writing is completed. Of course, in this embodiment, other ways of obtaining the pseudo code using the python programming language may be further included, which will not be described herein.
Referring to fig. 4, fig. 4 is a flowchart illustrating step S210 of the debugging method shown in fig. 2 of the present application. The method is applied to the electronic device, and will be described in detail with respect to the flow shown in fig. 4, and the method specifically may include the following steps:
step S211: the method comprises the steps of obtaining pseudo codes based on a python programming language, and extracting target pseudo codes associated with hardware codes in the pseudo codes.
In some embodiments, after a pseudocode written based on the python programming language is obtained, the pseudocode may be identified and a target pseudocode associated with the hardware code in the pseudocode may be extracted. As one approach, the pseudocode may include hardware-dependent portions that may be implemented by a pseudocode simulator, e.g., acceleration instructions in the pseudocode may be implemented by hardware, and hardware-independent portions that may be implemented by normal module operation without the pseudocode simulator. Thus, in this embodiment, after the pseudocode is obtained, the target pseudocode associated with the hardware in the pseudocode may be extracted, and the target pseudocode may be passed to the pseudocode simulator for implementation.
Step S212: and performing software code debugging on the target pseudo code through the pseudo code simulator.
In this embodiment, after the target pseudocode is obtained, the pseudocode simulator may be invoked to perform software code debugging on the target pseudocode. Specifically, a software developer may use a target pseudocode test program through an electronic device and debug the correctness of the software code using a target pseudocode simulator. As one way, a pseudocode simulator may be used to run the target pseudocode and monitor whether the target pseudocode is running properly, wherein software code debugging may be determined to be successful when the target pseudocode is monitored to be running properly, and software debugging may be determined to be failed when the target pseudocode is monitored to be running failed, e.g., an interrupt, a stop, a crash, etc. occurs during the target pseudocode running. For example, the software code debugging is performed on the acceleration instruction, the loop instruction, the jump instruction, and the like in the pseudo code by the pseudo code simulator, which is not limited herein.
Step S220: when the software code debugging fails, determining that the software code has problems and modifying the pseudo code.
The specific description of step S220 is referred to step S120, and will not be repeated here.
Step S230: and when the software code is successfully debugged, translating the pseudo code into real code.
In some implementations, software code debugging may be determined to be successful when the pseudocode is operating normally, or software code debugging may be determined to be successful when the target pseudocode is operating normally. When it is determined that the software code is successfully debugged, the pseudo code may be translated into the real code, that is, the pseudo code may be translated into the real code, for example, the pseudo code may be translated into jiva, c++, C, dephi, etc., which is not limited herein.
In this embodiment, the pseudo code may be manually translated into the real code by a user (such as a developer) and then uploaded to the electronic device, the pseudo code may be automatically translated into the real code locally by the electronic device, the pseudo code may be sent to other electronic devices by the electronic device through a near field communication technology to translate the pseudo code into the real code, and the real code fed back by the other electronic devices may be uploaded to the server by the electronic device through a data network or a wireless network, the pseudo code may be downloaded from the server by the other electronic devices and translated into the real code and then fed back to the server, and then downloaded from the server by the electronic device, and the like, which is not limited herein.
Step S240: the real code is compiled into binary code by a compiler.
In some embodiments, after obtaining the real code translated by the pseudo code, the real code may be compiled into binary code by a compiler to meet the loading requirements of the hardware model.
In this embodiment, the electronic device may automatically compile the real code into the binary code locally through the compiler, the electronic device may send the real code to other electronic devices through the near field communication technology, compile the real code into the binary code through the compiler, and receive the binary code fed back by other electronic devices, the electronic device may upload the real code to the server through the data network or the wireless network, and the other electronic devices download the real code from the server and compile the real code into the binary code through the compiler, and then feed back to the server, and the electronic device downloads the binary code from the server.
Step S250: and performing hardware code debugging on the binary code.
In this embodiment, after the binary code is acquired, hardware code debugging may be performed on the binary code. Specifically, a hardware developer may implement a test program using a binary code through an electronic device, and run the binary code using a hardware model that can run the binary code, and monitor whether the binary code is running normally, wherein when the binary code is monitored to run normally, a hardware code debug success may be determined, and when the binary code is monitored to run failure, for example, an interrupt, a stop, a crash, or the like occurs during the running of the binary code, a hardware debug failure may be determined.
In some embodiments, the binary code may be real code that is pre-compiled by the electronic device and stored locally in the electronic device, and accordingly, when performing hardware code debugging, a developer may directly read the binary code from the local by the electronic device and perform hardware code debugging on the binary code; in some embodiments, the binary code may be real code stored in the server after the server is compiled, and accordingly, when the hardware code is debugged, a developer may download the binary code from the server through the electronic device and debug the hardware code on the binary code; in some embodiments, the binary code may be compiled from the real code when the hardware code is debugged, and accordingly, a developer may compile the real code into the binary code through the electronic device, and perform the hardware code debugging on the binary code after the binary code is compiled.
Step S260: when the debugging of the hardware code fails, determining that the hardware code has problems and modifying the hardware code.
The specific description of step S260 is referred to step S150, and will not be repeated here.
According to the debugging method provided by the further embodiment of the application, the pseudo code is obtained based on the python programming language, software code debugging is conducted on the pseudo code through the pseudo code simulator, when the software code debugging fails, the occurrence of problems of the software code is determined, the pseudo code is modified, when the software code debugging is successful, the pseudo code is translated into the real code, the real code is compiled into the binary code through the compiler, hardware code debugging is conducted on the binary code, and when the hardware code debugging fails, the occurrence of problems of the hardware code is determined, and the hardware code is modified. Compared with the debugging method shown in fig. 1, the embodiment obtains the pseudo code through the python programming language to improve the readability and the development efficiency of the pseudo code, and in addition, the embodiment introduces a pseudo code simulator to debug the pseudo code by software code to release the coupling relation between software and hardware in the hardware development process based on the instruction set, thereby improving the development and debugging efficiency in the hardware development process based on the instruction set.
Referring to fig. 5, fig. 5 is a schematic flow chart of a debugging method according to still another embodiment of the present application. The method is applied to the electronic device, and will be described in detail with respect to the flowchart shown in fig. 5, and the debugging method specifically includes the following steps:
step S310: and acquiring a pseudo code based on the python programming language, and performing software code debugging on the pseudo code through a pseudo code simulator.
Step S320: when the software code debugging fails, determining that the software code has problems and modifying the pseudo code.
Step S330: and when the software code is successfully debugged, translating the pseudo code into real code.
Step S340: the real code is compiled into binary code by a compiler.
The specific description of step S310 to step S340 refer to step S210 to step S240, and are not described herein.
Step S350: and carrying out hardware code debugging on the binary code through a hardware model, wherein the hardware model at least comprises a Field Programmable Gate Array (FPGA).
In some embodiments, after obtaining the binary code, hardware code debugging may be performed on the binary code, specifically, a hardware developer may implement a test program by using the binary code through an electronic device, and use a hardware model to run the binary code, and monitor whether the binary code is normally run, where when the binary code is monitored to be normally run, the hardware code debugging may be determined to be successful, and when the binary code is monitored to be run failure, for example, an interrupt, a stop, a crash, or the like occurs during the running of the binary code, the hardware debugging may be determined to be failed. The hardware model at least includes a Field programmable gate array (Field-Programmable Gate Array, FPGA), that is, after the binary code is obtained, the hardware code can be debugged by the binary code of the FPGA device, which is not described herein.
Step S360: when the hardware code debugging fails, determining that the hardware model is problematic and modifying the hardware model.
In some embodiments, when the binary code fails to run, for example, an interrupt, a stop, a crash, etc. occurs during the running of the binary code, the hardware code debug failure may be determined, and thus, the hardware model may be determined to be problematic and modified, for example, if the hardware code debug is performed by the FPGA device binary code, the FPGA may be determined to be problematic and modified. When the problem of the binary code is determined, the hardware model can be directly modified and stored in the electronic equipment for debugging the binary code; the hardware model can be sent to other electronic equipment through a near field communication technology to modify the hardware model and receive the modified hardware model fed back by the other electronic equipment; the hardware model may also be sent to the server through a wireless network or a data network, and the hardware model may be downloaded from the server by other electronic devices, modified, uploaded to the server, and fed back to the electronic device by the server, which is not limited herein.
In this embodiment, after the electronic device obtains the modified hardware model, the electronic device may further debug the hardware model through the binary code running on the hardware model again until the debug result indicates that the hardware code is successfully debugged.
According to the debugging method provided by the further embodiment of the application, the pseudo code is obtained based on the python programming language, software code debugging is conducted on the pseudo code through the pseudo code simulator, when the software code debugging fails, the occurrence of problems of the software code is determined, the pseudo code is modified, when the software code debugging is successful, the pseudo code is translated into the real code, the real code is compiled into the binary code through the compiler, hardware code debugging is conducted on the binary code through the hardware model, wherein the hardware model at least comprises a field programmable gate array FPGA, and when the hardware code debugging fails, the occurrence of problems of the hardware model is determined, and the hardware model is modified. Compared with the debugging method shown in fig. 1, the embodiment obtains the pseudo code through the python programming language to improve the readability and development efficiency of the pseudo code, and in addition, the embodiment introduces a pseudo code simulator to debug the pseudo code by software code to release the coupling relation between software and hardware in the hardware development process based on the instruction set, so that the development and debugging efficiency in the hardware development process based on the instruction set is improved, and furthermore, the embodiment loads binary code through a hardware model to debug the hardware code to improve the hardware code debugging efficiency.
Referring to fig. 6, fig. 6 shows a block diagram of a debugging device 200 according to an embodiment of the present application. The debugging device 200 is applied to the above-described electronic apparatus. The debugging device 200 will be explained below with respect to the block diagram shown in fig. 6, comprising: a software code debugging module 210, a pseudo code modification module 220, a pseudo code conversion module 230, a hardware code debugging module 240, and a hardware code modification module 250, wherein:
and the software code debugging module 210 is used for acquiring the pseudo code and performing software code debugging on the pseudo code. Further, the software code debugging module 210 includes:
and the software code debugging sub-module is used for acquiring the pseudo code and carrying out software code debugging on the pseudo code through the pseudo code simulator. Further, the software code debugging submodule includes: an object pseudo code acquisition unit and a software code debugging unit, wherein:
and the target pseudo code acquisition unit is used for acquiring pseudo codes and extracting target pseudo codes associated with the hardware codes in the pseudo codes.
And the software code debugging unit is used for performing software code debugging on the target pseudo code through the pseudo code simulator.
Further, the software code debugging module 210 further includes: a pseudocode acquisition sub-module, wherein:
and the pseudo code acquisition sub-module is used for acquiring the pseudo code based on the python programming language.
And the pseudo code modification module 220 is used for determining that the software code has problems and modifying the pseudo code when the software code fails to debug.
A pseudo code conversion module 230, configured to convert the pseudo code into test code when the software code is successfully debugged. Further, the pseudo code conversion module 230 includes: a real code translation sub-module and a binary code compilation sub-module, wherein:
and the real code translation submodule is used for translating the pseudo code into a real code when the software code is successfully debugged.
And the binary code compiling sub-module is used for compiling the real code into binary code through a compiler.
And the hardware code debugging module 240 is used for carrying out hardware code debugging on the test code. Further, the hardware code debugging module 240 includes: a hardware code debugging sub-module, wherein:
and the hardware code debugging sub-module is used for carrying out hardware code debugging on the binary code. Further, the hardware code debugging submodule includes: a hardware code debugging unit, wherein:
and the hardware code debugging unit is used for carrying out hardware code debugging on the binary code through a hardware model, wherein the hardware model at least comprises a Field Programmable Gate Array (FPGA).
The hardware code modification module 250 is configured to determine that a problem occurs in the hardware code and modify the hardware code when the debugging of the hardware code fails. Further, the hardware code modification module 250 includes: a hardware model modification sub-module, wherein:
and the hardware model modification sub-module is used for determining that the hardware model is problematic and modifying the hardware model when the hardware code debugging fails.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus and modules described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
In several embodiments provided herein, the coupling of the modules to each other may be electrical, mechanical, or other.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
Referring to fig. 7, a block diagram of an electronic device 100 according to an embodiment of the present application is shown. The electronic device 100 may be a smart phone, a tablet computer, an electronic book, or the like capable of running an application program. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, wherein the one or more application programs may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more program(s) configured to perform the method as described in the foregoing method embodiments.
Wherein the processor 110 may include one or more processing cores. The processor 110 utilizes various interfaces and lines to connect various portions of the overall electronic device 100, perform various functions of the electronic device 100, and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 110 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing of display content; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 110 and may be implemented solely by a single communication chip.
The Memory 120 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). Memory 120 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described below, etc. The storage data area may also store data created by the terminal 100 in use (such as phonebook, audio-video data, chat-record data), etc.
Referring to fig. 8, a block diagram of a computer readable storage medium according to an embodiment of the present application is shown. The computer readable medium 300 has stored therein program code which can be invoked by a processor to perform the methods described in the method embodiments described above.
The computer readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 300 comprises a non-volatile computer readable medium (non-transitory computer-readable storage medium). The computer readable storage medium 300 has storage space for program code 310 that performs any of the method steps described above. The program code can be read from or written to one or more computer program products. Program code 310 may be compressed, for example, in a suitable form.
In summary, the debugging method, the device, the electronic equipment and the storage medium provided by the embodiment of the application acquire the pseudo code, perform software code debugging on the pseudo code, determine that the software code has a problem and modify the pseudo code when the software code is debugged successfully, convert the pseudo code into the test code when the software code is debugged successfully, perform hardware code debugging on the test code, determine that the hardware code has a problem and modify the hardware code when the hardware code is debugged successfully, thereby relieving the coupling relation between the software and the hardware in the hardware development process based on the instruction set by introducing the pseudo code, and improving the development and debugging efficiency in the hardware development process based on the instruction set.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, one of ordinary skill in the art will appreciate that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not drive the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (9)

1. A method of debugging, the method comprising:
acquiring a pseudo code, and performing software code debugging on the pseudo code;
when the software code debugging fails, determining that the software code has problems and modifying the pseudo code;
when the software code is successfully debugged, translating the pseudo code into a real code;
compiling the real code into binary code by a compiler;
performing hardware code debugging on the binary code;
when the hardware code debugging fails, determining that the hardware code has a problem and modifying the hardware code;
when the software code debugging fails, the pseudo code is not converted into test code and hardware code debugging is stopped.
2. The method of claim 1, wherein the obtaining the pseudocode, performing software code debugging on the pseudocode, comprises:
and acquiring a pseudo code, and performing software code debugging on the pseudo code through a pseudo code simulator.
3. The method of claim 2, wherein the obtaining the pseudocode, performing software code debugging on the pseudocode, comprises:
acquiring a pseudo code, and extracting a target pseudo code associated with a hardware code from the pseudo code;
and performing software code debugging on the target pseudo code through the pseudo code simulator.
4. The method of claim 1, wherein said performing hardware code debugging on said binary code comprises:
and carrying out hardware code debugging on the binary code through a hardware model, wherein the hardware model at least comprises a Field Programmable Gate Array (FPGA).
5. The method of claim 4, wherein the determining that the hardware code is problematic and modifying the hardware code when the hardware code fails to debug comprises:
when the hardware code debugging fails, determining that the hardware model is problematic and modifying the hardware model.
6. The method of any of claims 1-5, wherein the acquiring pseudo-code comprises:
the pseudocode is obtained based on the python programming language.
7. A debugging device, the device comprising:
the software code debugging module is used for acquiring a pseudo code and carrying out software code debugging on the pseudo code;
the pseudo code modification module is used for determining that the software code has problems and modifying the pseudo code when the software code fails to debug;
the pseudo code conversion module is used for translating the pseudo code into a real code when the software code is successfully debugged, compiling the real code into a binary code through a compiler, or not converting the pseudo code into a test code and stopping hardware code debugging when the software code is failed to debug;
the hardware code debugging module is used for carrying out hardware code debugging on the binary code;
and the hardware code modification module is used for determining that the hardware code has a problem and modifying the hardware code when the hardware code fails to debug.
8. An electronic device comprising a memory and a processor, the memory coupled to the processor, the memory storing instructions that when executed by the processor perform the method of any of claims 1-6.
9. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a program code, which is callable by a processor for executing the method according to any one of claims 1-6.
CN201910726510.XA 2019-08-07 2019-08-07 Debugging method, device, electronic equipment and storage medium Active CN110502439B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910726510.XA CN110502439B (en) 2019-08-07 2019-08-07 Debugging method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910726510.XA CN110502439B (en) 2019-08-07 2019-08-07 Debugging method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110502439A CN110502439A (en) 2019-11-26
CN110502439B true CN110502439B (en) 2024-01-12

Family

ID=68586625

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910726510.XA Active CN110502439B (en) 2019-08-07 2019-08-07 Debugging method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110502439B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112579073B (en) * 2020-12-25 2024-04-19 深圳市优必选科技股份有限公司 Code conversion method, device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110024A (en) * 2007-08-14 2008-01-23 中兴通讯股份有限公司 Unit test system and method thereof
CN103293538A (en) * 2013-06-17 2013-09-11 中南大学 Beidou satellite signal acquisition method based on code storage
CN106598840A (en) * 2016-10-25 2017-04-26 南京航空航天大学 Software self-testing technology-based low-speed peripheral efficient test architecture and method
CN107526577A (en) * 2016-06-22 2017-12-29 山东易华录信息技术有限公司 A kind of Software Development method
CN107526679A (en) * 2017-07-13 2017-12-29 深圳市小牛在线互联网信息咨询有限公司 Automated test frame, the automated testing method based on thereon, storage medium and computer equipment
CN107590066A (en) * 2016-07-08 2018-01-16 广州市动景计算机科技有限公司 Method of testing, equipment and the programmable device of application program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6834364B2 (en) * 2001-04-19 2004-12-21 Agilent Technologies, Inc. Algorithmically programmable memory tester with breakpoint trigger, error jamming and 'scope mode that memorizes target sequences

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101110024A (en) * 2007-08-14 2008-01-23 中兴通讯股份有限公司 Unit test system and method thereof
CN103293538A (en) * 2013-06-17 2013-09-11 中南大学 Beidou satellite signal acquisition method based on code storage
CN107526577A (en) * 2016-06-22 2017-12-29 山东易华录信息技术有限公司 A kind of Software Development method
CN107590066A (en) * 2016-07-08 2018-01-16 广州市动景计算机科技有限公司 Method of testing, equipment and the programmable device of application program
CN106598840A (en) * 2016-10-25 2017-04-26 南京航空航天大学 Software self-testing technology-based low-speed peripheral efficient test architecture and method
CN107526679A (en) * 2017-07-13 2017-12-29 深圳市小牛在线互联网信息咨询有限公司 Automated test frame, the automated testing method based on thereon, storage medium and computer equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《 基于FPGA的毫米波成像系统中数据采集系统研究》;王艳丽;《中国优秀硕士学位论文全文数据库 信息科技辑》;全文 *
《PSL Assertion Checkers Synthesis with ASM Based HLS tool ABELITE》;Maksim J et al;《IEEE》;全文 *

Also Published As

Publication number Publication date
CN110502439A (en) 2019-11-26

Similar Documents

Publication Publication Date Title
US10540262B2 (en) Using edit and continue to dynamically set and unset optimizations in source code while debugging
US10261889B2 (en) Techniques for edit-and-continue and enhanced optimized debugging on optimized code
EP2368189B1 (en) Debugging pipeline
JP5415557B2 (en) User script code conversion for debugging
US20130007720A1 (en) Dynamic Isolated Debugging via Class Instrumentation
US20160246622A1 (en) Method and system for implementing invocation stubs for the application programming interfaces embedding with function overload resolution for dynamic computer programming languages
US8930923B2 (en) Generating debugging extension source code utilizing debugging information
US11789913B2 (en) Integration of model execution engine containers with a model development environment
CN111176629A (en) Application development method and device
US20150007150A1 (en) Determining control flow divergence due to variable value difference
CN107463421B (en) Compiling and executing method and system of static flow model
CN110502439B (en) Debugging method, device, electronic equipment and storage medium
CN115705194A (en) Code processing method under hardware memory order architecture and corresponding device
CN116627850B (en) Function debugging method and device, storage medium and electronic equipment
US20170052765A1 (en) Method and system for creating app
CN113238761A (en) Cross-platform software development method and device, electronic equipment and storage medium
CN112416533A (en) Method and device for running application program on browser and electronic equipment
TW202403541A (en) System, method and device for introducing applet into third-party APP and medium
CN113641594B (en) Cross-terminal automatic testing method and related device
CN111488152B (en) Application program page previewing method, related device and system
CN113448874A (en) Method and device for generating unit test script
CN113672238B (en) Operation method, device and equipment based on real-time operating system modularized management
CN105700854B (en) Run the method and device of application task
US20240134832A1 (en) Integration of model execution engine containers with a model development environment
WO2023164897A1 (en) Optimization method and apparatus for binary program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant