]> git.sur5r.net Git - freertos/commitdiff
Latest TriCore demo files - these still contain some debug code, and are not yet...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 17 Nov 2011 11:11:15 +0000 (11:11 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 17 Nov 2011 11:11:15 +0000 (11:11 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1631 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/CreateProjectDirectoryStructure.bat
Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/FreeRTOSConfig.h
Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/InterruptNestTest.c
Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c
Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/serial.c

index 92ad175bdc87fa6e783bde088f12db0900d722e3..3c33ec5704db68e0f062623f93b3154ab3f2b9c1 100644 (file)
@@ -53,8 +53,8 @@ IF EXIST FreeRTOS_Source Goto END
     copy %COMMON_SOURCE%\flash.c           Common_Demo_Source\r
     copy %COMMON_SOURCE%\comtest.c         Common_Demo_Source\r
     copy %COMMON_SOURCE%\TimerDemo.c       Common_Demo_Source\r
-       copy %COMMON_SOURCE%\countsem.c        Common_Demo_Source\r
-       copy %COMMON_SOURCE%\integer.c         Common_Demo_Source\r
+    copy %COMMON_SOURCE%\countsem.c        Common_Demo_Source\r
+    copy %COMMON_SOURCE%\integer.c         Common_Demo_Source\r
     \r
     REM Copy the common demo file headers.\r
     copy %COMMON_INCLUDE%\*.h              Common_Demo_Source\include\r
index cd2f137b568ec8351f563ea38d7d77af7d864bee..898774a7569281d619e700ba73e31e374864739f 100644 (file)
@@ -69,7 +69,7 @@
 /*----------------------------------------------------------*/\r
 \r
 #define configUSE_PREEMPTION                           1\r
-#define configUSE_IDLE_HOOK                                    0\r
+#define configUSE_IDLE_HOOK                                    1\r
 /* CPU is actually 150MHz but FPIDIV is 1 meaning divide by 2 for the\r
 peripheral clock. */\r
 #define configCPU_CLOCK_HZ                                     ( ( unsigned long ) 150000000UL )\r
@@ -77,14 +77,14 @@ peripheral clock. */
 #define configTICK_RATE_HZ                                     ( ( portTickType ) 1000UL )\r
 #define configMAX_PRIORITIES                           ( ( unsigned portBASE_TYPE ) 6 )\r
 #define configMINIMAL_STACK_SIZE                       ( ( unsigned short ) 128 )\r
-#define configTOTAL_HEAP_SIZE                          ( ( size_t ) ( 32 * 1024 ) )\r
+#define configTOTAL_HEAP_SIZE                          ( ( size_t ) ( 35U * 1024U ) )\r
 #define configMAX_TASK_NAME_LEN                                ( 16 )\r
 #define configUSE_TRACE_FACILITY                       0\r
 #define configUSE_16_BIT_TICKS                         0\r
 #define configIDLE_SHOULD_YIELD                                0\r
 #define configUSE_MALLOC_FAILED_HOOK           1\r
 #define configCHECK_FOR_STACK_OVERFLOW         0\r
-\r
+#define configUSE_TICK_HOOK                                    1\r
 #define configUSE_COUNTING_SEMAPHORES          1\r
 #define configUSE_RECURSIVE_MUTEXES                    1\r
 #define configUSE_MUTEXES                                      1\r
@@ -93,21 +93,11 @@ peripheral clock. */
 #define configUSE_CO_ROUTINES                          0\r
 #define configMAX_CO_ROUTINE_PRIORITIES        ( 2 )\r
 \r
-/* Timer functionality.  For space constraint reasons, the standard demo timer\r
-tests are only included in the build configuration that generates code that\r
-runs from Flash, and not in the build configuration that generates code that\r
-runs from RAM. */\r
-#ifdef BUILD_FOR_RAM_EXECUTION\r
-       #define configUSE_TIMERS                                        0\r
-       #define configUSE_TICK_HOOK                                     0\r
-#else\r
-       #define configUSE_TIMER                                         1\r
-       #define configUSE_TICK_HOOK                                     1\r
-#endif\r
-\r
-#define configTIMER_TASK_PRIORITY                              ( 4 )\r
-#define configTIMER_QUEUE_LENGTH                               ( 5 )\r
-#define configTIMER_TASK_STACK_DEPTH                   configMINIMAL_STACK_SIZE\r
+/* Software timer configuration. */\r
+#define configUSE_TIMERS                                       1\r
+#define configTIMER_TASK_PRIORITY                      ( 4 )\r
+#define configTIMER_QUEUE_LENGTH                       ( 5 )\r
+#define configTIMER_TASK_STACK_DEPTH           configMINIMAL_STACK_SIZE\r
 \r
 /* Set the following definitions to 1 to include the API function, or zero\r
  to exclude the API function. */\r
@@ -120,11 +110,27 @@ runs from RAM. */
 #define INCLUDE_vTaskDelayUntil                                        1\r
 #define INCLUDE_vTaskDelay                                             1\r
 \r
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY   64\r
-#define configKERNEL_INTERRUPT_PRIORITY                        1\r
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY   64 /* Interrupt above priority 64 are not effected by critical sections, but cannot call interrupt safe FreeRTOS functions. */\r
+#define configKERNEL_INTERRUPT_PRIORITY                        2  /* This is defined here for clarity, but the value must not be changed from 2. */\r
+#define configKERNEL_YIELD_PRIORITY                            1  /* This is defined here for clarity, but must not be changed from its default value of 1. */\r
+\r
+/* Interrupt priorities. */\r
+#define configINTERRUPT_PRIORITY_TX                            16\r
+#define configINTERRUPT_PRIORITY_RX                            18\r
+#define configHIGH_FREQUENCY_TIMER_PRIORITY            ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 1UL )\r
 \r
 /* Default definition of configASSERT(). */\r
 #define configASSERT( x ) if( ( x ) == 0 )             { portDISABLE_INTERRUPTS(); for( ;; ); }\r
 \r
+extern volatile unsigned long ulNest, ulMaxNest;\r
+#define COUNT_NEST()                   \\r
+{                                                              \\r
+       ulNest++;                                       \\r
+       if( ulNest > ulMaxNest )        \\r
+       {                                                       \\r
+               ulMaxNest = ulNest;             \\r
+       }                                                       \\r
+}\r
+\r
 #endif /* FREERTOS_CONFIG_H */\r
 \r
index 6f24605adeb81be16d045d92b5eb1c4dd1d29f72..0464b3942a6d08fb6048b99728c716b5ba4991c6 100644 (file)
 #include <machine/cint.h>\r
 #include <machine/wdtcon.h>\r
 \r
+#warning DOCUMENT THIS\r
 /* This constant is specific to this test application.  It allows the high\r
 frequency (interrupt nesting test) timer to know how often to trigger, and the\r
 check task to know how many iterations to expect at any given time. */\r
-#define tmrtestHIGH_FREQUENCY_TIMER_TEST_HZ            ( 1931UL )\r
+#define tmrtestHIGH_FREQUENCY_TIMER_TEST_HZ            ( 8931UL )\r
 \r
 static void prvPortHighFrequencyTimerHandler( int iArg ) __attribute__((longcall));\r
 static void prvHighFrequencyTimerTask( void *pvParameters );\r
@@ -101,19 +102,9 @@ unsigned long ulCompareMatchBits;
        \r
        /* Setup the interrupt itself.  The STM module clock divider is setup when \r
        the tick interrupt is configured - which is when the scheduler is started - \r
-       so there is no need     to do it here. */\r
+       so there is no need     to do it here.\r
 \r
-       unlock_wdtcon();\r
-       {\r
-               /* Wait until access to Endint protected register is enabled. */\r
-               while( 0 != ( WDT_CON0.reg & 0x1UL ) );\r
-\r
-               /* RMC == 1 so STM Clock == FPI */\r
-               STM_CLC.reg = ( 1UL << 8 );\r
-       }\r
-       lock_wdtcon();\r
-\r
-       /* The tick interrupt uses compare match 0, so this test uses compare match\r
+       The tick interrupt uses compare match 0, so this test uses compare match\r
        1, which means shifting up the values by 16 before writing them to the\r
        register. */\r
        ulCompareMatchBits = ( 0x1fUL - __CLZ( ulCompareMatchValue ) );\r
@@ -127,10 +118,10 @@ unsigned long ulCompareMatchBits;
                STM_CMCON.reg |= ulCompareMatchBits;\r
                STM_CMP1.reg = ulCompareMatchValue;\r
 \r
-               if( 0 != _install_int_handler( configMAX_SYSCALL_INTERRUPT_PRIORITY - 5, prvPortHighFrequencyTimerHandler, 0 ) )\r
+               if( 0 != _install_int_handler( configHIGH_FREQUENCY_TIMER_PRIORITY, prvPortHighFrequencyTimerHandler, 0 ) )\r
                {\r
                        /* Set-up the interrupt. */\r
-                       STM_SRC1.reg = ( ( configMAX_SYSCALL_INTERRUPT_PRIORITY - 5 ) | 0x00005000UL );\r
+                       STM_SRC1.reg = ( configHIGH_FREQUENCY_TIMER_PRIORITY | 0x00005000UL );\r
        \r
                        /* Enable the Interrupt. */\r
                        STM_ISRR.reg &= ~( 0x03UL << 2UL );\r
@@ -177,6 +168,7 @@ static void prvPortHighFrequencyTimerHandler( int iArg )
 static volatile unsigned long ulExecutionCounter = 0UL;\r
 unsigned long ulHigherPriorityTaskWoken = pdFALSE;\r
 \r
+COUNT_NEST();\r
        /* Just to avoid compiler warnings about unused parameters. */\r
        ( void ) iArg;\r
 \r
@@ -200,4 +192,5 @@ unsigned long ulHigherPriorityTaskWoken = pdFALSE;
        }\r
        \r
        portYIELD_FROM_ISR( ulHigherPriorityTaskWoken );\r
+ulNest--;\r
 }\r
index acda40487fe67c976c89c36e8f5134c120246a2e..7b852a3a9ffd2651493eae8be3a8494e5de69cf2 100644 (file)
@@ -1,3 +1,4 @@
+volatile unsigned long ulNest = 0UL, ulMaxNest = 0UL;\r
 /*\r
     FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.\r
 \r
@@ -297,47 +298,52 @@ unsigned long ulHighFrequencyTimerTaskIterations, ulExpectedIncFrequency_ms;
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( xArePollingQueuesStillRunning() != pdTRUE )\r
+       if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+       if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+       if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
+       if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+       if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+       if( prvAreRegTestTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+       if( xIsCreateTaskStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( prvAreRegTestTasksStillRunning() != pdTRUE )\r
+       if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD_MS ) != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( xIsCreateTaskStillRunning() != pdTRUE )\r
+       if( xArePollingQueuesStillRunning() != pdTRUE )\r
+       {\r
+               lReturn = pdFAIL;\r
+       }\r
+\r
+       if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
@@ -353,18 +359,6 @@ unsigned long ulHighFrequencyTimerTaskIterations, ulExpectedIncFrequency_ms;
                lReturn = pdFAIL;\r
        }\r
 \r
-\r
-       #if configUSE_TIMERS == 1\r
-       {\r
-               /* For space constraint reasons, do not include the timer demo in\r
-               builds that execute from RAM. */\r
-               if( xAreTimerDemoTasksStillRunning( mainNO_ERROR_FLASH_PERIOD_MS ) != pdTRUE )\r
-               {\r
-                       lReturn = pdFAIL;\r
-               }\r
-       }\r
-       #endif\r
-\r
        return lReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -393,7 +387,6 @@ void vApplicationMallocFailedHook( void )
        FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used\r
        to query the size of free heap space that remains (although it does not\r
        provide information on how the remaining heap might be fragmented). */\r
