Moved FreeRTOS to an object library

This also allows for reducing the propagated includes and thus avoid name clashes to FreeRTOS.
This commit is contained in:
Raphael Coeffic
2022-04-03 17:50:53 +02:00
parent 93b8bf129c
commit c11d7d58ae
10 changed files with 75 additions and 55 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ set(FIRMWARE_RANLIB "${GCC_ARM_PATH}arm-none-eabi-ranlib" CACHE STRING "Specific
set(THIRDPARTY_DIR thirdparty)
set(LUA_DIR ${THIRDPARTY_DIR}/Lua/src)
set(RTOS_DIR ${THIRDPARTY_DIR}/FreeRTOS-Kernel-10.4.4)
set(RTOS_DIR ${THIRDPARTY_DIR}/FreeRTOS)
set(FATFS_DIR ${THIRDPARTY_DIR}/FatFs)
set(RADIO_BIN_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+2 -2
View File
@@ -19,8 +19,8 @@
* GNU General Public License for more details.
*/
#include <FreeRTOS.h>
#include <stream_buffer.h>
#include <FreeRTOS/include/FreeRTOS.h>
#include <FreeRTOS/include/stream_buffer.h>
#include "opentx.h"
#include "diskio.h"
-3
View File
@@ -49,9 +49,6 @@
#include "pulses/afhds2.h"
#endif
#include <FreeRTOS.h>
#include <timers.h>
uint8_t s_pulses_paused = 0;
ModuleState moduleState[NUM_MODULES];
InternalModulePulsesData intmodulePulsesData __DMA;
+2 -2
View File
@@ -23,8 +23,8 @@
#if configSUPPORT_STATIC_ALLOCATION > 0
#include <FreeRTOS.h>
#include <task.h>
#include <FreeRTOS/include/FreeRTOS.h>
#include <FreeRTOS/include/task.h>
/* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an
implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
+3 -3
View File
@@ -141,9 +141,9 @@ inline void RTOS_CREATE_TASK(pthread_t &taskId, void * (*task)(void *), const ch
#ifdef __cplusplus
extern "C" {
#endif
#include <FreeRTOS.h>
#include <task.h>
#include <semphr.h>
#include <FreeRTOS/include/FreeRTOS.h>
#include <FreeRTOS/include/task.h>
#include <FreeRTOS/include/semphr.h>
#ifdef __cplusplus
}
#endif
+2 -2
View File
@@ -47,8 +47,8 @@ extern caddr_t _sbrk(int nbytes)
#if defined(THREADSAFE_MALLOC) && !defined(BOOT)
#include <FreeRTOS.h>
#include <task.h>
#include <FreeRTOS/include/FreeRTOS.h>
#include <FreeRTOS/include/task.h>
void __malloc_lock(struct _reent *r)
{
@@ -270,8 +270,6 @@ add_definitions(-DGPS)
add_definitions(-DBATTGRAPH -DTHRTRACE)
add_definitions(-DSBUS_TRAINER)
include_directories(${RTOS_DIR}/include)
foreach(LANGUAGE ${TTS_LANGUAGES})
string(TOLOWER ${LANGUAGE} lang_lower)
set(SRC ${SRC} translations/tts_${lang_lower}.cpp)
@@ -299,22 +297,6 @@ set(FIRMWARE_TARGET_SRC
telemetry_driver.cpp
)
set(FIRMWARE_SRC
${FIRMWARE_SRC}
${RTOS_DIR}/list.c
${RTOS_DIR}/queue.c
${RTOS_DIR}/tasks.c
${RTOS_DIR}/event_groups.c
${RTOS_DIR}/timers.c
rtos.c)
if(CLI)
set(FIRMWARE_SRC
${FIRMWARE_SRC}
${RTOS_DIR}/stream_buffer.c)
endif()
set(PULSES_SRC
${PULSES_SRC}
pulses.cpp
@@ -47,16 +47,36 @@ set(STM32LIB_SRC
STM32F2xx_StdPeriph_Driver/src/stm32f2xx_adc.c
)
#
# FreeRTOS port specific include
#
include_directories(${RTOS_DIR}/portable/GCC/ARM_CM3)
if(NOT NATIVE_BUILD)
#
# FreeRTOS port specific include
#
add_library(freertos OBJECT EXCLUDE_FROM_ALL
${RTOS_DIR}/list.c
${RTOS_DIR}/queue.c
${RTOS_DIR}/tasks.c
${RTOS_DIR}/event_groups.c
${RTOS_DIR}/timers.c
${RTOS_DIR}/stream_buffer.c
${RTOS_DIR}/portable/GCC/ARM_CM3/port.c
)
#
# System and FreeRTOS port files
#
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC}
../common/arm/stm32/f2/system_stm32f2xx.c
../../${RTOS_DIR}/portable/GCC/ARM_CM3/port.c
)
target_include_directories(freertos
PUBLIC ${RTOS_DIR}/portable/GCC/ARM_CM3
PRIVATE ${RTOS_DIR}/include
)
include_directories(${RTOS_DIR}/portable/GCC/ARM_CM3)
# EdgeTx Compat layer
set(FIRMWARE_SRC ${FIRMWARE_SRC} rtos.c)
#
# System and FreeRTOS port files
#
set(FIRMWARE_SRC ${FIRMWARE_SRC}
$<TARGET_OBJECTS:freertos>
targets/common/arm/stm32/f2/system_stm32f2xx.c
)
endif()
@@ -49,16 +49,35 @@ set(STM32LIB_SRC
STM32F4xx_StdPeriph_Driver/src/stm32f4xx_adc.c
)
#
# FreeRTOS port specific include
#
include_directories(${RTOS_DIR}/portable/GCC/ARM_CM4F)
if(NOT NATIVE_BUILD)
#
# FreeRTOS port specific include
#
add_library(freertos OBJECT EXCLUDE_FROM_ALL
${RTOS_DIR}/list.c
${RTOS_DIR}/queue.c
${RTOS_DIR}/tasks.c
${RTOS_DIR}/event_groups.c
${RTOS_DIR}/timers.c
${RTOS_DIR}/stream_buffer.c
${RTOS_DIR}/portable/GCC/ARM_CM4F/port.c
)
#
# System and FreeRTOS port files
#
set(FIRMWARE_TARGET_SRC ${FIRMWARE_TARGET_SRC}
../common/arm/stm32/f4/system_stm32f4xx.c
../../${RTOS_DIR}/portable/GCC/ARM_CM4F/port.c
)
target_include_directories(freertos
PUBLIC ${RTOS_DIR}/portable/GCC/ARM_CM4F
PRIVATE ${RTOS_DIR}/include
)
include_directories(${RTOS_DIR}/portable/GCC/ARM_CM4F)
# EdgeTx Compat layer
set(FIRMWARE_SRC ${FIRMWARE_SRC} rtos.c)
#
# System and FreeRTOS port files
#
set(FIRMWARE_SRC ${FIRMWARE_SRC}
$<TARGET_OBJECTS:freertos>
targets/common/arm/stm32/f4/system_stm32f4xx.c
)
endif()
+4 -2
View File
@@ -31,8 +31,10 @@
#include "libopenui.h"
#endif
#include <FreeRTOS.h>
#include <timers.h>
#if !defined(SIMU)
#include <FreeRTOS/include/FreeRTOS.h>
#include <FreeRTOS/include/timers.h>
#endif
uint8_t telemetryStreaming = 0;
uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE]; // Receive buffer. 9 bytes (full packet), worst case 18 bytes with byte-stuffing (+1)