colibri_imx7.rst 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. .. SPDX-License-Identifier: GPL-2.0-or-later
  2. .. sectionauthor:: Igor Opaniuk <igor.opaniuk@toradex.com>
  3. Colibri iMX7 Modules
  4. ====================
  5. - SoM: https://www.toradex.com/computer-on-modules/colibri-arm-family/nxp-freescale-imx7
  6. - Carrier board: https://www.toradex.com/products/carrier-board/colibri-evaluation-board
  7. Quick Start
  8. -----------
  9. - Build U-Boot
  10. - NAND IMX image adjustments before flashing
  11. - Flashing manually U-Boot to eMMC
  12. - Flashing manually U-Boot to NAND
  13. - Using ``update_uboot`` script
  14. Build U-Boot
  15. ------------
  16. .. code-block:: bash
  17. $ export CROSS_COMPILE=arm-linux-gnueabi-
  18. $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig
  19. $ make
  20. After the build succeeds, you will obtain the final ``u-boot-dtb.imx`` IMX
  21. specific image, ready for flashing (but check next section for additional
  22. adjustments).
  23. The final IMX program image includes (section ``6.6.7`` from `IMX7DRM
  24. <https://www.nxp.com/webapp/Download?colCode=IMX7DRM>`_):
  25. * **Image vector table** (IVT) for BootROM
  26. * **Boot data** -indicates the program image location, program image size
  27. in bytes, and the plugin flag.
  28. * **Device configuration data**
  29. * **User image**: U-Boot image (``u-boot-dtb.bin``)
  30. IMX image adjustments prior to flashing
  31. ---------------------------------------
  32. 1. U-Boot for both Colibri iMX7 NAND and eMMC versions
  33. is built with HABv4 support (`AN4581.pdf
  34. <https://www.nxp.com/docs/en/application-note/AN4581.pdf>`_)
  35. enabled by default, which requires generating a proper
  36. Command Sequence File (CSF) by srktool from NXP (not included in the
  37. U-Boot tree, check additional details in introduction_habv4.txt)
  38. and concatenate it to the final ``u-boot-dtb.imx``.
  39. 2. In case you don't want to generate a proper ``CSF`` (for any reason),
  40. you still need to pad the IMX image so it has the same size as specified in
  41. the **Boot Data** section of the IMX image.
  42. To obtain this value, run:
  43. .. code-block:: bash
  44. $ od -X -N 0x30 u-boot-dtb.imx
  45. 0000000 402000d1 87800000 00000000 877ff42c
  46. 0000020 877ff420 877ff400 878a5000 00000000
  47. ^^^^^^^^
  48. 0000040 877ff000 000a8060 00000000 40b401d2
  49. ^^^^^^^^ ^^^^^^^^
  50. Where:
  51. * ``877ff400`` - IVT self address
  52. * ``877ff000`` - Program image address
  53. * ``000a8060`` - Program image size
  54. To calculate the padding:
  55. * IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400``
  56. * Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60``
  57. and then pad the image:
  58. .. code-block:: bash
  59. $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \
  60. u-boot-dtb.imx u-boot-dtb.imx.zero-padded
  61. 3. Also, according to the requirement from ``6.6.7.1``, the final image
  62. should have ``0x400`` offset for the initial IVT table.
  63. For eMMC setup we handle this by flashing it to ``0x400``, however
  64. for NAND setup we adjust the image prior to flashing, adding padding at the
  65. beginning of the image.
  66. .. code-block:: bash
  67. $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1
  68. Flash U-Boot IMX image to eMMC
  69. ------------------------------
  70. Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware
  71. boot area partition:
  72. .. code-block:: bash
  73. => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded
  74. => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200
  75. => mmc dev 0 1
  76. => mmc write ${loadaddr} 0x2 ${blkcnt}
  77. Flash U-Boot IMX image to NAND
  78. ------------------------------
  79. .. code-block:: bash
  80. => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
  81. => nand erase.part u-boot1
  82. => nand write ${loadaddr} u-boot1 ${filesize}
  83. => nand erase.part u-boot2
  84. => nand write ${loadaddr} u-boot2 ${filesize}
  85. Using update_uboot script
  86. -------------------------
  87. You can also use U-Boot env update_uboot script,
  88. which wraps all eMMC/NAND specific command invocations:
  89. .. code-block:: bash
  90. => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready
  91. => run update_uboot