-       _debug();\r
        taskDISABLE_INTERRUPTS();\r
        for( ;; );\r
 }\r
@@ -455,6 +448,46 @@ portBASE_TYPE xReturn = pdPASS;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+static void prvOptionallyCreateComprehensveTestApplication( void )\r
+{\r
+       #if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0\r
+       {\r
+               vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
+               vStartDynamicPriorityTasks();\r
+               vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
+               vCreateBlockTimeTasks();\r
+               vStartCountingSemaphoreTasks();\r
+               vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
+               vStartRecursiveMutexTasks();\r
+               vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
+               vSetupInterruptNestingTest();\r
+               vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+               vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
+               vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
+\r
+               /* Create the register test tasks, as described at the top of this file. */\r
+               xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL );\r
+               xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL );\r
+\r
+               /* Start the check task - which is defined in this file. */\r
+               xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+\r
+               /* This task has to be created last as it keeps account of the number of tasks\r
+               it expects to see running. */\r
+               vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
+       }\r
+       #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
+       {\r
+               /* Just to prevent compiler warnings when the configuration options are\r
+               set such that these static functions are not used. */\r
+               ( void ) prvCheckTask;\r
+               ( void ) prvRegisterCheckTask1;\r
+               ( void ) prvRegisterCheckTask2;\r
+       }\r
+       #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 static void prvRegisterCheckTask1( void *pvParameters )\r
 {\r
        /* Make space on the stack for the parameter and a counter. */\r
@@ -668,53 +701,6 @@ static void prvRegisterCheckTask2( void *pvParameters )
        /* The parameter is used but in the assembly. */\r
        (void)pvParameters;\r
 }\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvOptionallyCreateComprehensveTestApplication( void )\r
