Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ |
| 2 | |
Frieder Schrempf | ba30cc2 | 2022-08-24 15:59:19 +0200 | [diff] [blame] | 3 | Kontron Electronics i.MX8MM SoMs and Boards |
| 4 | =========================================== |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 5 | |
Frieder Schrempf | ba30cc2 | 2022-08-24 15:59:19 +0200 | [diff] [blame] | 6 | The SL i.MX8MM and OSM-S i.MX8MM by Kontron Electronics GmbH are SoM modules |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 7 | with an i.MX8M-Mini SoC, 1/2/4 GB LPDDR4 RAM, SPI NOR, eMMC and PMIC. |
| 8 | |
Frieder Schrempf | ba30cc2 | 2022-08-24 15:59:19 +0200 | [diff] [blame] | 9 | The matching evaluation boards (Board-Line, BL) have two Ethernet ports, |
| 10 | USB 2.0, HDMI/LVDS, SD card, CAN, RS485, RS232 and much more. |
| 11 | |
Frieder Schrempf | 0f3cd9e | 2023-01-19 12:20:34 +0100 | [diff] [blame] | 12 | The OSM-S i.MX8MM is compliant to the Open Standard Module (OSM) 1.1 |
Frieder Schrempf | ba30cc2 | 2022-08-24 15:59:19 +0200 | [diff] [blame] | 13 | specification, size S (https://sget.org/standards/osm). |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 14 | |
| 15 | Quick Start |
| 16 | ----------- |
| 17 | |
| 18 | - Get and Build the Trusted Firmware-A (TF-A) |
| 19 | - Get the DDR firmware |
| 20 | - Build U-Boot |
| 21 | - Boot |
| 22 | |
Frieder Schrempf | 4a30efa | 2023-01-19 12:20:35 +0100 | [diff] [blame] | 23 | .. note:: |
| 24 | |
| 25 | To build on a x86-64 host machine, you need a GNU cross toolchain for the |
| 26 | target architecture (aarch64). Check your distros package manager or |
| 27 | download and install the necessary tools (``aarch64-linux-gnu-*``) manually. |
| 28 | |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 29 | Get and Build the Trusted Firmware-A (TF-A) |
| 30 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 32 | There are two sources for the TF-A. Mainline and NXP. Get the one you prefer |
| 33 | (support and features might differ). |
| 34 | |
Frieder Schrempf | a93985d | 2023-01-19 12:20:36 +0100 | [diff] [blame] | 35 | .. note:: |
| 36 | |
| 37 | If you are using GCC 12 and you get compiler/linker errors, try to add the |
| 38 | following arguments to your make command as workaround: |
| 39 | ``CFLAGS="-Wno-array-bounds" LDFLAGS="--no-warn-rwx-segments"`` |
| 40 | |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 41 | **NXP's imx-atf** |
| 42 | |
Frieder Schrempf | db869a2 | 2023-02-08 17:20:33 +0100 | [diff] [blame] | 43 | 1. Get TF-A from: https://github.com/nxp-imx/imx-atf, branch: lf_v2.6 |
Frieder Schrempf | a93985d | 2023-01-19 12:20:36 +0100 | [diff] [blame] | 44 | 2. Build |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 45 | |
| 46 | .. code-block:: bash |
| 47 | |
Frieder Schrempf | a93985d | 2023-01-19 12:20:36 +0100 | [diff] [blame] | 48 | $ make PLAT=imx8mm CROSS_COMPILE=aarch64-linux-gnu- IMX_BOOT_UART_BASE="0x30880000" bl31 |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 49 | $ cp build/imx8mm/release/bl31.bin $(builddir) |
| 50 | |
Frieder Schrempf | a93985d | 2023-01-19 12:20:36 +0100 | [diff] [blame] | 51 | .. note:: |
| 52 | |
| 53 | *builddir* is U-Boot's build directory (source directory for in-tree builds) |
| 54 | |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 55 | **Mainline TF-A** |
| 56 | |
| 57 | 1. Get TF-A from: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/, tag: v2.4 |
| 58 | 2. Build |
| 59 | |
| 60 | .. code-block:: bash |
| 61 | |
| 62 | $ make PLAT=imx8mm CROSS_COMPILE=aarch64-linux-gnu- IMX_BOOT_UART_BASE="0x30880000" bl31 |
| 63 | $ cp build/imx8mm/release/bl31.bin $(builddir) |
| 64 | |
| 65 | Get the DDR firmware |
| 66 | ^^^^^^^^^^^^^^^^^^^^ |
| 67 | |
| 68 | .. code-block:: bash |
| 69 | |
Frieder Schrempf | 5800fb8 | 2023-01-19 12:20:37 +0100 | [diff] [blame] | 70 | $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.18.bin |
| 71 | $ chmod +x firmware-imx-8.18.bin |
| 72 | $ ./firmware-imx-8.18.bin |
| 73 | $ cp firmware-imx-8.18/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem.bin $(builddir) |
| 74 | $ cp firmware-imx-8.18/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem.bin $(builddir) |
| 75 | $ cp firmware-imx-8.18/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem.bin $(builddir) |
| 76 | $ cp firmware-imx-8.18/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem.bin $(builddir) |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 77 | |
| 78 | Build U-Boot |
| 79 | ^^^^^^^^^^^^ |
| 80 | |
| 81 | .. code-block:: bash |
| 82 | |
| 83 | $ make kontron-sl-mx8mm_defconfig |
Frieder Schrempf | 1402f1d | 2023-01-19 12:20:39 +0100 | [diff] [blame] | 84 | $ make CROSS_COMPILE=aarch64-linux-gnu- |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 85 | |
Frieder Schrempf | 1402f1d | 2023-01-19 12:20:39 +0100 | [diff] [blame] | 86 | Copy the flash.bin to SD card at an offset of 33 KiB: |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 87 | |
| 88 | .. code-block:: bash |
| 89 | |
| 90 | $ dd if=flash.bin of=/dev/sd[x] bs=1K seek=33 conv=notrunc |
| 91 | |
| 92 | Boot |
| 93 | ^^^^ |
| 94 | |
Frieder Schrempf | 888ff2e | 2023-01-19 12:20:38 +0100 | [diff] [blame] | 95 | Put the SD card in the slot on the board and apply power. Check the serial |
| 96 | console for output. |
| 97 | |
| 98 | Flash the Bootloader to SPI NOR |
| 99 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 100 | |
| 101 | 1. Determine and note the exact size of the ``flash.bin`` image in bytes (e.g. |
| 102 | by running ``ls -l flash.bin``) |
| 103 | |
| 104 | 2. On the U-Boot CLI copy the bootloader from SD card to RAM: |
| 105 | |
| 106 | .. code-block:: |
| 107 | |
| 108 | mmc dev 1 |
| 109 | mmc read $loadaddr 0x42 0x1000 |
| 110 | |
| 111 | 3. Erase the SPI NOR flash: |
| 112 | |
| 113 | .. code-block:: |
| 114 | |
| 115 | sf probe |
| 116 | sf erase 0x0 0x200000 |
| 117 | |
| 118 | 4. Copy the bootloader from RAM to SPI NOR. For the last parameter of the |
| 119 | command, use the size determined in step 1 in **hexadecimal notation**: |
| 120 | |
| 121 | .. code-block:: |
| 122 | |
| 123 | sf write $loadaddr 0x400 0x13B6F0 |
| 124 | |
| 125 | .. note:: |
| 126 | |
| 127 | To be able to boot from SPI NOR the OTP fuses need to be set accordingly. |
Frieder Schrempf | 9cab87f | 2021-09-29 16:42:42 +0200 | [diff] [blame] | 128 | |
| 129 | Further Information |
| 130 | ------------------- |
| 131 | |
| 132 | The bootloader configuration is setup to be used with kernel FIT images. Legacy |
| 133 | images might not be working out of the box. |
| 134 | |
| 135 | Please see https://docs.kontron-electronics.de for further vendor documentation. |