Skip to content

Commit

Permalink
Merge pull request #8 from spanio/clinard/cmsis-cleanup
Browse files Browse the repository at this point in the history
Clinard/cmsis cleanup
  • Loading branch information
StevenClinardSpanIO authored May 16, 2023
2 parents 95a5a11 + 2418ec3 commit b5d19b5
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
8 changes: 4 additions & 4 deletions CMSIS/RTOS2/FreeRTOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
33 changes: 33 additions & 0 deletions CMSIS/RTOS2/FreeRTOS/Include/cmsis_os2_control_blocks.h
Original file line number Diff line number Diff line change
@@ -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;
2 changes: 1 addition & 1 deletion CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion CMSIS/RTOS2/FreeRTOS/include.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include_directories(${FW3_CMSIS_DIR}/Include ${FW3_CMSIS_DIR}/Include1)
include_directories(${FW3_CMSIS_DIR}/Include)
9 changes: 7 additions & 2 deletions Source/include.cmake
Original file line number Diff line number Diff line change
@@ -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 "")

0 comments on commit b5d19b5

Please sign in to comment.