From 22ec5399ecaa84d0dc75ec6caf78ac5ee45d85df Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Tue, 22 Sep 2026 20:14:30 +0100 Subject: [PATCH] tf-m: Implement os_wrapper_is_kernel_started Implement the TF-M kernel-started hook (new in TF-M 2.3.0) using xTaskGetSchedulerState(). Treat a suspended scheduler as started, since the kernel has already been initialised. Guard the hook with the same configuration condition as xTaskGetSchedulerState() so configurations without that API continue to build. Signed-off-by: Wilfried Chauveau --- .../ThirdParty/GCC/ARM_TFM/os_wrapper_freertos.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/portable/ThirdParty/GCC/ARM_TFM/os_wrapper_freertos.c b/portable/ThirdParty/GCC/ARM_TFM/os_wrapper_freertos.c index 35add2b5a..554f49dd7 100644 --- a/portable/ThirdParty/GCC/ARM_TFM/os_wrapper_freertos.c +++ b/portable/ThirdParty/GCC/ARM_TFM/os_wrapper_freertos.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, Arm Limited. All rights reserved. + * Copyright 2019-2024,2026 Arm Limited and/or its affiliates * * SPDX-License-Identifier: MIT * @@ -28,9 +28,12 @@ * The implementation is based on FreeRTOS mutex type semaphore. */ +#include + #include "os_wrapper/mutex.h" #include "FreeRTOS.h" +#include "task.h" #include "semphr.h" #include "mpu_wrappers.h" @@ -43,6 +46,13 @@ StaticSemaphore_t xSecureMutexBuffer; #endif +#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) + bool os_wrapper_is_kernel_started( void ) + { + return xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED; + } +#endif + void * os_wrapper_mutex_create( void ) { SemaphoreHandle_t xMutexHandle = NULL;