set(FREERTOS_KERNEL_PATH "${CMAKE_CURRENT_LIST_DIR}/FreeRTOS-Kernel-SMP-reduced")

set(FREERTOS_KERNEL_RP2040_RELATIVE_PATH "portable/ThirdParty/GCC/RP2040")

set(FREERTOS_PORT_PATH ${FREERTOS_KERNEL_PATH}/${FREERTOS_KERNEL_RP2040_RELATIVE_PATH})

add_subdirectory(${FREERTOS_PORT_PATH})

add_library(my_freertos INTERFACE)

target_sources(my_freertos INTERFACE
    ${CMAKE_CURRENT_LIST_DIR}/get_timer_task_static_memory.c
    ${CMAKE_CURRENT_LIST_DIR}/my_printer.c
    ${CMAKE_CURRENT_LIST_DIR}/task_agent.cpp
    ${CMAKE_CURRENT_LIST_DIR}/timer_agent.cpp
    ${CMAKE_CURRENT_LIST_DIR}/watchdog.cpp
    #${CMAKE_CURRENT_LIST_DIR}/lockout.cpp
)
target_include_directories(my_freertos INTERFACE
    ${CMAKE_CURRENT_LIST_DIR}/include
)

target_link_libraries(my_freertos INTERFACE
    # FreeRTOS-Kernel-Static
    FreeRTOS-Kernel
    FreeRTOS-Kernel-Heap3
)
