diff --git a/CMSIS/RTOS2/FreeRTOS/CMakeLists.txt b/CMSIS/RTOS2/FreeRTOS/CMakeLists.txt index 9b16fea5..d63a8b9d 100644 --- a/CMSIS/RTOS2/FreeRTOS/CMakeLists.txt +++ b/CMSIS/RTOS2/FreeRTOS/CMakeLists.txt @@ -3,10 +3,10 @@ add_library(FW3_CMSIS_TARGET) target_sources( FW3_CMSIS_TARGET - PRIVATE ${FW3_CMSIS_DIR}/Source/cmsis_os2.c - ${FW3_CMSIS_DIR}/Source/freertos_evr.c - ${FW3_CMSIS_DIR}/Source/os_systick.c - ${FW3_CMSIS_DIR}/Source/ARM/clib_arm.c) + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Source/cmsis_os2.c + ${CMAKE_CURRENT_SOURCE_DIR}/Source/freertos_evr.c + ${CMAKE_CURRENT_SOURCE_DIR}/Source/os_systick.c + ${CMAKE_CURRENT_SOURCE_DIR}/Source/ARM/clib_arm.c) set_source_files_properties(${FW3_CMSIS_DIR}/Source/cmsis_os1.c PROPERTIES COMPILE_OPTIONS -Wno-switch-enum) diff --git a/CMSIS/RTOS2/FreeRTOS/Include/cmsis_os2_control_blocks.h b/CMSIS/RTOS2/FreeRTOS/Include/cmsis_os2_control_blocks.h new file mode 100644 index 00000000..ce02e881 --- /dev/null +++ b/CMSIS/RTOS2/FreeRTOS/Include/cmsis_os2_control_blocks.h @@ -0,0 +1,33 @@ +/* + * freertos_os2_control_blocks.h + * + * Copyright 2022 Span.IO Inc. + * + * Created on: Oct 25, 2022 + * Author: sgc + */ + +#pragma once + +#include "FreeRTOS.h" +#include "cmsis_os2.h" +#include "freertos_mpool.h" +#include "semphr.h" + +#define osTickRateHz (configTICK_RATE_HZ) +#define osMaxDelayTicks (portMAX_DELAY) + +typedef StaticTask_t osThreadControlBlock; +typedef MemPool_t osMemoryPoolControlBlock; +typedef StaticQueue_t osMessageQueueControlBlock; + +struct osTimerControlBlock { + StaticTimer_t m_static; + + // These are TimerCallback_t, defined inside cmsis_os2.c + osTimerFunc_t m_timer_callback; + void* m_arg; +}; + +typedef StaticSemaphore_t osMutexControlBlock; +typedef StaticSemaphore_t osSemaphoreControlBlock; diff --git a/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c b/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c index 2fd7dd93..194195d9 100644 --- a/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c +++ b/CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c @@ -906,7 +906,7 @@ uint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items) { } else { vTaskSuspendAll(); - /* Allocate memory on heap to temporarily store TaskStatus_t information */ + /* Allocate memory on heap or stack to temporarily store TaskStatus_t information */ count = uxTaskGetNumberOfTasks(); #if (configSUPPORT_DYNAMIC_ALLOCATION == 1) diff --git a/CMSIS/RTOS2/FreeRTOS/include.cmake b/CMSIS/RTOS2/FreeRTOS/include.cmake index d2575c02..4efa0bed 100644 --- a/CMSIS/RTOS2/FreeRTOS/include.cmake +++ b/CMSIS/RTOS2/FreeRTOS/include.cmake @@ -1 +1 @@ -include_directories(${FW3_CMSIS_DIR}/Include ${FW3_CMSIS_DIR}/Include1) +include_directories(${FW3_CMSIS_DIR}/Include) diff --git a/Source/include.cmake b/Source/include.cmake index 0e6ed305..228b31b7 100644 --- a/Source/include.cmake +++ b/Source/include.cmake @@ -1,3 +1,8 @@ -set(FREERTOS_CONFIG_FILE_DIRECTORY ${FW3_APPLICATION_DIR}/Include CACHE STRING "") +include_directories(${FW3_RTOS_DIR}/include) -set(FREERTOS_HEAP ${FW3_COMPONENTS_DIR}/Source/no_heap.c CACHE STRING "") +set(FREERTOS_CONFIG_FILE_DIRECTORY + ${FW3_APPLICATION_DIR}/Include + CACHE STRING "") +set(FREERTOS_HEAP + ${FW3_COMPONENTS_DIR}/Source/no_heap.c + CACHE STRING "")