From cb4c4b95e78189ebbc835fed7692f1b6ca924c47 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Sun, 11 May 2008 13:19:05 +0000 Subject: [PATCH] Added optional inclusion of floating point tasks. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@346 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../RTOSDemo/FreeRTOSConfig.h | 11 +++++++ .../PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c | 32 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h index 42fc96bd6..1f5ef7902 100644 --- a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h +++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/FreeRTOSConfig.h @@ -74,6 +74,8 @@ #define configUSE_TRACE_FACILITY 0 #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_FPU 0 /* Co-routine definitions. */ @@ -96,4 +98,13 @@ to exclude the API function. */ #define configUSE_RECURSIVE_MUTEXES 1 +#if configUSE_FPU == 1 + /* Include the header that define the traceTASK_SWITCHED_IN() and + traceTASK_SWITCHED_OUT() macros to save and restore the floating + point registers for tasks that have requested this behaviour. */ + #include "FPU_Macros.h" +#endif + #endif /* FREERTOS_CONFIG_H */ + + diff --git a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c index 3e6b8eaad..6e4e31621 100644 --- a/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c +++ b/Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c @@ -95,6 +95,8 @@ #include "partest.h" #include "countsem.h" #include "recmutex.h" +#include "flop.h" +#include "flop-reg-test.h" /* Priorities assigned to the demo tasks. */ #define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 4 ) @@ -176,6 +178,24 @@ int main( void ) vStartCountingSemaphoreTasks(); vStartRecursiveMutexTasks(); + #if ( configUSE_FPU == 1 ) + { + /* To use floating point: + + 0) Add the files contained in the RTOSDemo/flop directory to the + build. + 1) Your FPGA hardware design needs to add the APU FPU. This should + then also make the compiler options change to include the option + -mfpu=sp_full, but best to check. + 2) Set configUSE_FPU to 1 in FreeRTOSConfig.h. + 3) Set configUSE_APPLICATION_TASK_TAG to 1 in FreeRTOSConfig.h. + 4) Ensure #include "FPU_Macros.h" is contained within + FreeRTOSConfig.h (as per this example). */ + vStartMathTasks( mainFLOP_PRIORITY ); + vStartFlopRegTests(); + } + #endif + /* Create the tasks defined within this file. */ xTaskCreate( prvRegTestTask1, "Regtest1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( prvRegTestTask2, "Regtest2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); @@ -264,6 +284,18 @@ static unsigned portLONG ulLastRegTest1Counter= 0UL, ulLastRegTest2Counter = 0UL lReturn = pdFAIL; } + #if ( configUSE_FPU == 1 ) + if( xAreMathsTaskStillRunning() != pdTRUE ) + { + lReturn = pdFAIL; + } + + if( xAreFlopRegisterTestsStillRunning() != pdTRUE ) + { + lReturn = pdFAIL; + } + #endif + /* Have the register test tasks found any errors? */ if( xRegTestStatus != pdPASS ) { -- 2.39.5