sdp.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. -------------
  2. SDP in U-Boot
  3. -------------
  4. SDP stands for serial download protocol. It is the protocol used in NXP's
  5. i.MX SoCs ROM Serial Downloader and provides means to download a program
  6. image to the chip over USB and UART serial connection.
  7. The implementation in U-Boot uses the USB Downloader Gadget (g_dnl) to
  8. provide a SDP implementation over USB. This allows to download program
  9. images to the target in SPL/U-Boot using the same protocol/tooling the
  10. SoC's recovery mechanism is using.
  11. The SDP protocol over USB is a USB HID class protocol. USB HID class
  12. protocols allow to access a USB device without OS specific drivers. The
  13. U-Boot implementation has primarly been tested using the open source
  14. imx_loader utility (https://github.com/boundarydevices/imx_usb_loader).
  15. imx_usb_loader is a very nice tool by Boundary Devices that allow to
  16. install U-Boot without a JTAG debugger, using the USB boot mode as
  17. described in the manual. It is a replacement for Freescale's
  18. MFGTOOLS.
  19. The host side utilities are typically capable to interpret the i.MX
  20. specific image header (see doc/imx/mkimage/imximage.txt). There are extensions
  21. for imx_loader's imx_usb utility which allow to interpret the U-Boot
  22. specific legacy image format (see mkimage(1)). Also the U-Boot side
  23. support beside the i.MX specific header the U-Boot legacy header.
  24. 1. Using imx_usb_loader for first install with SPL
  25. --------------------------------------------------
  26. This implementation can be started in U-Boot using the sdp command
  27. (CONFIG_CMD_USB_SDP) or in SPL if Serial Downloader boot mode has been
  28. detected (CONFIG_SPL_USB_SDP_SUPPORT).
  29. A typical use case is downloading full U-Boot after SPL has been
  30. downloaded through the boot ROM's Serial Downloader. Using boot mode
  31. detection the SPL will run the SDP implementation automatically in
  32. this case:
  33. # imx_usb SPL
  34. Targets Serial Console:
  35. Trying to boot from USB SDP
  36. SDP: initialize...
  37. SDP: handle requests...
  38. At this point the SPL reenumerated as a new HID device and emulating
  39. the boot ROM's SDP protocol. The USB VID/PID will depend on standard
  40. U-Boot configurations CONFIG_G_DNL_(VENDOR|PRODUCT)_NUM. Make sure
  41. imx_usb is aware of the USB VID/PID for your device by adding a
  42. configuration entry in imx_usb.conf:
  43. 0x1b67:0x4fff, mx6_usb_sdp_spl.conf
  44. And the device specific configuration file mx6_usb_sdp_spl.conf:
  45. mx6_spl_sdp
  46. hid,uboot_header,1024,0x910000,0x10000000,1G,0x00900000,0x40000
  47. This allows to download the regular U-Boot with legacy image headers
  48. (u-boot.img) using a second invocation of imx_usb:
  49. # imx_usb u-boot.img
  50. Furthermore, when U-Boot is running the sdp command can be used to
  51. download and run scripts:
  52. # imx_usb script.scr
  53. imx_usb configuration files can be also used to download multiple
  54. files and of arbitrary types, e.g.
  55. mx6_usb_sdp_uboot
  56. hid,1024,0x10000000,1G,0x00907000,0x31000
  57. full.itb:load 0x12100000
  58. boot.scr:load 0x12000000,jump 0x12000000
  59. There is also a batch mode which allows imx_usb to handle multiple
  60. consecutive reenumerations by adding multiple VID/PID specifications
  61. in imx_usb.conf:
  62. 0x15a2:0x0061, mx6_usb_rom.conf, 0x1b67:0x4fff, mx6_usb_sdp_spl.conf
  63. In this mode the file to download (imx_usb job) needs to be specified
  64. in the configuration files.
  65. mx6_usb_rom.conf:
  66. mx6_qsb
  67. hid,1024,0x910000,0x10000000,1G,0x00900000,0x40000
  68. SPL:jump header2
  69. mx6_usb_sdp_spl.conf:
  70. mx6_spl_sdp
  71. hid,uboot_header,1024,0x10000000,1G,0x00907000,0x31000
  72. u-boot.img:jump header2
  73. With that SPL and U-Boot can be downloaded with a single invocation
  74. of imx_usb without arguments:
  75. # imx_usb
  76. 2. Using imx_usb_loader non-SPL images
  77. ---------------------------------------
  78. Booting in USB mode, the i.MX6 announces itself to the Linux Host as:
  79. Bus 001 Device 111: ID 15a2:0061 Freescale Semiconductor, Inc.
  80. imx_usb_loader is able to download a single file (u-boot.imx)
  81. to the board. For boards without SPL support, it is enough to
  82. issue the command:
  83. sudo ../imx_usb_loader/imx_usb -v u-boot.imx