From 9e4e95f211cfa62cd4f4760ac20111ff5050fc3c Mon Sep 17 00:00:00 2001 From: richardbarry Date: Fri, 8 Feb 2013 16:10:13 +0000 Subject: [PATCH] Add the queue set test to the SAM4S-EK Atmel Studio code. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1819 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../CreateProjectDirectoryStructure.bat | 1 + .../RTOSDemo.atsuo | Bin 38912 -> 42496 bytes .../RTOSDemo.cproj | 23 ++--- .../src/FreeRTOSConfig.h | 33 ++++---- .../CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c | 36 +++----- .../src/main_blinky.c | 10 +++ .../src/main_full.c | 80 +++++++++++------- 7 files changed, 103 insertions(+), 80 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat index a744b23de..373445d30 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat @@ -51,6 +51,7 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END copy %COMMON_SOURCE%\recmutex.c src\Common-Demo-Source copy %COMMON_SOURCE%\countsem.c src\Common-Demo-Source copy %COMMON_SOURCE%\integer.c src\Common-Demo-Source + copy %COMMON_SOURCE%\QueueSet.c src\Common-Demo-Source REM Copy the common demo file headers. copy %COMMON_INCLUDE%\*.h src\Common-Demo-Source\include diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo index d00d30fc9b7cec18b7a703b790b6ee31bc2fbc1c..5e8db2c57e9ee3cce8fab469e962e5d805d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n4se zl$(MSBuildProjectName) $(MSBuildProjectName) $(MSBuildProjectName) - 3.1.3 + 2.11.1 @@ -154,19 +154,19 @@ JTAG com.atmel.avrdbg.tool.samice - com.atmel.avrdbg.tool.samice - SAM-ICE - 000158000789 - true - false - + com.atmel.avrdbg.tool.samice + J-Link + 000158008149 + true + false + - + 127.0.0.1 - 3166 + 1637 False - + JTAG 4000000 @@ -425,6 +425,9 @@ compile + + compile + compile diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h index bd1f933a6..1cfa33cb1 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h @@ -1,7 +1,7 @@ /* FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd. - FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT + FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. *************************************************************************** @@ -42,7 +42,7 @@ FreeRTOS WEB site. 1 tab == 4 spaces! - + *************************************************************************** * * * Having a problem? Start by reading the FAQ "My application does * @@ -52,17 +52,17 @@ * * *************************************************************************** - - http://www.FreeRTOS.org - Documentation, training, latest versions, license - and contact details. - + + http://www.FreeRTOS.org - Documentation, training, latest versions, license + and contact details. + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, including FreeRTOS+Trace - an indispensable productivity tool. - Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell - the code with commercial support, indemnification, and middleware, under + Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell + the code with commercial support, indemnification, and middleware, under the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also - provide a safety engineered and independently SIL3 certified version under + provide a safety engineered and independently SIL3 certified version under the SafeRTOS brand: http://www.SafeRTOS.com. */ @@ -70,12 +70,12 @@ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H -/* +/* * The following #error directive is to remind users that a batch file must be - * executed prior to this project being built. Once it has been executed + * executed prior to this project being built. Once it has been executed * remove the #error line below. */ -#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. +//#error Ensure CreateProjectDirectoryStructure.bat has been executed before building. See comment immediately above. /*----------------------------------------------------------- * Application specific definitions. @@ -94,7 +94,7 @@ extern uint32_t SystemCoreClock; #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 0 -#define configUSE_TICK_HOOK 0 +#define configUSE_TICK_HOOK 1 #define configCPU_CLOCK_HZ ( SystemCoreClock ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) @@ -111,6 +111,7 @@ extern uint32_t SystemCoreClock; #define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_QUEUE_SETS 1 #define configGENERATE_RUN_TIME_STATS 0 /* Co-routine definitions. */ @@ -157,11 +158,11 @@ to all Cortex-M ports, and do not rely on any particular library functions. */ /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) - + /* Normal assert() semantics without relying on the provision of an assert.h header file. */ -#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } - +#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); } + /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */ #define vPortSVCHandler SVC_Handler diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c index 47128d6e2..80b0400bc 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c @@ -1,7 +1,7 @@ /* FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd. - FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT + FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. *************************************************************************** @@ -42,7 +42,7 @@ FreeRTOS WEB site. 1 tab == 4 spaces! - + *************************************************************************** * * * Having a problem? Start by reading the FAQ "My application does * @@ -52,17 +52,17 @@ * * *************************************************************************** - - http://www.FreeRTOS.org - Documentation, training, latest versions, license - and contact details. - + + http://www.FreeRTOS.org - Documentation, training, latest versions, license + and contact details. + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, including FreeRTOS+Trace - an indispensable productivity tool. - Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell - the code with commercial support, indemnification, and middleware, under + Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell + the code with commercial support, indemnification, and middleware, under the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also - provide a safety engineered and independently SIL3 certified version under + provide a safety engineered and independently SIL3 certified version under the SafeRTOS brand: http://www.SafeRTOS.com. */ @@ -104,9 +104,9 @@ or 0 to run the more comprehensive test and demo application. */ */ static void prvSetupHardware( void ); -/* +/* * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1. - * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. + * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0. */ extern void main_blinky( void ); extern void main_full( void ); @@ -146,11 +146,11 @@ extern void SystemCoreClockUpdate( void ); /* Ensure all priority bits are assigned as preemption priority bits. */ NVIC_SetPriorityGrouping( 0 ); - + /* Atmel library function to setup for the evaluation kit being used. */ board_init(); - /* Perform any configuration necessary to use the ParTest LED output + /* Perform any configuration necessary to use the ParTest LED output functions. */ vParTestInitialise(); } @@ -200,13 +200,3 @@ void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName } /*-----------------------------------------------------------*/ -void vApplicationTickHook( void ) -{ - /* This function will be called by each tick interrupt if - configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be - added here, but the tick hook is called from an interrupt context, so - code must not attempt to block, and only the interrupt safe FreeRTOS API - functions can be used (those that end in FromISR()). */ -} -/*-----------------------------------------------------------*/ - diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c index e165eb493..1ea633724 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_blinky.c @@ -240,3 +240,13 @@ unsigned long ulReceivedValue; } /*-----------------------------------------------------------*/ +void vApplicationTickHook( void ) +{ + /* This function will be called by each tick interrupt if + configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + added here, but the tick hook is called from an interrupt context, so + code must not attempt to block, and only the interrupt safe FreeRTOS API + functions can be used (those that end in FromISR()). */ +} +/*-----------------------------------------------------------*/ + diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c index 591a63827..84cae55e6 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c @@ -1,7 +1,7 @@ /* FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd. - FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT + FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. *************************************************************************** @@ -42,7 +42,7 @@ FreeRTOS WEB site. 1 tab == 4 spaces! - + *************************************************************************** * * * Having a problem? Start by reading the FAQ "My application does * @@ -52,17 +52,17 @@ * * *************************************************************************** - - http://www.FreeRTOS.org - Documentation, training, latest versions, license - and contact details. - + + http://www.FreeRTOS.org - Documentation, training, latest versions, license + and contact details. + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, including FreeRTOS+Trace - an indispensable productivity tool. - Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell - the code with commercial support, indemnification, and middleware, under + Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell + the code with commercial support, indemnification, and middleware, under the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also - provide a safety engineered and independently SIL3 certified version under + provide a safety engineered and independently SIL3 certified version under the SafeRTOS brand: http://www.SafeRTOS.com. */ @@ -79,8 +79,8 @@ ****************************************************************************** * * main_full() creates all the demo application tasks and a software timer, then - * starts the scheduler. The web documentation provides more details of the - * standard demo application tasks, which provide no particular functionality, + * starts the scheduler. The web documentation provides more details of the + * standard demo application tasks, which provide no particular functionality, * but do provide a good example of how to use the FreeRTOS API. * * In addition to the standard demo tasks, the following tasks and tests are @@ -88,18 +88,18 @@ * * "Check" timer - The check software timer period is initially set to three * seconds. The callback function associated with the check software timer - * checks that all the standard demo tasks are not only still executing, but - * are executing without reporting any errors. If the check software timer - * discovers that a task has either stalled, or reported an error, then it - * changes its own execution period from the initial three seconds, to just - * 200ms. The check software timer callback function also toggles the green - * LED each time it is called. This provides a visual indication of the system - * status: If the green LED toggles every three seconds, then no issues have - * been discovered. If the green LED toggles every 200ms, then an issue has + * checks that all the standard demo tasks are not only still executing, but + * are executing without reporting any errors. If the check software timer + * discovers that a task has either stalled, or reported an error, then it + * changes its own execution period from the initial three seconds, to just + * 200ms. The check software timer callback function also toggles the green + * LED each time it is called. This provides a visual indication of the system + * status: If the green LED toggles every three seconds, then no issues have + * been discovered. If the green LED toggles every 200ms, then an issue has * been discovered with at least one task. * * See the documentation page for this demo on the FreeRTOS.org web site for - * full information, including hardware setup requirements. + * full information, including hardware setup requirements. */ /* Standard includes. */ @@ -125,7 +125,7 @@ #include "flash_timer.h" #include "partest.h" #include "comtest2.h" - +#include "QueueSet.h" /* Atmel library includes. */ #include "asf.h" @@ -194,7 +194,8 @@ xTimerHandle xCheckTimer = NULL; vStartSemaphoreTasks( mainSEM_TEST_PRIORITY ); vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS ); vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); - + vStartQueueSetTasks(); + /* Create the software timer that performs the 'check' functionality, as described at the top of this file. */ xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */ @@ -202,27 +203,27 @@ xTimerHandle xCheckTimer = NULL; pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */ ( void * ) 0, /* The ID is not used, so can be set to anything. */ prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */ - ); - + ); + if( xCheckTimer != NULL ) { xTimerStart( xCheckTimer, mainDONT_BLOCK ); } - /* The set of tasks created by the following function call have to be - created last as they keep account of the number of tasks they expect to see + /* The set of tasks created by the following function call have to be + created last as they keep account of the number of tasks they expect to see running. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); /* Start the scheduler. */ vTaskStartScheduler(); - + /* If all is well, the scheduler will now be running, and the following line will never be reached. If the following line does execute, then there was insufficient FreeRTOS heap memory available for the idle and/or timer tasks to be created. See the memory management section on the FreeRTOS web site for more details. */ - for( ;; ); + for( ;; ); } /*-----------------------------------------------------------*/ @@ -278,17 +279,22 @@ unsigned long ulErrorFound = pdFALSE; { ulErrorFound = pdTRUE; } - + if( xAreComTestTasksStillRunning() != pdTRUE ) { ulErrorFound = pdTRUE; } + if( xAreQueueSetTasksStillRunning() != pdPASS ) + { + ulErrorFound = pdTRUE; + } + /* Toggle the check LED to give an indication of the system status. If the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then everything is ok. A faster toggle indicates an error. */ vParTestToggleLED( mainCHECK_LED ); - + /* Have any errors been latch in ulErrorFound? If so, shorten the period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds. This will result in an increase in the rate at which mainCHECK_LED @@ -298,7 +304,7 @@ unsigned long ulErrorFound = pdFALSE; if( lChangedTimerPeriodAlready == pdFALSE ) { lChangedTimerPeriodAlready = pdTRUE; - + /* This call to xTimerChangePeriod() uses a zero block time. Functions called from inside of a timer callback function must *never* attempt to block. */ @@ -308,3 +314,15 @@ unsigned long ulErrorFound = pdFALSE; } /*-----------------------------------------------------------*/ +void vApplicationTickHook( void ) +{ + /* This function will be called by each tick interrupt if + configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be + added here, but the tick hook is called from an interrupt context, so + code must not attempt to block, and only the interrupt safe FreeRTOS API + functions can be used (those that end in FromISR()). In this case the tick + hook is used as part of the queue set test. */ + vQueueSetWriteToQueueFromISR(); +} +/*-----------------------------------------------------------*/ + -- 2.39.5