串口0作为调试端口,怎么改变为接收数据接口

我们在使用嵌入式linux调试板子时候必须要有调试接口,一般是串口0.

我就以我使用的S3C2416的板子为例:

启动u-boot打印如下:

SMDK2416 # printenv
bootcmd=nand read c0008000 900000 300000;bootm c0008000
bootdelay=3
baudrate=115200
ethaddr=00:40:5c:26:0a:5b
gatewayip=192.168.1.1
netmask=255.255.255.0
bootargs=root=/dev/mtdblock3 rootfstype=yaffs2 init=/init console=ttySAC0,115200
gatemask=192.168.0.1
serverip=192.168.1.100
ipaddr=192.168.1.242
stdin=serial
stdout=serial
stderr=serial

Environment size: 341/16380 bytes

这句“bootargs=root=/dev/mtdblock3 rootfstype=yaffs2 init=/init console=ttySAC0,115200”就是指定为串口0,波特率为115200的系统打印信息。

然后我们需要修改

 打入命令:setenv bootargs ‘root=/dev/mtdblock3 rootfstype=yaffs2 init=/init console=’
这样在系统启动后串口就不会有任何的打印数据输出,此时系统的串口就可以留作它用。
setenv bootargs  ‘root=/dev/mtdblock3 rootfstype=yaffs2 init=/init console=ttySAC0,115200’
这个就是设置串口0作为打印口。
原文地址:https://www.cnblogs.com/hcu5555/p/3672935.html