刚毕业那会抽奖抽了一块RTT的D1S开发板,看了一下打印log就放下吃灰了。跑RT-thread的感觉折腾起来太麻烦了就让他吃灰了。最近手头有一块屏幕和一个2欧的小喇叭打算驱动一下。 正好这块板子也出来好多年了。玩一玩。首先我找到了百问网的哪吒开发板他也是D1S的,直接把他的SDK给搞下来编译,根据开发板的配置正好是个贴片的SD卡,正好有SD卡的配置
直接选6,可以正常烧录,但是烧录后boot完,不进行下一步的打印。我怀疑烧录的地方不对,找了一大圈之后发现机器是能正常启动的。因为ADB这些东西都是正常化的可以执行一些相关的操作。经过一下午的折腾现在终于是可以正常的打印启动的相关log了,现在记录一下操作过程。网上也有相关帖子。主要是参考他们的,在此过程中对全志的SDK进一步的熟悉了。
首先是修改debug的调试串口,这个关乎到生成的镜像文件 /home/shy/d1s/tina-d1-h/device/config/chips/d1s/configs/nezha_sd/sys_config.fex
[uart_para]
uart_debug_port = 3
uart_debug_tx = port:PG8<5><1><default><default>
uart_debug_rx = port:PG9<5><1><default><default>
调试产口改到串口3.
改uboot中相关内容
/home/shy/d1s/tina-d1-h/lichee/brandy-2.0/u-boot-2018/configs/sun20iw1p1_defconfig
添加
CONFIG_SPECIFY_CONSOLE_INDEX=y
CONFIG_CONS_INDEX=4 #说明:这里是UART3+1 = 4 串口号+1
修改/home/shy/d1s/tina-d1-h/device/config/chips/d1s/configs/nezha_sd/uboot-board.dts
&card0_boot_para { /* Avoid dtc compiling warnings. @TODO: Developer should modify this to the actual value /
/ reg = <0x0 0x2 0x0 0x0>; [> Avoid dtc compiling warnings. @TODO: Developer should modify this to the actual value <] */
device_type = "card0_boot_para";
card_ctrl = <0x0>;
card_high_speed = <0x1>;
card_line = <0x4>;
pinctrl-0 = <&sdc0_pins_a>; //取消这段代码的注释
};
接下来是修改启动介质这个修改后就支持线刷了
/home/shy/d1s/tina-d1-h/lichee/brandy-2.0/u-boot-2018/drivers/sunxi_flash/mmc/sdmmc.c
int sunxi_sprite_mmc_probe(void)
{
#ifndef CONFIG_MACH_SUN50IW11return sdmmc_init_for_sprite(0, 0); //02 这里是从sd卡进行启动
#elseint workmode = uboot_spare_head.boot_data.work_mode;if (workmode == WORK_MODE_CARD_PRODUCT)return -1;elsereturn sdmmc_init_for_sprite(0, 0);
#endif
}
接下来是修改kernel
/home/shy/d1s/tina-d1-h/lichee/linux-5.4/arch/riscv/boot/dts/sunxi/sun20iw1p1.dtsi
chosen {bootargs = "console=ttyS3,115200n8 debug loglevel=7,initcall_debug=1 init=/init earlycon=sbi";stdout-path = "serial0:115200n8";linux,initrd-start = <0x42000000>;linux,initrd-end = <0x43000000>;};uart3: uart@2500c00 {compatible = "allwinner,sun20i-uart";device_type = "uart3";reg = <0x0 0x02500c00 0x0 0x400>;interrupts-extended = <&plic0 21 IRQ_TYPE_LEVEL_HIGH>;sunxi,uart-fifosize = <256>;clocks = <&ccu CLK_BUS_UART3>;clock-names = "uart3";resets = <&ccu RST_BUS_UART3>;uart3_port = <3>;uart3_type = <4>;status = "okay";};
/home/shy/d1s/tina-d1-h/device/config/chips/d1s/configs/nezha_sd/board.dts
&uart3 {pinctrl-names = "default", "sleep";pinctrl-0 = <&uart3_pins_a>;pinctrl-1 = <&uart3_pins_b>;status = "okay";
};uart3_pins_a: uart3_pins@0 { /* For EVB1 board */// pins = "PB6", "PB7";pins = "PG8", "PG9";function = "uart3";muxsel = <7>;drive-strength = <10>;bias-pull-up;};uart3_pins_b: uart3_pins@1 { /* For EVB1 board */// pins = "PB6", "PB7";pins = "PG8", "PG9";function = "gpio_in";};
期间参考了 https://blog.csdn.net/qq_39838924/article/details/136534361
https://www.cnblogs.com/yddeboke/p/17191230.html