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

2024-02-19

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

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

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

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

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

  • Linux命令通过硬件流量控制将二进制文件发送到串口?在堆栈溢出 https://stackoverflow.com/questions/21067874/linux-command-to-send-binary-file-to-serial-port-with-hw-flow-control
  • 串行终端上的二进制数据堆栈溢出 https://stackoverflow.com/questions/506805/binary-data-over-serial-terminal
  • 使用串行控制台传输文件k.japko.eu http://k.japko.eu/serial-transfers.html
  • 通过串行线路进行文件传输超级用户网站 https://superuser.com/questions/278483/file-transfer-over-a-serial-line
  • 当您只有串行控制台时,如何将文件传输到主机?在堆栈交换 https://unix.stackexchange.com/questions/312/how-to-get-file-to-a-host-when-all-you-have-is-a-serial-console

主要是因为 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 >

可用的 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

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

流程应该是这样的:

  1. run loady in uboot enter image description here
  2. use teraterm send data enter image description here
  3. 该文件将传输到位于 0x01000000 的设备内存中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

  • Linux环境下串口数据转换为TCP/IP

    我需要从Linux系统的串口获取数据并将其转换为TCP IP发送到服务器 这很难做到吗 我有一些基本的编程经验 但对 Linux 的经验不多 有没有开源应用程序可以做到这一点 在 Linux 中您不需要编写程序来执行此操作 只是pipe h
  • qt 读取就绪信号

    我正在尝试与运行 1996 年处理器的设备建立串行连接 这意味着数据传输回我可能需要几秒钟的时间 我知道readyRead每次有新数据可用时都会生成信号 但我的问题是生成多长时间 这也是我可以测试就绪读取是否较低的一种方法 因为如果当它们不
  • 如何创建二进制补丁?

    为二进制文件制作补丁的最佳方法是什么 我希望用户能够简单地应用 一个简单的patch应用程序会很好 在文件上运行 diff 只是给出Binary files differ 查看bsdiff and bspatch website http
  • 为什么字符串中的反斜杠(\)在控制台中给出错误

    我有一个像这样的字符串 C projects cisco iwan staging enc enterprise network controller ui plugins iwan 当我粘贴到console然后按回车键 它给出以下错误 U
  • mysql CLI 工具是否提供了一种以控制台友好的方式显示二进制数据的方法?

    我有一个 MySQL 数据库 其中包含一个带有二进制类型列的表 我希望能够投影该列而不必运行它 例如 HEX 是否mysqlCLI 工具有一个配置选项或其他方式来显示二进制数据的表示形式 而不会输出任意字节供我的控制台以搞笑 烦人的方式解释
  • 计算串行通信的块校验字符 (BCC)

    我通过 NET 的 SerialPort 类通过串行与设备进行通信 并且根据第三方设备规范要求 我需要计算 块检查字符 我被告知的唯一信息是 这是一个异或运算 XOR 并且必须对所有角色执行 那么 如果我有字符串 Bob 001 将如何计算
  • 将二进制文件转换为图像

    我需要找到一种将二进制文件转换为图像的快速方法 二进制文件由 N 个NN 矩阵 我想将 0 与一种颜色关联 将 1 与另一种颜色关联 我需要对超过 1000 个二进制文件执行此操作 如果可能的话 我想避免使用 MatLab 有没有任何工具
  • C# SerialPort BaseStream ReadAsync - CancellationToken 从未取消?

    我尝试以异步方式从串行端口读取数据 请记住操作所花费的时间不得超过指定的时间段 我使用的代码 private async Task
  • C# .NET 串口已连接,但无法读取或写入

    我使用 C 和 NET 4 5 以及 Visual Studio 2012 编译器 IDE 来打开串行端口并与之交互 我的代码旨在连接到 US Digital 的 QSB 正交 USB 转换器 这是我用来打开端口并连接的代码 this Po
  • 反转二进制网络

    如何反转二元方程 以便找到哪些输入将产生给定的输出 Example Inputs i0 through i8 Outputs o0 through o8 Operators XOR AND 二元方程 1 i0 1 i1 0 i2 1 i3
  • 新的 .NET 6 控制台模板中的 C# 函数重载不起作用

    我在尝试重载该函数时遇到错误Print object in the 新的 NET 6 C 控制台应用程序模板 https learn microsoft com en us dotnet core tutorials top level t
  • 禁用显示控制台窗口

    我可以在哪里禁用 Microsoft Visual C 显示控制台窗口 在您的控制台应用程序中 转到 Properties gt Linker gt System change SubSystem to Windows 并在你的代码中 代替
  • Linux、ARM:为什么仅当启动时存在 I2C GPIO 扩展器时才创建 gpiochip

    在 imx6sx 硬件平台 NXP 嵌入式 ARM 上使用 Linux 3 14 52 问题是设备树中指定的 PCF8575 I2C GPIO 扩展器不会实例化为 sys class gpio 结构中的设备 除非它们在内核启动期间存在 这些
  • Qt Creator:在终端中运行

    我想获得在 Qt Creator 中运行程序的完整控制台功能 与此处描述的问题相同 使用 Qt Creator 进行控制台输入 https stackoverflow com questions 1356328 console input
  • 如何在Android studio中调用.so库上的方法

    编辑 请参阅我的第一个答案 我想在我的项目中使用 android 串口 api 我这样做有很多麻烦 关于如何配置旧版本的 gradle 或如何使用 NDK 进行编译 存在大量相互冲突的信息 而这两者都没有用 我完全迷失了 我发现唯一可能正确
  • 从 56 位二进制字符串创建 DES 密钥

    我有一个 56 位二进制字符串 我想将其用作 DES 加密的密钥 我在JCA文档网站上找到了以下代码 byte desKeyData byte 0x01 byte 0x02 byte 0x03 byte 0x04 byte 0x05 byt
  • 如何修复“iptables:没有该名称的链/目标/匹配”?

    我在我的 Linux 嵌入式系统上构建并安装了 iptables 如果我列出所有规则 则一切正常 iptables list Chain INPUT policy ACCEPT target prot opt source destinat
  • 判断串口是普通COM还是SPP

    我正在寻找一种方法来确定 COM 是标准 COM 还是 SPP COM 也称为 COM 设备的电缆替换蓝牙适配器 我有一个可以在 USB COM gt USB 和蓝牙下工作的设备 并且蓝牙接口可以与 SPP 一起工作 我目前正在使用Syst
  • 互联网 RFC 数据包图中预期的位(不是字节)顺序是哪个

    我正在我的家庭有线网络上解析 ICMPv6 数据报 但在特定 RFC 中找不到对位排序约定的明确提及 多字节字段是网络顺序的 但是字节内的位又如何呢 机器是按字节寻址的 但网络硬件对位进行序列化 在图表中 8 位字段 左侧 的一位最终位于无
  • GLIBCXX_3.4.26 未找到在 BeagleBone 上运行交叉编译的程序

    我有以下程序 include

随机推荐