Patrice Chotard | 458966c | 2022-04-27 13:54:01 +0200 | [diff] [blame] | 1 | .. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause |
| 2 | .. sectionauthor:: Patrice Chotard <patrice.chotardy@foss.st.com> |
| 3 | |
| 4 | STM32 MCU boards |
Heinrich Schuchardt | b72160b | 2023-10-28 11:59:32 +0200 | [diff] [blame] | 5 | ================ |
Patrice Chotard | 458966c | 2022-04-27 13:54:01 +0200 | [diff] [blame] | 6 | |
| 7 | This is a quick instruction for setup STM32 MCU boards. |
| 8 | |
| 9 | Supported devices |
| 10 | ----------------- |
| 11 | |
| 12 | U-Boot supports the following STMP32 MCU SoCs: |
| 13 | |
| 14 | - STM32F429 |
| 15 | - STM32F469 |
| 16 | - STM32F746 |
| 17 | - STM32F769 |
| 18 | - STM32H743 |
| 19 | - STM32H750 |
| 20 | |
| 21 | SoCs information: |
| 22 | ----------------- |
| 23 | STM32F4 series are Cortex-M4 MCU. |
| 24 | STM32F7 and STM32H7 series are Cortex-M7 MCU. |
| 25 | |
| 26 | + STM32F4 series: https://www.st.com/en/microcontrollers-microprocessors/stm32f4-series.html |
| 27 | + STM32F7 series: https://www.st.com/en/microcontrollers-microprocessors/stm32f7-series.html |
| 28 | + STM32H7 series: https://www.st.com/en/microcontrollers-microprocessors/stm32h7-series.html |
| 29 | |
| 30 | Currently the following boards are supported: |
| 31 | |
| 32 | + stm32f429-discovery |
| 33 | + stm32f469-discovery |
| 34 | + stm32746g-evaluation |
| 35 | + stm32f746-discovery |
| 36 | + stm32f769-discovery |
| 37 | + stm32h743i-discovery |
| 38 | + stm32h743i-evaluation |
| 39 | + stm32h750i-art-pi |
| 40 | |
| 41 | Boot Sequences |
| 42 | -------------- |
| 43 | |
| 44 | For STM32F7 series, 2 boot configurations are supported with and without SPL |
| 45 | |
| 46 | +------------------------+-------------------------+--------------+ |
| 47 | | **FSBL** | **SSBL** | **OS** | |
| 48 | +------------------------+-------------------------+--------------+ |
| 49 | | First Stage Bootloader | Second Stage Bootloader | Linux Kernel | |
| 50 | +------------------------+-------------------------+--------------+ |
| 51 | | embedded Flash | DDR | |
| 52 | +------------------------+-------------------------+--------------+ |
| 53 | |
| 54 | The boot chain with SPL |
| 55 | ``````````````````````` |
| 56 | |
| 57 | defconfig_file : |
| 58 | + **stm32746g-eval_spl_defconfig** |
| 59 | + **stm32f746-disco_spl_defconfig** |
| 60 | + **stm32f769-disco_spl_defconfig** |
| 61 | |
| 62 | +------------+------------+-------+ |
| 63 | | FSBL | SSBL | OS | |
| 64 | +------------+------------+-------+ |
| 65 | |U-Boot SPL | U-Boot | Linux | |
| 66 | +------------+------------+-------+ |
| 67 | |
| 68 | The boot chain without SPL |
| 69 | `````````````````````````` |
| 70 | |
| 71 | defconfig_file : |
| 72 | + **stm32f429-discovery_defconfig** |
| 73 | + **stm32f429-evaluation_defconfig** |
| 74 | + **stm32f469-discovery_defconfig** |
| 75 | + **stm32746g-eval_defconfig** |
| 76 | + **stm32f746-disco_defconfig** |
| 77 | + **stm32f769-disco_defconfig** |
| 78 | + **stm32h743-disco_defconfig** |
| 79 | + **stm32h743-eval_defconfig** |
| 80 | + **stm32h750-art-pi_defconfig** |
| 81 | |
| 82 | +-----------+-------+ |
| 83 | | FSBL | OS | |
| 84 | +-----------+-------+ |
| 85 | |U-Boot | Linux | |
| 86 | +-----------+-------+ |
| 87 | |
| 88 | Build Procedure |
| 89 | --------------- |
| 90 | |
| 91 | 1. Install the required tools for U-Boot |
| 92 | |
| 93 | * install package needed in U-Boot makefile |
| 94 | (libssl-dev, swig, libpython-dev...) |
| 95 | |
| 96 | * install ARMv7 toolchain for 32bit Cortex-A (from Linaro, |
| 97 | from SDK for STM32MP15x, or any crosstoolchains from your distribution) |
| 98 | (you can use any gcc cross compiler compatible with U-Boot) |
| 99 | |
| 100 | 2. Set the cross compiler:: |
| 101 | |
| 102 | # export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi- |
| 103 | |
| 104 | 3. Select the output directory (optional):: |
| 105 | |
| 106 | # export KBUILD_OUTPUT=/path/to/output |
| 107 | |
| 108 | for example: use one output directory for each configuration:: |
| 109 | |
| 110 | # export KBUILD_OUTPUT=stm32f4 |
| 111 | # export KBUILD_OUTPUT=stm32f7 |
| 112 | # export KBUILD_OUTPUT=stm32h7 |
| 113 | |
| 114 | you can build outside of code directory:: |
| 115 | |
| 116 | # export KBUILD_OUTPUT=../build/stm32f4 |
| 117 | |
| 118 | 4. Configure U-Boot:: |
| 119 | |
| 120 | # make <defconfig_file> |
| 121 | |
| 122 | For example with <defconfig_file>: |
| 123 | |
| 124 | - For **stm32f429 discovery** board : **stm32f429-discovery_defconfig** |
| 125 | - For **stm32f769 discovery** board with SPL: **stm32f769-disco_spl_defconfig** |
| 126 | - For **stm32f769 discovery** board without SPL: **stm32f769-disco_defconfig** |
| 127 | |
| 128 | 5. Configure the device-tree and build the U-Boot image:: |
| 129 | |
| 130 | # make DEVICE_TREE=<name> all |
| 131 | |
| 132 | Examples: |
| 133 | |
| 134 | a) boot with SPL on stm32f746 discovery board:: |
| 135 | |
| 136 | # export KBUILD_OUTPUT=stm32f746-disco |
| 137 | # make stm32f746-disco_spl_defconfig |
| 138 | # make all |
| 139 | |
| 140 | b) boot without SPL on stm32f746 discovery board:: |
| 141 | |
| 142 | # export KBUILD_OUTPUT=stm32f746-disco |
| 143 | # make stm32f746-disco_defconfig |
| 144 | # make all |
| 145 | |
| 146 | c) boot on stm32h743 discovery board:: |
| 147 | |
| 148 | # export KBUILD_OUTPUT=stm32h743-disco |
| 149 | # make stm32h743-disco_defconfig |
| 150 | # make all |
| 151 | |
| 152 | d) boot on stm32h743 evaluation board:: |
| 153 | |
| 154 | # export KBUILD_OUTPUT=stm32h743-disco |
| 155 | # make stm32h743-eval_defconfig |
| 156 | # make all |
| 157 | |
| 158 | 6. U-Boot Output files |
| 159 | |
| 160 | So in the output directory (selected by KBUILD_OUTPUT), |
| 161 | you can found the needed U-Boot files, for example:: |
| 162 | |
| 163 | - stm32f746-disco_defconfig = **u-boot-dtb.bin** and **u-boot.dtb** |
| 164 | |
| 165 | - FSBL = u-boot-dtb.bin |
| 166 | |
| 167 | - stm32f746-disco_spl_defconfig = **u-boot-dtb.bin**, **u-boot.dtb** and **u-boot-with-spl.bin** |
| 168 | |
| 169 | - FSBL + SSBL = u-boot-with-spl.bin |
| 170 | - SSBL = u-boot-dtb.bin |
| 171 | |
| 172 | 7. Flash U-Boot files |
| 173 | |
| 174 | Plug STM32 MCUs board using the USB ST-Link connector, hence it will expose |
| 175 | the flash area as a mass-storage. In this mass-storage you will find the |
| 176 | following files: |
| 177 | |
| 178 | - DETAILS.TXT: give the bootrom version and build |
| 179 | - MBED.HTM: shortcul to the hardware board description web page from st.com. |
| 180 | |
| 181 | Copy/paste the u-boot.bin or u-boot-with-spl.bin (in case of bootchain with SPL) |
| 182 | to this mass-storage. The "COM" LED will blink alternatively red and green during |
| 183 | the flash process. When done the board will reboot automatically. |
| 184 | |
| 185 | In case of boot with SPL, by default SPL will try to load either a Linux |
| 186 | kernel (falcon mode) or, if the key "c" is maintained pressed, the main U-Boot. |