嵌入式学习笔记之XMODEM

背景

由于在实验环境中使用串口监视和控制,同时实验开发板处在一个密闭的环境中,不能随意插入usb来拷贝设备,这个时候如果想要在电脑和开发板中传输数据存在问题,下面我把自己使用的xmodem的使用方法写到这里,以求共勉

使用方法

由于xmodem是一个比较成熟的应用,不同的平台是大部分可以通用的,所以可以将压缩包拷贝另外的平台使用,如果发现存在问题,在去查找是否因为平台的差异性引起的。这个是后续需要考虑的,今天不做讲解。

命令解释

 xmodem我接触的主要有三个文件,rx,lsz,lrz;如下图:

 1.rx ,接收文件用,即将电脑中的文件发送到嵌入式系统中,一般的使用方法是中断软件上选择xmodem模式发送,如:

 然后弹出一个对话框,让你选择文件(由于使用串口发送,文件不能太大,建议小于1M),选择文件后即发送。一回即可发送完成,同时嵌入式系统中出现如下命令:

 

这个时候就会发现文件已经发送到这里了。

2.lrz 

# lrz --help
lrz version 0.12.20
Usage: lrz [options] [filename.if.xmodem]
Receive files with ZMODEM/YMODEM/XMODEM protocol
    (X) = option applies to XMODEM only
    (Y) = option applies to YMODEM only
    (Z) = option applies to ZMODEM only
  -+, --append                append to existing files
  -a, --ascii                 ASCII transfer (change CR/LF to LF)
  -b, --binary                binary transfer
  -B, --bufsize N             buffer N bytes (N==auto: buffer whole file)
  -c, --with-crc              Use 16 bit CRC (X)
  -C, --allow-remote-commands allow execution of remote commands (Z)
  -D, --null                  write all received data to /dev/null
      --delay-startup N       sleep N seconds before doing anything
  -e, --escape                Escape control characters (Z)
  -E, --rename                rename any files already existing
      --errors N              generate CRC error every N bytes (debugging)
  -h, --help                  Help, print this usage message
  -m, --min-bps N             stop transmission if BPS below N
  -M, --min-bps-time N          for at least N seconds (default: 120)
  -O, --disable-timeouts      disable timeout code, wait forever for data
      --o-sync                open output file(s) in synchronous write mode
  -p, --protect               protect existing files
  -q, --quiet                 quiet, no progress reports
  -r, --resume                try to resume interrupted file transfer (Z)
  -R, --restricted            restricted, more secure mode
  -s, --stop-at {HH:MM|+N}    stop transmission at HH:MM or in N seconds
  -S, --timesync              request remote time (twice: set local time)
      --syslog[=off]          turn syslog on or off, if possible
  -t, --timeout N             set timeout to N tenths of a second
  -u, --keep-uppercase        keep upper case filenames
  -U, --unrestrict            disable restricted mode (if allowed to)
  -v, --verbose               be verbose, provide debugging information
  -w, --windowsize N          Window is N bytes (Z)
  -X  --xmodem                use XMODEM protocol
  -y, --overwrite             Yes, clobber existing file if any
      --ymodem                use YMODEM protocol
  -Z, --zmodem                use ZMODEM protocol

short options use the same arguments as the long ones

最简单的应用就是直接输入 lrz ,然后就会弹出一个对话框,选择你要发送的文件,即可,可以实现和rx一样的效果。

3.lsz  ,这个是将嵌入式中的文件发送到电脑中

选择文件夹后,就会将文件名称传送到电脑上,这对与拷贝嵌入式系统的运行日志非常好用。

就先简单写到这里。

学习笔记,在于一点一滴。。

Guess you like

Origin blog.csdn.net/mainmaster/article/details/121854298