Go to: http://blog.csdn.net/jiereliyi/article/details/4504136 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 int OEMReadDebugByte (void) used to print information: Read a byte from the serial port, when an error occurs, OEM_DEBUG_COM_ERROR is returned. If no data exists, OEM_DEBUG_READ_NODATvoid OEMWriteDebugByte (BYTE ch) is returned. Write a byte to the serial port void OEMWriteDebugString, this function is actually called 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 only used in OAL. It can print information directly from the serial port without being affected by the compilation options. 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. RETAILMSG (..) both the Debug mode and the Release mode output debugging information. However, if you select "Enable ship Build" in "build option" in the project attribute ", then the RETAILMSG function will not print information.