loadx.rst 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .. SPDX-License-Identifier: GPL-2.0+:
  2. loadx command
  3. =============
  4. Synopsis
  5. --------
  6. ::
  7. loadx [addr [baud]]
  8. Description
  9. -----------
  10. The loadx command is used to transfer a file to the device via the serial line
  11. using the XMODEM protocol.
  12. The number of transferred bytes is saved in environment variable filesize.
  13. addr
  14. load address, defaults to environment variable loadaddr or if loadaddr is
  15. not set to configuration variable CONFIG_SYS_LOAD_ADDR
  16. baud
  17. baud rate for the ymodem transmission. After the transmission the baud
  18. rate is reset to the original value.
  19. Example
  20. -------
  21. In the example below the terminal emulation program picocom was used to
  22. transfer a file to the device.
  23. .. code-block::
  24. picocom --send-cmd 'sx -b vv' --baud 115200 /dev/ttyUSB0
  25. After entering the loadx command the key sequence <CTRL-A><CTRL-S> is used to
  26. let picocom prompt for the file name. Picocom invokes the program sx for the
  27. file transfer.
  28. ::
  29. => loadx 60800000 115200
  30. ## Ready for binary (xmodem) download to 0x60800000 at 115200 bps...
  31. C
  32. *** file: helloworld.efi
  33. $ sx -b vv helloworld.efi
  34. sx: cannot open vv: No such file or directory
  35. Sending helloworld.efi, 24 blocks: Give your local XMODEM receive command now.
  36. Xmodem sectors/kbytes sent: 0/ 0kRetry 0: NAK on sector
  37. Bytes Sent: 3072 BPS:1147
  38. Transfer incomplete
  39. *** exit status: 1 ***
  40. ## Total Size = 0x00000c00 = 3072 Bytes
  41. ## Start Addr = 0x60800000
  42. =>
  43. The transfer can be cancelled by pressing 3 times <CTRL+C> after two seconds
  44. of inactivity on terminal.
  45. Configuration
  46. -------------
  47. The command is only available if CONFIG_CMD_LOADB=y.
  48. Initial timeout in seconds while waiting for transfer is configured by
  49. config option CMD_LOADXY_TIMEOUT or by env variable $loadxy_timeout.
  50. Setting it to 0 means infinite timeout.
  51. Return value
  52. ------------
  53. The return value $? is 0 (true) on success, 1 (false) otherwise.