blob: 5823f883790ccace59e1279f3cba22ea8d6050c4 [file] [log] [blame]
Heinrich Schuchardta8cc3832023-06-25 15:14:03 +02001.. SPDX-License-Identifier: GPL-2.0+:
2
3saves command
4=============
5
6Synopsis
7--------
8
9::
10
11 saves [offset [size [baud]]]
12
13Description
14-----------
15
16The *saves* command is used to transfer a file from the device via the serial
17line using the Motorola S-record file format.
18
19offset
20 start address of memory area to save, defaults to 0x0
21
22size
23 size of memory area to save, defaults to 0x0
24
25baud
26 baud rate to use for upload. This parameter is only available if
27 CONFIG_SYS_LOADS_BAUD_CHANGE=y
28
29Example
30-------
31
32In the example the *screen* command is used to connect to the U-Boot serial
33console.
34
35In a first screen session a file is loaded from the SD-card and the *saves*
36command is invoked. <CTRL+A><k> is used to kill the screen session.
37
38A new screen session is started which logs the output to a file and the
39<ENTER> key is hit to start the file output. <CTRL+A><k> is issued to kill the
40screen session.
41
42The log file is converted to a binary file using the *srec_cat* command.
43A negative offset of -1337982976 (= -0x4c000000) is applied to compensate for
44the offset used in the *saves* command.
45
46.. code-block::
47
48 $ screen /dev/ttyUSB0 115200
49 => echo $scriptaddr
50 0x4FC00000
51 => load mmc 0:1 $scriptaddr boot.txt
52 124 bytes read in 1 ms (121.1 KiB/s)
53 => saves $scriptaddr $filesize
54 ## Ready for S-Record upload, press ENTER to proceed ...
55 Really kill this window [y/n]
56 $ screen -Logfile out.srec -L /dev/ttyUSB0 115200
57 S0030000FC
58 S3154FC00000736574656E76206175746F6C6F616420AD
59 S3154FC000106E6F0A646863700A6C6F6164206D6D633E
60 S3154FC0002020303A3120246664745F616464725F72B3
61 S3154FC00030206474620A6C6F6164206D6D6320303AC0
62 S3154FC000403120246B65726E656C5F616464725F72DA
63 S3154FC0005020736E702E6566690A626F6F74656669C6
64 S3154FC0006020246B65726E656C5F616464725F7220CB
65 S3114FC00070246664745F616464725F720A38
66 S70500000000FA
67 ## S-Record upload complete
68 =>
69 Really kill this window [y/n]
70 $ srec_cat out.srec -offset -1337982976 -Output out.txt -binary 2>/dev/null
71 $ cat out.txt
72 setenv autoload no
73 dhcp
74 load mmc 0:1 $fdt_addr_r dtb
75 load mmc 0:1 $kernel_addr_r snp.efi
76 bootefi $kernel_addr_r $fdt_addr_r
77 $
78
79Configuration
80-------------
81
82The command is only available if CONFIG_CMD_SAVES=y. The parameter to set the
83baud rate is only available if CONFIG_SYS_LOADS_BAUD_CHANGE=y
84
85Return value
86------------
87
88The return value $? is 0 (true) on success, 1 (false) otherwise.