README.dfutftp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. Device Firmware Upgrade (DFU) - extension to use TFTP
  2. =====================================================
  3. Why?
  4. ----
  5. * Update TFTP (CONFIG_UPDATE_TFTP) only supports writing
  6. code to NAND memory via TFTP.
  7. * DFU supports writing data to the variety of mediums (NAND,
  8. eMMC, SD, partitions, RAM, etc) via USB.
  9. Combination of both solves their shortcomings!
  10. Overview
  11. --------
  12. This document briefly describes how to use DFU for
  13. upgrading firmware (e.g. kernel, u-boot, rootfs, etc.)
  14. via TFTP protocol.
  15. By using Ethernet (TFTP protocol to be precise) it is
  16. possible to overcome the major problem of USB based DFU -
  17. the relatively low transfer speed for large files.
  18. This was caused by DFU standard, which imposed utilization
  19. of only EP0 for transfer. By using Ethernet we can circumvent
  20. this shortcoming.
  21. Beagle Bone Black rev. C (BBB) powered by TI's am335x CPU has
  22. been used as a demo board.
  23. To utilize this feature, one needs to first enable support
  24. for USB based DFU (CONFIG_DFU_*) and DFU TFTP update
  25. (CONFIG_DFU_TFTP) described in ./doc/README.update.
  26. The "dfu" command has been extended to support transfer via TFTP - one
  27. needs to type for example "dfu tftp 0 mmc 0"
  28. This feature does not depend on "fitupd" command enabled.
  29. As of this writing (SHA1:8d77576371381ade83de475bb639949b44941e8c v2015.10-rc2)
  30. the update.c code is not enabled (CONFIG_UPDATE_TFTP) by any board in the
  31. contemporary u-boot tree.
  32. Environment variables
  33. ---------------------
  34. The "dfu tftp" command can be used in the "preboot" environment variable
  35. (when it is enabled by defining CONFIG_PREBOOT).
  36. This is the preferable way of using this command in the early boot stage
  37. as opposed to legacy update_tftp() function invocation.
  38. Beagle Bone Black (BBB) setup
  39. -----------------------------
  40. 1. Setup tftp env variables:
  41. * select desired eth device - 'ethact' variable ["ethact=cpsw"]
  42. (use "bdinfo" to check current setting)
  43. * setup "serverip" and "ipaddr" variables
  44. * set "loadaddr" as a fixed buffer where incoming data is placed
  45. ["loadaddr=0x81000000"]
  46. #########
  47. # BONUS #
  48. #########
  49. It is possible to use USB interface to emulate ETH connection by setting
  50. "ethact=usb_ether". In this way one can have very fast DFU transfer via USB.
  51. For 33MiB test image the transfer rate was 1MiB/s for ETH over USB and 200KiB/s
  52. for pure DFU USB transfer.
  53. 2. Setup update_tftp variables:
  54. * set "updatefile" - the file name to be downloaded via TFTP (stored on
  55. the HOST at e.g. /srv/tftp)
  56. 3. If required, to update firmware on boot, put the "dfu tftp 0 mmc 0" in the
  57. "preboot" env variable. Otherwise use this command from u-boot prompt.
  58. 4. Inspect "dfu" specific variables:
  59. * "dfu_alt_info" - information about available DFU entities
  60. * "dfu_bufsiz" - variable to set buffer size [in bytes] - when it is not
  61. possible to set large enough default buffer (8 MiB @ BBB)
  62. FIT image format for download
  63. -----------------------------
  64. To create FIT image for download one should follow the update tftp README file
  65. (./doc/README.update) with one notable difference:
  66. The original snippet of ./doc/uImage.FIT/update_uboot.its
  67. images {
  68. update@1 {
  69. description = "U-Boot binary";
  70. should look like
  71. images {
  72. u-boot.bin@1 {
  73. description = "U-Boot binary";
  74. where "u-boot.bin" is the DFU entity name to be stored.
  75. To do
  76. -----
  77. * Extend dfu-util command to support TFTP based transfers
  78. * Upload support (via TFTP)