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