Kernel changes:

+ Do not attempt to free the stack of a deleted task if the stack was statically allocated.
+ Introduce configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES - which optionally writes known values into the list and list item data structures in order to assist with the detection of memory corruptions.

Microblase port:  
+Change occurrences of #if XPAR_MICROBLAZE_0_USE_FPU == 1 to 	#if XPAR_MICROBLAZE_0_USE_FPU != 0 as the value can also be 2 or 3.

Demo app modifications:
+ Update Zynq project to use the 2014.4 tools and add in tests for the new task notification feature.
+ Update SAM4S project to include tests for the new task notification feature.
This commit is contained in:
Richard Barry 2014-12-19 16:27:56 +00:00
parent f407b70dcc
commit 2de32c0141
18 changed files with 327 additions and 98 deletions

View file

@ -106,7 +106,6 @@
*/
#define configMAX_API_CALL_INTERRUPT_PRIORITY 18
#define configCPU_CLOCK_HZ 100000000UL
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_TICKLESS_IDLE 0

View file

@ -144,6 +144,8 @@
#include "QueueOverwrite.h"
#include "IntQueue.h"
#include "EventGroupsDemo.h"
#include "TaskNotify.h"
#include "IntSemTest.h"
/* Priorities for the demo application tasks. */
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
@ -250,6 +252,9 @@ void main_full( void )
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
vStartEventGroupTasks();
vStartTaskNotifyTask();
vStartInterruptSemaphoreTasks();
/* Start the tasks that implements the command console on the UART, as
described above. */
@ -318,80 +323,90 @@ unsigned long ulErrorFound = pdFALSE;
that they are all still running, and that none have detected an error. */
if( xAreIntQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 0UL;
}
if( xAreMathsTaskStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 1UL;
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 2UL;
}
if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 3UL;
}
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 4UL;
}
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 5UL;
}
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 6UL;
}
if( xIsCreateTaskStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 7UL;
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 8UL;
}
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 9UL;
}
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 10UL;
}
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 11UL;
}
if( xAreEventGroupTasksStillRunning() != pdPASS )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 12UL;
}
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 13UL;
}
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 14UL;
}
/* Check that the register test 1 task is still running. */
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 15UL;
}
ulLastRegTest1Value = ulRegTest1LoopCounter;
/* Check that the register test 2 task is still running. */
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 16UL;
}
ulLastRegTest2Value = ulRegTest2LoopCounter;

View file

@ -105,6 +105,8 @@
#include "TimerDemo.h"
#include "QueueOverwrite.h"
#include "EventGroupsDemo.h"
#include "TaskNotify.h"
#include "IntSemTest.h"
/* Xilinx includes. */
#include "platform.h"
@ -311,6 +313,12 @@ void vApplicationTickHook( void )
/* Call the periodic event group from ISR demo. */
vPeriodicEventGroupsProcessing();
/* Use task notifications from an interrupt. */
xNotifyTaskFromISR();
/* Use mutexes from interrupts. */
vInterruptSemaphorePeriodicTest();
}
#endif
}

View file

@ -24,6 +24,7 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
copy %FREERTOS_SOURCE%\queue.c src\asf\thirdparty\FreeRTOS
copy %FREERTOS_SOURCE%\list.c src\asf\thirdparty\FreeRTOS
copy %FREERTOS_SOURCE%\timers.c src\asf\thirdparty\FreeRTOS
copy %FREERTOS_SOURCE%\event_groups.c src\asf\thirdparty\FreeRTOS
REM Copy the common header files into the project directory
copy %FREERTOS_SOURCE%\include\*.* src\asf\thirdparty\FreeRTOS\include
@ -48,6 +49,10 @@ IF EXIST src\asf\thirdparty\FreeRTOS Goto END
copy %COMMON_SOURCE%\integer.c src\Common-Demo-Source
copy %COMMON_SOURCE%\QueueSet.c src\Common-Demo-Source
COPY %COMMON_SOURCE%\IntQueue.c src\Common-Demo-Source
COPY %COMMON_SOURCE%\TaskNotify.c src\Common-Demo-Source
COPY %COMMON_SOURCE%\TimerDemo.c src\Common-Demo-Source
COPY %COMMON_SOURCE%\EventGroupsDemo.c src\Common-Demo-Source
COPY %COMMON_SOURCE%\IntSemTest.c src\Common-Demo-Source
REM Copy the common demo file headers.
copy %COMMON_INCLUDE%\*.h src\Common-Demo-Source\include

View file

