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