loads command


loads [offset [baud]]


The loads command is used to transfer a file to the device via the serial line using the Motorola S-record file format.


offset added to the addresses in the S-record file


baud rate to use for download. This parameter is only available if CONFIG_SYS_LOADS_BAUD_CHANGE=y


As example file to be transferred we use a script printing ‘hello s-record’. Here are the commands to create the S-record file:

$ echo 'echo hello s-record' > script.txt
$ mkimage -T script -d script.txt script.scr
Image Name:
Created:      Sun Jun 25 10:35:02 2023
Image Type:   PowerPC Linux Script (gzip compressed)
Data Size:    28 Bytes = 0.03 KiB = 0.00 MiB
Load Address: 00000000
Entry Point:  00000000
   Image 0: 20 Bytes = 0.02 KiB = 0.00 MiB
$ srec_cat script.scr -binary -CRLF -Output script.srec
$ echo -e "S9030000FC\r" >> script.srec
$ cat script.srec

The load address in the first S1 record is 0x0000.

The terminal emulation program picocom is invoked with cat as the send command to transfer the file.

picocom --send-cmd 'cat' --baud 115200 /dev/ttyUSB0

After entering the loads command the key sequence <CTRL-A><CTRL-S> is used to let picocom prompt for the file name. Picocom invokes the program cat for the file transfer. The loaded script is executed using the source command.

=> loads $scriptaddr
## Ready for S-Record download ...

*** file: script.srec
$ cat script.srec

*** exit status: 0 ***

## First Load Addr = 0x4FC00000
## Last  Load Addr = 0x4FC0005B
## Total Size      = 0x0000005C = 92 Bytes
## Start Addr      = 0x00000000
=> source $scriptaddr
## Executing script at 4fc00000
hello s-record


The command is only available if CONFIG_CMD_LOADS=y. The parameter to set the baud rate is only available if CONFIG_SYS_LOADS_BAUD_CHANGE=y

Return value

The return value $? is 0 (true) on success, 1 (false) otherwise.