调试Mini2440时,默认情况无法打开串口调试信息输出。如果需要打开串口0进行调试信息输出,按照如下方法进行:
1. bsp包的/Src/Kernel/Oal路径下的debug.c文件中
(1)添加如下信息:
//-----------------------------------------------
// add by DY for test used
#define BSP_DEBUG_UART0
//-----------------------------------------------
#undef BSP_DEBUGPORT
#if defined(BSP_DEBUG_UART0) || defined(BSP_DEBUG_UART1)
#define BSP_DEBUGPORT
#endif
(2)更改如下信息
// Configure the UART.
//
/*
OUTREG32(&g_pUARTReg->UFCON, BSP_UART1_UFCON);
OUTREG32(&g_pUARTReg->UMCON, BSP_UART1_UMCON);
OUTREG32(&g_pUARTReg->ULCON, BSP_UART1_ULCON);
OUTREG32(&g_pUARTReg->UCON, BSP_UART1_UCON);
OUTREG32(&g_pUARTReg->UBRDIV, BSP_UART1_UBRDIV);
*/
OUTREG32(&g_pUARTReg->UFCON, BSP_UART0_UFCON);
OUTREG32(&g_pUARTReg->UMCON, BSP_UART0_UMCON);
OUTREG32(&g_pUARTReg->ULCON, BSP_UART0_ULCON);
OUTREG32(&g_pUARTReg->UCON, BSP_UART0_UCON);
OUTREG32(&g_pUARTReg->UBRDIV, BSP_UART0_UBRDIV);
2. 相关的改动还有Src/Inc下的bsp_cfg.h
//------------------------------------------------------------------------------
// Debug UART1
//------------------------------------------------------------------------------
/*
#define DEBUG_BAUDRATE (115200)
#define BSP_UART1_ULCON 0x03 // 8 bits, 1 stop, no parity
#define BSP_UART1_UCON 0x0005 // pool mode, PCLK for UART
#define BSP_UART1_UFCON 0x00 // disable FIFO
#define BSP_UART1_UMCON 0x00 // disable auto flow control
#define BSP_UART1_UBRDIV (S3C2440A_PCLK/(DEBUG_BAUDRATE*16) - 1)
*/
#define DEBUG_BAUDRATE (115200)
#define BSP_UART0_ULCON 0x03 // 8 bits, 1 stop, no parity
#define BSP_UART0_UCON 0x0005 // pool mode, PCLK for UART
#define BSP_UART0_UFCON 0x00 // disable FIFO
#define BSP_UART0_UMCON 0x00 // disable auto flow control
#define BSP_UART0_UBRDIV (S3C2440A_PCLK/(DEBUG_BAUDRATE*16) - 1)
3. 由于不能让内核在启动过程中加载正常串口0的驱动,如果加载无法做调试口使用,需要修改注册表文件platform.reg,在这个文件中注释掉关于串口0的部分
IF BSP_NOSERIAL !
IF 0
IF BSP_NOUART0 !
;IF BSP_KITL != SERIAL_UART0
;=============== UART0 (physical COM1 connector P1) (Serial) ===============
[HKEY_LOCAL_MACHINE/Drivers/BuiltIn/Serial0]
"DeviceArrayIndex"=dword:0
"Irq"=dword:1c
"MemBase"=dword:50000000
"MemLen"=dword:2C
"InterruptBitsShift"=dword:0 ; UART 0 Interrupt Sub Register shift bit.
"ISTTimeouts"=dword:200 ; every 512 ticks checking Modem status.
"Prefix"="COM"
"Index"=dword:1
"Dll"="serial_smdk2440.dll"
"Order"=dword:0
"Priority"=dword:0
"Port"="COM1:"
"DeviceType"=dword:0
"FriendlyName"="COM-1"
"Tsp"="unimodem.dll"
"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
"DevConfig"=hex: 10,00, 00,00, 05,00,00,00, 10,01,00,00, 00,4B,00,00, 00,00, 08, 00, 00, 00,00,00,00
;ENDIF
ENDIF
ENDIF
按照如上步骤添加之后,重新编译一下bsp即可。