买了芒果派的f1c200s板子,烧录nano的uboot无LOG输出,最终发现串口终端使用的是uart1,而nano的源码是使用的uart0。
找了很多资料,参考:https://whycan.com/t_1624.html修改u-boot源码uart1为终端输出,并打包成patch分享给大家使用。
补丁包:f1c100s-uboot串口1终端补丁包.zip
详细的修改步骤之前记录在CSDN了:全志F1C100S/F1C200S学习笔记(3)——主线uboot更改默认终端串口为uart1
补丁使用:
1、u-boot-uart1.patch 放在u-boot 同级目录
2、进入u-boot目录
3、执行patch -p1 < ../u-boot-uart1.patch
离线
贴出修改内容:
1、 u-boot/arch/arm/dts/suniv-f1c100s-licheepi-nano.dts 17行:
/ {
model = "Lichee Pi Nano";
compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s",
"allwinner,suniv";
aliases {
serial0 = &uart0;
serial1 = &uart1;
spi0 = &spi0;
};
chosen {
stdout-path = "serial1:115200n8";
};
};
...
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins_a>;
status = "okay";
};
离线
2、 u-boot/arch/arm/dts/suniv.dtsi 124行:
pio: pinctrl@1c20800 {
compatible = "allwinner,suniv-pinctrl";
reg = <0x01c20800 0x400>;
interrupts = <38>, <39>, <40>;
clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
clock-names = "apb", "hosc", "losc";
gpio-controller;
interrupt-controller;
#interrupt-cells = <3>;
#gpio-cells = <3>;
spi0_pins_a: spi0-pins-pc {
pins = "PC0", "PC1", "PC2", "PC3";
function = "spi0";
};
uart0_pins_a: uart-pins-pe {
pins = "PE0", "PE1";
function = "uart0";
};
uart1_pins_a: uart-pins-pa {
pins = "PA2", "PA3";
function = "uart1";
};
};
离线
3、 /u-boot/arch/arm/include/asm/arch-sunxi/gpio.h 146行:
#define SUNXI_GPA_EMAC 2
#define SUNIV_GPA_UART1 5
4、 u-boot/include/configs/suniv.h 17行:
#include <configs/sunxi-common.h>
#undef CONFIG_CONS_INDEX
#define CONFIG_CONS_INDEX 2 //UART1
#endif /* __CONFIG_H */
5、 u-boot/arch/arm/mach-sunxi/board.c 86行:
#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUNIV)
sunxi_gpio_set_cfgpin(SUNXI_GPE(0), SUNIV_GPE_UART0);
sunxi_gpio_set_cfgpin(SUNXI_GPE(1), SUNIV_GPE_UART0);
sunxi_gpio_set_pull(SUNXI_GPE(1), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUNIV)
sunxi_gpio_set_cfgpin(SUNXI_GPA(2), SUNIV_GPA_UART1);
sunxi_gpio_set_cfgpin(SUNXI_GPA(3), SUNIV_GPA_UART1);
sunxi_gpio_set_pull(SUNXI_GPA(3), SUNXI_GPIO_PULL_UP);
离线