跳转到主要内容

通过REPL与MicroPython板通信和传输文件

项目描述

文档: https://mpy-repl-tool.readthedocs.io/en/latest

通过Python REPL(读取评估打印循环)传输文件。该工具开发用于从MicroPython板上传输文件。

这又是另一个工具,现在有几个类似工具,但并非所有都拥有相同的功能。

此工具的关键特性

  • detect 串行端口和MicroPython板。

  • run 运行临时脚本。

  • pull 从目标文件系统获取文件和目录。

  • push 在目标文件系统上上传文件和目录。

  • mount 将目标作为文件系统(FUSE)挂载。

  • --interactive 模式(终端)。

  • 设置RTC

  • 通过串行REPL连接到MicroPython板,以上所有功能,还有更多。

用法

以下是 python3 -m there --help 的输出

usage: __main__.py [-h] [-p PORT] [-b BAUDRATE] [--set-rtc]
                  [--reset-on-connect] [-c COMMAND] [-i] [--reset] [-u USER]
                  [-w PASSWORD] [-v] [--develop] [--timeit]
                  ACTION ...

Do stuff via the MicroPython REPL

optional arguments:
  -h, --help            show this help message and exit

port settings:
  -p PORT, --port PORT  set the serial port
  -b BAUDRATE, --baudrate BAUDRATE
                        set the baud rate

operations before running action:
  --set-rtc             set the RTC to "now" before command is executed
  --reset-on-connect    do a soft reset as first operation (main.py will not
                        be executed)

operations after running action:
  -c COMMAND, --command COMMAND
                        execute given code on target
  --command-timeout T   timeout in seconds for --command
  -i, --interactive     drop to interactive shell at the end
  --reset               do a soft reset on the end

login:
  -u USER, --user USER  response to login prompt
  -w PASSWORD, --password PASSWORD
                        response to password prompt

diagnostics:
  -v, --verbose         show diagnostic messages, repeat for more
  --develop             show tracebacks on errors (development of this tool)
  --timeit              measure command run time

subcommands:
  use "__main__.py ACTION --help" for more on each sub-command

  ACTION                sub-command help
    detect              help locating a board
    run                 execute file contents on target
    ls                  list files
    hash                hash files
    cat                 print contents of one file
    pull                file(s) to copy from target
    push                file(s) to copy onto target
    rm                  remove files from target
    df                  Show filesystem information
    mount               Make target files accessible via FUSE
    rtc                 Read the real time clock (RTC)

使用 -c 选项在运行所有动作后执行给定的字符串。使用 -i 选项在所有其他动作完成后进入miniterm会话。

工具会自动选择一个USB端口进行通信,如果连接了多个USB串行设备,可能会选择错误的端口。在这种情况下,请使用there detect列出所有设备,然后使用-p PORT指定其他调用中要使用的端口。

使用python3 -m there <action> --help来获取子命令的帮助信息。

需求

此工具需要Python 3。

它依赖于pySerial进行通信,并且挂载功能需要fusepy。这些依赖项在使用pip时自动安装,请参阅文档中的安装说明。

项目详情


下载文件

下载适用于您的平台文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源代码分发

mpy-repl-tool-0.14.tar.gz (37.9 kB 查看哈希)

上传时间

构建分发

mpy_repl_tool-0.14-py3-none-any.whl (29.1 kB 查看哈希)

上传时间 Python 3

支持者