Heinrich Schuchardt | 189a76a | 2023-05-16 07:46:53 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+: |
| 2 | |
| 3 | loadx command |
| 4 | ============= |
| 5 | |
| 6 | Synopsis |
| 7 | -------- |
| 8 | |
| 9 | :: |
| 10 | |
| 11 | loadx [addr [baud]] |
| 12 | |
| 13 | Description |
| 14 | ----------- |
| 15 | |
| 16 | The loadx command is used to transfer a file to the device via the serial line |
| 17 | using the XMODEM protocol. |
| 18 | |
| 19 | The number of transferred bytes is saved in environment variable filesize. |
| 20 | |
| 21 | addr |
| 22 | load address, defaults to environment variable loadaddr or if loadaddr is |
| 23 | not set to configuration variable CONFIG_SYS_LOAD_ADDR |
| 24 | |
| 25 | baud |
| 26 | baud rate for the ymodem transmission. After the transmission the baud |
| 27 | rate is reset to the original value. |
| 28 | |
| 29 | Example |
| 30 | ------- |
| 31 | |
| 32 | In the example below the terminal emulation program picocom was used to |
| 33 | transfer a file to the device. |
| 34 | |
| 35 | .. code-block:: |
| 36 | |
| 37 | picocom --send-cmd 'sx -b vv' --baud 115200 /dev/ttyUSB0 |
| 38 | |
| 39 | After entering the loadx command the key sequence <CTRL-A><CTRL-S> is used to |
| 40 | let picocom prompt for the file name. Picocom invokes the program sx for the |
| 41 | file transfer. |
| 42 | |
| 43 | :: |
| 44 | |
| 45 | => loadx 60800000 115200 |
| 46 | ## Ready for binary (xmodem) download to 0x60800000 at 115200 bps... |
| 47 | C |
| 48 | *** file: helloworld.efi |
| 49 | $ sx -b vv helloworld.efi |
| 50 | sx: cannot open vv: No such file or directory |
| 51 | Sending helloworld.efi, 24 blocks: Give your local XMODEM receive command now. |
| 52 | Xmodem sectors/kbytes sent: 0/ 0kRetry 0: NAK on sector |
| 53 | Bytes Sent: 3072 BPS:1147 |
| 54 | |
| 55 | Transfer incomplete |
| 56 | |
| 57 | *** exit status: 1 *** |
| 58 | ## Total Size = 0x00000c00 = 3072 Bytes |
| 59 | ## Start Addr = 0x60800000 |
| 60 | => |
| 61 | |
| 62 | The transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds |
| 63 | of inactivity on terminal. |
| 64 | |
| 65 | Configuration |
| 66 | ------------- |
| 67 | |
| 68 | The command is only available if CONFIG_CMD_LOADB=y. |
| 69 | |
| 70 | Initial timeout in seconds while waiting for transfer is configured by |
| 71 | config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout. |
| 72 | Setting it to 0 means infinite timeout. |
| 73 | |
| 74 | Return value |
| 75 | ------------ |
| 76 | |
| 77 | The return value $? is 0 (true) on success, 1 (false) otherwise. |