]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_MPU_LPC1768_GCC_RedSuite/src/main.c
Update version number to 8.1.2 after moving the defaulting of configUSE_PORT_OPTIMISE...
[freertos] / FreeRTOS / Demo / CORTEX_MPU_LPC1768_GCC_RedSuite / src / main.c
index 078232ea5597dba00d915433b9c5aca1ffeddc8d..40c3efe90bd2f29e50b25930c5b85a1ad93ff345 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
-    FreeRTOS V7.5.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
     the terms of the GNU General Public License (version 2) as published by the\r
     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
 \r
-    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
-    >>! a combined work that includes FreeRTOS without being obliged to provide\r
-    >>! the source code for proprietary components outside of the FreeRTOS\r
-    >>! kernel.\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
 \r
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
@@ -70,7 +71,7 @@
  * User mode and Privileged mode, and using both the original xTaskCreate() and\r
  * the new xTaskCreateRestricted() API functions.  The purpose of each created\r
  * task is documented in the comments above the task function prototype (in\r
- * this file), with the task behaviour demonstrated and documented within the \r
+ * this file), with the task behaviour demonstrated and documented within the\r
  * task function itself.  In addition a queue is used to demonstrate passing\r
  * data between protected/restricted tasks as well as passing data between an\r
  * interrupt and a protected/restricted task.\r
@@ -116,7 +117,7 @@ achieved. */
 /* Prototypes for functions that implement tasks. -----------*/\r
 /*-----------------------------------------------------------*/\r
 \r
-/* \r
+/*\r
  * Prototype for the reg test tasks.  Amongst other things, these fill the CPU\r
  * registers with known values before checking that the registers still contain\r
  * the expected values.  Each of the two tasks use different values so an error\r
@@ -146,15 +147,15 @@ static void prvRegTest2Task( void *pvParameters );
 static void prvCheckTask( void *pvParameters );\r
 \r
 /*\r
- * Prototype for a task created in User mode using the original vTaskCreate() \r
+ * Prototype for a task created in User mode using the original vTaskCreate()\r
  * API function.  The task demonstrates the characteristics of such a task,\r
  * before simply deleting itself.\r
  */\r
 static void prvOldStyleUserModeTask( void *pvParameters );\r
 \r
 /*\r
- * Prototype for a task created in Privileged mode using the original \r
- * vTaskCreate() API function.  The task demonstrates the characteristics of \r
+ * Prototype for a task created in Privileged mode using the original\r
+ * vTaskCreate() API function.  The task demonstrates the characteristics of\r
  * such a task, before simply deleting itself.\r
  */\r
 static void prvOldStylePrivilegedModeTask( void *pvParameters );\r
@@ -182,7 +183,7 @@ static void prvDeleteMe( void ) __attribute__((noinline));
  * If a reg test task detects an error it will delete itself, and in so doing\r
  * prevent itself from sending any more 'I'm Alive' messages to the check task.\r
  */\r
-static void prvSendImAlive( xQueueHandle xHandle, unsigned long ulTaskNumber );\r
+static void prvSendImAlive( QueueHandle_t xHandle, unsigned long ulTaskNumber );\r
 \r
 /*\r
  * The check task is created with access to three memory regions (plus its\r
@@ -199,9 +200,9 @@ static void prvTestMemoryRegions( void );
 /* The handle of the queue used to communicate between tasks and between tasks\r
 and interrupts.  Note that this is a file scope variable that falls outside of\r
 any MPU region.  As such other techniques have to be used to allow the tasks\r
-to gain access to the queue.  See the comments in the tasks themselves for \r
+to gain access to the queue.  See the comments in the tasks themselves for\r
 further information. */\r
-static xQueueHandle xFileScopeCheckQueue = NULL;\r
+static QueueHandle_t xFileScopeCheckQueue = NULL;\r
 \r
 \r
 \r
