首页 > 代码库 > X-006 FriendlyARM tiny4412 u-boot移植之Debug串口用起来
X-006 FriendlyARM tiny4412 u-boot移植之Debug串口用起来
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
开发环境:win7 64位 + VMware12 + Ubuntu14.04 64位
工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabi
要移植的u-boot版本:u-boot-2016-11
Tiny4412开发板硬件版本为:
底板: Tiny4412/Super4412SDK 1506
核心板:Tiny4412 - 1412
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
在上一节我们初始化完成了exynos4412的时钟,接下来把tiny4412的debug串口用起来。
1、Tiny4412 debug 串口电路原理图
参考:Tiny4412SDK-1506-Schematic.pdf
Tiny4412-1412-Schematic.pdf
从原理图上我们可看出,tiny4412的debug串口使用的uart0.
2、uart0初始化步骤
1. 选择UART的时钟源
2.将所涉及的UART通道管脚设为UART功能
3. 设置波特率:UBRDIVn寄存器(UART BAUD RATE DIVISOR)、UFRACVALn寄存器
4. 设置传输格式:ULCONn寄存器(UART LINE CONTROL)
5. 设置UART工作模式:UCONn寄存器(UART CONTROL)
6. UFCONn寄存器(UART FIFO CONTROL)、UFSTATn寄存器(UART FIFO STATUS)
3、使用Tiny4412 Debug 串口uart0代码设置
diff --git a/arch/arm/dts/exynos4412-tiny4412.dts b/arch/arm/dts/exynos4412-tiny4412.dts index 8822d52..a467250 100644 --- a/arch/arm/dts/exynos4412-tiny4412.dts +++ b/arch/arm/dts/exynos4412-tiny4412.dts @@ -14,73 +14,16 @@ model = "Tiny4412 based on Exynos4412"; compatible = "samsung,tiny4412", "samsung,exynos4412";
- aliases { - i2c0 = "/i2c@13860000"; - i2c1 = "/i2c@13870000"; - i2c2 = "/i2c@13880000"; - i2c3 = "/i2c@13890000"; - i2c4 = "/i2c@138a0000"; - i2c5 = "/i2c@138b0000"; - i2c6 = "/i2c@138c0000"; - i2c7 = "/i2c@138d0000"; - serial0 = "/serial@13800000"; - console = "/serial@13810000"; - mmc2 = "/sdhci@12530000"; - mmc4 = "/dwmmc@12550000"; + chosen { + stdout-path = "serial0"; };
- i2c@13860000 { - samsung,i2c-sda-delay = <100>; - samsung,i2c-slave-addr = <0x10>; - samsung,i2c-max-bus-freq = <100000>; - status = "okay"; + aliases { + serial0 = "/serial@13800000"; + console = "/serial@13800000"; };
- serial@13810000 { + serial0:serial@13810000 { status = "okay"; }; - - sdhci@12510000 { - status = "disabled"; - }; - - sdhci@12520000 { - status = "disabled"; - }; - - sdhci@12530000 { - samsung,bus-width = <4>; - samsung,timing = <1 2 3>; - cd-gpios = <&gpk2 2 0>; - }; - - sdhci@12540000 { - status = "disabled"; - }; - - dwmmc@12550000 { - samsung,bus-width = <8>; - samsung,timing = <2 1 0>; - samsung,removable = <0>; - fifoth_val = <0x203f0040>; - bus_hz = <400000000>; - div = <0x3>; - index = <4>; - }; - - ehci@12580000 { - compatible = "samsung,exynos-ehci"; - reg = <0x12580000 0x100>; - #address-cells = <1>; - #size-cells = <1>; - phy { - compatible = "samsung,exynos-usb-phy"; - reg = <0x125B0000 0x100>; - }; - }; - - emmc-reset { - compatible = "samsung,emmc-reset"; - reset-gpio = <&gpk1 2 0>; - }; }; diff --git a/arch/arm/mach-exynos/lowlevel_init.c b/arch/arm/mach-exynos/lowlevel_init.c index 1e090fd..361727d 100644 --- a/arch/arm/mach-exynos/lowlevel_init.c +++ b/arch/arm/mach-exynos/lowlevel_init.c @@ -215,11 +215,17 @@ int do_lowlevel_init(void)
if (actions & DO_CLOCKS) { system_clock_init(); + #ifdef CONFIG_DEBUG_UART #if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_SERIAL_SUPPORT)) || \ !defined(CONFIG_SPL_BUILD) + #ifdef TINY4412 + exynos_pinmux_config(PERIPH_ID_UART0, PINMUX_FLAG_NONE); + #else exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE); + #endif debug_uart_init(); + printascii("UART DEBUG enable .... !!!\n\r"); #endif #endif mem_ctrl_init(actions & DO_MEM_RESET); diff --git a/configs/tiny4412_defconfig b/configs/tiny4412_defconfig index 93917b9..19d0dda 100644 --- a/configs/tiny4412_defconfig +++ b/configs/tiny4412_defconfig @@ -24,6 +24,16 @@ CONFIG_CMD_FS_GENERIC=y CONFIG_OF_CONTROL=y
# +#DEBUG UART +# +CONFIG_DEBUG_UART=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_DEBUG_UART_S5P=y +CONFIG_DEBUG_UART_BASE=0x13800000 +CONFIG_DEBUG_UART_CLOCK=100000000 + +# #NOTE:do not delete this: # # CONFIG_CMD_IMLS is not set |
编译下载代码到SD卡,从SD卡启动后,tiny4412开发板的com0串口上会输出如下调试字符串:
UART DEBUG enable .... !!!
后面移植调试u-boot SPL部分的代码时候,可以通过串口打印log的方式进行,比之前的点亮LED灯调试可以获取到更多信息。
参考
1、《Exynos 4412 SCP_Users Manual_Ver.0.10.00_Preliminary.pdf》
2、《嵌入式Linux系统开发完全手册_基于4412_上册.pdf》
3、uboot_tiny4412-20130729
4、Tiny4412裸机程序之UART收发数据 http://www.techbulo.com/1555.html
X-006 FriendlyARM tiny4412 u-boot移植之Debug串口用起来