-{\r
-       #if mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY == 0\r
-       {\r
-               vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
-               vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
-               vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
-               vStartDynamicPriorityTasks();\r
-               vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
-               vCreateBlockTimeTasks();\r
-               vStartCountingSemaphoreTasks();\r
-               vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
-               vStartRecursiveMutexTasks();\r
-               vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
-               vSetupInterruptNestingTest();\r
-\r
-               #if configUSE_TIMERS == 1\r
-               {\r
-                       /* For space constraint reasons, do not include the timer demo in\r
-                       builds that execute from RAM. */\r
-                       vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
-               }\r
-               #endif /* configUSE_TIMERS */\r
-\r
-               /* Create the register test tasks, as described at the top of this file. */\r
-               xTaskCreate( prvRegisterCheckTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, tskIDLE_PRIORITY, NULL );\r
-               xTaskCreate( prvRegisterCheckTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, tskIDLE_PRIORITY, NULL );\r
-\r
-               /* Start the check task - which is defined in this file. */\r
-               xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
-\r
-               /* This task has to be created last as it keeps account of the number of tasks\r
-               it expects to see running. */\r
-               vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
-       }\r
-       #else /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
-       {\r
-               /* Just to prevent compiler warnings when the configuration options are\r
-               set such that these static functions are not used. */\r
-               ( void ) prvCheckTask;\r
-               ( void ) prvRegisterCheckTask1;\r
-               ( void ) prvRegisterCheckTask2;\r
-       }\r
-       #endif /* mainCREATE_SIMPLE_LED_FLASHER_DEMO_ONLY */\r
-}\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
index fe0d32bd35dfd8bf6c5745b3fb67a73c768a6132..2f2b4040d382515e3cea70b1bff6c9d04a29f928 100644 (file)
 \r
 /*---------------------------------------------------------------------------*/\r
 \r
