Debug messages can be very helpful for developing or debugging applications. The debug messages provided by Windows CE are normally not visible. There are two ways to get to these messages:
You can enable debug messages over the serial port. Using the serial port for debug messages slows down the system. It's not recommended to use the debug serial port for large amount of debug data.
To enable the debug messages over serial please follow the steps mentioned below:
X
set dbg.serial = 1 // 0: disable, 1: enable
save dbg
The debug messages are now sent out through the serial port and can be monitored running a terminal application on the PC.
Instead of using the bootloader commands above, the ConfigBlock Editor can be used to make the setting.
Warning: Enabling debug messages will make the serial port unavailable for the operating system.
The bootloader and Windows CE use a special ring-buffer in RAM to store the debug messages. These messages can be read through the tool Debug Message Logger or by accessing the RAM buffer directly by an application.
The Debug Message Buffer feature is available on the following modules:
To enable the debug messages buffer please follow the steps mentioned below:
X
set dbg.msgbuf = 1 // 0: disable, 1: enable
save dbg
set mem.dbgmsgram 10 // set buffer size (in kB)
save mem
Instead of using the bootloader commands above, the ConfigBlock Editor can be used to make the setting.
This registry setting is only available on PXA The size of this buffer is fix 2k in the bootloader and adjustable for Windows CE (10k default). The following registry key lets you change the size or even disable the feature:
[HKLM\System\Config] "DbgMsgBufSize" = dword:0x00002800 ;buffer size in bytes, 0=feature disabled, 0x2800=10k(default)
See Debug Message Logger for details.
The debug message buffer is implemented as a memory mapped file. The following code snippet demonstrates the access to this buffer.
// Struct used for the debug message buffer typedef struct { DWORD version; // version of the message buffer DWORD bufSize; // message buffer size, w/o header bytes (this means size starting from buf offest) DWORD head; // head pointer which points to the character which gets written next DWORD flags; // see flag description below DWORD reserved[3]; // reserved, do not use char buf[]; // start of the debug message buffer (ring buffer) } DBGMSGBUF; // flag definitions #define DBGMSGBUF_F_OVERFLOW (1<< 0) // set (1) means, there was at least one wrap around performed on the message buffer // C code (no error handling done, more information about the used Windows APIs can be found on MSDN) HANDLE hMapFile; DBGMSGBUF * pDbgMsgBuf; hMapFile= CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READONLY, 0, 0, L"DbgMsgBuffer"); pDbgMsgBuf = (DBGMSGBUF*) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0); // start using the debug message buffer. e.g. if(pDbgMsgBuf->version != 1) ...