@@ -215,19 +216,19 @@ stack size is defined in words, not bytes. */
 #define mainCHECK_TASK_STACK_ALIGNMENT ( mainCHECK_TASK_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )\r
 \r
 /* Declare the stack that will be used by the check task.  The kernel will\r
- automatically create an MPU region for the stack.  The stack alignment must \r
- match its size, so if 128 words are reserved for the stack then it must be \r
+ automatically create an MPU region for the stack.  The stack alignment must\r
+ match its size, so if 128 words are reserved for the stack then it must be\r
  aligned to ( 128 * 4 ) bytes. */\r
 static portSTACK_TYPE xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] mainALIGN_TO( mainCHECK_TASK_STACK_ALIGNMENT );\r
 \r
 /* Declare three arrays - an MPU region will be created for each array\r
-using the xTaskParameters structure below.  THIS IS JUST TO DEMONSTRATE THE\r
+using the TaskParameters_t structure below.  THIS IS JUST TO DEMONSTRATE THE\r
 MPU FUNCTIONALITY, the data is not used by the check tasks primary function\r
 of monitoring the reg test tasks and printing out status information.\r
 \r
-Note that the arrays allocate slightly more RAM than is actually assigned to \r
-the MPU region.  This is to permit writes off the end of the array to be \r
-detected even when the arrays are placed in adjacent memory locations (with no \r
+Note that the arrays allocate slightly more RAM than is actually assigned to\r
+the MPU region.  This is to permit writes off the end of the array to be\r
+detected even when the arrays are placed in adjacent memory locations (with no\r
 gaps between them).  The align size must be a power of two. */\r
 #define mainREAD_WRITE_ARRAY_SIZE 130\r
 #define mainREAD_WRITE_ALIGN_SIZE 128\r
@@ -241,12 +242,12 @@ char cReadOnlyArray[ mainREAD_ONLY_ARRAY_SIZE ] mainALIGN_TO( mainREAD_ONLY_ALIG
 #define mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE 128\r
 char cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] mainALIGN_TO( mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE );\r
 \r
-/* Fill in a xTaskParameters structure to define the check task - this is the\r
+/* Fill in a TaskParameters_t structure to define the check task - this is the\r
 structure passed to the xTaskCreateRestricted() function. */\r