@ -142,7 +142,7 @@
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.6.0" />
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.10.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
@ -267,11 +267,6 @@
</armgcc.linker.libraries.LibrarySearchPaths>
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
<armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>
<armgcc.assembler.general.IncludePaths>
<ListValues>
<Value>../src/ASF/sam/drivers/tc</Value>
</ListValues>
</armgcc.assembler.general.IncludePaths>
<armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>
<armgcc.preprocessingassembler.general.IncludePaths>
<ListValues>
@ -372,12 +367,8 @@
</ListValues>
</armgcc.linker.libraries.LibrarySearchPaths>
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
<armgcc.linker.memorysettings.ExternalRAM />
<armgcc.linker.miscellaneous.LinkerFlags>-T../src/asf/sam/utils/linker_scripts/sam4s/sam4s16/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb</armgcc.linker.miscellaneous.LinkerFlags>
<armgcc.assembler.general.IncludePaths>
<ListValues>
<Value>../src/ASF/sam/drivers/tc</Value>
</ListValues>
</armgcc.assembler.general.IncludePaths>
<armgcc.preprocessingassembler.general.AssemblerFlags>-DARM_MATH_CM4=true -DBOARD=SAM4S_EK -D__SAM4S16C__</armgcc.preprocessingassembler.general.AssemblerFlags>
<armgcc.preprocessingassembler.general.IncludePaths>
<ListValues>
@ -423,18 +414,36 @@
<None Include="src\asf\sam\drivers\usart\usart.h">
<SubType>compile</SubType>
</None>
<Compile Include="src\asf\thirdparty\FreeRTOS\event_groups.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\asf\thirdparty\FreeRTOS\portable\MemMang\heap_4.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\EventGroupsDemo.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\include\demo_serial.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\include\TaskNotify.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\IntQueue.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\IntSemTest.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\QueueSet.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\TaskNotify.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\Common-Demo-Source\TimerDemo.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="src\IntQueueTimer.c">
<SubType>compile</SubType>
</Compile>

View file

@ -91,7 +91,7 @@ extern uint32_t SystemCoreClock;
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
@ -132,6 +132,7 @@ to exclude the API function. */
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS

View file

@ -85,7 +85,6 @@
/* Standard demo includes. */
#include "partest.h"
#include "QueueSet.h"
/* Atmel library includes. */
#include <asf.h>
@ -181,6 +180,14 @@ void vApplicationIdleHook( void )
important that vApplicationIdleHook() is permitted to return to its calling
function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
{
extern void vFullDemoIdleHook( void );
vFullDemoIdleHook();
}
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
}
/*-----------------------------------------------------------*/
@ -207,8 +214,9 @@ void vApplicationTickHook( void )
#if ( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0 )
{
/* In this case the tick hook is used as part of the queue set test. */
vQueueSetAccessQueueSetFromISR();
extern void vFullDemoTickHook( void );
vFullDemoTickHook();
}
#endif /* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY */
}

View file

