如何仅使用串行控制台将二进制闪存文件发送到嵌入式系统?

use*_*470 3 binary console serial-port file-transfer embedded-linux

我有一个使用 ramdisk 启动的嵌入式 Linux 系统,因此它运行时没有可用的持久存储(它有闪存来存储内核和 ramdisk)。

唯一的连接是 RS-232 串行登录控制台。所以我受到其内置 busybox 提供的功能的限制。我想检索 ramdisk,修改它,然后重写 ramdisk。内核没有内置 Flash 文件系统支持。ramdisk 分区大小约为 10 MB。当用户目录下的所有文件都被删除后,可用的ramdisk大小约为14 MBytes。

命令 dd 可用,因此我可以将 ramdisk 分区复制到 ramdisk,并可以从 ramdisk 文件写入闪存。flashcp 也可用。

所以我现在的问题是如何通过RS-232串行控制台接收和发送二进制文件?

我研究了以下内容,但没有一个对我有用:

主要是因为 x/y/zmodem 在 busybox 中不可用。

任何想法?谢谢!

根据要求,这是我应该首先包含的内容。

可用的 u-boot 命令:

U-Boot >?
?       - alias for 'help'
askenv  - get environment variables from stdin
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootm   - boot application image from memory
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
crc32_chk_uimage- checksum calculation of an image for u-boot
echo    - echo args to console
editenv - edit environment variable
env     - environment handling commands
exit    - exit script
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fatwrite- write file into a dos filesystem
go      - start application at address 'addr'
gpio    - input/set/clear/toggle gpio pins
help    - print command description/usage
i2c     - I2C sub-system
iminfo  - print header information for application image
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
md      - memory display
mdc     - memory display cyclic
mm      - memory modify (auto-incrementing address)
mw      - memory write (fill)
mwc     - memory write cyclic
nm      - memory modify (constant address)
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
saves   - save S-Record file over serial line
setenv  - set environment variables
sf      - SPI flash sub-system
showvar - print local hushshell variables
sleep   - delay execution for some time
source  - run script from memory
sspi    - SPI utility command
test    - minimal test like /bin/sh
true    - do nothing, successfully
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
U-Boot >
Run Code Online (Sandbox Code Playgroud)

可用的 busybox 命令:

BusyBox v1.13.2 (2015-03-16 10:50:56 EDT) multi-call binary
Copyright (C) 1998-2008 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as!

Currently defined functions:
        [, [[, addgroup, adduser, ar, ash, awk, basename, blkid,
        bunzip2, bzcat, cat, chattr, chgrp, chmod, chown, chpasswd,
        chroot, chvt, clear, cmp, cp, cpio, cryptpw, cut, date,
        dc, dd, deallocvt, delgroup, deluser, df, dhcprelay, diff,
        dirname, dmesg, du, dumpkmap, dumpleases, echo, egrep, env,
        expr, false, fbset, fbsplash, fdisk, fgrep, find, free,
        freeramdisk, fsck, fsck.minix, fuser, getopt, getty, grep,
        gunzip, gzip, halt, head, hexdump, hostname, httpd, hwclock,
        id, ifconfig, ifdown, ifup, inetd, init, insmod, ip, kill,
        killall, klogd, last, less, linuxrc, ln, loadfont, loadkmap,
        logger, login, logname, logread, losetup, ls, lsmod, makedevs,
        md5sum, mdev, microcom, mkdir, mkfifo, mkfs.minix, mknod,
        mkswap, mktemp, modprobe, more, mount, mv, nc, netstat,
        nice, nohup, nslookup, od, openvt, passwd, patch, pidof,
        ping, ping6, pivot_root, poweroff, printf, ps, pwd, rdate,
        rdev, readahead, readlink, readprofile, realpath, reboot,
        renice, reset, rm, rmdir, rmmod, route, rtcwake, run-parts,
        sed, seq, setconsole, setfont, sh, showkey, sleep, sort,
        start-stop-daemon, strings, stty, su, sulogin, swapoff,
        swapon, switch_root, sync, sysctl, syslogd, tail, tar, tcpsvd,
        tee, telnet, telnetd, test, tftp, tftpd, time, top, touch,
        tr, traceroute, true, tty, udhcpc, udhcpd, udpsvd, umount,
        uname, uniq, unzip, uptime, usleep, vconfig, vi, vlock,
        watch, wc, wget, which, who, whoami, xargs, yes, zcat
Run Code Online (Sandbox Code Playgroud)

Ezi*_*zio 6

在uboot中,您可以loady/loadx通过uart从PC获取文件。我通常使用teraterm发送文件。

流程应该是这样的:

  1. loady在uboot中 运行在此输入图像描述
  2. 使用teraterm发送数据 在此输入图像描述
  3. 该文件将传输到位于 0x01000000 的设备内存中。