Carry out the method for man-machine interaction debugging EC based on UART terminal input character string commandTechnical field
The present invention relates to the method for a kind of debugging EC (Embedded Cotroller), particularly a kind of method of carrying out man-machine interaction debugging EC based on UART terminal input character string command.
Background technology
The method of utilizing the UART interface to debug is the adjustment method commonly used of exploitations such as single-chip microcomputer, EC, embedded system.At present general serial port debugging method all is that the equipment that will debug and the serial ports of HOST connect, and opens the serial port terminal instrument of HOST, and the device power that will debug just prints related commissioning information so passively on the serial port terminal window then.Though this method can finely be observed the state of system's operation, the IC that does not have operating system but this has only firmware for single-chip microcomputer, EC etc., just can only observe limited Debugging message, because in firmware, add the program size that a large amount of Debugging message can increase firmware, for the less IC of these storage spaces, be difficult to satisfy the demands.In addition, this method is just printed Debugging message passively, if optionally debug the function of certain module, must revise correlative code, adds Debugging message, compiling, and burning again will increase the complexity of debugging so greatly.Sometimes can't directly remove to carry out certain internal command and go the desired result that obtains intuitively, for example want to read the data of a slice storage area, check content of internal register or the like.Therefore, this adjustment method can not go to carry out the debugging of correlation function with carrying out man-machine interaction easily, greatly influences debugging efficiency.
Summary of the invention
Technical matters to be solved by this invention provides a kind of method of carrying out man-machine interaction debugging EC based on UART terminal input character string command, inferior method can improve the efficient of debugging effectively, solves the problem that can not carry out the man-machine interaction debugging in the general serial port debugging method.
For reaching above-mentioned technical purpose, technical scheme of the present invention is: a kind ofly carry out the method for man-machine interaction debugging EC based on UART terminal input character string command, it may further comprise the steps:
(1) character string of add resolving the specified format that receives from serial port terminal in the EC firmware obtains related command and parameter and carries out the code of this order;
(3) the inner integrated UART interface of EC is connected to the COMx PORT of HOST;
(2) function of utilizing the reception of the serial port terminal instrument in the operating system of HOST and sending character string realizes the interactive debug with EC:
A. send the character string of prescribed form to EC when transmission character string function from the serial port terminal instrument of HOST, after EC receives this character string by the UART interface, call the character string analytical function and resolve character string, obtain related command and parameter, carry out related command then, and execution result converted in character string sends to HOST by the UART interface the serial port terminal tool window print, can carry out related commissioning according to this information;
B. the character string that sends as HOST does not meet form, or invalid order, then can print the relevant error information reporting errors;
C. when debugging new module or function, only need in the command analysis function, to add related command and Debugging message, in the serial port terminal of HOST, send the related command character string then and can carry out related commissioning work.
The present invention compared with prior art, it can have the embedded system development of UART interface to carry out the debugging of man-machine interaction to EC etc., can utility command read and write debugging, immediately obtain the feedback result of needs, observe the running status of each module of firmware very intuitively, solve the directly perceived and not inconvenient problem of the general adjustment method of using bright LED lamp fully, greatly improved debugging efficiency and accuracy.The realization low cost of the inventive method is comparatively flexible simultaneously, the efficient height.
Embodiment
Carry out the method that EC is debugged in man-machine interaction based on UART terminal input character string command, may further comprise the steps:
(1) character string of add resolving the specified format that receives from serial port terminal in the EC firmware obtains related command and parameter and carries out the code of this order;
(3) the inner integrated UART interface of EC is connected to the COMx PORT of HOST;
(2) function of utilizing the reception of the serial port terminal instrument in the operating system of HOST and sending character string realizes the interactive debug with EC:
A. send the character string of prescribed form to EC when transmission character string function from the serial port terminal instrument of HOST, after EC receives this character string by the UART interface, call the character string analytical function and resolve character string, obtain related command and parameter, carry out related command then, and execution result converted in character string sends to HOST by the UART interface the serial port terminal tool window print, can carry out related commissioning according to this information;
B. the character string that sends as HOST does not meet form, or invalid order, then can print the relevant error information reporting errors;
C. when debugging new module or function, only need in the command analysis function, to add related command and Debugging message, in the serial port terminal of HOST, send the related command character string then and can carry out related commissioning work.
Now being that example is described in detail based on WINBOND WPCE775L EC development board and F/W (firmware):
Based on the integrated UART interface of the EC chip internal of WPCE775L development board, the UART interface of EC is connected with the level transferring chip MAX3323E on development board, and MAX3323E is connected to the COMx PORT of HOST by serial port connecting wire.
The serial ports parameter is provided with: frequency 25MHz, and baud rate 9600, data bit 8, position of rest 1, no parity allows UART to interrupt and receives to interrupt.
Compiled EC F/W binary code burning is advanced among the ROM of EC outside, power on then, EC brings into operation.
The function of utilizing the reception of the serial port terminal instrument in the operating system of HOST and sending character string realizes the interactive debug with EC.
Utilize the serial port terminal program to carry out interactive debug on the WPCE775L development board, promptly see to be gained, the order that input needs just can obtain desirable Debugging message, brings convenience to debugging, has increased the interest of debugging.Because of not using special-purpose commissioning device, reduce debugging cost widely, and can adjust debug command at any time in addition, strengthened the dirigibility of debugging.
The foregoing description does not limit the present invention in any way, and every employing is equal to replaces or technical scheme that the mode of equivalent transformation obtains all drops in protection scope of the present invention.