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