diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.HardwareDebuglinker b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.HardwareDebuglinker
index 99f3c2cda..ee26509c6 100644
--- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.HardwareDebuglinker
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.HardwareDebuglinker
@@ -10,11 +10,8 @@
-
-
-
-
+
@@ -32,6 +29,9 @@
+
+
+
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.cproject b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.cproject
index 412d691d9..06a09b34b 100644
--- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.cproject
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.cproject
@@ -204,7 +204,7 @@
-
+
@@ -215,6 +215,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.project b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.project
index 29a634b92..281d83f6a 100644
--- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.project
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/.project
@@ -35,6 +35,11 @@
2virtual:/virtual
+
+ Source/Common_Demo_Source/Minimal
+ 2
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal
+
Source/Common_Demo_Source/include2
@@ -77,6 +82,51 @@
+
+ 1394031827230
+ Source/Common_Demo_Source/Minimal
+ 6
+
+ org.eclipse.ui.ide.multiFilter
+ 1.0-name-matches-false-false-alt*.c
+
+
+
+ 1394031827245
+ Source/Common_Demo_Source/Minimal
+ 6
+
+ org.eclipse.ui.ide.multiFilter
+ 1.0-name-matches-false-false-com*.c
+
+
+
+ 1394031827261
+ Source/Common_Demo_Source/Minimal
+ 6
+
+ org.eclipse.ui.ide.multiFilter
+ 1.0-name-matches-false-false-cr*.c
+
+
+
+ 1394031827261
+ Source/Common_Demo_Source/Minimal
+ 6
+
+ org.eclipse.ui.ide.multiFilter
+ 1.0-name-matches-false-false-IntQueue.c
+
+
+
+ 1394031827276
+ Source/Common_Demo_Source/Minimal
+ 6
+
+ org.eclipse.ui.ide.multiFilter
+ 1.0-name-matches-false-false-sp_flop.c
+
+ 1393853702360Source/FreeRTOS_Source/portable
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h
index b370b3d73..bfb27922e 100644
--- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/FreeRTOSConfig.h
@@ -83,7 +83,7 @@
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1
-#define configUSE_TICK_HOOK 0
+#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( 120000000UL ) /*_RB_ guess*/
#define configPERIPHERAL_CLOCK_HZ ( 60000000UL ) /*_RB_ guess*/
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
@@ -101,13 +101,14 @@
#define configQUEUE_REGISTRY_SIZE 0
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
-
+#define configUSE_QUEUE_SETS 1
+#define configUSE_COUNTING_SEMAPHORES 1
#define configMAX_PRIORITIES ( 7 )
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1
-#define configTIMER_TASK_PRIORITY ( 3 )
+#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
@@ -138,6 +139,7 @@ to exclude the API function. */
#define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1
#define INCLUDE_eTaskGetState 1
+#define INCLUDE_xTimerPendFunctionCall 1
void vAssertCalled( void );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/RegTest.src b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/RegTest.src
new file mode 100644
index 000000000..27cc31ec6
--- /dev/null
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/RegTest.src
@@ -0,0 +1,238 @@
+;/*
+; FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
+; All rights reserved
+;
+; VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
+;
+; ***************************************************************************
+; * *
+; * FreeRTOS provides completely free yet professionally developed, *
+; * robust, strictly quality controlled, supported, and cross *
+; * platform software that has become a de facto standard. *
+; * *
+; * Help yourself get started quickly and support the FreeRTOS *
+; * project by purchasing a FreeRTOS tutorial book, reference *
+; * manual, or both from: http://www.FreeRTOS.org/Documentation *
+; * *
+; * Thank you! *
+; * *
+; ***************************************************************************
+;
+; This file is part of the FreeRTOS distribution.
+;
+; FreeRTOS is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License (version 2) as published by the
+; Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
+;
+; >>! NOTE: The modification to the GPL is included to allow you to distribute
+; >>! a combined work that includes FreeRTOS without being obliged to provide
+; >>! the source code for proprietary components outside of the FreeRTOS
+; >>! kernel.
+;
+; FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+; FOR A PARTICULAR PURPOSE. Full license text is available from the following
+; link: http://www.freertos.org/a00114.html
+;
+; 1 tab == 4 spaces!
+;
+; ***************************************************************************
+; * *
+; * Having a problem? Start by reading the FAQ "My application does *
+; * not run, what could be wrong?" *
+; * *
+; * http://www.FreeRTOS.org/FAQHelp.html *
+; * *
+; ***************************************************************************
+;
+; http://www.FreeRTOS.org - Documentation, books, training, latest versions,
+; license and Real Time Engineers Ltd. contact details.;
+;
+; http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
+; including FreeRTOS+Trace - an indispensable productivity tool, a DOS
+; compatible FAT file system, and our tiny thread aware UDP/IP stack.
+;
+; http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
+; Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
+; licenses offer ticketed support, indemnification and middleware.
+;
+; http://www.SafeRTOS.com - High Integrity Systems also provide a safety
+; engineered and independently SIL3 certified version for use in safety and
+; mission critical applications that require provable dependability.
+;
+; 1 tab == 4 spaces!
+;*/
+
+ .GLB _vRegTest1Implementation
+ .GLB _vRegTest2Implementation
+
+ .GLB _ulRegTest1LoopCounter
+ .GLB _ulRegTest2LoopCounter
+
+ .SECTION P,CODE
+
+
+;/* This function is explained in the comments at the top of main.c. */
+_vRegTest1Implementation:
+
+ ;/* Put a known value in each register. */
+ MOV.L #1, R1
+ MOV.L #2, R2
+ MOV.L #3, R3
+ MOV.L #4, R4
+ MOV.L #5, R5
+ MOV.L #6, R6
+ MOV.L #7, R7
+ MOV.L #8, R8
+ MOV.L #9, R9
+ MOV.L #10, R10
+ MOV.L #11, R11
+ MOV.L #12, R12
+ MOV.L #13, R13
+ MOV.L #14, R14
+ MOV.L #15, R15
+
+ ;/* Loop, checking each itteration that each register still contains the
+ ;expected value. */
+TestLoop1:
+
+ ;/* Push the registers that are going to get clobbered. */
+ PUSHM R14-R15
+
+ ;/* Increment the loop counter to show this task is still getting CPU time. */
+ MOV.L #_ulRegTest1LoopCounter, R14
+ MOV.L [ R14 ], R15
+ ADD #1, R15
+ MOV.L R15, [ R14 ]
+
+ ;/* Yield to extend the text coverage. Set the bit in the ITU SWINTR register. */
+ MOV.L #1, R14
+ MOV.L #0872E0H, R15
+ MOV.B R14, [R15]
+ NOP
+ NOP
+
+ ;/* Restore the clobbered registers. */
+ POPM R14-R15
+
+ ;/* Now compare each register to ensure it still contains the value that was
+ ;set before this loop was entered. */
+ CMP #1, R1
+ BNE RegTest1Error
+ CMP #2, R2
+ BNE RegTest1Error
+ CMP #3, R3
+ BNE RegTest1Error
+ CMP #4, R4
+ BNE RegTest1Error
+ CMP #5, R5
+ BNE RegTest1Error
+ CMP #6, R6
+ BNE RegTest1Error
+ CMP #7, R7
+ BNE RegTest1Error
+ CMP #8, R8
+ BNE RegTest1Error
+ CMP #9, R9
+ BNE RegTest1Error
+ CMP #10, R10
+ BNE RegTest1Error
+ CMP #11, R11
+ BNE RegTest1Error
+ CMP #12, R12
+ BNE RegTest1Error
+ CMP #13, R13
+ BNE RegTest1Error
+ CMP #14, R14
+ BNE RegTest1Error
+ CMP #15, R15
+ BNE RegTest1Error
+
+ ;/* All comparisons passed, start a new itteratio of this loop. */
+ BRA TestLoop1
+
+RegTest1Error:
+ ;/* A compare failed, just loop here so the loop counter stops incrementing
+ ;- causing the check task to indicate the error. */
+ BRA RegTest1Error
+;/*-----------------------------------------------------------*/
+
+;/* This function is explained in the comments at the top of main.c. */
+_vRegTest2Implementation:
+
+ ;/* Put a known value in each register. */
+ MOV.L #10H, R1
+ MOV.L #20H, R2
+ MOV.L #30H, R3
+ MOV.L #40H, R4
+ MOV.L #50H, R5
+ MOV.L #60H, R6
+ MOV.L #70H, R7
+ MOV.L #80H, R8
+ MOV.L #90H, R9
+ MOV.L #100H, R10
+ MOV.L #110H, R11
+ MOV.L #120H, R12
+ MOV.L #130H, R13
+ MOV.L #140H, R14
+ MOV.L #150H, R15
+
+ ;/* Loop, checking each itteration that each register still contains the
+ ;expected value. */
+TestLoop2:
+
+ ;/* Push the registers that are going to get clobbered. */
+ PUSHM R14-R15
+
+ ;/* Increment the loop counter to show this task is still getting CPU time. */
+ MOV.L #_ulRegTest2LoopCounter, R14
+ MOV.L [ R14 ], R15
+ ADD #1, R15
+ MOV.L R15, [ R14 ]
+
+ ;/* Restore the clobbered registers. */
+ POPM R14-R15
+
+ ;/* Now compare each register to ensure it still contains the value that was
+ ;set before this loop was entered. */
+ CMP #10H, R1
+ BNE RegTest2Error
+ CMP #20H, R2
+ BNE RegTest2Error
+ CMP #30H, R3
+ BNE RegTest2Error
+ CMP #40H, R4
+ BNE RegTest2Error
+ CMP #50H, R5
+ BNE RegTest2Error
+ CMP #60H, R6
+ BNE RegTest2Error
+ CMP #70H, R7
+ BNE RegTest2Error
+ CMP #80H, R8
+ BNE RegTest2Error
+ CMP #90H, R9
+ BNE RegTest2Error
+ CMP #100H, R10
+ BNE RegTest2Error
+ CMP #110H, R11
+ BNE RegTest2Error
+ CMP #120H, R12
+ BNE RegTest2Error
+ CMP #130H, R13
+ BNE RegTest2Error
+ CMP #140H, R14
+ BNE RegTest2Error
+ CMP #150H, R15
+ BNE RegTest2Error
+
+ ;/* All comparisons passed, start a new itteratio of this loop. */
+ BRA TestLoop2
+
+RegTest2Error:
+ ;/* A compare failed, just loop here so the loop counter stops incrementing
+ ;- causing the check task to indicate the error. */
+ BRA RegTest2Error
+
+
+ .END
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c
index 9dbd3b13b..4c51843c5 100644
--- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main.c
@@ -86,16 +86,13 @@
#include "semphr.h"
/* Standard demo includes. */
-//#include "partest.h"
-//#include "TimerDemo.h"
-//#include "QueueOverwrite.h"
-//#include "EventGroupsDemo.h"
+#include "partest.h"
+#include "TimerDemo.h"
+#include "QueueOverwrite.h"
+#include "EventGroupsDemo.h"
/* Renesas includes. */
#include "r_cg_macrodriver.h"
-//#include "r_cg_cgc.h"
-//#include "r_cg_cmt.h"
-//#include "r_cg_userdefine.h"
/* Set option bytes */
#pragma address OFS0_location = 0xFFFFFF8CUL
@@ -106,7 +103,7 @@ volatile const uint32_t OFS1_location = 0xFFFFFFFFUL;
/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
or 0 to run the more comprehensive test and demo application. */
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
/*-----------------------------------------------------------*/
@@ -251,6 +248,11 @@ volatile unsigned long ul = 0;
This allows the application to choose the tick interrupt source. */
void vApplicationSetupTimerInterrupt( void )
{
+const uint32_t ulEnableRegisterWrite = 0xA50BUL, ulDisableRegisterWrite = 0xA500UL;
+
+ /* Disable register write protection. */
+ SYSTEM.PRCR.WORD = ulEnableRegisterWrite;
+
/* Enable compare match timer 0. */
MSTP( CMT0 ) = 0;
@@ -271,5 +273,8 @@ void vApplicationSetupTimerInterrupt( void )
/* Start the timer. */
CMT.CMSTR0.BIT.STR0 = 1;
+
+ /* Reneable register protection. */
+ SYSTEM.PRCR.WORD = ulDisableRegisterWrite;
}
/*-----------------------------------------------------------*/
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c
index b84f2a020..9c39e72b9 100644
--- a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_blinky.c
@@ -182,7 +182,7 @@ void main_blinky( void )
static void prvQueueSendTask( void *pvParameters )
{
TickType_t xNextWakeTime;
-const unsigned long ulValueToSend = 100UL;
+const uint32_t ulValueToSend = 100UL;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
@@ -204,10 +204,12 @@ const unsigned long ulValueToSend = 100UL;
}
/*-----------------------------------------------------------*/
+volatile uint32_t ulRxEvents = 0;
+
static void prvQueueReceiveTask( void *pvParameters )
{
-unsigned long ulReceivedValue;
-const unsigned long ulExpectedValue = 100UL;
+uint32_t ulReceivedValue;
+const uint32_t ulExpectedValue = 100UL;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
@@ -225,6 +227,7 @@ const unsigned long ulExpectedValue = 100UL;
{
vParTestToggleLED( mainTASK_LED );
ulReceivedValue = 0U;
+ ulRxEvents++;
}
}
}
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c
new file mode 100644
index 000000000..075430eb4
--- /dev/null
+++ b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/main_full.c
@@ -0,0 +1,491 @@
+/*
+ FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd.
+ All rights reserved
+
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
+
+ ***************************************************************************
+ * *
+ * FreeRTOS provides completely free yet professionally developed, *
+ * robust, strictly quality controlled, supported, and cross *
+ * platform software that has become a de facto standard. *
+ * *
+ * Help yourself get started quickly and support the FreeRTOS *
+ * project by purchasing a FreeRTOS tutorial book, reference *
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *
+ * *
+ * Thank you! *
+ * *
+ ***************************************************************************
+
+ This file is part of the FreeRTOS distribution.
+
+ FreeRTOS is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License (version 2) as published by the
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
+
+ >>! NOTE: The modification to the GPL is included to allow you to distribute
+ >>! a combined work that includes FreeRTOS without being obliged to provide
+ >>! the source code for proprietary components outside of the FreeRTOS
+ >>! kernel.
+
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following
+ link: http://www.freertos.org/a00114.html
+
+ 1 tab == 4 spaces!
+
+ ***************************************************************************
+ * *
+ * Having a problem? Start by reading the FAQ "My application does *
+ * not run, what could be wrong?" *
+ * *
+ * http://www.FreeRTOS.org/FAQHelp.html *
+ * *
+ ***************************************************************************
+
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,
+ license and Real Time Engineers Ltd. contact details.
+
+ http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.
+
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
+ licenses offer ticketed support, indemnification and middleware.
+
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety
+ engineered and independently SIL3 certified version for use in safety and
+ mission critical applications that require provable dependability.
+
+ 1 tab == 4 spaces!
+*/
+
+/******************************************************************************
+ * NOTE 1: This project provides two demo applications. A simple blinky style
+ * project, and a more comprehensive test and demo application. The
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
+ * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
+ * in main.c. This file implements the comprehensive test and demo version.
+ *
+ * NOTE 2: This file only contains the source code that is specific to the
+ * full demo. Generic functions, such FreeRTOS hook functions, and functions
+ * required to configure the hardware, are defined in main.c.
+ *
+ ******************************************************************************
+ *
+ * main_full() creates all the demo application tasks and software timers, then
+ * 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
+ * defined and/or created within this file:
+ *
+ * FreeRTOS+CLI command console. The command console is access through the
+ * UART to USB connector on the ZC702 Zynq development board (marked J2). For
+ * reasons of robustness testing the UART driver is deliberately written to be
+ * inefficient and should not be used as a template for a production driver.
+ * Type "help" to see a list of registered commands. The FreeRTOS+CLI license
+ * is different to the FreeRTOS license, see http://www.FreeRTOS.org/cli for
+ * license and usage details. The default baud rate is 115200.
+ *
+ * "Reg test" tasks - These fill both the core and floating point registers with
+ * known values, then check that each register maintains its expected value for
+ * the lifetime of the task. Each task uses a different set of values. The reg
+ * test tasks execute with a very low priority, so get preempted very
+ * frequently. A register containing an unexpected value is indicative of an
+ * error in the context switching mechanism.
+ *
+ * "Check" task - The check task period is initially set to three seconds. The
+ * task checks that all the standard demo tasks, and the register check tasks,
+ * are not only still executing, but are executing without reporting any errors.
+ * If the check task 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 task also toggles an LED each time it is
+ * called. This provides a visual indication of the system status: If the LED
+ * toggles every three seconds, then no issues have been discovered. If the LED
+ * toggles every 200ms, then an issue has been discovered with at least one
+ * task.
+ */
+
+/* Standard includes. */
+#include
+
+/* Kernel includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "timers.h"
+#include "semphr.h"
+
+/* Standard demo application includes. */
+#include "flop.h"
+#include "semtest.h"
+#include "dynamic.h"
+#include "BlockQ.h"
+#include "blocktim.h"
+#include "countsem.h"
+#include "GenQTest.h"
+#include "recmutex.h"
+#include "death.h"
+#include "partest.h"
+#include "comtest2.h"
+#include "serial.h"
+#include "TimerDemo.h"
+#include "QueueOverwrite.h"
+#include "IntQueue.h"
+#include "EventGroupsDemo.h"
+
+/* Priorities for the demo application tasks. */
+#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
+#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )
+#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
+#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
+#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3UL )
+#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
+#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
+
+/* The priority used by the UART command console task. */
+#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
+
+/* The LED used by the check timer. */
+#define mainCHECK_LED ( 0 )
+
+/* A block time of zero simply means "don't block". */
+#define mainDONT_BLOCK ( 0UL )
+
+/* 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 mainNO_ERROR_CHECK_TASK_PERIOD ( 3000UL / portTICK_PERIOD_MS )
+
+/* 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_TASK_PERIOD ( 200UL / portTICK_PERIOD_MS )
+
+/* Parameters that are passed into the register check tasks solely for the
+purpose of ensuring parameters are passed into tasks correctly. */
+#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
+#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
+
+/* The base period used by the timer test tasks. */
+#define mainTIMER_TEST_PERIOD ( 50 )
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Called by main() to run the full demo (as opposed to the blinky demo) when
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
+ */
+void main_full( void );
+
+/*
+ * The check task, as described at the top of this file.
+ */
+static void prvCheckTask( void *pvParameters );
+
+/*
+ * Register check tasks, and the tasks used to write over and check the contents
+ * of the FPU registers, as described at the top of this file. The nature of
+ * these files necessitates that they are written in an assembly file, but the
+ * entry points are kept in the C file for the convenience of checking the task
+ * parameter.
+ */
+static void prvRegTestTaskEntry1( void *pvParameters );
+extern void vRegTest1Implementation( void );
+static void prvRegTestTaskEntry2( void *pvParameters );
+extern void vRegTest2Implementation( void );
+
+/*
+ * Register commands that can be used with FreeRTOS+CLI. The commands are
+ * defined in CLI-Commands.c and File-Related-CLI-Command.c respectively.
+ */
+extern void vRegisterSampleCLICommands( void );
+
+/*
+ * The task that manages the FreeRTOS+CLI input and output.
+ */
+extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );
+
+/*
+ * A high priority task that does nothing other than execute at a pseudo random
+ * time to ensure the other test tasks don't just execute in a repeating
+ * pattern.
+ */
+static void prvPseudoRandomiser( void *pvParameters );
+
+/*-----------------------------------------------------------*/
+
+/* The following two variables are used to communicate the status of the
+register check tasks to the check task. If the variables keep incrementing,
+then the register check tasks has not discovered any errors. If a variable
+stops incrementing, then an error has been found. */
+volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
+
+/*-----------------------------------------------------------*/
+
+void main_full( void )
+{
+ /* Start all the other standard demo/test tasks. They have not particular
+ functionality, but do demonstrate how to use the FreeRTOS API and test the
+ kernel port. */
+// vStartInterruptQueueTasks();
+ vStartDynamicPriorityTasks();
+ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
+ vCreateBlockTimeTasks();
+ vStartCountingSemaphoreTasks();
+ vStartGenericQueueTasks( tskIDLE_PRIORITY );
+ vStartRecursiveMutexTasks();
+ vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
+ vStartMathTasks( mainFLOP_TASK_PRIORITY );
+ vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
+ vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
+ vStartEventGroupTasks();
+
+ /* Start the tasks that implements the command console on the UART, as
+ described above. */
+// vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );
+
+ /* Register the standard CLI commands. */
+// vRegisterSampleCLICommands();
+
+ /* Create the register check tasks, as described at the top of this file */
+ xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
+ xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
+
+ /* Create the task that just adds a little random behaviour. */
+ xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
+
+ /* Create the task that performs the 'check' functionality, as described at
+ the top of this file. */
+ xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
+
+ /* 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 either insufficient FreeRTOS heap memory available for the idle
+ and/or timer tasks to be created, or vTaskStartScheduler() was called from
+ User mode. See the memory management section on the FreeRTOS web site for
+ more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
+ mode from which main() is called is set in the C start up code and must be
+ a privileged mode (not user mode). */
+ for( ;; );
+}
+/*-----------------------------------------------------------*/
+
+static void prvCheckTask( void *pvParameters )
+{
+TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
+TickType_t xLastExecutionTime;
+static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
+unsigned long ulErrorFound = pdFALSE;
+
+ /* Just to stop compiler warnings. */
+ ( void ) pvParameters;
+
+ /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
+ works correctly. */
+ xLastExecutionTime = xTaskGetTickCount();
+
+ /* Cycle for ever, delaying then checking all the other tasks are still
+ operating without error. The onboard LED is toggled on each iteration.
+ If an error is detected then the delay period is decreased from
+ mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the
+ effect of increasing the rate at which the onboard LED toggles, and in so
+ doing gives visual feedback of the system status. */
+ for( ;; )
+ {
+ /* Delay until it is time to execute again. */
+ vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
+
+ /* Check all the demo tasks (other than the flash tasks) to ensure
+ that they are all still running, and that none have detected an error. */
+// if( xAreIntQueueTasksStillRunning() != pdTRUE )
+ {
+// ulErrorFound = pdTRUE;
+ }
+
+ if( xAreMathsTaskStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xAreBlockingQueuesStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xIsCreateTaskStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xAreSemaphoreTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xAreTimerDemoTasksStillRunning( ( TickType_t ) mainNO_ERROR_CHECK_TASK_PERIOD ) != pdPASS )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ if( xAreEventGroupTasksStillRunning() != pdPASS )
+ {
+ ulErrorFound = pdTRUE;
+ }
+
+ /* Check that the register test 1 task is still running. */
+ if( ulLastRegTest1Value == ulRegTest1LoopCounter )
+ {
+ ulErrorFound = pdTRUE;
+ }
+ ulLastRegTest1Value = ulRegTest1LoopCounter;
+
+ /* Check that the register test 2 task is still running. */
+ if( ulLastRegTest2Value == ulRegTest2LoopCounter )
+ {
+// ulErrorFound = pdTRUE;
+ }
+ ulLastRegTest2Value = ulRegTest2LoopCounter;
+
+ /* Toggle the check LED to give an indication of the system status. If
+ the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then
+ everything is ok. A faster toggle indicates an error. */
+ vParTestToggleLED( mainCHECK_LED );
+
+ if( ulErrorFound != pdFALSE )
+ {
+ /* An error has been detected in one of the tasks - flash the LED
+ at a higher frequency to give visible feedback that something has
+ gone wrong (it might just be that the loop back connector required
+ by the comtest tasks has not been fitted). */
+ xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
+ }
+ }
+}
+/*-----------------------------------------------------------*/
+
+static void prvRegTestTaskEntry1( void *pvParameters )
+{
+ /* Although the regtest task is written in assembler, its entry point is
+ written in C for convenience of checking the task parameter is being passed
+ in correctly. */
+ if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
+ {
+ /* The reg test task also tests the floating point registers. Tasks
+ that use the floating point unit must call vPortTaskUsesFPU() before
+ any floating point instructions are executed. */
+// vPortTaskUsesFPU();
+
+ /* Start the part of the test that is written in assembler. */
+ vRegTest1Implementation();
+ }
+
+ /* The following line will only execute if the task parameter is found to
+ be incorrect. The check timer will detect that the regtest loop counter is
+ not being incremented and flag an error. */
+ vTaskDelete( NULL );
+}
+/*-----------------------------------------------------------*/
+
+static void prvRegTestTaskEntry2( void *pvParameters )
+{
+ /* Although the regtest task is written in assembler, its entry point is
+ written in C for convenience of checking the task parameter is being passed
+ in correctly. */
+ if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
+ {
+ /* The reg test task also tests the floating point registers. Tasks
+ that use the floating point unit must call vPortTaskUsesFPU() before
+ any floating point instructions are executed. */
+// vPortTaskUsesFPU();
+
+ /* Start the part of the test that is written in assembler. */
+ vRegTest2Implementation();
+ }
+
+ /* The following line will only execute if the task parameter is found to
+ be incorrect. The check timer will detect that the regtest loop counter is
+ not being incremented and flag an error. */
+ vTaskDelete( NULL );
+}
+/*-----------------------------------------------------------*/
+
+static void prvPseudoRandomiser( void *pvParameters )
+{
+const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS );
+volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue;
+
+ /* This task does nothing other than ensure there is a little bit of
+ disruption in the scheduling pattern of the other tasks. Normally this is
+ done by generating interrupts at pseudo random times. */
+ for( ;; )
+ {
+ ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
+ ulValue = ( ulNextRand >> 16UL ) & 0xffUL;
+
+ if( ulValue < ulMinDelay )
+ {
+ ulValue = ulMinDelay;
+ }
+
+ vTaskDelay( ulValue );
+
+ while( ulValue > 0 )
+ {
+ nop();
+ nop();
+ nop();
+
+ ulValue--;
+ }
+ }
+}
+
+
+
+
+
+