u-boot/board/st/stm32mp1/README

192 lines
5.2 KiB
Text
Raw Normal View History

#
# Copyright (C) 2018 STMicroelectronics - All Rights Reserved
#
# SPDX-License-Identifier: GPL-2.0+ BSD-3-Clause
#
U-Boot on STMicroelectronics STM32MP1
======================================
1. Summary
==========
This is a quick instruction for setup stm32mp1 boards.
2. Supported devices
====================
U-Boot supports one STMP32MP1 SoCs: STM32MP157
The STM32MP157 is a Cortex-A MPU aimed at various applications.
It features:
- Dual core Cortex-A7 application core
- 2D/3D image composition with GPU
- Standard memories interface support
- Standard connectivity, widely inherited from the STM32 MCU family
- Comprehensive security support
Everything is supported in Linux but U-Boot is limited to:
1. UART
2. SDCard/MMC controller (SDMMC)
And the necessary drivers
1. I2C
2. STPMU1
3. Clock, Reset
Currently the following boards are supported:
+ stm32mp157c-ed1
3. Boot Sequences
=================
BootRom => FSBL in SYSRAM => SSBL in DDR => OS (Linux Kernel)
with FSBL = First Stage Bootloader
SSBL = Second Stage Bootloader
One boot configuration is supported:
The "Basic" boot chain (defconfig_file : stm32mp15_basic_defconfig)
BootRom => FSBL = U-Boot SPL => SSBL = U-Boot
SPL has limited security initialisation
U-Boot is running in secure mode and provide a secure monitor to the kernel
with only PSCI support (Power State Coordination Interface defined by ARM)
All the STM32MP1 board supported by U-Boot use the same generic board
stm32mp1 which support all the bootable devices.
Each board is configurated only with the associated device tree.
4. Device Tree Selection
========================
You need to select the appropriate device tree for your board,
the supported device trees for stm32mp157 are:
+ ed1: daughter board with pmic stpmu1
dts: stm32mp157c-ed1
5. Build Procedure
==================
1. Install required tools for U-Boot
+ install package needed in U-Boot makefile
(libssl-dev, swig, libpython-dev...)
+ install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
from SDK for STM32MP1, or any crosstoolchains from your distribution)
2. Set the cross compiler:
# export CROSS_COMPILE=/path/to/toolchain/arm-linux-gnueabi-
(you can use any gcc cross compiler compatible with U-Boot)
3. Select the output directory (optional)
# export KBUILD_OUTPUT=/path/to/output
for example: use one output directory for each configuration
# export KBUILD_OUTPUT=stm32mp15_basic
4. Configure the U-Boot:
# make <defconfig_file>
- For basic boot mode: "stm32mp15_basic_defconfig"
5. Configure the device-tree and build the U-Boot image:
# make DEVICE_TREE=<name> all
example:
basic boot on ed1
# export KBUILD_OUTPUT=stm32mp15_basic
# make stm32mp15_basic_defconfig
# make DEVICE_TREE=stm32mp157c-ed1 all
6. Output files
BootRom and ATF expect binaries with STM32 image header
SPL expects file with U-Boot uImage header
So in the output directory (selected by KBUILD_OUTPUT),
you can found the needed files:
+ FSBL = spl/u-boot-spl.stm32
+ SSBL = u-boot.img
6. Prepare an SDCard
===================
The minimal requirements for STMP32MP1 boot up to U-Boot are:
- GPT partitioning (with gdisk or with sgdisk)
- 2 fsbl partitions, named fsbl1 and fsbl2, size at least 256KiB
- one ssbl partition for U-Boot
Then the minimal GPT partition is:
----- ------- --------- -------------
| Num | Name | Size | Content |
----- ------- -------- --------------
| 1 | fsbl1 | 256 KiB | ATF or SPL |
| 2 | fsbl2 | 256 KiB | ATF or SPL |
| 3 | ssbl | enought | U-Boot |
| * | - | - | Boot/Rootfs|
----- ------- --------- -------------
(*) add bootable partition for extlinux.conf
following Generic Distribution
(doc/README.distro for use)
according the used card reader select the block device
(/dev/sdx or /dev/mmcblk0)
in the next example I use /dev/mmcblk0
for example: with gpt table with 128 entries
a) remove previous formatting
# sgdisk -o /dev/<SDCard dev>
b) create minimal image
# sgdisk --resize-table=128 -a 1 \
-n 1:34:545 -c 1:fsbl1 \
-n 2:546:1057 -c 2:fsbl2 \
-n 3:1058:5153 -c 3:ssbl \
-p /dev/<SDCard dev>
you can add other partition for kernel (rootfs)
c) copy the FSBL (2 times) and SSBL file on the correct partition.
in this example in partition 1 to 3
for basic boot mode : <SDCard dev> = /dev/mmcblk0
# dd if=u-boot-spl.stm32 of=/dev/mmcblk0p1
# dd if=u-boot-spl.stm32 of=/dev/mmcblk0p2
# dd if=u-boot.img of=/dev/mmcblk0p3
7. Switch Setting
==================
You can select the boot mode, on the board ed1 with the switch SW1
-----------------------------------
Boot Mode BOOT2 BOOT1 BOOT0
-----------------------------------
Reserved 0 0 0
NOR 0 0 1
SD-Card 1 1 1
SD-Card 1 0 1
eMMC 0 1 0
NAND 0 1 1
Recovery 1 1 0
Recovery 0 0 0
To boot from SDCard, select BootPinMode = 1 1 1 and reset.
Recovery is a boot from serial link (UART/USB) and it is used with
STM32CubeProgrammer tool to load executable in RAM and to update the flash
devices available on the board (NOR/NAND/eMMC/SDCARD).
The communication between HOST and board is based on
- for UARTs : the uart protocol used with all MCU STM32
- for USB : based on USB DFU 1.1 (without the ST extensions used on MCU STM32)