-static const xTaskParameters xCheckTaskParameters =\r
+static const TaskParameters_t xCheckTaskParameters =\r
 {\r
        prvCheckTask,                                                           /* pvTaskCode - the function that implements the task. */\r
-       ( signed char * ) "Check",                                      /* pcName                       */\r
+       "Check",                                                                        /* pcName                       */\r
        mainCHECK_TASK_STACK_SIZE_WORDS,                        /* usStackDepth - defined in words, not bytes. */\r
        ( void * ) 0x12121212,                                          /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */\r
        ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT,/* uxPriority - this is the highest priority task in the system.  The task is created in privileged mode to demonstrate accessing the privileged only data. */\r
@@ -257,7 +258,7 @@ static const xTaskParameters xCheckTaskParameters =
        created with different parameters.  Again, THIS IS JUST TO DEMONSTRATE THE\r
        MPU FUNCTIONALITY, the data is not used by the check tasks primary function\r
        of monitoring the reg test tasks and printing out status information.*/\r
-       {                                                                                       \r
+       {\r
                /* Base address                                 Length                                                                  Parameters */\r
         { cReadWriteArray,                             mainREAD_WRITE_ALIGN_SIZE,                              portMPU_REGION_READ_WRITE },\r
         { cReadOnlyArray,                              mainREAD_ONLY_ALIGN_SIZE,                               portMPU_REGION_READ_ONLY },\r
@@ -265,15 +266,15 @@ static const xTaskParameters xCheckTaskParameters =
        }\r
 };\r
 \r
-/* Three MPU regions are defined for use by the 'check' task when the task is \r
+/* Three MPU regions are defined for use by the 'check' task when the task is\r
 created.  These are only used to demonstrate the MPU features and are not\r
 actually necessary for the check task to fulfill its primary purpose.  Instead\r
-the MPU regions are replaced with those defined by xAltRegions prior to the \r
+the MPU regions are replaced with those defined by xAltRegions prior to the\r
 check task receiving any data on the queue or printing any messages to the\r
 debug console.  The MPU region defined below covers the GPIO peripherals used\r
 to write to the LCD. */\r
-static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =\r
-{                                                                                      \r
+static const MemoryRegion_t xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] =\r
+{\r
        /* Base address                         Length                  Parameters */\r
        { mainGPIO_START_ADDRESS,       ( 64 * 1024 ),  portMPU_REGION_READ_WRITE },\r
        { 0,                                            0,                              0 },\r
@@ -292,17 +293,17 @@ that stack size is defined in words, not bytes. */
 #define mainREG_TEST_STACK_ALIGNMENT   ( mainREG_TEST_STACK_SIZE_WORDS * sizeof( portSTACK_TYPE ) )\r
 \r
 /* Declare the stacks that will be used by the reg test tasks.  The kernel will\r
-automatically create an MPU region for the stack.  The stack alignment must \r
-match its size, so if 128 words are reserved for the stack then it must be \r
+automatically create an MPU region for the stack.  The stack alignment must\r
+match its size, so if 128 words are reserved for the stack then it must be\r
 aligned to ( 128 * 4 ) bytes. */\r
 static portSTACK_TYPE xRegTest1Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );\r
 static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_TO( mainREG_TEST_STACK_ALIGNMENT );\r
 \r
-/* Fill in a xTaskParameters structure per reg test task to define the tasks. */\r
-static const xTaskParameters xRegTest1Parameters =\r
+/* Fill in a TaskParameters_t structure per reg test task to define the tasks. */\r
+static const TaskParameters_t xRegTest1Parameters =\r
 {\r
        prvRegTest1Task,                                                /* pvTaskCode - the function that implements the task. */\r
-       ( signed char * ) "RegTest1",                   /* pcName                       */\r
+       "RegTest1",                                                             /* pcName                       */\r
        mainREG_TEST_STACK_SIZE_WORDS,                  /* usStackDepth         */\r
        ( void * ) 0x12345678,                                  /* pvParameters - this value is just to test that the parameter is being passed into the task correctly. */\r
        tskIDLE_PRIORITY | portPRIVILEGE_BIT,   /* uxPriority - note that this task is created with privileges to demonstrate one method of passing a queue handle into the task. */\r
@@ -316,10 +317,10 @@ static const xTaskParameters xRegTest1Parameters =
 };\r
 /*-----------------------------------------------------------*/\r
 \r
-static xTaskParameters xRegTest2Parameters =\r
+static TaskParameters_t xRegTest2Parameters =\r
 {\r
        prvRegTest2Task,                                /* pvTaskCode - the function that implements the task. */\r
-       ( signed char * ) "RegTest2",   /* pcName                       */\r
+       "RegTest2",                                             /* pcName                       */\r
        mainREG_TEST_STACK_SIZE_WORDS,  /* usStackDepth         */\r
        ( void * ) NULL,                                /* pvParameters - this task uses the parameter to pass in a queue handle, but the queue is not created yet. */\r
        tskIDLE_PRIORITY,                               /* uxPriority           */\r
@@ -356,7 +357,7 @@ int main( void )
        /* Create the tasks that are created using the original xTaskCreate() API\r
        function. */\r
        xTaskCreate(    prvOldStyleUserModeTask,        /* The function that implements the task. */\r
-                                       ( signed char * ) "Task1",      /* Text name for the task. */\r
+                                       "Task1",                                        /* Text name for the task. */\r
                                        100,                                            /* Stack depth in words. */\r
                                        NULL,                                           /* Task parameters. */\r
                                        3,                                                      /* Priority and mode (user in this case). */\r
@@ -364,7 +365,7 @@ int main( void )
                                );\r
 \r
        xTaskCreate(    prvOldStylePrivilegedModeTask,  /* The function that implements the task. */\r
-                                       ( signed char * ) "Task2",              /* Text name for the task. */\r
+                                       "Task2",                                                /* Text name for the task. */\r
                                        100,                                                    /* Stack depth in words. */\r
                                        NULL,                                                   /* Task parameters. */\r
                                        ( 3 | portPRIVILEGE_BIT ),              /* Priority and mode. */\r
@@ -387,7 +388,7 @@ static void prvCheckTask( void *pvParameters )
 queue variable.  Take a stack copy of this before the task is set into user\r
 mode.  Once that task is in user mode the file scope queue variable will no\r
 longer be accessible but the stack copy will. */\r
-xQueueHandle xQueue = xFileScopeCheckQueue;\r
+QueueHandle_t xQueue = xFileScopeCheckQueue;\r
 long lMessage;\r
 unsigned long ulStillAliveCounts[ 2 ] = { 0 };\r
 char *pcStatusMessage = "PASS\r\n";\r
@@ -396,7 +397,7 @@ unsigned char x = 5, y = 10;
        /* Just to remove compiler warning. */\r
        ( void ) pvParameters;\r
 \r
-       /* Demonstrate how the various memory regions can and can't be accessed. \r
+       /* Demonstrate how the various memory regions can and can't be accessed.\r
        The task privilege is set down to user mode within this function. */\r
        prvTestMemoryRegions();\r
 \r
@@ -410,26 +411,26 @@ unsigned char x = 5, y = 10;
        {\r
                /* Wait for the next message to arrive. */\r
                xQueueReceive( xQueue, &lMessage, portMAX_DELAY );\r
-               \r
+\r
                switch( lMessage )\r
                {\r
-                       case mainREG_TEST_1_STILL_EXECUTING     :       \r
+                       case mainREG_TEST_1_STILL_EXECUTING     :\r
                                        /* Message from task 1, so task 1 must still be executing. */\r
                                        ( ulStillAliveCounts[ 0 ] )++;\r
                                        break;\r
 \r
-                       case mainREG_TEST_2_STILL_EXECUTING     :                                               \r
+                       case mainREG_TEST_2_STILL_EXECUTING     :\r
                                        /* Message from task 2, so task 2 must still be executing. */\r
                                        ( ulStillAliveCounts[ 1 ] )++;\r
                                        break;\r
 \r
-                       case mainPRINT_SYSTEM_STATUS            :       \r
+                       case mainPRINT_SYSTEM_STATUS            :\r
                                        /* Message from tick hook, time to print out the system\r
                                        status.  If messages has stopped arriving from either reg\r
                                        test task then the status must be set to fail. */\r
                                        if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 )  )\r
                                        {\r
-                                               /* One or both of the test tasks are no longer sending \r
+                                               /* One or both of the test tasks are no longer sending\r
                                                'still alive' messages. */\r
                                                pcStatusMessage = "FAIL\r\n";\r
                                        }\r
@@ -437,7 +438,7 @@ unsigned char x = 5, y = 10;
                                        /* Print a pass/fail message to the LCD - moving the\r
                                        message each time to provide feedback that the output\r
                                        is still being produced.  LCD_PrintString() accesses const\r
-                                       data stored in flash, which all tasks are at liberty to do, \r
+                                       data stored in flash, which all tasks are at liberty to do,\r
                                        and GPIO for which an MPU region has been set up for it. */\r
                                        LCD_ClearScreen();\r
                                        LCD_PrintString( x>>1, y>>1, pcStatusMessage, 6, COLOR_RED );\r
@@ -449,7 +450,7 @@ unsigned char x = 5, y = 10;
                                        break;\r
 \r
                default :\r
-                                       /* Something unexpected happened.  Delete this task so the \r
+                                       /* Something unexpected happened.  Delete this task so the\r
                                        error is apparent (no output will be displayed). */\r
                                        prvDeleteMe();\r
                                        break;\r
@@ -463,8 +464,8 @@ static void prvTestMemoryRegions( void )
 long l;\r
 char cTemp;\r
 \r
-       /* The check task (from which this function is called) is created in the \r
-       Privileged mode.  The privileged array can be both read from and written \r
+       /* The check task (from which this function is called) is created in the\r
+       Privileged mode.  The privileged array can be both read from and written\r
        to while this task is privileged. */\r
        cPrivilegedOnlyAccessArray[ 0 ] = 'a';\r
        if( cPrivilegedOnlyAccessArray[ 0 ] != 'a' )\r
@@ -475,15 +476,15 @@ char cTemp;
        }\r
 \r
        /* Writing off the end of the RAM allocated to this task will *NOT* cause a\r
-       protection fault because the task is still executing in a privileged mode.  \r
+       protection fault because the task is still executing in a privileged mode.\r
        Uncomment the following to test. */\r
        /* cPrivilegedOnlyAccessArray[ mainPRIVILEGED_ONLY_ACCESS_ALIGN_SIZE ] = 'a'; */\r
 \r
        /* Now set the task into user mode. */\r
        portSWITCH_TO_USER_MODE();\r
-        \r
-       /* Accessing the privileged only array will now cause a fault.  Uncomment \r
-       the following line to test. */    \r
+\r
+       /* Accessing the privileged only array will now cause a fault.  Uncomment\r
+       the following line to test. */\r
        /* cPrivilegedOnlyAccessArray[ 0 ] = 'a'; */\r
 \r
        /* The read/write array can still be successfully read and written. */\r
@@ -499,7 +500,7 @@ char cTemp;
        }\r
 \r
        /* But attempting to read or write off the end of the RAM allocated to this\r
-       task will cause a fault.  Uncomment either of the following two lines to \r
+       task will cause a fault.  Uncomment either of the following two lines to\r
        test. */\r
        /* cReadWriteArray[ 0 ] = cReadWriteArray[ -1 ]; */\r
        /* cReadWriteArray[ mainREAD_WRITE_ALIGN_SIZE ] = 0x00; */\r
@@ -513,14 +514,14 @@ char cTemp;
        /* ...but cannot be written.  Uncomment the following line to test. */\r
        /* cReadOnlyArray[ 0 ] = 'a'; */\r
 \r
-       /* Writing to the first and last locations in the stack array should not \r
+       /* Writing to the first and last locations in the stack array should not\r
        cause a protection fault.  Note that doing this will cause the kernel to\r
-       detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than \r
+       detect a stack overflow if configCHECK_FOR_STACK_OVERFLOW is greater than\r
        1. */\r
     xCheckTaskStack[ 0 ] = 0;\r
     xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS - 1 ] = 0;\r
 \r
