[PATCH] Kconfig: Set STACK_SIZE to 16KB for STM32 MCUs

Patrice CHOTARD patrice.chotard at foss.st.com
Wed Dec 18 11:28:07 CET 2024



On 12/18/24 10:59, Patrick DELAUNAY wrote:
> Hi
> 
> On 12/18/24 08:58, Patrice Chotard wrote:
>> Since commit 6534d26ee9a5 ("lmb: do away with arch_lmb_reserve()"),
>> STM32F746-disco hangs when loading device tree just before starting
>> kernel:
>>
>> Retrieving file: /stm32f746-disco.dtb
>> Kernel image @ 0xc0008000 [ 0x000000 - 0x19ae00 ]
>> Flattened Device Tree blob at c0408000
>>     Booting using the fdt blob at 0xc0408000
>> Working FDT set to c0408000
>>     Loading Device Tree to c05f8000, end c05ff71c ...
>>
>> Adjust STACK_SIZE to 16KB for STM32 MCUs (F4/F7 and H7) boards
>> to fix kernel boot process as some of these boards embeds a limited
>> amount of memory.
>>
>> Fixes: 6534d26ee9a5 ("lmb: do away with arch_lmb_reserve()")
> 
> 
> I think it is also linked to an other commit
> 
> Fixes:74b869bae74c ("efi_loader: use CONFIG_STACK_SIZE in the UEFI sub-system")
> 
> before the patch CONFIG_SET_STACK_SIZE was not defined for ALL ARM platform
> 
> So CONFIG_STACK_SIZE was not defined  / and was no used in platform
> 
> (U-Boot stack up to end of the U-Boot area)
> 
> after the patch the CONFIG_STACK_SIZEis set a 16MB for all platform, even if EFI is not used
> 
> 
> +config STACK_SIZE
> +    hex "Define max stack size that can be used by U-Boot"
> 
> +    default 0x4000000 if ARCH_VERSAL || ARCH_ZYNQMP
> +    default 0x200000 if MICROBLAZE
> +    default 0x1000000
> 
> 
> 16MB is needed ONLY for EFI loader cases, for other platform that seems huge.
> 
> 
> @Heinrich: do you think you can add this condition CONFIG_EFI_LOADER to avoid issue for other platforms =
> 
> So use 16MB (previously hardcoded in lib/efi_loader/efi_memory.c with add_u_boot_and_runtime() )
> 
>     default 0x1000000 if EFI_LOADER
> 
> 
> and so force the other platforms to define the CONFIG_STACK_SIZE (now used in LMB) with an adequate value ?
> 
> 
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard at foss.st.com>
>> ---
>>
>>   Kconfig | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/Kconfig b/Kconfig
>> index 1f5b0f1972d..c087a420a24 100644
>> --- a/Kconfig
>> +++ b/Kconfig
>> @@ -578,6 +578,7 @@ config STACK_SIZE
>>       hex "Define max stack size that can be used by U-Boot"
>>       default 0x4000000 if ARCH_VERSAL_NET || ARCH_VERSAL || ARCH_ZYNQMP
>>       default 0x200000 if MICROBLAZE
>> +    default 0x4000 if ARCH_STM32
>>       default 0x1000000
>>       help
>>         Define Max stack size that can be used by U-Boot. This value is used
> 
> 
> Anyway for this STM32 MCU patch:
> 
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> 
> Thanks
> Patrick
> 
Applied to u-boot-stm32/next

Thanks
Patrice


More information about the U-Boot mailing list