Skip to content

Commit

Permalink
sw_services: xiltimer: Add checks for default timer functionality
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Appana Durga Kedareswara rao <[email protected]>
  • Loading branch information
M Lakshmaiah authored and Siva Addepalli committed Oct 28, 2024
1 parent 5f03a57 commit 83aaa61
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
6 changes: 4 additions & 2 deletions lib/sw_services/xiltimer/src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Expand Down
15 changes: 7 additions & 8 deletions lib/sw_services/xiltimer/src/xiltimer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions scripts/pyesw/library_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 83aaa61

Please sign in to comment.