From 7dec65622d5c14195593b04034010bb3fae24352 Mon Sep 17 00:00:00 2001 From: RichardBarry Date: Thu, 22 Jan 2009 17:25:06 +0000 Subject: [PATCH] Backup NEC project - still a work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@617 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Demo/NEC_V850ES_Fx3_IAR/FreeRTOSConfig.h | 50 +++--- Demo/NEC_V850ES_Fx3_IAR/main.c | 164 +++++++++++------- Demo/NEC_V850ES_Fx3_IAR/rtosdemo.ewp | 45 +++-- .../settings/rtosdemo.dbgdt | 12 +- .../NEC_V850ES_Fx3_IAR/settings/rtosdemo.wsdt | 10 +- 5 files changed, 167 insertions(+), 114 deletions(-) diff --git a/Demo/NEC_V850ES_Fx3_IAR/FreeRTOSConfig.h b/Demo/NEC_V850ES_Fx3_IAR/FreeRTOSConfig.h index b00f5b5f5..dc8338112 100644 --- a/Demo/NEC_V850ES_Fx3_IAR/FreeRTOSConfig.h +++ b/Demo/NEC_V850ES_Fx3_IAR/FreeRTOSConfig.h @@ -19,7 +19,7 @@ A special exception to the GPL can be applied should you wish to distribute a combined work that includes FreeRTOS.org, without being obliged to provide - the source code for any proprietary components. See the licensing section + the source code for any proprietary components. See the licensing section of http://www.FreeRTOS.org for full details of how and when the exception can be applied. @@ -37,13 +37,13 @@ Please ensure to read the configuration and relevant port sections of the online documentation. - http://www.FreeRTOS.org - Documentation, latest information, license and + http://www.FreeRTOS.org - Documentation, latest information, license and contact details. - http://www.SafeRTOS.com - A version that is certified for use in safety + http://www.SafeRTOS.com - A version that is certified for use in safety critical systems. - http://www.OpenRTOS.com - Commercial support, development, porting, + http://www.OpenRTOS.com - Commercial support, development, porting, licensing and training services. */ @@ -81,31 +81,37 @@ /* only include in C files */ #ifdef __IAR_SYSTEMS_ICC__ -#define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 -#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 48000000 ) /* using the external clock source */ -#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) -#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 64 ) -#define configTOTAL_HEAP_SIZE ( (size_t ) ( 9000 ) ) -#define configMAX_TASK_NAME_LEN ( 10 ) -#define configUSE_TRACE_FACILITY 0 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 +#define configUSE_IDLE_HOOK 0 +#define configUSE_TICK_HOOK 0 +#define configCPU_CLOCK_HZ ( ( unsigned portLONG ) 48000000 ) /* using the external clock source */ +#define configTICK_RATE_HZ ( ( portTickType ) 1000 ) +#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 4 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 64 ) +#define configTOTAL_HEAP_SIZE ( (size_t ) ( 20000 ) ) +#define configMAX_TASK_NAME_LEN ( 10 ) +#define configUSE_TRACE_FACILITY 0 +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 0 +#define configUSE_CO_ROUTINES 0 +#define configUSE_MUTEXES 1 +#define configCHECK_FOR_STACK_OVERFLOW 2 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 0 +#define configUSE_COUNTING_SEMAPHORES 0 /* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 +#define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 0 -#define INCLUDE_uxTaskPriorityGet 0 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 0 -#define INCLUDE_vTaskSuspend 0 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 0 +#define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 +#define INCLUDE_vTaskDelay 1 #endif /* __IAR_SYSTEMS_ICC__ */ diff --git a/Demo/NEC_V850ES_Fx3_IAR/main.c b/Demo/NEC_V850ES_Fx3_IAR/main.c index 2c401980f..9777f886f 100644 --- a/Demo/NEC_V850ES_Fx3_IAR/main.c +++ b/Demo/NEC_V850ES_Fx3_IAR/main.c @@ -19,7 +19,7 @@ A special exception to the GPL can be applied should you wish to distribute a combined work that includes FreeRTOS.org, without being obliged to provide - the source code for any proprietary components. See the licensing section + the source code for any proprietary components. See the licensing section of http://www.FreeRTOS.org for full details of how and when the exception can be applied. @@ -37,13 +37,13 @@ Please ensure to read the configuration and relevant port sections of the online documentation. - http://www.FreeRTOS.org - Documentation, latest information, license and + http://www.FreeRTOS.org - Documentation, latest information, license and contact details. - http://www.SafeRTOS.com - A version that is certified for use in safety + http://www.SafeRTOS.com - A version that is certified for use in safety critical systems. - http://www.OpenRTOS.com - Commercial support, development, porting, + http://www.OpenRTOS.com - Commercial support, development, porting, licensing and training services. */ @@ -56,68 +56,82 @@ /* Demo file headers. */ #include -#include "PollQ.h" -#include "semtest.h" -#include "print.h" +#include "BlockQ.h" +#include "death.h" +#include "flash.h" +#include "partest.h" #include "semtest.h" -#include "led.h" -#include "integer.h" +#include "PollQ.h" +#include "GenQTest.h" +#include "QPeek.h" +#include "recmutex.h" /* * Priority definitions for most of the tasks in the demo application. Some * tasks just use the idle priority. */ -#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) -#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainSEMTEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) -#define mainLED_TOGGLE_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainFLASH_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCHECK_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY ) +#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) /* The period between executions of the check task. */ -#define mainCHECK_PERIOD ( ( portTickType ) 3000 / portTICK_RATE_MS ) +#define mainNO_ERROR_DELAY ( ( portTickType ) 3000 / portTICK_RATE_MS ) +#define mainERROR_DELAY ( ( portTickType ) 500 / portTICK_RATE_MS ) -/* The task function for the "Check" task. */ -static void vErrorChecks( void *pvParameters ); +#define mainCHECK_TASK_LED ( 3 ) -/* - * Checks the unique counts of other tasks to ensure they are still operational. - * Flashes an LED if everything is okay. - */ -static long prvCheckOtherTasksAreStillRunning( void ); +/* The task function for the "Check" task. */ +static void prvCheckTask( void *pvParameters ); /* low level initialization prototype */ unsigned portCHAR __low_level_init(void); +static void prvSetupHardware( void ); + extern void vRegTest1( void *pvParameters ); extern void vRegTest2( void *pvParameters ); /*-----------------------------------------------------------*/ -volatile portLONG lRegTestStatus = pdPASS; +static volatile portLONG lRegTestStatus = pdPASS; void vRegTestFailed( void ) { lRegTestStatus = pdFAIL; + + /* Do not return from here as the reg test tasks clobber all registers so + function calls may not function correctly. */ for( ;; ); } void main( void ) { - /* Create some standard demo tasks. */ -// vStartIntegerMathTasks( tskIDLE_PRIORITY ); -// vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); -// vStartSemaphoreTasks(mainSEMTEST_PRIORITY); - - /* Create a simple task that toggles a pin. */ -// vStartLEDToggleTasks( mainLED_TOGGLE_PRIORITY ); + prvSetupHardware(); + + vStartLEDFlashTasks( mainFLASH_PRIORITY ); + vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); + vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); + vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY ); + vStartQueuePeekTasks(); + vStartRecursiveMutexTasks(); + vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); /* Create the tasks defined within this file. */ -// xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - -// vPrintInitialise(); + xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); -xTaskCreate( vRegTest1, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); -xTaskCreate( vRegTest2, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest1, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vRegTest2, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + /* The suicide tasks must be created last as they need to know how many + tasks were running prior to their creation in order to ascertain whether + or not the correct/expected number of tasks are running at any given time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); + /* Start the scheduler. */ vTaskStartScheduler(); @@ -127,56 +141,63 @@ xTaskCreate( vRegTest2, "Check", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORIT } /*-----------------------------------------------------------*/ -static void vErrorChecks( void *pvParameters ) +static void prvCheckTask( void *pvParameters ) { -volatile long lError = pdFALSE; +portTickType xDelayPeriod = mainNO_ERROR_DELAY, xLastWakeTime; /* Just to remove the compiler warning. */ ( void ) pvParameters; + xLastWakeTime = xTaskGetTickCount(); + /* Cycle for ever, delaying then checking all the other tasks are still operating without error. */ for( ;; ) { - /* Delay until it is time to check the other tasks again. */ - vTaskDelay( mainCHECK_PERIOD ); + vTaskDelayUntil( &xLastWakeTime, xDelayPeriod ); + + if( lRegTestStatus != pdPASS ) + { + xDelayPeriod = mainERROR_DELAY; + } + + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } - if( prvCheckOtherTasksAreStillRunning() != pdPASS ) + if( xAreQueuePeekTasksStillRunning() != pdTRUE ) { - lError = pdTRUE; - - /* Do something to indicate the error. */ - ( void ) lError; + xDelayPeriod = mainERROR_DELAY; } - } -} -/*-----------------------------------------------------------*/ -static long prvCheckOtherTasksAreStillRunning( void ) -{ -long lStatus = pdPASS; + if( xAreBlockingQueuesStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } - if( xAreIntegerMathsTaskStillRunning() != pdPASS ) - { - lStatus = pdFAIL; - } + if( xAreSemaphoreTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } - if( xArePollingQueuesStillRunning() != pdPASS ) - { - lStatus = pdFAIL; - } + if( xArePollingQueuesStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } - if( xAreSemaphoreTasksStillRunning() != pdPASS ) - { - lStatus = pdFAIL; - } + if( xIsCreateTaskStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } - if( xAreLEDToggleTaskStillRunning() != pdPASS ) - { - lStatus = pdFAIL; - } + if( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) + { + xDelayPeriod = mainERROR_DELAY; + } - return lStatus; + vParTestToggleLED( mainCHECK_TASK_LED ); + } } /*-----------------------------------------------------------*/ @@ -250,4 +271,15 @@ unsigned portCHAR psval = 0; return pdTRUE; } +static void prvSetupHardware( void ) +{ + vParTestInitialise(); +} + +void vApplicationStackOverflowHook( void ) +{ + for( ;; ); +} + + diff --git a/Demo/NEC_V850ES_Fx3_IAR/rtosdemo.ewp b/Demo/NEC_V850ES_Fx3_IAR/rtosdemo.ewp index 0a25cc743..6a6dc84d8 100644 --- a/Demo/NEC_V850ES_Fx3_IAR/rtosdemo.ewp +++ b/Demo/NEC_V850ES_Fx3_IAR/rtosdemo.ewp @@ -1645,32 +1645,47 @@ demo source - - $PROJ_DIR$\..\Common\Full\integer.c - - - $PROJ_DIR$\LEDtoggle\LED.c - + + Standard Demo Tasks + + $PROJ_DIR$\..\Common\Minimal\BlockQ.c + + + $PROJ_DIR$\..\Common\Minimal\death.c + + + $PROJ_DIR$\..\Common\Minimal\flash.c + + + $PROJ_DIR$\..\Common\Minimal\GenQTest.c + + + $PROJ_DIR$\..\Common\Minimal\PollQ.c + + + $PROJ_DIR$\..\Common\Minimal\QPeek.c + + + $PROJ_DIR$\..\Common\Minimal\recmutex.c + + + $PROJ_DIR$\..\Common\Minimal\semtest.c + + $PROJ_DIR$\main.c - $PROJ_DIR$\..\Common\Full\PollQ.c - - - $PROJ_DIR$\..\Common\Full\print.c + $PROJ_DIR$\ParTest\ParTest.c $PROJ_DIR$\RegTest.s85 - - $PROJ_DIR$\..\semtest.c - kernel source - $PROJ_DIR$\..\..\Source\portable\MemMang\heap_1.c + $PROJ_DIR$\..\..\Source\portable\MemMang\heap_2.c $PROJ_DIR$\..\..\Source\list.c @@ -1679,7 +1694,7 @@ $PROJ_DIR$\..\..\Source\portable\IAR\V850ES_Fx3\port.c - $PROJ_DIR$\..\..\Source\portable\IAR\V850ES_Fx3\portmacro.s85 + $PROJ_DIR$\..\..\Source\portable\IAR\V850ES_Fx3\portasm.s85 $PROJ_DIR$\..\..\Source\queue.c diff --git a/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.dbgdt b/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.dbgdt index f09c8a511..5dc531757 100644 --- a/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.dbgdt +++ b/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.dbgdt @@ -22,12 +22,12 @@ 20010 - + 200 - + TabID-757-1323 @@ -43,7 +43,7 @@ - 0 + 0 TabID-11505-1326 @@ -55,20 +55,20 @@ - 0TabID-24251-8685RegisterRegister00000 + 0 - TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Source\tasks.c014504649046508TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Source\portable\IAR\V850ES_Fx3\port.c02214901540TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Source\portable\IAR\V850ES_Fx3\portmacro.s85013687228740TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\semtest.c018295209520TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\LEDtoggle\LED.c09045054505TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\main.c08637183718TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\Common\Full\integer.c032680208043TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\FreeRTOSConfig.h05126752675TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\RegTest.s8501634999499980100000010000001 + TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\main.c092413141310TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\RegTest.s8507231273127TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\LEDtoggle\LED.c0951010410104TextEditorC:\Devtools\IAR Systems\Embedded Workbench 5.0\v850\lib\dl85esnn.h0000TextEditorC:\Devtools\IAR Systems\Embedded Workbench 5.0\v850\inc\io70f3385.h0182300TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\Common\Minimal\flash.c07234713532TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\FreeRTOSConfig.h08142594259TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\Common\Minimal\PollQ.c084405040500100000010000001 - iaridepm.enu1debuggergui.enu1-2-2740490-2-2240200142857203666292857755601-2-2740286-2-2240200142857203666171429755601-2-21981682-2-216842001002381203666142857203666 + iaridepm.enu1debuggergui.enu1-2-2740490-2-2240200142857203666292857755601-2-21981682-2-216842001002381203666142857203666 diff --git a/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.wsdt b/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.wsdt index a1eb05466..c4419a244 100644 --- a/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.wsdt +++ b/Demo/NEC_V850ES_Fx3_IAR/settings/rtosdemo.wsdt @@ -17,7 +17,7 @@ 20121632481 - + TabID-30435-11592 @@ -25,24 +25,24 @@ Workspace - rtosdemortosdemo/demo sourcertosdemo/kernel source + rtosdemortosdemo/demo sourcertosdemo/demo source/Standard Demo Tasksrtosdemo/kernel source - 0TabID-2785-875BuildBuildTabID-21438-1140Debug LogDebug-LogTabID-21061-4073BreakpointsBreakpoints0 + 0TabID-2785-875BuildBuildTabID-21438-1140Debug LogDebug-LogTabID-21061-4073BreakpointsBreakpoints0 - TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Source\tasks.c014504649046508TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Source\portable\IAR\V850ES_Fx3\port.c02214901540TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Source\portable\IAR\V850ES_Fx3\portmacro.s85013687228740TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\semtest.c018295209520TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\LEDtoggle\LED.c09045054505TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\main.c08637183718TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\Common\Full\integer.c032680208043TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\FreeRTOSConfig.h05126752675TextEditorC:\E\temp\NEC\FreeRTOS V850\FreeRTOS_V850ESFx3\Demo\NEC_V850ES_Fx3_IAR\RegTest.s8501634999499980100000010000001 + TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\main.c092413141310TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\RegTest.s8507231273127TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\LEDtoggle\LED.c0951010410104TextEditorC:\Devtools\IAR Systems\Embedded Workbench 5.0\v850\lib\dl85esnn.h0000TextEditorC:\Devtools\IAR Systems\Embedded Workbench 5.0\v850\inc\io70f3385.h0182300TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\Common\Minimal\flash.c07234713532TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\NEC_V850ES_Fx3_IAR\FreeRTOSConfig.h08142594259TextEditorC:\E\Dev\FreeRTOS\WorkingCopy3\Demo\Common\Minimal\PollQ.c084405040500100000010000001 - iaridepm.enu1-2-2740314-2-2316205188095208758188095755601-2-21981682-2-216842001002381203666142857203666 + iaridepm.enu1-2-2740314-2-2316205188095208758188095755601-2-21981682-2-216842001002381203666142857203666 -- 2.39.2