nuttx-apps/system/ymodem
anjiahao 55b0d4a110 ymodem:support sbrb.py use serial to transport
Get help to use ./sbrb.py -h
./sbrb.py -h
usage: sbrb.py [-h] [-k KBLOCKSIZE] [-t TTY] [-b BAUDRATE] [-r [RECVFROM ...]] [-s SENDTO] [--debug DEBUG] [filelist ...]

positional arguments:
  filelist              if filelist is valid, that is sb, else is rb

options:
  -h, --help            show this help message and exit
  -k KBLOCKSIZE, --kblocksize KBLOCKSIZE
                        This opthin can set a customsize block size to transfer
  -t TTY, --tty TTY     Serial path
  -b BAUDRATE, --baudrate BAUDRATE
  -r [RECVFROM ...], --recvfrom [RECVFROM ...]
                        recvfile from board path like this: ./sbrb.py -r <file1 [file2 [file 3]...]> -t /dev/ttyUBS0
  -s SENDTO, --sendto SENDTO
                        send file to board path like this: ./sbrb.py -s <path on board> -t /dev/ttyUBS0 <file1 [file2 [file3] ...]>
  --debug DEBUG         This opthin is save debug log on host

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-30 01:20:36 -07:00
..
Kconfig support ymodem send/recve can asynchronous 2023-04-29 21:23:55 +08:00
Make.defs apps/system/ymodem/Make.defs: fix nxstyle 2023-03-24 15:04:43 -03:00
Makefile apps/system/ymodem/Makefile: fix nxstyle 2023-03-24 15:04:43 -03:00
rb_main.c support ymodem transfer on a custom blocksize 2023-04-29 21:23:55 +08:00
README.md support ymodem transfer on a custom blocksize 2023-04-29 21:23:55 +08:00
sb_main.c support ymodem transfer on a custom blocksize 2023-04-29 21:23:55 +08:00
sbrb.py ymodem:support sbrb.py use serial to transport 2023-07-30 01:20:36 -07:00
ymodem.c ymodem:fix ymodem bug 2023-07-30 01:20:36 -07:00
ymodem.h support ymodem transfer on a custom blocksize 2023-04-29 21:23:55 +08:00

Introduce

This is ymodem protocal. According to it, the sb rb application is realized, which is used to send files and receive files respectively

Usage

Common Usage

In the ubuntu system, lszrz needs to be installed, can use sudo apt install lszrz. Use minicom to communicate with the board.

Advanced Usage

In order to achieve a faster transmission speed, I added a specific HEADER STC to the YMODEM protocol to represent the custom length. Using the sb and rb commands on the board, you can use the -k option to set the length of the custom packet, and the unit is KB. Therefore, you need to use sbrb.py for file transfer, and you need sbrb.py -k to set the same length as the board. According to my test, when using -k 32, it can reach 93% of the baud rate, and is fully compatible with the original ymodem protocol. First, you need to add a soft link to sbrb.py, for example sudo ln -s /home/<name>/.../<nuttxwork>/apps/system/ymodem/sbrb.py /usr/bin and then sbrb.py can be configured into minicom.<Ctrl + a> z o then chose File transfer protocols and crate two option cmd is 'sbrb.py -k 32'. like this

Name Program Name U/D FullScr IO-Red. Multi
ymodem-k sbrb.py -k 32 Y U N Y Y
ymodem-k sbrb.py -k 32 N D N Y Y

usb sb -k 32 or rb -k 32 for file transfer on board.

Sendfile to pc

use sb command like this nsh> sb /tmp/test.c ..., this command support send multiple files together then use <Ctrl + a> , r chose ymodem to receive board file.

Sendfile to board

use rb cmd like this nsh> rb, this command support receive multiple files together then use <Ctrl + a> , s chose ymodem, then chose what file need to send.

help

can use sb -h or rb -h get help.

Debug

Because the serial port is used for communication, the log is printed to the debug file you can use CONFIG_SYSTEM_YMODEM_DEBUGFILE_PATH set debug file path.