[PATCH] stm32mp: add binman support for STM32MP15x

Patrick DELAUNAY patrick.delaunay at foss.st.com
Tue Oct 12 17:12:01 CEST 2021


Hi,

On 10/8/21 9:34 AM, Patrick Delaunay wrote:
> Use binman to add the stm32image header on SPL binary for basic boot
> or on U-Boot binary when it is required, i.e. for TF-A boot without FIP
> support, when CONFIG_STM32MP15x_STM32IMAGE is activated.
>
> The "binman" tool is the recommended tool for specific image generation.
> This patch allows to suppress the config.mk file and it is a preliminary
> step to manage FIT generation with binman.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
>
>   arch/arm/dts/stm32mp15-u-boot.dtsi | 29 +++++++++++++++++++++++++++++
>   arch/arm/mach-stm32mp/Kconfig      |  1 +
>   arch/arm/mach-stm32mp/config.mk    | 29 -----------------------------
>   3 files changed, 30 insertions(+), 29 deletions(-)
>   delete mode 100644 arch/arm/mach-stm32mp/config.mk
>
> diff --git a/arch/arm/dts/stm32mp15-u-boot.dtsi b/arch/arm/dts/stm32mp15-u-boot.dtsi
> index 43a7909978..db23d80eef 100644
> --- a/arch/arm/dts/stm32mp15-u-boot.dtsi
> +++ b/arch/arm/dts/stm32mp15-u-boot.dtsi
> @@ -21,6 +21,10 @@
>   		pinctrl1 = &pinctrl_z;
>   	};
>   
> +	binman: binman {
> +		multiple-images;
> +	};
> +
>   	clocks {
>   		u-boot,dm-pre-reloc;
>   	};
> @@ -228,3 +232,28 @@
>   	resets = <&rcc UART8_R>;
>   };
>   
> +#if defined(CONFIG_STM32MP15x_STM32IMAGE)
> +&binman {
> +	u-boot-stm32 {
> +		filename = "u-boot.stm32";
> +		mkimage {
> +			args = "-T stm32image -a 0xC0100000 -e 0xC0100000";
> +			u-boot {
> +			};
> +		};
> +	};
> +};
> +#endif
> +
> +#if defined(CONFIG_SPL)
> +&binman {
> +	spl-stm32 {
> +		filename = "u-boot-spl.stm32";
> +		mkimage {
> +			args = "-T stm32image -a 0x2FFC2500 -e 0x2FFC2500";
> +			u-boot-spl {
> +			};
> +		};
> +	};
> +};
> +#endif
> diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
> index 69d56c23e1..4acb29333c 100644
> --- a/arch/arm/mach-stm32mp/Kconfig
> +++ b/arch/arm/mach-stm32mp/Kconfig
> @@ -37,6 +37,7 @@ config STM32MP15x
>   	bool "Support STMicroelectronics STM32MP15x Soc"
>   	select ARCH_SUPPORT_PSCI if !TFABOOT
>   	select ARM_SMCCC if TFABOOT
> +	select BINMAN
>   	select CPU_V7A
>   	select CPU_V7_HAS_NONSEC if !TFABOOT
>   	select CPU_V7_HAS_VIRT
> diff --git a/arch/arm/mach-stm32mp/config.mk b/arch/arm/mach-stm32mp/config.mk
> deleted file mode 100644
> index f7f5b77c41..0000000000
> --- a/arch/arm/mach-stm32mp/config.mk
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
> -#
> -# Copyright (C) 2018, STMicroelectronics - All Rights Reserved
> -#
> -
> -ifndef CONFIG_SPL
> -INPUTS-$(CONFIG_STM32MP15x_STM32IMAGE) += u-boot.stm32
> -else
> -ifdef CONFIG_SPL_BUILD
> -INPUTS-y += u-boot-spl.stm32
> -endif
> -endif
> -
> -MKIMAGEFLAGS_u-boot.stm32 = -T stm32image -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
> -
> -u-boot.stm32: MKIMAGEOUTPUT = u-boot.stm32.log
> -
> -u-boot.stm32: u-boot.bin FORCE
> -	$(call if_changed,mkimage)
> -
> -MKIMAGEFLAGS_u-boot-spl.stm32 = -T stm32image -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE)
> -
> -spl/u-boot-spl.stm32: MKIMAGEOUTPUT = spl/u-boot-spl.stm32.log
> -
> -spl/u-boot-spl.stm32: spl/u-boot-spl.bin FORCE
> -	$(call if_changed,mkimage)
> -
> -u-boot-spl.stm32 : spl/u-boot-spl.stm32
> -	$(call if_changed,copy)


The binary are correctly managed for basic boot or trusted boot (TFABOOT 
with STM32IMAGE support)


but the TF-A boot with FIP failed with the error:


NOTICE:  CPU: STM32MP157CAC Rev.B
NOTICE:  Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
NOTICE:  Board: MB1272 Var2.0 Rev.C-01
NOTICE:  BL2: v2.5(release):v2.5-614-g40358fc54
NOTICE:  BL2: Built : 14:54:35, Oct 12 2021
NOTICE:  BL2: Booting BL32
I/TC: Early console on UART#4
I/TC:
I/TC: Pager is enabled. Hashes: 2176 bytes
I/TC: Pager pool size: 96kB
I/TC: Non-secure external DT found
I/TC: Embedded DTB found
I/TC: OP-TEE version: 3.15.0-rc1-1-g96c7b633b (gcc version 9.3.0 (GCC)) 
#1 Tue Oct 12 14:56:25 UTC 2021 arm
I/TC: Primary CPU initializing
I/TC: Platform stm32mp1: flavor PLATFORM_FLAVOR - DT stm32mp157c-dk2.dts
I/TC: RCC is non-secure
I/TC: DTB enables console (non-secure)
I/TC: Primary CPU switching to normal world boot


U-Boot 2021.10-00609-gbd6c2d38d1 (Oct 12 2021 - 16:59:42 +0200)

CPU: STM32MP157CAC Rev.B
Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
Board: stm32mp1 in trusted mode (st,stm32mp157c-dk2)
Board: MB1272 Var2.0 Rev.C-01
DRAM:  512 MiB
Clocks:
- MPU : 650 MHz
- MCU : 208.878 MHz
- AXI : 266.500 MHz
- PER : 24 MHz
- DDR : 533 MHz
binman_init failed:-2
initcall sequence ddce91b8 failed at call c011a825 (err=-2)
### ERROR ### Please RESET the board ###


=> after analysis, the CONFIG_BINMAN_FDT should be deactivated

       as STM32MP15x U-Boot have no reason to parse the binman node

      (no binary to select or to load) = the binman library can be 
deactivated


I will add in V2

# CONFIG_BINMAN_FDT is not set

in all stm32mp15_*_defconfig



Regards

Patrick




More information about the U-Boot mailing list