一:UBOOT
1、修改uboot-imx\board\freescale\mx51_bbg里的mx51_bbg.c文件,改成需要的设置:
static void setup_uart(void)
{
unsigned int pad = PAD_CTL_HYS_ENABLE | PAD_CTL_PKE_ENABLE |
PAD_CTL_PUE_PULL | PAD_CTL_DRV_HIGH;
mxc_request_iomux(MX51_PIN_UART2_RXD, IOMUX_CONFIG_ALT0);
mxc_iomux_set_pad(MX51_PIN_UART2_RXD, pad | PAD_CTL_SRE_FAST);
mxc_request_iomux(MX51_PIN_UART2_TXD, IOMUX_CONFIG_ALT0);
mxc_iomux_set_pad(MX51_PIN_UART2_TXD, pad | PAD_CTL_SRE_FAST);
mxc_iomux_set_input(MUX_IN_UART2_IPP_UART_RXD_MUX_SELECT_INPUT, INPUT_CTL_PATH2);
// mxc_request_iomux(MX51_PIN_UART1_RTS, IOMUX_CONFIG_ALT0);
// mxc_iomux_set_pad(MX51_PIN_UART1_RTS, pad);
// mxc_request_iomux(MX51_PIN_UART1_CTS, IOMUX_CONFIG_ALT0);
// mxc_iomux_set_pad(MX51_PIN_UART1_CTS, pad);
/* enable GPIO1_9 for CLK0 and GPIO1_8 for CLK02 */
writel(0x00000004, 0x73fa83e8);
writel(0x00000004, 0x73fa83ec);
}
2、修改uboot-imx\include\configs里的mx51_bbg_android.h文件,#define CONFIG_UART_BASE_ADDR UART2_BASE_ADDR ,改为串口2的地址,重新编译就可以了。
二:修改内核调试串口
1、内核解压输出信息,内核解压时使用的串口驱动是独立于UBOOT或内核的串口驱动的,解压时输出的打印信息的相关的代码在kernel_imx/arch/arm/plat-mxc/include/mach/uncompress.h内。这里的串口输出代码很简单,只是往数据寄存器写数据,并没有对串口进行相关的配置,所以这里串口的正常输出需要依赖UBOOT对串口的正确配置。
#define MX51_UART1_BASE_ADDR 0x73fbc000
uart_base = MX51_UART1_BASE_ADDR;
改为需要到串口地址就可以里!
2:修改uboot-imx\include\configs里的mx51_bbg_android.h文件
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"ethprime=FEC0\0" \
"ethaddr=00:04:9f:00:ea:d3\0" \
"bootfile=uImage\0" \
"loadaddr=0x90800000\0" \
"rd_loadaddr=0x90D00000\0" \
"bootargs=console=ttymxc1 init=/init androidboot.console=ttymxc1 " \
"console=mxcuart,0x73fc0000,115200n8" \ 增加这一句。
"di1_primary gpu_nommu gpu_memory=32M calibration\0" \
"bootcmd_SD=mmc read 0 ${loadaddr} 0x800 0x2000;" \
"mmc read 0 ${rd_loadaddr} 0x3000 0x300\0" \
"bootcmd=run bootcmd_SD; bootm ${loadaddr} ${rd_loadaddr}\0" \