summaryrefslogtreecommitdiff
path: root/FreeRTOS
diff options
context:
space:
mode:
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2014-12-19 16:27:56 +0000
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2014-12-19 16:27:56 +0000
commit7971989e9fbc3fbf59e9647caeae3044000f57e4 (patch)
treeb9f0624032fce4a452c026c328cdb92925cb6991 /FreeRTOS
parent00234ccb848898af1a57174fd0954e8ac9bd15e4 (diff)
downloadfreertos-7971989e9fbc3fbf59e9647caeae3044000f57e4.tar.gz
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. git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2316 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'FreeRTOS')
-rw-r--r--FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h1
-rw-r--r--FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c45
-rw-r--r--FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c8
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat5
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuobin61952 -> 62976 bytes
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj31
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h3
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c14
-rw-r--r--FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main_full.c137
-rw-r--r--FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h2
-rw-r--r--FreeRTOS/Demo/WIN32-MSVC/main.c11
-rw-r--r--FreeRTOS/Source/include/list.h46
-rw-r--r--FreeRTOS/Source/include/projdefs.h11
-rw-r--r--FreeRTOS/Source/list.c22
-rw-r--r--FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c2
-rw-r--r--FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c28
-rw-r--r--FreeRTOS/Source/portable/GCC/MicroBlazeV8/portasm.S14
-rw-r--r--FreeRTOS/Source/tasks.c45
18 files changed, 327 insertions, 98 deletions
diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h
index d0bf8b2ed..038fc6348 100644
--- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h
@@ -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
diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c
index 36cd22b0b..f11db5ac7 100644
--- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c
+++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/main_full.c
@@ -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;
diff --git a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
index 108b39ee6..fe97be62e 100644
--- a/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
+++ b/FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/main.c
@@ -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
}
diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat
index 26df7ce1d..4150f521e 100644
--- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat
+++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/CreateProjectDirectoryStructure.bat
@@ -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
diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo
index e72f99e07..a19959c2d 100644
--- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo
+++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.atsuo
Binary files differ
diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj
index d97e4ff16..f953787d3 100644
--- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj
+++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/RTOSDemo.cproj
@@ -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>
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 f55e4c763..c0e105e37 100644
--- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/FreeRTOSConfig.h
@@ -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
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 ed98eb91f..ad69a329b 100644
--- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c
+++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4S_Atmel_Studio/src/main.c
@@ -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 */
}
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 2067f66bb..4e4495cec 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
@@ -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,9 +169,24 @@ 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.
*/
static void prvCheckTimerCallback( TimerHandle_t xTimer );
@@ -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 |= 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 = 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();
+}
diff --git a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h
index e4f6ce87b..03f9f68aa 100644
--- a/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/WIN32-MSVC/FreeRTOSConfig.h
@@ -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
diff --git a/FreeRTOS/Demo/WIN32-MSVC/main.c b/FreeRTOS/Demo/WIN32-MSVC/main.c
index 6c10d8dde..21332acc3 100644
--- a/FreeRTOS/Demo/WIN32-MSVC/main.c
+++ b/FreeRTOS/Demo/WIN32-MSVC/main.c
@@ -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 );
}
/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Source/include/list.h b/FreeRTOS/Source/include/list.h
index 99be287fc..70d53da0a 100644
--- a/FreeRTOS/Source/include/list.h
+++ b/FreeRTOS/Source/include/list.h
@@ -91,6 +91,9 @@
* \ingroup FreeRTOSIntro
*/
+#ifndef INC_FREERTOS_H
+ #error FreeRTOS.h must be included before list.h
+#endif
#ifndef LIST_H
#define LIST_H
@@ -130,21 +133,62 @@
#ifdef __cplusplus
extern "C" {
#endif
+
+/* Macros that can be used to place known values within the list structures,
+then check that the known values do not get corrupted during the execution of
+the application. These may catch the list data structures being overwritten in
+memory. They will not catch data errors caused by incorrect configuration or
+use of FreeRTOS.*/
+#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
+ /* Define the macros to do nothing. */
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2
+ #define listLIST_INTEGRITY_CHECK_VALUE_1
+ #define listLIST_INTEGRITY_CHECK_VALUE_2
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem )
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem )
+ #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
+ #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
+ #define listTEST_LIST_ITEM_INTEGRITY( pxItem )
+ #define listTEST_LIST_INTEGRITY( pxList )
+#else
+ /* Define macros that add new members into the list structures. */
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 TickType_t xListItemIntegrityValue1;
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2 TickType_t xListItemIntegrityValue2;
+ #define listLIST_INTEGRITY_CHECK_VALUE_1 TickType_t xListIntegrityValue1;
+ #define listLIST_INTEGRITY_CHECK_VALUE_2 TickType_t xListIntegrityValue2;
+
+ /* Define macros that set the new structure members to known values. */
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
+ #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
+ #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
+
+ /* Define macros that will assert if one of the structure members does not
+ contain its expected value. */
+ #define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
+ #define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
+#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
+
+
/*
* Definition of the only type of object that a list can contain.
*/
struct xLIST_ITEM
{
+ listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
+ listLIST_ITEM_INTEGRITY_CHECK_VALUE_2 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
};
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
struct xMINI_LIST_ITEM
{
+ listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE TickType_t xItemValue;
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
@@ -156,9 +200,11 @@ typedef struct xMINI_LIST_ITEM MiniListItem_t;
*/
typedef struct xLIST
{
+ listLIST_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
+ listLIST_INTEGRITY_CHECK_VALUE_2 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
} List_t;
/*
diff --git a/FreeRTOS/Source/include/projdefs.h b/FreeRTOS/Source/include/projdefs.h
index 0062738af..8aa751255 100644
--- a/FreeRTOS/Source/include/projdefs.h
+++ b/FreeRTOS/Source/include/projdefs.h
@@ -88,6 +88,17 @@ typedef void (*TaskFunction_t)( void * );
#define errQUEUE_BLOCKED ( -4 )
#define errQUEUE_YIELD ( -5 )
+/* Macros used for basic data corruption checks. */
+#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
+ #define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
+#endif
+
+#if( configUSE_16_BIT_TICKS == 1 )
+ #define pdINTEGRITY_CHECK_VALUE 0x5a5a
+#else
+ #define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
+#endif
+
#endif /* PROJDEFS_H */
diff --git a/FreeRTOS/Source/list.c b/FreeRTOS/Source/list.c
index a8d9d5b90..d256fae4c 100644
--- a/FreeRTOS/Source/list.c
+++ b/FreeRTOS/Source/list.c
@@ -89,6 +89,11 @@ void vListInitialise( List_t * const pxList )
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
+
+ /* Write known values into the list if
+ configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
+ listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
+ listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
}
/*-----------------------------------------------------------*/
@@ -96,6 +101,11 @@ void vListInitialiseItem( ListItem_t * const pxItem )
{
/* Make sure the list item is not recorded as being on a list. */
pxItem->pvContainer = NULL;
+
+ /* Write known values into the list item if
+ configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
+ listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem );
+ listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem );
}
/*-----------------------------------------------------------*/
@@ -103,6 +113,12 @@ void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
{
ListItem_t * const pxIndex = pxList->pxIndex;
+ /* Only effective when configASSERT() is also defined, these tests may catch
+ the list data structures being overwritten in memory. They will not catch
+ data errors caused by incorrect configuration or use of FreeRTOS. */
+ listTEST_LIST_INTEGRITY( pxList );
+ listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
+
/* Insert a new list item into pxList, but rather than sort the list,
makes the new list item the last item to be removed by a call to
listGET_OWNER_OF_NEXT_ENTRY(). */
@@ -123,6 +139,12 @@ void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
ListItem_t *pxIterator;
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
+ /* Only effective when configASSERT() is also defined, these tests may catch
+ the list data structures being overwritten in memory. They will not catch
+ data errors caused by incorrect configuration or use of FreeRTOS. */
+ listTEST_LIST_INTEGRITY( pxList );
+ listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
+
/* Insert the new list item into the list, sorted in xItemValue order.
If the list already contains a list item with the same item value then the
diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c
index 25b04f49b..c4a24cbea 100644
--- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c
+++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c
@@ -155,7 +155,7 @@ const uint32_t ulR13 = ( uint32_t ) &_SDA_BASE_;
*pxTopOfStack = ( StackType_t ) 0x00000000;
pxTopOfStack--;
- #if XPAR_MICROBLAZE_0_USE_FPU == 1
+ #if XPAR_MICROBLAZE_0_USE_FPU != 0
/* The FSR value placed in the initial task context is just 0. */
*pxTopOfStack = portINITIAL_FSR;
pxTopOfStack--;
diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c
index 800eaa203..d25fe5aee 100644
--- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c
+++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port_exceptions.c
@@ -1,5 +1,5 @@
/*
- FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
+ FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@@ -120,10 +120,10 @@ extern void vPortExceptionHandlerEntry( void *pvExceptionID );
/*-----------------------------------------------------------*/
-/* vApplicationExceptionRegisterDump() is a callback function that the
+/* vApplicationExceptionRegisterDump() is a callback function that the
application can optionally define to receive a populated xPortRegisterDump
-structure. If the application chooses not to define a version of
-vApplicationExceptionRegisterDump() then this weekly defined default
+structure. If the application chooses not to define a version of
+vApplicationExceptionRegisterDump() then this weekly defined default
implementation will be called instead. */
extern void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump ) __attribute__((weak));
void vApplicationExceptionRegisterDump( xPortRegisterDump *xRegisterDump )
@@ -143,8 +143,8 @@ extern void *pxCurrentTCB;
/* Fill an xPortRegisterDump structure with the MicroBlaze context as it
was immediately before the exception occurrence. */
-
- /* First fill in the name and handle of the task that was in the Running
+
+ /* First fill in the name and handle of the task that was in the Running
state when the exception occurred. */
xRegisterDump.xCurrentTaskHandle = pxCurrentTCB;
xRegisterDump.pcCurrentTaskName = pcTaskGetTaskName( NULL );
@@ -167,7 +167,7 @@ extern void *pxCurrentTCB;
xRegisterDump.ulR18 = pulStackPointerOnFunctionEntry[ portexR18_STACK_OFFSET ];
xRegisterDump.ulR19 = pulStackPointerOnFunctionEntry[ portexR19_STACK_OFFSET ];
xRegisterDump.ulMSR = pulStackPointerOnFunctionEntry[ portexMSR_STACK_OFFSET ];
-
+
/* Obtain the value of all other registers. */
xRegisterDump.ulR2_small_data_area = mfgpr( R2 );
xRegisterDump.ulR13_read_write_small_data_area = mfgpr( R13 );
@@ -190,13 +190,13 @@ extern void *pxCurrentTCB;
xRegisterDump.ulEAR = mfear();
xRegisterDump.ulESR = mfesr();
xRegisterDump.ulEDR = mfedr();
-
+
/* Move the saved program counter back to the instruction that was executed
when the exception occurred. This is only valid for certain types of
exception. */
xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_exceptions - portexINSTRUCTION_SIZE;
- #if XPAR_MICROBLAZE_0_USE_FPU == 1
+ #if XPAR_MICROBLAZE_0_USE_FPU != 0
{
xRegisterDump.ulFSR = mffsr();
}
@@ -239,7 +239,7 @@ extern void *pxCurrentTCB;
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_STACK_VIOLATION or XEXC_ID_MMU";
break;
- #if XPAR_MICROBLAZE_0_USE_FPU == 1
+ #if XPAR_MICROBLAZE_0_USE_FPU != 0
case XEXC_ID_FPU :
xRegisterDump.pcExceptionCause = ( int8_t * const ) "XEXC_ID_FPU see ulFSR value";
@@ -248,10 +248,10 @@ extern void *pxCurrentTCB;
#endif /* XPAR_MICROBLAZE_0_USE_FPU */
}
- /* vApplicationExceptionRegisterDump() is a callback function that the
+ /* vApplicationExceptionRegisterDump() is a callback function that the
application can optionally define to receive the populated xPortRegisterDump
- structure. If the application chooses not to define a version of
- vApplicationExceptionRegisterDump() then the weekly defined default
+ structure. If the application chooses not to define a version of
+ vApplicationExceptionRegisterDump() then the weekly defined default
implementation within this file will be called instead. */
vApplicationExceptionRegisterDump( &xRegisterDump );
@@ -310,7 +310,7 @@ static uint32_t ulHandlersAlreadyInstalled = pdFALSE;
}
/* Exclude the entire file if the MicroBlaze is not configured to handle
-exceptions, or the application defined configuration item
+exceptions, or the application defined configuration item
configINSTALL_EXCEPTION_HANDLERS is not set to 1. */
#endif /* ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) */
diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portasm.S b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portasm.S
index 44cc1ff31..cf5d3389a 100644
--- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portasm.S
+++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portasm.S
@@ -1,5 +1,5 @@
/*
- FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
+ FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
@@ -72,7 +72,7 @@
/* The context is oversized to allow functions called from the ISR to write
back into the caller stack. */
-#if XPAR_MICROBLAZE_0_USE_FPU == 1
+#if XPAR_MICROBLAZE_0_USE_FPU != 0
#define portCONTEXT_SIZE 136
#define portMINUS_CONTEXT_SIZE -136
#else
@@ -175,7 +175,7 @@ back into the caller stack. */
mfs r18, rmsr
swi r18, r1, portMSR_OFFSET
- #if XPAR_MICROBLAZE_0_USE_FPU == 1
+ #if XPAR_MICROBLAZE_0_USE_FPU != 0
/* Stack FSR. */
mfs r18, rfsr
swi r18, r1, portFSR_OFFSET
@@ -184,7 +184,7 @@ back into the caller stack. */
/* Save the top of stack value to the TCB. */
lwi r3, r0, pxCurrentTCB
sw r1, r0, r3
-
+
.endm
.macro portRESTORE_CONTEXT
@@ -228,7 +228,7 @@ back into the caller stack. */
lwi r18, r1, portMSR_OFFSET
mts rmsr, r18
- #if XPAR_MICROBLAZE_0_USE_FPU == 1
+ #if XPAR_MICROBLAZE_0_USE_FPU != 0
/* Reload the FSR from the stack. */
lwi r18, r1, portFSR_OFFSET
mts rfsr, r18
@@ -345,11 +345,11 @@ VPortYieldASM:
vPortStartFirstTask:
portRESTORE_CONTEXT
-
+
#if MICROBLAZE_EXCEPTIONS_ENABLED == 1
-
+
.text
.align 2
vPortExceptionHandlerEntry:
diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c
index 99c005fcc..69aaebb76 100644
--- a/FreeRTOS/Source/tasks.c
+++ b/FreeRTOS/Source/tasks.c
@@ -133,6 +133,7 @@ typedef struct tskTaskControlBlock
#if ( portUSING_MPU_WRAPPERS == 1 )
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
+ BaseType_t xUsingStaticallyAllocatedStack; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */
#endif
ListItem_t xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
@@ -543,6 +544,7 @@ BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcN
{
BaseType_t xReturn;
TCB_t * pxNewTCB;
+StackType_t *pxTopOfStack;
configASSERT( pxTaskCode );
configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );
@@ -553,8 +555,6 @@ TCB_t * pxNewTCB;
if( pxNewTCB != NULL )
{
- StackType_t *pxTopOfStack;
-
#if( portUSING_MPU_WRAPPERS == 1 )
/* Should the task be created in privileged mode? */
BaseType_t xRunPrivileged;
@@ -567,6 +567,20 @@ TCB_t * pxNewTCB;
xRunPrivileged = pdFALSE;
}
uxPriority &= ~portPRIVILEGE_BIT;
+
+ if( puxStackBuffer != NULL )
+ {
+ /* The application provided its own stack. Note this so no
+ attempt is made to delete the stack should that task be
+ deleted. */
+ pxNewTCB->xUsingStaticallyAllocatedStack = pdTRUE;
+ }
+ else
+ {
+ /* The stack was allocated dynamically. Note this so it can be
+ deleted again if the task is deleted. */
+ pxNewTCB->xUsingStaticallyAllocatedStack = pdFALSE;
+ }
#endif /* portUSING_MPU_WRAPPERS == 1 */
/* Calculate the top of stack address. This depends on whether the
@@ -3222,7 +3236,22 @@ TCB_t *pxNewTCB;
_reclaim_reent( &( pxTCB->xNewLib_reent ) );
}
#endif /* configUSE_NEWLIB_REENTRANT */
- vPortFreeAligned( pxTCB->pxStack );
+
+ #if( portUSING_MPU_WRAPPERS == 1 )
+ {
+ /* Only free the stack if it was allocated dynamically in the first
+ place. */
+ if( pxTCB->xUsingStaticallyAllocatedStack == pdFALSE )
+ {
+ vPortFreeAligned( pxTCB->pxStack );
+ }
+ }
+ #else
+ {
+ vPortFreeAligned( pxTCB->pxStack );
+ }
+ #endif
+
vPortFree( pxTCB );
}
@@ -3601,7 +3630,7 @@ TCB_t *pxTCB;
pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );
/* Write the rest of the string. */
- sprintf( pcWriteBuffer, "\t\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
+ sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
pcWriteBuffer += strlen( pcWriteBuffer );
}
@@ -3694,13 +3723,13 @@ TCB_t *pxTCB;
{
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
{
- sprintf( pcWriteBuffer, "\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
+ sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
}
#else
{
/* sizeof( int ) == sizeof( long ) so a smaller
printf() library can be used. */
- sprintf( pcWriteBuffer, "\t\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
+ sprintf( pcWriteBuffer, "\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
}
#endif
}
@@ -3710,13 +3739,13 @@ TCB_t *pxTCB;
consumed less than 1% of the total run time. */
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
{
- sprintf( pcWriteBuffer, "\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
+ sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter );
}
#else
{
/* sizeof( int ) == sizeof( long ) so a smaller
printf() library can be used. */
- sprintf( pcWriteBuffer, "\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
+ sprintf( pcWriteBuffer, "\t%u\t\t<1%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
}
#endif
}