-       /* Writing off either end of the stack array should cause a protection \r
+       /* Writing off either end of the stack array should cause a protection\r
        fault, uncomment either of the following two lines to test. */\r
        /* xCheckTaskStack[ -1 ] = 0; */\r
     /* xCheckTaskStack[ mainCHECK_TASK_STACK_SIZE_WORDS ] = 0; */\r
@@ -533,9 +534,9 @@ static void prvRegTest1Task( void *pvParameters )
 queue variable.  Take a stack copy of this before the task is set into user\r
 mode.  Once this task is in user mode the file scope queue variable will no\r
 longer be accessible but the stack copy will. */\r
-xQueueHandle xQueue = xFileScopeCheckQueue;\r
+QueueHandle_t xQueue = xFileScopeCheckQueue;\r
 \r
-       /* Now the queue handle has been obtained the task can switch to user \r
+       /* Now the queue handle has been obtained the task can switch to user\r
        mode.  This is just one method of passing a handle into a protected\r
        task, the other reg test task uses the task parameter instead. */\r
     portSWITCH_TO_USER_MODE();\r
@@ -550,12 +551,12 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
 \r
 \r
        for( ;; )\r
-       {               \r
+       {\r
                /* This task tests the kernel context switch mechanism by reading and\r
                writing directly to registers - which requires the test to be written\r
                in assembly code. */\r
-               __asm volatile \r
-               (       \r
+               __asm volatile\r
+               (\r
                        "               MOV     R4, #104                        \n" /* Set registers to a known value.  R0 to R1 are done in the loop below. */\r
                        "               MOV     R5, #105                        \n"\r
                        "               MOV     R6, #106                        \n"\r
@@ -578,8 +579,8 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
                        "               BNE     prvDeleteMe                     \n"\r
                        "               CMP R3, #103                    \n"\r
                        "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R4, #104                        \n" \r
-                       "               BNE     prvDeleteMe                     \n" \r
+                       "               CMP     R4, #104                        \n"\r
+                       "               BNE     prvDeleteMe                     \n"\r
                        "               CMP     R5, #105                        \n"\r
                        "               BNE     prvDeleteMe                     \n"\r
                        "               CMP     R6, #106                        \n"\r
@@ -597,7 +598,7 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
                        :::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"\r
                );\r
 \r
-               /* Send mainREG_TEST_1_STILL_EXECUTING to the check task to indicate that this \r
+               /* Send mainREG_TEST_1_STILL_EXECUTING to the check task to indicate that this\r
                task is still functioning. */\r
                prvSendImAlive( xQueue, mainREG_TEST_1_STILL_EXECUTING );\r
 \r
@@ -610,24 +611,24 @@ xQueueHandle xQueue = xFileScopeCheckQueue;
 static void prvRegTest2Task( void *pvParameters )\r
 {\r
 /* The queue handle is passed in as the task parameter.  This is one method of\r
-passing data into a protected task, the other reg test task uses a different \r
+passing data into a protected task, the other reg test task uses a different\r
 method. */\r
-xQueueHandle xQueue = ( xQueueHandle ) pvParameters;\r
+QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;\r
 \r
        for( ;; )\r
        {\r
                /* This task tests the kernel context switch mechanism by reading and\r
                writing directly to registers - which requires the test to be written\r
                in assembly code. */\r
-               __asm volatile \r
-               (       \r
+               __asm volatile\r
+               (\r
                        "               MOV     R4, #4                          \n" /* Set registers to a known value.  R0 to R1 are done in the loop below. */\r
                        "               MOV     R5, #5                          \n"\r
                        "               MOV     R6, #6                          \n"\r
                        "               MOV     R8, #8                          \n" /* Frame pointer is omitted as it must not be changed. */\r
                        "               MOV     R9, #9                          \n"\r
                        "               MOV     R10, 10                         \n"\r
-                       "               MOV     R11, #11                        \n"                                             \r
+                       "               MOV     R11, #11                        \n"\r
                        "reg2loop:                                              \n"\r
                        "               MOV     R0, #13                         \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */\r
                        "               MOV     R1, #1                          \n"\r
@@ -661,7 +662,7 @@ xQueueHandle xQueue = ( xQueueHandle ) pvParameters;
             :::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"\r
                );\r
 \r
-               /* Send mainREG_TEST_2_STILL_EXECUTING to the check task to indicate that this \r
+               /* Send mainREG_TEST_2_STILL_EXECUTING to the check task to indicate that this\r
                task is still functioning. */\r
                prvSendImAlive( xQueue, mainREG_TEST_2_STILL_EXECUTING );\r
 \r
@@ -683,8 +684,8 @@ volatile unsigned long ulReadData;
 \r
        /* The idle task, and therefore this function, run in Supervisor mode and\r
        can therefore access all memory.  Try reading from corners of flash and\r
-       RAM to ensure a memory fault does not occur. \r
-       \r
+       RAM to ensure a memory fault does not occur.\r
+\r
        Start with the edges of the privileged data area. */\r
        pul = __privileged_data_start__;\r
        ulReadData = *pul;\r
@@ -702,9 +703,9 @@ volatile unsigned long ulReadData;
        pul = __FLASH_segment_end__ - 1;\r
        ulReadData = *pul;\r
 \r
-       /* Reading off the end of Flash or SRAM space should cause a fault.  \r
+       /* Reading off the end of Flash or SRAM space should cause a fault.\r
        Uncomment one of the following two pairs of lines to test. */\r
-       \r
+\r
        /* pul = __FLASH_segment_end__ + 4;\r
        ulReadData = *pul; */\r
 \r
@@ -725,7 +726,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
 volatile unsigned long *pul;\r
 volatile unsigned long ulReadData;\r
 \r
-/* The following lines are commented out to prevent the unused variable \r
+/* The following lines are commented out to prevent the unused variable\r
 compiler warnings when the tests that use the variable are also commented out.\r
 extern unsigned long __privileged_functions_start__[];\r
 const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned long * ) 0xe000e014; */\r
@@ -765,17 +766,17 @@ const volatile unsigned long *pulSystemPeripheralRegister = ( volatile unsigned
 \r
        /* pul = __privileged_functions_start__;\r
        ulReadData = *pul; */\r
-       \r
+\r
        /* pul = __privileged_functions_end__ - 1;\r
        ulReadData = *pul; */\r
 \r
        /* pul = __privileged_data_start__;\r
-       ulReadData = *pul; */ \r
-       \r
+       ulReadData = *pul; */\r
+\r
        /* pul = __privileged_data_end__ - 1;\r
        ulReadData = *pul; */\r
 \r
-       /* Must not just run off the end of a task function, so delete this task. \r
+       /* Must not just run off the end of a task function, so delete this task.\r
        Note that because this task was created using xTaskCreate() the stack was\r
        allocated dynamically and I have not included any code to free it again. */\r
        vTaskDelete( NULL );\r
@@ -798,10 +799,10 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
 \r
        ( void ) pvParameters;\r
 \r
-       /* This task is created in Privileged mode using the original xTaskCreate() \r
-       API     function.  It should have access to all Flash and RAM including that \r
-       marked as Privileged access only.  So reading from the start and end of the \r
-       non-privileged RAM should not cause a problem (the privileged RAM is the \r
+       /* This task is created in Privileged mode using the original xTaskCreate()\r
+       API     function.  It should have access to all Flash and RAM including that\r
+       marked as Privileged access only.  So reading from the start and end of the\r
+       non-privileged RAM should not cause a problem (the privileged RAM is the\r
        first block at the bottom of the RAM memory). */\r
        pul = __privileged_data_end__ + 1;\r
        ulReadData = *pul;\r
@@ -823,7 +824,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
        pul = __privileged_functions_end__ - 1;\r
        ulReadData = *pul;\r
        pul = __privileged_data_start__;\r
-       ulReadData = *pul;      \r
+       ulReadData = *pul;\r
        pul = __privileged_data_end__ - 1;\r
        ulReadData = *pul;\r
 \r
@@ -832,7 +833,7 @@ const volatile unsigned long *pulStandardPeripheralRegister = ( volatile unsigne
     ulReadData = *pulSystemPeripheralRegister;\r
        ulReadData = *pulStandardPeripheralRegister;\r
 \r
-       /* Must not just run off the end of a task function, so delete this task. \r
+       /* Must not just run off the end of a task function, so delete this task.\r
        Note that because this task was created using xTaskCreate() the stack was\r
        allocated dynamically and I have not included any code to free it again. */\r
        vTaskDelete( NULL );\r
@@ -845,7 +846,7 @@ static void prvDeleteMe( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvSendImAlive( xQueueHandle xHandle, unsigned long ulTaskNumber )\r
+static void prvSendImAlive( QueueHandle_t xHandle, unsigned long ulTaskNumber )\r
 {\r
        if( xHandle != NULL )\r
        {\r
@@ -868,84 +869,84 @@ void prvSetupHardware( void )
        if ( SC->PLL0STAT & ( 1 << 25 ) )\r
        {\r
                /* Enable PLL, disconnected. */\r
-               SC->PLL0CON = 1;                        \r
+               SC->PLL0CON = 1;\r
                SC->PLL0FEED = PLLFEED_FEED1;\r
                SC->PLL0FEED = PLLFEED_FEED2;\r
        }\r
-       \r
+\r
        /* Disable PLL, disconnected. */\r
-       SC->PLL0CON = 0;                                \r
+       SC->PLL0CON = 0;\r
        SC->PLL0FEED = PLLFEED_FEED1;\r
        SC->PLL0FEED = PLLFEED_FEED2;\r
-           \r
+\r
        /* Enable main OSC. */\r
-       SC->SCS |= 0x20;                        \r
+       SC->SCS |= 0x20;\r
        while( !( SC->SCS & 0x40 ) );\r
-       \r
+\r
        /* select main OSC, 12MHz, as the PLL clock source. */\r
-       SC->CLKSRCSEL = 0x1;            \r
-       \r
+       SC->CLKSRCSEL = 0x1;\r
+\r
        SC->PLL0CFG = 0x20031;\r
        SC->PLL0FEED = PLLFEED_FEED1;\r
        SC->PLL0FEED = PLLFEED_FEED2;\r
-             \r
+\r
        /* Enable PLL, disconnected. */\r
-       SC->PLL0CON = 1;                                \r
+       SC->PLL0CON = 1;\r
        SC->PLL0FEED = PLLFEED_FEED1;\r
        SC->PLL0FEED = PLLFEED_FEED2;\r
-       \r
+\r
        /* Set clock divider. */\r
        SC->CCLKCFG = 0x03;\r
-       \r
+\r
        /* Configure flash accelerator. */\r
        SC->FLASHCFG = 0x403a;\r
-       \r
+\r
        /* Check lock bit status. */\r
-       while( ( ( SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );       \r
-           \r
+       while( ( ( SC->PLL0STAT & ( 1 << 26 ) ) == 0 ) );\r
+\r
        /* Enable and connect. */\r
-       SC->PLL0CON = 3;                                \r
+       SC->PLL0CON = 3;\r
        SC->PLL0FEED = PLLFEED_FEED1;\r
        SC->PLL0FEED = PLLFEED_FEED2;\r
-       while( ( ( SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );       \r
+       while( ( ( SC->PLL0STAT & ( 1 << 25 ) ) == 0 ) );\r
+\r
+\r
+\r
 \r
-       \r
-       \r
-       \r
        /* Configure the clock for the USB. */\r
-         \r
+\r
        if( SC->PLL1STAT & ( 1 << 9 ) )\r
        {\r
                /* Enable PLL, disconnected. */\r
-               SC->PLL1CON = 1;                        \r
+               SC->PLL1CON = 1;\r
                SC->PLL1FEED = PLLFEED_FEED1;\r
                SC->PLL1FEED = PLLFEED_FEED2;\r
        }\r
-       \r
+\r
        /* Disable PLL, disconnected. */\r
-       SC->PLL1CON = 0;                                \r
+       SC->PLL1CON = 0;\r
        SC->PLL1FEED = PLLFEED_FEED1;\r
        SC->PLL1FEED = PLLFEED_FEED2;\r
-       \r
+\r
        SC->PLL1CFG = 0x23;\r
        SC->PLL1FEED = PLLFEED_FEED1;\r
        SC->PLL1FEED = PLLFEED_FEED2;\r
-             \r
+\r
        /* Enable PLL, disconnected. */\r
-       SC->PLL1CON = 1;                                \r
+       SC->PLL1CON = 1;\r
        SC->PLL1FEED = PLLFEED_FEED1;\r
        SC->PLL1FEED = PLLFEED_FEED2;\r
        while( ( ( SC->PLL1STAT & ( 1 << 10 ) ) == 0 ) );\r
-       \r
+\r
        /* Enable and connect. */\r
-       SC->PLL1CON = 3;                                \r
+       SC->PLL1CON = 3;\r
        SC->PLL1FEED = PLLFEED_FEED1;\r
        SC->PLL1FEED = PLLFEED_FEED2;\r
        while( ( ( SC->PLL1STAT & ( 1 << 9 ) ) == 0 ) );\r
 \r
        /*  Setup the peripheral bus to be the same as the PLL output (64 MHz). */\r
        SC->PCLKSEL0 = 0x05555555;\r
-       \r
+\r
        /* Prepare the LCD. */\r
        LCDdriver_initialisation();\r
        LCD_PrintString( 5, 10, "FreeRTOS.org", 14, COLOR_GREEN);\r
@@ -955,7 +956,7 @@ void prvSetupHardware( void )
 void vApplicationTickHook( void )\r
 {\r
 static unsigned long ulCallCount;\r
-const unsigned long ulCallsBetweenSends = 5000 / portTICK_RATE_MS;\r
+const unsigned long ulCallsBetweenSends = 5000 / portTICK_PERIOD_MS;\r
 const unsigned long ulMessage = mainPRINT_SYSTEM_STATUS;\r
 portBASE_TYPE xDummy;\r
 \r
@@ -971,8 +972,8 @@ portBASE_TYPE xDummy;
                ulCallCount = 0;\r
 \r
                /* Send a message to the check task to command it to check that all\r
-               the tasks are still running then print out the status. \r
-               \r
+               the tasks are still running then print out the status.\r
+\r
                This is running in an ISR so has to use the "FromISR" version of\r
                xQueueSend().  Because it is in an ISR it is running with privileges\r
                so can access xFileScopeCheckQueue directly. */\r
@@ -981,9 +982,9 @@ portBASE_TYPE xDummy;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
 {\r
-       /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this \r
+       /* If configCHECK_FOR_STACK_OVERFLOW is set to either 1 or 2 then this\r
        function will automatically get called if a task overflows its stack. */\r
        ( void ) pxTask;\r
        ( void ) pcTaskName;\r