-/* Interrupt priorities. */\r
-#define serialINTERRUPT_PRIORITY_TX                    16\r
-#define serialINTERRUPT_PRIORITY_RX                    18\r
-\r
-/*---------------------------------------------------------------------------*/\r
-\r
 /*\r
  * See if the Serial Transmit Interrupt is currently activated, meaning that\r
  * the interrupt is working through the back log of bytes that it needs to\r
@@ -135,16 +129,16 @@ unsigned long ulReloadValue = 0UL;
        ASC0_CON.reg = 0x00008011;      /* 1 Start, 1 Stop, 8 Data, No Parity, No Error Checking, Receive On, Module On. */\r
 \r
        /* Install the Tx interrupt. */\r
-       if( 0 != _install_int_handler( serialINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) )\r
+       if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_TX, prvTxBufferInterruptHandler, 0 ) )\r
        {\r
-               ASC0_TBSRC.reg = serialINTERRUPT_PRIORITY_TX | 0x5000UL;\r
+               ASC0_TBSRC.reg = configINTERRUPT_PRIORITY_TX | 0x5000UL;\r
                xTransmitStatus = 0UL;\r
        }\r
 \r
        /* Install the Rx interrupt. */\r
-       if( 0 != _install_int_handler( serialINTERRUPT_PRIORITY_RX, prvRxInterruptHandler, 0 ) )\r
+       if( 0 != _install_int_handler( configINTERRUPT_PRIORITY_RX, prvRxInterruptHandler, 0 ) )\r
        {\r
-               ASC0_RSRC.reg = serialINTERRUPT_PRIORITY_RX | 0x5000UL;\r
+               ASC0_RSRC.reg = configINTERRUPT_PRIORITY_RX | 0x5000UL;\r
        }\r
 \r
        /* COM Handle is never used by demo code. */\r
@@ -194,6 +188,8 @@ static void prvTxBufferInterruptHandler( int iArg )
 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
 unsigned char ucTx;\r
 \r
+COUNT_NEST();\r
+\r
        /* Just to remove compiler warnings about unused parameters. */\r
        ( void ) iArg;\r
 \r
@@ -214,6 +210,7 @@ unsigned char ucTx;
 \r
        /* Finally end ISR and switch Task. */\r
        portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ulNest--;\r
 }\r
 /*---------------------------------------------------------------------------*/\r
 \r
@@ -221,7 +218,7 @@ static void prvRxInterruptHandler( int iArg )
 {\r
 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
 unsigned char ucRx;\r
-\r
+COUNT_NEST();\r
        /* Just to remove compiler warnings about unused parameters. */\r
        ( void ) iArg;\r
 \r
@@ -239,6 +236,7 @@ unsigned char ucRx;
 \r
        /* Finally end ISR and switch Task. */\r
        portYIELD_FROM_ISR( xHigherPriorityTaskWoken );\r
+ulNest--;\r
 }\r
 /*---------------------------------------------------------------------------*/\r
 \r