blob: facca9b969d4a1bbd0ec85c5acb98461fa6666dc [file] [log] [blame]
Heinrich Schuchardt189a76a2023-05-16 07:46:53 +02001.. SPDX-License-Identifier: GPL-2.0+:
2
3loadx command
4=============
5
6Synopsis
7--------
8
9::
10
11 loadx [addr [baud]]
12
13Description
14-----------
15
16The loadx command is used to transfer a file to the device via the serial line
17using the XMODEM protocol.
18
19The number of transferred bytes is saved in environment variable filesize.
20
21addr
22 load address, defaults to environment variable loadaddr or if loadaddr is
23 not set to configuration variable CONFIG_SYS_LOAD_ADDR
24
25baud
26 baud rate for the ymodem transmission. After the transmission the baud
27 rate is reset to the original value.
28
29Example
30-------
31
32In the example below the terminal emulation program picocom was used to
33transfer a file to the device.
34
35.. code-block::
36
37 picocom --send-cmd 'sx -b vv' --baud 115200 /dev/ttyUSB0
38
39After entering the loadx command the key sequence <CTRL-A><CTRL-S> is used to
40let picocom prompt for the file name. Picocom invokes the program sx for the
41file 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
62The transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds
63of inactivity on terminal.
64
65Configuration
66-------------
67
68The command is only available if CONFIG_CMD_LOADB=y.
69
70Initial timeout in seconds while waiting for transfer is configured by
71config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout.
72Setting it to 0 means infinite timeout.
73
74Return value
75------------
76
77The return value $? is 0 (true) on success, 1 (false) otherwise.