Debug-port

Developers may need one port for debugging in the development phase. But while in production phase, that debug port can be disabled and can be used as a COM port in kernel (i.e for Application). Generally, a PXA270 Computer on Module port can be used either as a debug port or as a COM port and cannot be used for both the purposes. The debug port is disabled only in the kernel level, so it can be still used for debugging in boot loader level. Disabling the debug port is a compiler time option and cannot be done dynamically. This blog explains how to disable the debug COM port in both ARM and X86 devices.

Disabling Debug Port for ARM

For the ARM BSPs, the implementation of following three functions determines the usage of debug ports.

OEMDebugInit
OEMDebugWriteByte
OEMDebugReaByte

Leaving the above functions empty disables the debug port and that port can be used as a COM port in kernel by modifying the serial driver and adding appropriate registry settings.

Disabling Debug Port for X86

For X86 Bsps, the usage of debug ports is determined in OEMInitDebugSerial function which is located in “\%_WIN_DIR%\PUBLIC\COMMON\OAK\CSP\X86\OAL\debug.c” file. In some BSPs, this function might have been implemented inside the BSP itself. Add the following line in OEMInitDebugSerial function as follows:

pBootArgs->ucComPort = 0;

void OEMInitDebugSerial(void)

{

pBootArgs = (BOOT_ARGS *) ((ULONG)(*(PBYTE *)BOOT_ARG_PTR_LOCATION) | 0x80000000);

if ( ! pBootArgs->ucBaudDivisor )

{

pBootArgs->ucBaudDivisor = 6; // Default to 19.2 if nothing specified.

}

pBootArgs->ucComPort = 0; //– add this line

switch ( pBootArgs->ucComPort )

{

case 1:

IoPortBase = (PUCHAR)COM1_BASE;

break;

………….

}

}

Now the debug port can be used as a COM port in kernel by modifying the serial driver and adding appropriate registry settings.