Merge "feat(st): add a halt on panic flag" into integration

This commit is contained in:
Boyan Karatotev 2026-05-05 07:56:13 +00:00 committed by TrustedFirmware Code Review
commit df9fc6004e
3 changed files with 28 additions and 2 deletions

View File

@ -57,6 +57,9 @@ else
STM32MP_SUPPORT_PM := 1
endif
# Halt CPU on panic
STM32MP_HALT_ON_PANIC ?= ${DEBUG}
# Number of TF-A copies in the device
STM32_TF_A_COPIES := 2
@ -119,6 +122,7 @@ $(eval $(call assert_booleans,\
PLAT_XLAT_TABLES_DYNAMIC \
STM32MP_EMMC \
STM32MP_EMMC_BOOT \
STM32MP_HALT_ON_PANIC \
STM32MP_RAW_NAND \
STM32MP_RECONFIGURE_CONSOLE \
STM32MP_SDMMC \
@ -141,6 +145,7 @@ $(eval $(call add_defines,\
STM32_TF_VERSION \
STM32MP_EMMC \
STM32MP_EMMC_BOOT \
STM32MP_HALT_ON_PANIC \
STM32MP_RAW_NAND \
STM32MP_RECONFIGURE_CONSOLE \
STM32MP_SDMMC \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2026, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -296,7 +296,8 @@ endfunc plat_crash_console_putc
/* ----------------------------------------------------------
* void plat_panic_handler(void) __dead2;
* Report exception + endless loop.
* Report exception + endless loop if STM32MP_HALT_ON_PANIC is
* set, system reset otherwise.
*
* r6 holds the address where the fault occurred.
* Filling lr with this value allows debuggers to reconstruct
@ -307,8 +308,12 @@ func plat_panic_handler
mrs r0, cpsr
and r0, #MODE32_MASK
bl plat_report_exception
#if STM32MP_HALT_ON_PANIC
mov lr, r6
b .
#else
bl stm32mp_system_reset
#endif
endfunc plat_panic_handler
#if DEBUG

View File

@ -18,6 +18,7 @@
.globl plat_crash_console_init
.globl plat_crash_console_flush
.globl plat_crash_console_putc
.globl plat_panic_handler
.globl plat_report_exception
func platform_mem_init
@ -184,6 +185,21 @@ func plat_crash_console_putc
b console_stm32_core_putc
endfunc plat_crash_console_putc
/* -----------------------------------------------------
* void plat_panic_handler(void) __dead2;
* Endless loop if STM32MP_HALT_ON_PANIC is set, system
* reset otherwise.
* -----------------------------------------------------
*/
func plat_panic_handler
#if STM32MP_HALT_ON_PANIC
wfi
b plat_panic_handler
#else
bl stm32mp_system_reset
#endif
endfunc plat_panic_handler
#ifdef IMAGE_BL2
/* ---------------------------------------------
* void plat_report_exception(unsigned int type)