Implementation of printed information in wince BSP -- transferred from: By arm-WinCE (Microsoft MVP)

Source: Internet
Author: User

Transferred from: Author: Arm-WinCE (Microsoft MVP)

 

Whether in wince5.0 or wince6.0, we will use the print function when debugging the driver or application. In the driver, we may use debugmsg (...), retailmsg (...), and nkdbuplintfw (..). Before using these print functions to debug our program, we need to implement the serial port printing function.

In the BSP of wince, if you want to call debugmsg (..) or retailmsg (..) to print information from the serial port, we must find debug at the oal layer in our BSP. c. Implement the following four functions in this file:

Void oeminitdebugserial (void): Initialize the serial port used to print information

Int oemreaddebugbyte (void): Read a byte from the serial port. If an error occurs, oem_debug_com_error is returned. If no data exists, oem_debug_read_nodata is returned.

Void oemwritedebugbyte (byteCh): Write a byte to the serial port.
Void oemwritedebugstring (unsigned short * Str): Write a string to the serial port. This function is actually implemented by calling oemwritedebugbyte.
After the above four functions are implemented, You can debug the program through serial port printing. Generally, these four functions are implemented in debug. C of OAL.
 
In BSP, we usually use three functions to print: debugmsg, retailmsg, and nkdbuplintfw. A Brief Introduction:
 
The nkdbuplintfw (...) function is generally used only in oal and can print information directly from the serial port without being affected by the compilation option.
 
The debugmsg (...) function prints information only after the project is compiled in debug mode. If it is compiled in release mode, the information will not be printed.

 

==================================== Here I want to correct it

During driver development of wince, we usually compile the project into the release mode. If the compilation is in debug mode, the compilation result (NK) will be very large, exceeding the limit on NK in the code.

In addition, sometimes we only need to understand the debugging information of individual device drivers, and do not need to compile the entire project into the debug mode.

In this case, you can use this method to add the following to the driver file header:

# UNDEF debugmsg
# Define debugmsg (x, S) nkdbuplintfw s

In this way, all the debugging information in the driver file will be printed and the debugzone settings will be ignored.
======================================================-- Repost the independent yutai website, the verification is indeed feasible.

 
The retailmsg (...) function will print debugging information during compilation in debug mode and release mode.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.