@ -124,6 +124,10 @@
#include "comtest2.h"
#include "QueueSet.h"
#include "IntQueue.h"
#include "TaskNotify.h"
#include "TimerDemo.h"
#include "EventGroupsDemo.h"
#include "IntSemTest.h"
/* Atmel library includes. */
#include "asf.h"
@ -142,12 +146,12 @@
/* The period after which the check timer will expire, in ms, provided no errors
have been reported by any of the standard demo tasks. ms are converted to the
equivalent in ticks using the portTICK_PERIOD_MS constant. */
#define mainCHECK_TIMER_PERIOD_MS ( 3000UL / portTICK_PERIOD_MS )
#define mainCHECK_TIMER_PERIOD_MS ( pdMS_TO_TICKS( 3000UL ) )
/* The period at which the check timer will expire, in ms, if an error has been
reported in one of the standard demo tasks. ms are converted to the equivalent
in ticks using the portTICK_PERIOD_MS constant. */
#define mainERROR_CHECK_TIMER_PERIOD_MS ( 200UL / portTICK_PERIOD_MS )
#define mainERROR_CHECK_TIMER_PERIOD_MS ( pdMS_TO_TICKS( 200UL ) )
/* The standard demo flash timers can be used to flash any number of LEDs. In
this case, because only three LEDs are available, and one is in use by the
@ -165,8 +169,23 @@ standard demo flash timers. */
for the comtest, so the LED number is deliberately out of range. */
#define mainCOM_TEST_LED ( 3 )
/* Used by the standard demo timer tasks. */
#define mainTIMER_TEST_PERIOD ( 50 )
/*-----------------------------------------------------------*/
/*
* Called by the idle hook function when the project is configured to run the
* full (as opposed to the blinky) demo.
*/
void vFullDemoIdleHook( void );
/*
* Called by the tick hook function when the project is configured to run the
* full (as opposed to the blinky) demo.
*/
void vFullDemoTickHook( void );
/*
* The check timer callback function, as described at the top of this file.
*/
@ -176,8 +195,6 @@ static void prvCheckTimerCallback( TimerHandle_t xTimer );
void main_full( void )
{
TimerHandle_t xCheckTimer = NULL;
/* Start all the other standard demo/test tasks. The have not particular
functionality, but do demonstrate how to use the FreeRTOS API and test the
kernel port. */
@ -191,23 +208,12 @@ TimerHandle_t xCheckTimer = NULL;
vStartRecursiveMutexTasks();
vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
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( "CheckTimer", /* A text name, purely to help debugging. */
( mainCHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 3000ms (3s). */
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 );
}
vStartTaskNotifyTask();
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartEventGroupTasks();
vStartInterruptSemaphoreTasks();
/* 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
@ -236,63 +242,84 @@ unsigned long ulErrorFound = pdFALSE;
if( xAreIntQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 0UL;
}
if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 1UL;
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 2UL;
}
if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 3UL;
}
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 4UL;
}
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 5UL;
}
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 6UL;
}
if( xIsCreateTaskStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 7UL;
}
if( xArePollingQueuesStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 8UL;
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 9UL;
}
if( xAreComTestTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 10UL;
}
if( xAreQueueSetTasksStillRunning() != pdPASS )
if( xAreQueueSetTasksStillRunning() != pdTRUE )
{
ulErrorFound = pdTRUE;
ulErrorFound |= 1UL << 11UL;
}
if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 12UL;
}
if( xAreTimerDemoTasksStillRunning( mainCHECK_TIMER_PERIOD_MS ) != pdTRUE )
{
ulErrorFound |= 1UL << 13UL;
}
if( xAreEventGroupTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 14UL;
}
if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound |= 1UL << 15UL;
}
/* Toggle the check LED to give an indication of the system status. If
the LED toggles every mainCHECK_TIMER_PERIOD_MS milliseconds then
@ -318,3 +345,49 @@ unsigned long ulErrorFound = pdFALSE;
}
/*-----------------------------------------------------------*/
void vFullDemoIdleHook( void )
{
static TimerHandle_t xCheckTimer = NULL;
if( xCheckTimer == NULL )
{
/* Create the software timer that performs the 'check'
functionality, in the full demo. This is not done before the
scheduler is started as to do so would prevent the standard demo
timer tasks from passing their tests (they expect the timer
command queue to be empty. */
xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
mainCHECK_TIMER_PERIOD_MS, /* The timer period, in this case 3000ms (3s). */
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 );
}
/* Also start some timers that just flash LEDs. */
vStartLEDFlashTimers( mainNUMBER_OF_FLASH_TIMERS_LEDS );
}
}
/*-----------------------------------------------------------*/
void vFullDemoTickHook( void )
{
/* In this case the tick hook is used as part of the queue set test. */
vQueueSetAccessQueueSetFromISR();
/* Use task notifications from an interrupt. */
xNotifyTaskFromISR();
/* Use timers from an interrupt. */
vTimerPeriodicISRTests();
/* Use event groups from an interrupt. */
vPeriodicEventGroupsProcessing();
/* Use mutexes from interrupts. */
vInterruptSemaphorePeriodicTest();
}

View file

@ -83,7 +83,7 @@
#define configUSE_TICK_HOOK 1
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 23 * 1024 ) )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 24 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0

View file

@ -112,9 +112,9 @@ that make up the total heap. This is only done to provide an example of heap_5
being used as this demo could easily create one large heap region instead of
multiple smaller heap regions - in which case heap_4.c would be the more
appropriate choice. */
#define mainREGION_1_SIZE 3001
#define mainREGION_1_SIZE 4001
#define mainREGION_2_SIZE 18105
#define mainREGION_3_SIZE 1407
#define mainREGION_3_SIZE 1807
/*
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
@ -228,10 +228,10 @@ void vApplicationIdleHook( void )
function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */
/* Uncomment the following code to allow the trace to be stopped with any
/* Uncomment the following code to allow the trace to be stopped with any
key press. The code is commented out by default as the kbhit() function
interferes with the run time behaviour. */
/*
/*
if( _kbhit() != pdFALSE )
{
if( xTraceRunning == pdTRUE )
@ -367,6 +367,9 @@ const HeapRegion_t xHeapRegions[] =
array. */
configASSERT( ( ulAdditionalOffset + mainREGION_1_SIZE + mainREGION_2_SIZE + mainREGION_3_SIZE ) < configTOTAL_HEAP_SIZE );
/* Prevent compiler warnings when configASSERT() is not defined. */
( void ) ulAdditionalOffset;
vPortDefineHeapRegions( xHeapRegions );
}
/*-----------------------------------------------------------*/