From 83aaa6167da1fc23f39a63336cb20108429153b6 Mon Sep 17 00:00:00 2001 From: M Lakshmaiah Date: Sat, 26 Oct 2024 05:57:25 -1200 Subject: [PATCH] sw_services: xiltimer: Add checks for default timer functionality updated the condition to enhance the functionality to ensure the default timer is used when ticktimer is set to None and modified xiltimer.cmake to initialize tick_timer to "None" when there is no interval timer enabled. this change prevents uninitialized variables and ensures that the logic for setting XTIMER_NO_TICK_TIMER is correctly applied, facilitating better handling of timer instances and updated library_utils.py to enable the interval timer automatically for FreeRTOS, ensuring the proper functionality. Signed-off-by: M Lakshmaiah Acked-by: Appana Durga Kedareswara rao --- lib/sw_services/xiltimer/src/core/CMakeLists.txt | 6 ++++-- lib/sw_services/xiltimer/src/xiltimer.cmake | 15 +++++++-------- scripts/pyesw/library_utils.py | 4 ++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/sw_services/xiltimer/src/core/CMakeLists.txt b/lib/sw_services/xiltimer/src/core/CMakeLists.txt index 4935cb7bcf1..bc3350492af 100644 --- a/lib/sw_services/xiltimer/src/core/CMakeLists.txt +++ b/lib/sw_services/xiltimer/src/core/CMakeLists.txt @@ -1,7 +1,9 @@ -# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (C) 2023 - 2024 Advanced Micro Devices, Inc. All rights reserved. # SPDX-License-Identifier: MIT if (("${XILTIMER_sleep_timer}" STREQUAL "Default") OR - ("${XILTIMER_tick_timer}" STREQUAL "None")) + ("${XILTIMER_sleep_timer}" STREQUAL "Default;") OR + ("${XILTIMER_tick_timer}" STREQUAL "None") OR + ("${XILTIMER_tick_timer}" STREQUAL "None;")) add_subdirectory(default_timer) endif() diff --git a/lib/sw_services/xiltimer/src/xiltimer.cmake b/lib/sw_services/xiltimer/src/xiltimer.cmake index 2fb5019f2cf..c202f5631b7 100644 --- a/lib/sw_services/xiltimer/src/xiltimer.cmake +++ b/lib/sw_services/xiltimer/src/xiltimer.cmake @@ -31,11 +31,7 @@ else() SET_PROPERTY(CACHE XILTIMER_tick_timer PROPERTY STRINGS "None") endif() -if ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeRTOS") - option(XILTIMER_en_interval_timer "Enable Interval Timer" ON) -else() option(XILTIMER_en_interval_timer "Enable Interval Timer" OFF) -endif() if ("${XILTIMER_sleep_timer}" STREQUAL "${XILTIMER_tick_timer}") @@ -71,6 +67,7 @@ elseif (${_len} GREATER 1) if (${XILTIMER_en_interval_timer}) list(GET TOTAL_TIMER_INSTANCES 1 tick_timer) else() + set(tick_timer None) set(XTIMER_NO_TICK_TIMER 1) endif() elseif(${sleep_timer_len} EQUAL 1) @@ -86,10 +83,12 @@ elseif (${_len} GREATER 1) endif() endif() endif() - if ((("${XILTIMER_tick_timer}" STREQUAL "None") OR - ("${XILTIMER_tick_timer}" STREQUAL "None;")) AND - (NOT (${XILTIMER_en_interval_timer}))) - set(XTIMER_NO_TICK_TIMER 1) + if (("${XILTIMER_tick_timer}" STREQUAL "None") OR + ("${XILTIMER_tick_timer}" STREQUAL "None;")) + if (NOT (${XILTIMER_en_interval_timer})) + set(tick_timer None) + endif() + set(XTIMER_NO_TICK_TIMER 1) endif() elseif (${_len} EQUAL 1) if ((("${XILTIMER_tick_timer}" STREQUAL "None;") OR diff --git a/scripts/pyesw/library_utils.py b/scripts/pyesw/library_utils.py index 0c476e608b1..25635be76a6 100644 --- a/scripts/pyesw/library_utils.py +++ b/scripts/pyesw/library_utils.py @@ -323,6 +323,10 @@ def add_lib_for_apps(self, app_name): cmake_cmd_append += f" -D{key}={value}" if app_name == "zynqmp_fsbl": cmake_cmd_append += " -Dstandalone_zynqmp_fsbl_bsp=ON" + # for freertos os we need to enable interval timer always + if "freertos" in self.os: + cmake_cmd_append += " -DXILTIMER_en_interval_timer=ON" + if schema and schema.get("os_config", {}): if schema.get("os_config", {})[self.os]: self.os_config = schema.get("os_config", {})[self.os]