"Das U-Boot" Source Tree
at master 99 lines 2.6 kB view raw
1.. SPDX-License-Identifier: GPL-2.0+: 2 3.. index:: 4 single: loads (command) 5 6loads command 7============= 8 9Synopsis 10-------- 11 12:: 13 14 loads [offset [baud]] 15 16Description 17----------- 18 19The loads command is used to transfer a file to the device via the serial line 20using the Motorola S-record file format. 21 22offset 23 offset added to the addresses in the S-record file 24 25baud 26 baud rate to use for download. This parameter is only available if 27 CONFIG_SYS_LOADS_BAUD_CHANGE=y 28 29Example 30------- 31 32As example file to be transferred we use a script printing 'hello s-record'. 33Here are the commands to create the S-record file: 34 35.. code-block:: bash 36 37 $ echo 'echo hello s-record' > script.txt 38 $ mkimage -T script -d script.txt script.scr 39 Image Name: 40 Created: Sun Jun 25 10:35:02 2023 41 Image Type: PowerPC Linux Script (gzip compressed) 42 Data Size: 28 Bytes = 0.03 KiB = 0.00 MiB 43 Load Address: 00000000 44 Entry Point: 00000000 45 Contents: 46 Image 0: 20 Bytes = 0.02 KiB = 0.00 MiB 47 $ srec_cat script.scr -binary -CRLF -Output script.srec 48 $ echo -e "S9030000FC\r" >> script.srec 49 $ cat script.srec 50 S0220000687474703A2F2F737265636F72642E736F75726365666F7267652E6E65742F1D 51 S1230000270519566D773EB6649815E30000001700000000000000003DE3D97005070601E2 52 S12300200000000000000000000000000000000000000000000000000000000000000000BC 53 S11A00400000000F0000000068656C6C6F20732D7265636F72640A39 54 S5030003F9 55 S9030000FC 56 $ 57 58The load address in the first S1 record is 0x0000. 59 60The terminal emulation program picocom is invoked with *cat* as the send 61command to transfer the file. 62 63.. code-block:: 64 65 picocom --send-cmd 'cat' --baud 115200 /dev/ttyUSB0 66 67After entering the *loads* command the key sequence <CTRL-A><CTRL-S> is used to 68let picocom prompt for the file name. Picocom invokes the program *cat* for the 69file transfer. The loaded script is executed using the *source* command. 70 71.. code-block:: 72 73 => loads $scriptaddr 74 ## Ready for S-Record download ... 75 76 *** file: script.srec 77 $ cat script.srec 78 79 *** exit status: 0 *** 80 81 ## First Load Addr = 0x4FC00000 82 ## Last Load Addr = 0x4FC0005B 83 ## Total Size = 0x0000005C = 92 Bytes 84 ## Start Addr = 0x00000000 85 => source $scriptaddr 86 ## Executing script at 4fc00000 87 hello s-record 88 => 89 90Configuration 91------------- 92 93The command is only available if CONFIG_CMD_LOADS=y. The parameter to set the 94baud rate is only available if CONFIG_SYS_LOADS_BAUD_CHANGE=y 95 96Return value 97------------ 98 99The return value $? is 0 (true) on success, 1 (false) otherwise.