]> git.sur5r.net Git - freertos/commitdiff
Increase the test coverage of the GCC MPU demo that runs in the Keil simulator.
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 18 May 2016 19:51:14 +0000 (19:51 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 18 May 2016 19:51:14 +0000 (19:51 +0000)
Add an MPU demo that uses the Keil simulator that also uses the Keil compiler.
Correct a few version numbers for files recently added to the repository.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2459 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

22 files changed:
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/GCC_Specific/RegTest.c
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/Keil_Specific/RegTest.c
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main.c
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.c
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/IntQueueTimer.h
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_full/main_full.c
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/low_power_tick_config.c
FreeRTOS/Demo/CORTEX_M4F_CEC1302_Keil_GCC/main_low_power/main_low_power.c
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/FreeRTOSConfig.h
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvoptx
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RTOSDemo.uvprojx
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/RegTest.c
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/GCC_Specific/sections.ld
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.sct [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/startup_MPS_CM4.S [new file with mode: 0644]
FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/main.c
FreeRTOS/Source/portable/Common/mpu_wrappers.c

index cfad06c258edd8a4ff0585f63289d21f0a2ee055..b6e7ec3b4851c29dd868fcc1ef65e2a045cc4800 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index c3d1fc9bf49391da0415a647a9087309870ce0da..fae9006a336d7cd8ae3ebc4f3b0c57dd2e93059b 100644 (file)
 
   <Group>
     <GroupName>System</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
index dd82dd8925e06dadcb194faf765a0e8ee622b60b..05fac0ecc0ca4027d2f7e0e1b3c8d04b352c4ee8 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index e0bd936d19d4ead7fad532cf8eee95c83438f70c..bc0eda66b9ad66925711defeecfb1e75cebdb6c7 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 0ecb573d8abd0102887d144ae10043dfb13b30a3..d89c69eae1a756de41e60aa04dcaeda83e8438cf 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 50c9bff50ecf9b9221cd8cdee0f1d317b6a766c8..45f66dd1da312a07d01cdb20f7c9da64488c7c8b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 5c133ff238bf3d3fcf01ee802761635c7c6f32e3..db2bb01a9cfd68caf1561be453f237bba1e97f3c 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 8e477886fa57bf4bfdde937bab7a66e6ed87cbcb..f74f6588a13d22efe35a90406f79d59483ec7350 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 357b68097799d563ad91bdbd03936a2c8778ae91..a698b9fcab3fa4fdffea20ef54a1c2f12c925a7f 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 68c0974c1180a0177c0c1c0e67d9e13e8befdd99..d22be6a24d1280b66a7a7c4d9266a32fba42e1d3 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
index 3ff76a163504ae3c94fe131c6a85230afd80aa7c..612a84c77db081a696c8e298e89031ad4d6936a1 100644 (file)
@@ -191,14 +191,27 @@ standard names. */
 \r
 /* Normal assert() semantics without relying on the provision of an assert.h\r
 header file. */\r
-#define configASSERT( x ) if( ( x ) == 0UL ) { taskENTER_CRITICAL(); for( ;; ); }\r
+#define configASSERT( x ) if( ( x ) == 0UL ) { taskDISABLE_INTERRUPTS(); for( ;; ); }\r
 \r
 /* LED not used at present, so just increment a variable to keep a count of the\r
 number of times the LED would otherwise have been toggled. */\r
 #define configTOGGLE_LED()     ulLED++\r
 \r
+/* Definitions for the messages that can be sent to the check task. */\r
+#define configREG_TEST_1_STILL_EXECUTING       ( 0 )\r
+#define configREG_TEST_2_STILL_EXECUTING       ( 1 )\r
+#define configTIMER_STILL_EXECUTING                    ( 2 )\r
+#define configPRINT_SYSTEM_STATUS                      ( 3 )\r
+\r
+/* Parameters that are passed into the third and fourth register check tasks\r
+solely for the purpose of ensuring parameters are passed into tasks correctly. */\r
+#define configREG_TEST_TASK_1_PARAMETER        ( ( void * ) 0x11112222 )\r
+#define configREG_TEST_TASK_3_PARAMETER        ( ( void * ) 0x12345678 )\r
+#define configREG_TEST_TASK_4_PARAMETER        ( ( void * ) 0x87654321 )\r
 \r
 #ifdef __cplusplus\r
 }\r
 #endif\r
+\r
 #endif /* FREERTOS_CONFIG_H */\r
+\r
index 5ea158a3ee14d03f6ab2ab296e979a88e6b12326..b19ea2f1372d4c1284154eced54e2a8a27fe220e 100644 (file)
           <Name>-UV1115SAE -O2983 -S0 -C0 -P00 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO11  -FN1 -FC1000 -FD20000000 -FF0NEW_DEVICE -FL080000 -FS00 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM)</Name>
         </SetRegEntry>
       </TargetDriverDllRegistry>
-      <Breakpoint>
-        <Bp>
-          <Number>0</Number>
-          <Type>0</Type>
-          <LineNumber>1169</LineNumber>
-          <EnabledFlag>1</EnabledFlag>
-          <Address>38532</Address>
-          <ByteObject>0</ByteObject>
-          <HtxType>0</HtxType>
-          <ManyObjects>0</ManyObjects>
-          <SizeOfObject>0</SizeOfObject>
-          <BreakByAccess>0</BreakByAccess>
-          <BreakIfRCount>1</BreakIfRCount>
-          <Filename>C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_MPU_Simulator_Keil_GCC\main.c</Filename>
-          <ExecCommand></ExecCommand>
-          <Expression>\\RTOSDemo\../main.c\1169</Expression>
-        </Bp>
-      </Breakpoint>
+      <Breakpoint/>
       <WatchWindow1>
         <Ww>
           <count>0</count>
         <Ww>
           <count>1</count>
           <WinNumber>1</WinNumber>
-          <ItemText>ulExpireCount</ItemText>
+          <ItemText>ulCycleCount</ItemText>
         </Ww>
       </WatchWindow1>
       <MemoryWindow1>
 
   <Group>
     <GroupName>System</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
   </Group>
 
   <Group>
-    <GroupName>main_and_config</GroupName>
-    <tvExp>0</tvExp>
+    <GroupName>application_and_config</GroupName>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>4</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.\RegTest.c</PathWithFileName>
+      <FilenameWithoutPath>RegTest.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
   </Group>
 
   <Group>
     <GroupName>FreeRTOS_Source</GroupName>
-    <tvExp>0</tvExp>
+    <tvExp>1</tvExp>
     <tvExpOptDlg>0</tvExpOptDlg>
     <cbSel>0</cbSel>
     <RteFlg>0</RteFlg>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>4</FileNumber>
+      <FileNumber>5</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>5</FileNumber>
+      <FileNumber>6</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>6</FileNumber>
+      <FileNumber>7</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>7</FileNumber>
+      <FileNumber>8</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>8</FileNumber>
+      <FileNumber>9</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>9</FileNumber>
+      <FileNumber>10</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>10</FileNumber>
+      <FileNumber>11</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\Source\portable\GCC\ARM_CM3_MPU\port.c</PathWithFileName>
-      <FilenameWithoutPath>port.c</FilenameWithoutPath>
+      <PathWithFileName>..\..\..\Source\portable\Common\mpu_wrappers.c</PathWithFileName>
+      <FilenameWithoutPath>mpu_wrappers.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
     <File>
       <GroupNumber>3</GroupNumber>
-      <FileNumber>11</FileNumber>
+      <FileNumber>12</FileNumber>
       <FileType>1</FileType>
       <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
-      <PathWithFileName>..\..\..\Source\portable\Common\mpu_wrappers.c</PathWithFileName>
-      <FilenameWithoutPath>mpu_wrappers.c</FilenameWithoutPath>
+      <PathWithFileName>..\..\..\Source\portable\GCC\ARM_CM4_MPU\port.c</PathWithFileName>
+      <FilenameWithoutPath>port.c</FilenameWithoutPath>
       <RteFlg>0</RteFlg>
       <bShared>0</bShared>
     </File>
index af7dabaeae717e79dcd4b875d0e0fab851553962..c49cdc410ed8bfa1e06900a1f65f233b018c4a0b 100644 (file)
               <MiscControls>-mfloat-abi=softfp -mfpu=fpv4-sp-d16 -ffunction-sections -fdata-sections -O0 -g</MiscControls>
               <Define></Define>
               <Undefine></Undefine>
-              <IncludePath>..;..\..\..\Source\include;..\..\..\Source\portable\GCC\ARM_CM3_MPU;..\..\Common\include;..\peripheral_library;..\CMSIS;..\main_full;..\peripheral_library\interrupt</IncludePath>
+              <IncludePath>..;..\..\..\Source\include;..\..\..\Source\portable\GCC\ARM_CM4_MPU;..\..\Common\include;..\peripheral_library;..\CMSIS;..\main_full;..\peripheral_library\interrupt</IncludePath>
             </VariousControls>
           </Carm>
           <Aarm>
           </Files>
         </Group>
         <Group>
-          <GroupName>main_and_config</GroupName>
+          <GroupName>application_and_config</GroupName>
           <Files>
             <File>
               <FileName>main.c</FileName>
               <FileType>5</FileType>
               <FilePath>..\FreeRTOSConfig.h</FilePath>
             </File>
+            <File>
+              <FileName>RegTest.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>.\RegTest.c</FilePath>
+            </File>
           </Files>
         </Group>
         <Group>
               <FilePath>..\..\..\Source\portable\MemMang\heap_4.c</FilePath>
             </File>
             <File>
-              <FileName>port.c</FileName>
+              <FileName>mpu_wrappers.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\Source\portable\GCC\ARM_CM3_MPU\port.c</FilePath>
+              <FilePath>..\..\..\Source\portable\Common\mpu_wrappers.c</FilePath>
             </File>
             <File>
-              <FileName>mpu_wrappers.c</FileName>
+              <FileName>port.c</FileName>
               <FileType>1</FileType>
-              <FilePath>..\..\..\Source\portable\Common\mpu_wrappers.c</FilePath>
+              <FilePath>..\..\..\Source\portable\GCC\ARM_CM4_MPU\port.c</FilePath>
             </File>
           </Files>
         </Group>
index dd82dd8925e06dadcb194faf765a0e8ee622b60b..a3b8c907cf9cb29726395af865787b7a50b671e7 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
     1 tab == 4 spaces!\r
 */\r
 \r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "queue.h"\r
+\r
 /*\r
  * "Reg test" tasks - These fill the registers with known values, then check\r
  * that each register maintains its expected value for the lifetime of the\r
  * switching mechanism.\r
  */\r
 \r
-void vRegTest1Implementation( void ) __attribute__ ((naked));\r
-void vRegTest2Implementation( void ) __attribute__ ((naked));\r
+void vRegTest1Implementation( void *pvParameters );\r
+void vRegTest2Implementation( void *pvParameters );\r
+void vRegTest3Implementation( void ) __attribute__ ((naked));\r
+void vRegTest4Implementation( void ) __attribute__ ((naked));\r
+\r
+/*\r
+ * Used as an easy way of deleting a task from inline assembly.\r
+ */\r
+extern void vMainDeleteMe( void ) __attribute__((noinline));\r
+\r
+/*\r
+ * Used by the first two reg test tasks and a software timer callback function\r
+ * to send messages to the check task.  The message just lets the check task\r
+ * know that the tasks and timer are still functioning correctly.  If a reg test\r
+ * task detects an error it will delete itself, and in so doing prevent itself\r
+ * from sending any more 'I'm Alive' messages to the check task.\r
+ */\r
+extern void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );\r
+\r
+/* The queue used to send a message to the check task. */\r
+extern QueueHandle_t xGlobalScopeCheckQueue;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vRegTest1Implementation( void *pvParameters )\r
+{\r
+/* This task is created in privileged mode so can access the file scope\r
+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
+QueueHandle_t xQueue = xGlobalScopeCheckQueue;\r
+\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
+\r
+       /* First check that the parameter value is as expected. */\r
+       if( pvParameters != ( void * ) configREG_TEST_TASK_1_PARAMETER )\r
+       {\r
+               /* Error detected.  Delete the task so it stops communicating with\r
+               the check task. */\r
+               vMainDeleteMe();\r
+       }\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
+                       "               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
+                       "               MOV     R8, #108                        \n"\r
+                       "               MOV     R9, #109                        \n"\r
+                       "               MOV     R10, #110                       \n"\r
+                       "               MOV     R11, #111                       \n"\r
+                       "reg1loop:                                              \n"\r
+                       "               MOV     R0, #100                        \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */\r
+                       "               MOV     R1, #101                        \n"\r
+                       "               MOV     R2, #102                        \n"\r
+                       "               MOV R3, #103                    \n"\r
+                       "               MOV     R12, #112                       \n"\r
+                       "               SVC #1                                  \n" /* Yield just to increase test coverage. */\r
+                       "               CMP     R0, #100                        \n" /* Check all the registers still contain their expected values. */\r
+                       "               BNE     vMainDeleteMe           \n" /* Value was not as expected, delete the task so it stops communicating with the check task. */\r
+                       "               CMP     R1, #101                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R2, #102                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP R3, #103                    \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R4, #104                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R5, #105                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R6, #106                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R8, #108                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R9, #109                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R10, #110                       \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R11, #111                       \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R12, #112                       \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       :::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"\r
+               );\r
+\r
+               /* Send configREG_TEST_1_STILL_EXECUTING to the check task to indicate that this\r
+               task is still functioning. */\r
+               vMainSendImAlive( xQueue, configREG_TEST_1_STILL_EXECUTING );\r
+\r
+               /* Go back to check all the register values again. */\r
+               __asm volatile( "               B reg1loop      " );\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vRegTest2Implementation( 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
+method. */\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
+                       "               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
+                       "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
+                       "               MOV     R2, #2                          \n"\r
+                       "               MOV R3, #3                              \n"\r
+                       "               MOV     R12, #12                        \n"\r
+                       "               CMP     R0, #13                         \n" /* Check all the registers still contain their expected values. */\r
+                       "               BNE     vMainDeleteMe           \n" /* Value was not as expected, delete the task so it stops communicating with the check task */\r
+                       "               CMP     R1, #1                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R2, #2                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP R3, #3                              \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R4, #4                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R5, #5                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R6, #6                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R8, #8                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R9, #9                          \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R10, #10                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R11, #11                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       "               CMP     R12, #12                        \n"\r
+                       "               BNE     vMainDeleteMe           \n"\r
+                       :::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"\r
+               );\r
+\r
+               /* Send configREG_TEST_2_STILL_EXECUTING to the check task to indicate that this\r
+               task is still functioning. */\r
+               vMainSendImAlive( xQueue, configREG_TEST_2_STILL_EXECUTING );\r
+\r
+               /* Go back to check all the register values again. */\r
+               __asm volatile( "               B reg2loop      " );\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
 \r
-void vRegTest1Implementation( void )\r
+void vRegTest3Implementation( void )\r
 {\r
        __asm volatile\r
        (\r
-               ".extern ulRegTest1LoopCounter \n"\r
+               ".extern pulRegTest3LoopCounter \n"\r
                "/* Fill the core registers with known values. */               \n"\r
                "mov    r0, #100                        \n"\r
                "mov    r1, #101                        \n"\r
@@ -244,7 +412,8 @@ void vRegTest1Implementation( void )
 \r
                "/* Everything passed, increment the loop counter. */   \n"\r
                "push   { r0-r1 }                       \n"\r
-               "ldr    r0, =ulRegTest1LoopCounter      \n"\r
+               "ldr    r0, =pulRegTest3LoopCounter     \n"\r
+               "ldr    r0, [r0]                        \n"\r
                "ldr    r1, [r0]                        \n"\r
                "adds   r1, r1, #1                      \n"\r
                "str    r1, [r0]                        \n"\r
@@ -262,11 +431,11 @@ void vRegTest1Implementation( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vRegTest2Implementation( void )\r
+void vRegTest4Implementation( void )\r
 {\r
        __asm volatile\r
        (\r
-               ".extern ulRegTest2LoopCounter \n"\r
+               ".extern pulRegTest4LoopCounter \n"\r
                "/* Set all the core registers to known values. */      \n"\r
                "mov    r0, #-1                         \n"\r
                "mov    r1, #1                          \n"\r
@@ -427,22 +596,18 @@ void vRegTest2Implementation( void )
                "cmp    r12, #12                        \n"\r
                "bne    reg2_error_loop         \n"\r
 \r
-               "/* Increment the loop counter to indicate this test is still functioning       \n"\r
-               "correctly. */                          \n"\r
+               "/* Increment the loop counter so the check task knows this task is \n"\r
+               "still running. */                      \n"\r
                "push   { r0-r1 }                       \n"\r
-               "ldr    r0, =ulRegTest2LoopCounter      \n"\r
+               "ldr    r0, =pulRegTest4LoopCounter     \n"\r
+               "ldr    r0, [r0]                        \n"\r
                "ldr    r1, [r0]                        \n"\r
                "adds   r1, r1, #1                      \n"\r
                "str    r1, [r0]                        \n"\r
+               "pop { r0-r1 }                          \n"\r
 \r
                "/* Yield to increase test coverage. */                 \n"\r
-               "movs   r0, #0x01                       \n"\r
-               "ldr    r1, =0xe000ed04 /*NVIC_INT_CTRL */              \n"\r
-               "lsl    r0, r0, #28 /* Shift to PendSV bit */   \n"\r
-               "str    r0, [r1]                        \n"\r
-               "dsb                                            \n"\r
-\r
-               "pop { r0-r1 }                          \n"\r
+               "SVC #1                                         \n"\r
 \r
                "/* Start again. */                     \n"\r
                "b reg2_loop                            \n"\r
@@ -455,3 +620,73 @@ void vRegTest2Implementation( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+/* Fault handlers are here for convenience as they use compiler specific syntax\r
+and this file is specific to the GCC compiler. */\r
+void hard_fault_handler( uint32_t * hardfault_args )\r
+{\r
+volatile uint32_t stacked_r0;\r
+volatile uint32_t stacked_r1;\r
+volatile uint32_t stacked_r2;\r
+volatile uint32_t stacked_r3;\r
+volatile uint32_t stacked_r12;\r
+volatile uint32_t stacked_lr;\r
+volatile uint32_t stacked_pc;\r
+volatile uint32_t stacked_psr;\r
+\r
+       stacked_r0 = ((uint32_t) hardfault_args[ 0 ]);\r
+       stacked_r1 = ((uint32_t) hardfault_args[ 1 ]);\r
+       stacked_r2 = ((uint32_t) hardfault_args[ 2 ]);\r
+       stacked_r3 = ((uint32_t) hardfault_args[ 3 ]);\r
+\r
+       stacked_r12 = ((uint32_t) hardfault_args[ 4 ]);\r
+       stacked_lr = ((uint32_t) hardfault_args[ 5 ]);\r
+       stacked_pc = ((uint32_t) hardfault_args[ 6 ]);\r
+       stacked_psr = ((uint32_t) hardfault_args[ 7 ]);\r
+\r
+       /* Inspect stacked_pc to locate the offending instruction. */\r
+       for( ;; );\r
+\r
+       ( void ) stacked_psr;\r
+       ( void ) stacked_pc;\r
+       ( void ) stacked_lr;\r
+       ( void ) stacked_r12;\r
+    ( void ) stacked_r0;\r
+    ( void ) stacked_r1;\r
+    ( void ) stacked_r2;\r
+    ( void ) stacked_r3;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void HardFault_Handler( void ) __attribute__((naked));\r
+void HardFault_Handler( void )\r
+{\r
+       __asm volatile\r
+       (\r
+               " tst lr, #4                                                                            \n"\r
+               " ite eq                                                                                        \n"\r
+               " mrseq r0, msp                                                                         \n"\r
+               " mrsne r0, psp                                                                         \n"\r
+               " ldr r1, [r0, #24]                                                                     \n"\r
+               " ldr r2, handler_address_const                                         \n"\r
+               " bx r2                                                                                         \n"\r
+               " handler_address_const: .word hard_fault_handler       \n"\r
+       );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void MemManage_Handler( void ) __attribute__((naked));\r
+void MemManage_Handler( void )\r
+{\r
+       __asm volatile\r
+       (\r
+               " tst lr, #4                                                                            \n"\r
+               " ite eq                                                                                        \n"\r
+               " mrseq r0, msp                                                                         \n"\r
+               " mrsne r0, psp                                                                         \n"\r
+               " ldr r1, [r0, #24]                                                                     \n"\r
+               " ldr r2, handler2_address_const                                        \n"\r
+               " bx r2                                                                                         \n"\r
+               " handler2_address_const: .word hard_fault_handler      \n"\r
+       );\r
+}/*-----------------------------------------------------------*/\r
+\r
index ac94a5d11bb9a6a35ad62fa29c5fb913fd2216f4..b3c41d0cf5d848d46cbede5c3efa402818038a83 100644 (file)
@@ -6,8 +6,8 @@ MEMORY
 }\r
 \r
 /* Variables used by FreeRTOS-MPU. */\r
-_Privileged_Functions_Region_Size = 16K;\r
-_Privileged_Data_Region_Size = 256;\r
+_Privileged_Functions_Region_Size = 32K;\r
+_Privileged_Data_Region_Size = 512;\r
 \r
 __FLASH_segment_start__ = ORIGIN( ROM );\r
 __FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( ROM );\r
@@ -25,11 +25,7 @@ __privileged_data_end__ = ORIGIN( RAM ) + _Privileged_Data_Region_Size;
 /*\r
  * The '__stack' definition is required by crt0, do not remove it.\r
  */\r
-/* Place top of stack immediate before ROM Log\r
- *__stack = ORIGIN(RAM) + LENGTH(RAM);\r
- */\r
 __stack = ORIGIN(RAM) + LENGTH(RAM);\r
-\r
 _estack = __stack;\r
 \r
 /*\r
@@ -51,7 +47,7 @@ PROVIDE ( _Main_Stack_Limit = __Main_Stack_Limit ) ;
  * There will be a link error if there is not this amount of\r
  * RAM free at the end.\r
  */\r
-_Minimum_Stack_Size = 256 ;\r
+_Minimum_Stack_Size = 1024 ;\r
 \r
 /*\r
  * Default heap definitions.\r
@@ -82,15 +78,16 @@ SECTIONS
         KEEP(*(.isr_vector))\r
         *(privileged_functions)\r
         . = ALIGN(4);\r
+\r
+        /* Non privileged code is after _Privileged_Functions_Region_Size. */\r
+        __privileged_functions_actual_end__ = .;\r
+        . = _Privileged_Functions_Region_Size;\r
     } > ROM\r
 \r
 \r
 \r
     .text :\r
     {\r
-        /* Non privileged code kept out of the first 16K or flash. */\r
-        . = __privileged_functions_start__ + _Privileged_Functions_Region_Size;\r
-\r
         . = ALIGN(4);\r
 \r
 \r
@@ -222,11 +219,12 @@ SECTIONS
     privileged_data :\r
     {\r
         *(privileged_data)\r
-        /* Non kernel data is kept out of the first 256 bytes of SRAM. */\r
+        /* Non kernel data is kept out of the first _Privileged_Data_Region_Size\r
+        bytes of SRAM. */\r
+        __privileged_data_actual_end__ = .;\r
+        . = _Privileged_Data_Region_Size;\r
     } > RAM\r
 \r
-    . = ORIGIN( RAM ) + _Privileged_Data_Region_Size;\r
-\r
     /*\r
      * The initialised data section.\r
      * The program executes knowing that the data is in the RAM\r
@@ -308,81 +306,6 @@ SECTIONS
         . = ALIGN(4);\r
     } >RAM\r
 \r
-    ._check_rom_log :\r
-    {\r
-        . = ALIGN(4);\r
-\r
-/*        . = . + __ROM_Log_Size ; */\r
-\r
-        . = ALIGN(4);\r
-    } >RAM\r
-\r
-/*\r
-    .bss_CCMRAM : ALIGN(4)\r
-    {\r
-        *(.bss.CCMRAM .bss.CCMRAM.*)\r
-    } > CCMRAM\r
-*/\r
-    /*\r
-     * The ROM Bank1.\r
-     * The C or assembly source must explicitly place the code\r
-     * or data there using the "section" attribute.\r
-     */\r
-\r
-\r
-    /* remaining code */\r
-    /* read-only data (constants) */\r
-/*\r
-    .b1text :\r
-    {\r
-        *(.b1text)\r
-        *(.b1rodata)\r
-        *(.b1rodata.*)\r
-    } >ROMB1\r
-*/\r
-    /*\r
-     * The EXTMEM.\r
-     * The C or assembly source must explicitly place the code or data there\r
-     * using the "section" attribute.\r
-     */\r
-\r
-    /* EXTMEM Bank0 */\r
-/*\r
-    .eb0text :\r
-    {\r
-        *(.eb0text)\r
-        *(.eb0rodata)\r
-        *(.eb0rodata.*)\r
-    } >EXTMEMB0\r
-*/\r
-    /* EXTMEM Bank1 */\r
-/*\r
-    .eb1text :\r
-    {\r
-        *(.eb1text)\r
-        *(.eb1rodata)\r
-        *(.eb1rodata.*)\r
-    } >EXTMEMB1\r
-*/\r
-    /* EXTMEM Bank2 */\r
-/*\r
-    .eb2text :\r
-    {\r
-        *(.eb2text)\r
-        *(.eb2rodata)\r
-        *(.eb2rodata.*)\r
-    } >EXTMEMB2\r
-*/\r
-    /* EXTMEM Bank0 */\r
-/*\r
-    .eb3text :\r
-    {\r
-        *(.eb3text)\r
-        *(.eb3rodata)\r
-        *(.eb3rodata.*)\r
-    } >EXTMEMB3\r
-*/\r
-\r
     /* After that there are only debugging sections. */\r
 \r
     /* This can remove the debugging information from the standard libraries */\r
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.sct b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.sct
new file mode 100644 (file)
index 0000000..9b73fb1
--- /dev/null
@@ -0,0 +1,23 @@
+; *************************************************************\r
+; *** Scatter-Loading Description File generated by uVision ***\r
+; *************************************************************\r
+\r
+\r
+LR_IROM1 0x00000000  {    ; load region size_region\r
+  ER_IROM1 0x00000000  {  ; load address = execution address\r
+   *.o (RESET, +First)\r
+   *(InRoot$$Sections)\r
+   *( privileged_functions )\r
+  }\r
+  ER_IROM2 0x8000 FIXED {\r
+    .ANY (+RO)\r
+  }\r
+  RW_IRAM1 0x20000000  {  ; RW data\r
+   *( privileged_data )\r
+  }\r
+  RW_IRAM2 0x20000200 {  ; RW data\r
+   .ANY (+RW +ZI)\r
+  }\r
+}\r
+\r
+\r
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvoptx
new file mode 100644 (file)
index 0000000..ffe58a0
--- /dev/null
@@ -0,0 +1,380 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
+
+  <SchemaVersion>1.0</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Extensions>
+    <cExt>*.c</cExt>
+    <aExt>*.s*; *.src; *.a*</aExt>
+    <oExt>*.obj</oExt>
+    <lExt>*.lib</lExt>
+    <tExt>*.txt; *.h; *.inc</tExt>
+    <pExt>*.plm</pExt>
+    <CppX>*.cpp</CppX>
+    <nMigrate>0</nMigrate>
+  </Extensions>
+
+  <DaveTm>
+    <dwLowDateTime>0</dwLowDateTime>
+    <dwHighDateTime>0</dwHighDateTime>
+  </DaveTm>
+
+  <Target>
+    <TargetName>RTOSDemo</TargetName>
+    <ToolsetNumber>0x4</ToolsetNumber>
+    <ToolsetName>ARM-ADS</ToolsetName>
+    <TargetOption>
+      <CLKADS>48000000</CLKADS>
+      <OPTTT>
+        <gFlags>1</gFlags>
+        <BeepAtEnd>1</BeepAtEnd>
+        <RunSim>0</RunSim>
+        <RunTarget>1</RunTarget>
+        <RunAbUc>0</RunAbUc>
+      </OPTTT>
+      <OPTHX>
+        <HexSelection>1</HexSelection>
+        <FlashByte>65535</FlashByte>
+        <HexRangeLowAddress>0</HexRangeLowAddress>
+        <HexRangeHighAddress>0</HexRangeHighAddress>
+        <HexOffset>0</HexOffset>
+      </OPTHX>
+      <OPTLEX>
+        <PageWidth>79</PageWidth>
+        <PageLength>66</PageLength>
+        <TabStop>8</TabStop>
+        <ListingPath>.\Listings\</ListingPath>
+      </OPTLEX>
+      <ListingPage>
+        <CreateCListing>1</CreateCListing>
+        <CreateAListing>1</CreateAListing>
+        <CreateLListing>1</CreateLListing>
+        <CreateIListing>0</CreateIListing>
+        <AsmCond>1</AsmCond>
+        <AsmSymb>1</AsmSymb>
+        <AsmXref>0</AsmXref>
+        <CCond>1</CCond>
+        <CCode>0</CCode>
+        <CListInc>0</CListInc>
+        <CSymb>0</CSymb>
+        <LinkerCodeListing>0</LinkerCodeListing>
+      </ListingPage>
+      <OPTXL>
+        <LMap>1</LMap>
+        <LComments>1</LComments>
+        <LGenerateSymbols>1</LGenerateSymbols>
+        <LLibSym>1</LLibSym>
+        <LLines>1</LLines>
+        <LLocSym>1</LLocSym>
+        <LPubSym>1</LPubSym>
+        <LXref>0</LXref>
+        <LExpSel>0</LExpSel>
+      </OPTXL>
+      <OPTFL>
+        <tvExp>1</tvExp>
+        <tvExpOptDlg>0</tvExpOptDlg>
+        <IsCurrentTarget>1</IsCurrentTarget>
+      </OPTFL>
+      <CpuCode>7</CpuCode>
+      <DebugOpt>
+        <uSim>1</uSim>
+        <uTrg>0</uTrg>
+        <sLdApp>1</sLdApp>
+        <sGomain>1</sGomain>
+        <sRbreak>1</sRbreak>
+        <sRwatch>1</sRwatch>
+        <sRmem>1</sRmem>
+        <sRfunc>1</sRfunc>
+        <sRbox>1</sRbox>
+        <tLdApp>1</tLdApp>
+        <tGomain>0</tGomain>
+        <tRbreak>1</tRbreak>
+        <tRwatch>1</tRwatch>
+        <tRmem>1</tRmem>
+        <tRfunc>0</tRfunc>
+        <tRbox>1</tRbox>
+        <tRtrace>1</tRtrace>
+        <sRSysVw>1</sRSysVw>
+        <tRSysVw>1</tRSysVw>
+        <sRunDeb>0</sRunDeb>
+        <sLrtime>0</sLrtime>
+        <nTsel>0</nTsel>
+        <sDll></sDll>
+        <sDllPa></sDllPa>
+        <sDlgDll></sDlgDll>
+        <sDlgPa></sDlgPa>
+        <sIfile></sIfile>
+        <tDll></tDll>
+        <tDllPa></tDllPa>
+        <tDlgDll></tDlgDll>
+        <tDlgPa></tDlgPa>
+        <tIfile></tIfile>
+        <pMon>BIN\UL2CM3.DLL</pMon>
+      </DebugOpt>
+      <TargetDriverDllRegistry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGDARM</Key>
+          <Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGUARM</Key>
+          <Name>(105=-1,-1,-1,-1,0)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>ARMRTXEVENTFLAGS</Key>
+          <Name>-L70 -Z18 -C0 -M0 -T1</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>DLGTARM</Key>
+          <Name>(1010=1231,224,1641,767,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=1199,245,1664,545,0)</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>ARMDBGFLAGS</Key>
+          <Name>-T0</Name>
+        </SetRegEntry>
+        <SetRegEntry>
+          <Number>0</Number>
+          <Key>UL2CM3</Key>
+          <Name>-UV1115SAE -O3047 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC48000000 -TP21 -TDS8028 -TDT0 -TDC1F -TIE1 -TIP8 -FO11 -FD118000 -FC8000 -FN1 -FF0NEW_DEVICE.FLM -FS0E0000 -FL038000 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM)</Name>
+        </SetRegEntry>
+      </TargetDriverDllRegistry>
+      <Breakpoint/>
+      <WatchWindow1>
+        <Ww>
+          <count>0</count>
+          <WinNumber>1</WinNumber>
+          <ItemText>xTickCount</ItemText>
+        </Ww>
+        <Ww>
+          <count>1</count>
+          <WinNumber>1</WinNumber>
+          <ItemText>ulCycleCount</ItemText>
+        </Ww>
+        <Ww>
+          <count>2</count>
+          <WinNumber>1</WinNumber>
+          <ItemText>*(unsigned long *)0x200005E4</ItemText>
+        </Ww>
+      </WatchWindow1>
+      <MemoryWindow1>
+        <Mm>
+          <WinNumber>1</WinNumber>
+          <SubType>2</SubType>
+          <ItemText>0xe000e284</ItemText>
+          <AccSizeX>4</AccSizeX>
+        </Mm>
+      </MemoryWindow1>
+      <Tracepoint>
+        <THDelay>0</THDelay>
+      </Tracepoint>
+      <DebugFlag>
+        <trace>0</trace>
+        <periodic>1</periodic>
+        <aLwin>1</aLwin>
+        <aCover>0</aCover>
+        <aSer1>0</aSer1>
+        <aSer2>0</aSer2>
+        <aPa>0</aPa>
+        <viewmode>1</viewmode>
+        <vrSel>0</vrSel>
+        <aSym>0</aSym>
+        <aTbox>0</aTbox>
+        <AscS1>0</AscS1>
+        <AscS2>0</AscS2>
+        <AscS3>0</AscS3>
+        <aSer3>0</aSer3>
+        <eProf>0</eProf>
+        <aLa>0</aLa>
+        <aPa1>0</aPa1>
+        <AscS4>0</AscS4>
+        <aSer4>0</aSer4>
+        <StkLoc>0</StkLoc>
+        <TrcWin>0</TrcWin>
+        <newCpu>0</newCpu>
+        <uProt>0</uProt>
+      </DebugFlag>
+      <LintExecutable></LintExecutable>
+      <LintConfigFile></LintConfigFile>
+      <bLintAuto>0</bLintAuto>
+      <Lin2Executable></Lin2Executable>
+      <Lin2ConfigFile></Lin2ConfigFile>
+      <bLin2Auto>0</bLin2Auto>
+    </TargetOption>
+  </Target>
+
+  <Group>
+    <GroupName>System</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+    <File>
+      <GroupNumber>1</GroupNumber>
+      <FileNumber>1</FileNumber>
+      <FileType>2</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.\startup_MPS_CM4.S</PathWithFileName>
+      <FilenameWithoutPath>startup_MPS_CM4.S</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+  </Group>
+
+  <Group>
+    <GroupName>main_and_config</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>2</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\main.c</PathWithFileName>
+      <FilenameWithoutPath>main.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>3</FileNumber>
+      <FileType>5</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\FreeRTOSConfig.h</PathWithFileName>
+      <FilenameWithoutPath>FreeRTOSConfig.h</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>2</GroupNumber>
+      <FileNumber>4</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>.\RegTest.c</PathWithFileName>
+      <FilenameWithoutPath>RegTest.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+  </Group>
+
+  <Group>
+    <GroupName>FreeRTOS_Source</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>5</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\event_groups.c</PathWithFileName>
+      <FilenameWithoutPath>event_groups.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>6</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\list.c</PathWithFileName>
+      <FilenameWithoutPath>list.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>7</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\queue.c</PathWithFileName>
+      <FilenameWithoutPath>queue.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>8</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\tasks.c</PathWithFileName>
+      <FilenameWithoutPath>tasks.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>9</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\timers.c</PathWithFileName>
+      <FilenameWithoutPath>timers.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>10</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\portable\MemMang\heap_4.c</PathWithFileName>
+      <FilenameWithoutPath>heap_4.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>11</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\portable\RVDS\ARM_CM4_MPU\port.c</PathWithFileName>
+      <FilenameWithoutPath>port.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+    <File>
+      <GroupNumber>3</GroupNumber>
+      <FileNumber>12</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\..\Source\portable\Common\mpu_wrappers.c</PathWithFileName>
+      <FilenameWithoutPath>mpu_wrappers.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+  </Group>
+
+</ProjectOpt>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RTOSDemo.uvprojx
new file mode 100644 (file)
index 0000000..7056e25
--- /dev/null
@@ -0,0 +1,454 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
+
+  <SchemaVersion>2.1</SchemaVersion>
+
+  <Header>### uVision Project, (C) Keil Software</Header>
+
+  <Targets>
+    <Target>
+      <TargetName>RTOSDemo</TargetName>
+      <ToolsetNumber>0x4</ToolsetNumber>
+      <ToolsetName>ARM-ADS</ToolsetName>
+      <pCCUsed>5060061::V5.06 update 1 (build 61)::ARMCC</pCCUsed>
+      <TargetOption>
+        <TargetCommonOption>
+          <Device>ARMCM4_FP</Device>
+          <Vendor>ARM</Vendor>
+          <PackID>ARM.CMSIS.4.5.0</PackID>
+          <PackURL>http://www.keil.com/pack/</PackURL>
+          <Cpu>IROM(0x00000000,0x80000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ESEL ELITTLE</Cpu>
+          <FlashUtilSpec></FlashUtilSpec>
+          <StartupFile></StartupFile>
+          <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0NEW_DEVICE -FS00 -FL080000 -FP0($$Device:ARMCM4_FP$Device\ARM\Flash\NEW_DEVICE.FLM))</FlashDriverDll>
+          <DeviceId>0</DeviceId>
+          <RegisterFile>$$Device:ARMCM4_FP$Device\ARM\ARMCM4\Include\ARMCM4_FP.h</RegisterFile>
+          <MemoryEnv></MemoryEnv>
+          <Cmp></Cmp>
+          <Asm></Asm>
+          <Linker></Linker>
+          <OHString></OHString>
+          <InfinionOptionDll></InfinionOptionDll>
+          <SLE66CMisc></SLE66CMisc>
+          <SLE66AMisc></SLE66AMisc>
+          <SLE66LinkerMisc></SLE66LinkerMisc>
+          <SFDFile>$$Device:ARMCM4_FP$Device\ARM\SVD\ARMCM4.svd</SFDFile>
+          <bCustSvd>0</bCustSvd>
+          <UseEnv>0</UseEnv>
+          <BinPath></BinPath>
+          <IncludePath></IncludePath>
+          <LibPath></LibPath>
+          <RegisterFilePath></RegisterFilePath>
+          <DBRegisterFilePath></DBRegisterFilePath>
+          <TargetStatus>
+            <Error>0</Error>
+            <ExitCodeStop>0</ExitCodeStop>
+            <ButtonStop>0</ButtonStop>
+            <NotGenerated>0</NotGenerated>
+            <InvalidFlash>1</InvalidFlash>
+          </TargetStatus>
+          <OutputDirectory>.\Objects\</OutputDirectory>
+          <OutputName>RTOSDemo</OutputName>
+          <CreateExecutable>1</CreateExecutable>
+          <CreateLib>0</CreateLib>
+          <CreateHexFile>1</CreateHexFile>
+          <DebugInformation>1</DebugInformation>
+          <BrowseInformation>1</BrowseInformation>
+          <ListingPath>.\Listings\</ListingPath>
+          <HexFormatSelection>1</HexFormatSelection>
+          <Merge32K>0</Merge32K>
+          <CreateBatchFile>0</CreateBatchFile>
+          <BeforeCompile>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopU1X>0</nStopU1X>
+            <nStopU2X>0</nStopU2X>
+          </BeforeCompile>
+          <BeforeMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopB1X>0</nStopB1X>
+            <nStopB2X>0</nStopB2X>
+          </BeforeMake>
+          <AfterMake>
+            <RunUserProg1>0</RunUserProg1>
+            <RunUserProg2>0</RunUserProg2>
+            <UserProg1Name></UserProg1Name>
+            <UserProg2Name></UserProg2Name>
+            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
+            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
+            <nStopA1X>0</nStopA1X>
+            <nStopA2X>0</nStopA2X>
+          </AfterMake>
+          <SelectedForBatchBuild>0</SelectedForBatchBuild>
+          <SVCSIdString></SVCSIdString>
+        </TargetCommonOption>
+        <CommonProperty>
+          <UseCPPCompiler>0</UseCPPCompiler>
+          <RVCTCodeConst>0</RVCTCodeConst>
+          <RVCTZI>0</RVCTZI>
+          <RVCTOtherData>0</RVCTOtherData>
+          <ModuleSelection>0</ModuleSelection>
+          <IncludeInBuild>1</IncludeInBuild>
+          <AlwaysBuild>0</AlwaysBuild>
+          <GenerateAssemblyFile>0</GenerateAssemblyFile>
+          <AssembleAssemblyFile>0</AssembleAssemblyFile>
+          <PublicsOnly>0</PublicsOnly>
+          <StopOnExitCode>3</StopOnExitCode>
+          <CustomArgument></CustomArgument>
+          <IncludeLibraryModules></IncludeLibraryModules>
+          <ComprImg>1</ComprImg>
+        </CommonProperty>
+        <DllOption>
+          <SimDllName>SARMCM3.DLL</SimDllName>
+          <SimDllArguments>  -MPU</SimDllArguments>
+          <SimDlgDll>DCM.DLL</SimDlgDll>
+          <SimDlgDllArguments>-pCM4</SimDlgDllArguments>
+          <TargetDllName>SARMCM3.DLL</TargetDllName>
+          <TargetDllArguments> -MPU</TargetDllArguments>
+          <TargetDlgDll>TCM.DLL</TargetDlgDll>
+          <TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
+        </DllOption>
+        <DebugOption>
+          <OPTHX>
+            <HexSelection>1</HexSelection>
+            <HexRangeLowAddress>0</HexRangeLowAddress>
+            <HexRangeHighAddress>0</HexRangeHighAddress>
+            <HexOffset>0</HexOffset>
+            <Oh166RecLen>16</Oh166RecLen>
+          </OPTHX>
+        </DebugOption>
+        <Utilities>
+          <Flash1>
+            <UseTargetDll>1</UseTargetDll>
+            <UseExternalTool>0</UseExternalTool>
+            <RunIndependent>0</RunIndependent>
+            <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
+            <Capability>1</Capability>
+            <DriverSelection>4096</DriverSelection>
+          </Flash1>
+          <bUseTDR>1</bUseTDR>
+          <Flash2>BIN\UL2CM3.DLL</Flash2>
+          <Flash3>"" ()</Flash3>
+          <Flash4></Flash4>
+          <pFcarmOut></pFcarmOut>
+          <pFcarmGrp></pFcarmGrp>
+          <pFcArmRoot></pFcArmRoot>
+          <FcArmLst>0</FcArmLst>
+        </Utilities>
+        <TargetArmAds>
+          <ArmAdsMisc>
+            <GenerateListings>0</GenerateListings>
+            <asHll>1</asHll>
+            <asAsm>1</asAsm>
+            <asMacX>1</asMacX>
+            <asSyms>1</asSyms>
+            <asFals>1</asFals>
+            <asDbgD>1</asDbgD>
+            <asForm>1</asForm>
+            <ldLst>0</ldLst>
+            <ldmm>1</ldmm>
+            <ldXref>1</ldXref>
+            <BigEnd>0</BigEnd>
+            <AdsALst>1</AdsALst>
+            <AdsACrf>1</AdsACrf>
+            <AdsANop>0</AdsANop>
+            <AdsANot>0</AdsANot>
+            <AdsLLst>1</AdsLLst>
+            <AdsLmap>1</AdsLmap>
+            <AdsLcgr>1</AdsLcgr>
+            <AdsLsym>1</AdsLsym>
+            <AdsLszi>1</AdsLszi>
+            <AdsLtoi>1</AdsLtoi>
+            <AdsLsun>1</AdsLsun>
+            <AdsLven>1</AdsLven>
+            <AdsLsxf>1</AdsLsxf>
+            <RvctClst>1</RvctClst>
+            <GenPPlst>0</GenPPlst>
+            <AdsCpuType>"Cortex-M4"</AdsCpuType>
+            <RvctDeviceName></RvctDeviceName>
+            <mOS>0</mOS>
+            <uocRom>0</uocRom>
+            <uocRam>0</uocRam>
+            <hadIROM>1</hadIROM>
+            <hadIRAM>1</hadIRAM>
+            <hadXRAM>0</hadXRAM>
+            <uocXRam>0</uocXRam>
+            <RvdsVP>2</RvdsVP>
+            <hadIRAM2>0</hadIRAM2>
+            <hadIROM2>0</hadIROM2>
+            <StupSel>8</StupSel>
+            <useUlib>1</useUlib>
+            <EndSel>1</EndSel>
+            <uLtcg>0</uLtcg>
+            <nSecure>0</nSecure>
+            <RoSelD>3</RoSelD>
+            <RwSelD>3</RwSelD>
+            <CodeSel>0</CodeSel>
+            <OptFeed>0</OptFeed>
+            <NoZi1>0</NoZi1>
+            <NoZi2>0</NoZi2>
+            <NoZi3>0</NoZi3>
+            <NoZi4>0</NoZi4>
+            <NoZi5>0</NoZi5>
+            <Ro1Chk>0</Ro1Chk>
+            <Ro2Chk>0</Ro2Chk>
+            <Ro3Chk>0</Ro3Chk>
+            <Ir1Chk>1</Ir1Chk>
+            <Ir2Chk>0</Ir2Chk>
+            <Ra1Chk>0</Ra1Chk>
+            <Ra2Chk>0</Ra2Chk>
+            <Ra3Chk>0</Ra3Chk>
+            <Im1Chk>1</Im1Chk>
+            <Im2Chk>0</Im2Chk>
+            <OnChipMemories>
+              <Ocm1>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm1>
+              <Ocm2>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm2>
+              <Ocm3>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm3>
+              <Ocm4>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm4>
+              <Ocm5>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm5>
+              <Ocm6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </Ocm6>
+              <IRAM>
+                <Type>0</Type>
+                <StartAddress>0x20000000</StartAddress>
+                <Size>0x20000</Size>
+              </IRAM>
+              <IROM>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x80000</Size>
+              </IROM>
+              <XRAM>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </XRAM>
+              <OCR_RVCT1>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT1>
+              <OCR_RVCT2>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT2>
+              <OCR_RVCT3>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT3>
+              <OCR_RVCT4>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x80000</Size>
+              </OCR_RVCT4>
+              <OCR_RVCT5>
+                <Type>1</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT5>
+              <OCR_RVCT6>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT6>
+              <OCR_RVCT7>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT7>
+              <OCR_RVCT8>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT8>
+              <OCR_RVCT9>
+                <Type>0</Type>
+                <StartAddress>0x20000000</StartAddress>
+                <Size>0x8000</Size>
+              </OCR_RVCT9>
+              <OCR_RVCT10>
+                <Type>0</Type>
+                <StartAddress>0x0</StartAddress>
+                <Size>0x0</Size>
+              </OCR_RVCT10>
+            </OnChipMemories>
+            <RvctStartVector></RvctStartVector>
+          </ArmAdsMisc>
+          <Cads>
+            <interw>1</interw>
+            <Optim>1</Optim>
+            <oTime>0</oTime>
+            <SplitLS>0</SplitLS>
+            <OneElfS>1</OneElfS>
+            <Strict>0</Strict>
+            <EnumInt>0</EnumInt>
+            <PlainCh>0</PlainCh>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <wLevel>2</wLevel>
+            <uThumb>0</uThumb>
+            <uSurpInc>0</uSurpInc>
+            <uC99>0</uC99>
+            <useXO>0</useXO>
+            <v6Lang>0</v6Lang>
+            <v6LangP>0</v6LangP>
+            <vShortEn>0</vShortEn>
+            <vShortWch>0</vShortWch>
+            <VariousControls>
+              <MiscControls></MiscControls>
+              <Define></Define>
+              <Undefine></Undefine>
+              <IncludePath>..;..\..\..\Source\include;..\..\..\Source\portable\RVDS\ARM_CM4_MPU;..\..\Common\include;..\CMSIS;..\main_full</IncludePath>
+            </VariousControls>
+          </Cads>
+          <Aads>
+            <interw>1</interw>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <thumb>0</thumb>
+            <SplitLS>0</SplitLS>
+            <SwStkChk>0</SwStkChk>
+            <NoWarn>0</NoWarn>
+            <uSurpInc>0</uSurpInc>
+            <useXO>0</useXO>
+            <VariousControls>
+              <MiscControls></MiscControls>
+              <Define></Define>
+              <Undefine></Undefine>
+              <IncludePath></IncludePath>
+            </VariousControls>
+          </Aads>
+          <LDads>
+            <umfTarg>0</umfTarg>
+            <Ropi>0</Ropi>
+            <Rwpi>0</Rwpi>
+            <noStLib>0</noStLib>
+            <RepFail>1</RepFail>
+            <useFile>0</useFile>
+            <TextAddressRange>0x00000000</TextAddressRange>
+            <DataAddressRange>0x20000000</DataAddressRange>
+            <pXoBase></pXoBase>
+            <ScatterFile>RTOSDemo.sct</ScatterFile>
+            <IncludeLibs></IncludeLibs>
+            <IncludeLibsPath></IncludeLibsPath>
+            <Misc></Misc>
+            <LinkerInputFile></LinkerInputFile>
+            <DisabledWarnings></DisabledWarnings>
+          </LDads>
+        </TargetArmAds>
+      </TargetOption>
+      <Groups>
+        <Group>
+          <GroupName>System</GroupName>
+          <Files>
+            <File>
+              <FileName>startup_MPS_CM4.S</FileName>
+              <FileType>2</FileType>
+              <FilePath>.\startup_MPS_CM4.S</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>main_and_config</GroupName>
+          <Files>
+            <File>
+              <FileName>main.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\main.c</FilePath>
+            </File>
+            <File>
+              <FileName>FreeRTOSConfig.h</FileName>
+              <FileType>5</FileType>
+              <FilePath>..\FreeRTOSConfig.h</FilePath>
+            </File>
+            <File>
+              <FileName>RegTest.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>.\RegTest.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+        <Group>
+          <GroupName>FreeRTOS_Source</GroupName>
+          <Files>
+            <File>
+              <FileName>event_groups.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\event_groups.c</FilePath>
+            </File>
+            <File>
+              <FileName>list.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\list.c</FilePath>
+            </File>
+            <File>
+              <FileName>queue.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\queue.c</FilePath>
+            </File>
+            <File>
+              <FileName>tasks.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\tasks.c</FilePath>
+            </File>
+            <File>
+              <FileName>timers.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\timers.c</FilePath>
+            </File>
+            <File>
+              <FileName>heap_4.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\portable\MemMang\heap_4.c</FilePath>
+            </File>
+            <File>
+              <FileName>port.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\portable\RVDS\ARM_CM4_MPU\port.c</FilePath>
+            </File>
+            <File>
+              <FileName>mpu_wrappers.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\..\Source\portable\Common\mpu_wrappers.c</FilePath>
+            </File>
+          </Files>
+        </Group>
+      </Groups>
+    </Target>
+  </Targets>
+
+</Project>
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/RegTest.c
new file mode 100644 (file)
index 0000000..e2b8cfa
--- /dev/null
@@ -0,0 +1,703 @@
+/*\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2015 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
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\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
+    ***************************************************************************\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
+\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
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+/* FreeRTOS includes. */\r
+#include "FreeRTOS.h"\r
+#include "queue.h"\r
+#include "task.h"\r
+\r
+/*\r
+ * "Reg test" tasks - These fill the registers with known values, then check\r
+ * that each register maintains its expected value for the lifetime of the\r
+ * task.  Each task uses a different set of values.  The reg test tasks execute\r
+ * with a very low priority, so get preempted very frequently.  A register\r
+ * containing an unexpected value is indicative of an error in the context\r
+ * switching mechanism.\r
+ */\r
+\r
+void vRegTest1Implementation( void *pvParameters );\r
+void vRegTest2Implementation( void *pvParameters );\r
+void vRegTest3Implementation( void );\r
+void vRegTest4Implementation( void );\r
+\r
+/*\r
+ * Used as an easy way of deleting a task from inline assembly.\r
+ */\r
+extern void vMainDeleteMe( void ) __attribute__((noinline));\r
+\r
+/*\r
+ * Used by the first two reg test tasks and a software timer callback function\r
+ * to send messages to the check task.  The message just lets the check task\r
+ * know that the tasks and timer are still functioning correctly.  If a reg test\r
+ * task detects an error it will delete itself, and in so doing prevent itself\r
+ * from sending any more 'I'm Alive' messages to the check task.\r
+ */\r
+extern void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );\r
+\r
+/* The queue used to send a message to the check task. */\r
+extern QueueHandle_t xGlobalScopeCheckQueue;\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+void vRegTest1Implementation( void *pvParameters )\r
+{\r
+/* This task is created in privileged mode so can access the file scope\r
+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
+QueueHandle_t xQueue = xGlobalScopeCheckQueue;\r
+const TickType_t xDelayTime = pdMS_TO_TICKS( 100UL );\r
+\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
+\r
+       /* First check that the parameter value is as expected. */\r
+       if( pvParameters != ( void * ) configREG_TEST_TASK_1_PARAMETER )\r
+       {\r
+               /* Error detected.  Delete the task so it stops communicating with\r
+               the check task. */\r
+               vMainDeleteMe();\r
+       }\r
+\r
+       for( ;; )\r
+       {\r
+               #if defined ( __GNUC__ )\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
+                               "               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
+                               "               MOV     R8, #108                        \n"\r
+                               "               MOV     R9, #109                        \n"\r
+                               "               MOV     R10, #110                       \n"\r
+                               "               MOV     R11, #111                       \n"\r
+                               "reg1loop:                                              \n"\r
+                               "               MOV     R0, #100                        \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */\r
+                               "               MOV     R1, #101                        \n"\r
+                               "               MOV     R2, #102                        \n"\r
+                               "               MOV R3, #103                    \n"\r
+                               "               MOV     R12, #112                       \n"\r
+                               "               SVC #1                                  \n" /* Yield just to increase test coverage. */\r
+                               "               CMP     R0, #100                        \n" /* Check all the registers still contain their expected values. */\r
+                               "               BNE     vMainDeleteMe           \n" /* Value was not as expected, delete the task so it stops communicating with the check task. */\r
+                               "               CMP     R1, #101                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R2, #102                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP R3, #103                    \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R4, #104                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R5, #105                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R6, #106                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R8, #108                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R9, #109                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R10, #110                       \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R11, #111                       \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R12, #112                       \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               :::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"\r
+                       );\r
+               }\r
+               #endif /* __GNUC__ */\r
+\r
+               /* Send configREG_TEST_1_STILL_EXECUTING to the check task to indicate that this\r
+               task is still functioning. */\r
+               vMainSendImAlive( xQueue, configREG_TEST_1_STILL_EXECUTING );\r
+               vTaskDelay( xDelayTime );\r
+\r
+               #if defined ( __GNUC__ )\r
+               {\r
+                       /* Go back to check all the register values again. */\r
+                       __asm volatile( "               B reg1loop      " );\r
+               }\r
+               #endif /* __GNUC__ */\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vRegTest2Implementation( 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
+method. */\r
+QueueHandle_t xQueue = ( QueueHandle_t ) pvParameters;\r
+const TickType_t xDelayTime = pdMS_TO_TICKS( 100UL );\r
+\r
+       for( ;; )\r
+       {\r
+               #if defined ( __GNUC__ )\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
+                               "               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
+                               "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
+                               "               MOV     R2, #2                          \n"\r
+                               "               MOV R3, #3                              \n"\r
+                               "               MOV     R12, #12                        \n"\r
+                               "               CMP     R0, #13                         \n" /* Check all the registers still contain their expected values. */\r
+                               "               BNE     vMainDeleteMe           \n" /* Value was not as expected, delete the task so it stops communicating with the check task */\r
+                               "               CMP     R1, #1                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R2, #2                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP R3, #3                              \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R4, #4                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R5, #5                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R6, #6                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R8, #8                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R9, #9                          \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R10, #10                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R11, #11                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               "               CMP     R12, #12                        \n"\r
+                               "               BNE     vMainDeleteMe           \n"\r
+                               :::"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r8", "r9", "r10", "r11", "r12"\r
+                       );\r
+               }\r
+               #endif /* __GNUC__ */\r
+\r
+               /* Send configREG_TEST_2_STILL_EXECUTING to the check task to indicate\r
+               that this task is still functioning. */\r
+               vMainSendImAlive( xQueue, configREG_TEST_2_STILL_EXECUTING );\r
+               vTaskDelay( xDelayTime );\r
+\r
+               #if defined ( __GNUC__ )\r
+               {\r
+                       /* Go back to check all the register values again. */\r
+                       __asm volatile( "               B reg2loop      " );\r
+               }\r
+               #endif /* __GNUC__ */\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+__asm void vRegTest3Implementation( void )\r
+{\r
+       extern pulRegTest3LoopCounter\r
+\r
+       PRESERVE8\r
+\r
+       /* Fill the core registers with known values. */\r
+       mov     r0, #100\r
+       mov     r1, #101\r
+       mov     r2, #102\r
+       mov     r3, #103\r
+       mov     r4, #104\r
+       mov     r5, #105\r
+       mov     r6, #106\r
+       mov     r7, #107\r
+       mov     r8, #108\r
+       mov     r9, #109\r
+       mov     r10, #110\r
+       mov     r11, #111\r
+       mov     r12, #112\r
+\r
+       /* Fill the VFP registers with known values. */\r
+       vmov    d0, r0, r1\r
+       vmov    d1, r2, r3\r
+       vmov    d2, r4, r5\r
+       vmov    d3, r6, r7\r
+       vmov    d4, r8, r9\r
+       vmov    d5, r10, r11\r
+       vmov    d6, r0, r1\r
+       vmov    d7, r2, r3\r
+       vmov    d8, r4, r5\r
+       vmov    d9, r6, r7\r
+       vmov    d10, r8, r9\r
+       vmov    d11, r10, r11\r
+       vmov    d12, r0, r1\r
+       vmov    d13, r2, r3\r
+       vmov    d14, r4, r5\r
+       vmov    d15, r6, r7\r
+\r
+reg1_loop\r
+\r
+       /* Check all the VFP registers still contain the values set above.\r
+       First save registers that are clobbered by the test. */\r
+       push { r0-r1 }\r
+\r
+       vmov    r0, r1, d0\r
+       cmp     r0, #100\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #101\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d1\r
+       cmp     r0, #102\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #103\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d2\r
+       cmp     r0, #104\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #105\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d3\r
+       cmp     r0, #106\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #107\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d4\r
+       cmp     r0, #108\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #109\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d5\r
+       cmp     r0, #110\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #111\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d6\r
+       cmp     r0, #100\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #101\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d7\r
+       cmp     r0, #102\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #103\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d8\r
+       cmp     r0, #104\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #105\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d9\r
+       cmp     r0, #106\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #107\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d10\r
+       cmp     r0, #108\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #109\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d11\r
+       cmp     r0, #110\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #111\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d12\r
+       cmp     r0, #100\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #101\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d13\r
+       cmp     r0, #102\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #103\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d14\r
+       cmp     r0, #104\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #105\r
+       bne     reg1_error_loopf\r
+       vmov    r0, r1, d15\r
+       cmp     r0, #106\r
+       bne     reg1_error_loopf\r
+       cmp     r1, #107\r
+       bne     reg1_error_loopf\r
+\r
+       /* Restore the registers that were clobbered by the test. */\r
+       pop     {r0-r1}\r
+\r
+       /* VFP register test passed.  Jump to the core register test. */\r
+       b               reg1_loopf_pass\r
+\r
+reg1_error_loopf\r
+       /* If this line is hit then a VFP register value was found to be incorrect. */\r
+       b reg1_error_loopf\r
+\r
+reg1_loopf_pass\r
+\r
+       cmp     r0, #100\r
+       bne     reg1_error_loop\r
+       cmp     r1, #101\r
+       bne     reg1_error_loop\r
+       cmp     r2, #102\r
+       bne     reg1_error_loop\r
+       cmp     r3, #103\r
+       bne     reg1_error_loop\r
+       cmp     r4, #104\r
+       bne     reg1_error_loop\r
+       cmp     r5, #105\r
+       bne     reg1_error_loop\r
+       cmp     r6, #106\r
+       bne     reg1_error_loop\r
+       cmp     r7, #107\r
+       bne     reg1_error_loop\r
+       cmp     r8, #108\r
+       bne     reg1_error_loop\r
+       cmp     r9, #109\r
+       bne     reg1_error_loop\r
+       cmp     r10, #110\r
+       bne     reg1_error_loop\r
+       cmp     r11, #111\r
+       bne     reg1_error_loop\r
+       cmp     r12, #112\r
+       bne     reg1_error_loop\r
+\r
+       /* Everything passed, increment the loop counter. */\r
+       push    { r0-r1 }\r
+       ldr     r0, =pulRegTest3LoopCounter\r
+       ldr     r0, [r0]\r
+       ldr     r1, [r0]\r
+       adds    r1, r1, #1\r
+       str     r1, [r0]\r
+       pop     { r0-r1 }\r
+\r
+       /* Start again. */\r
+       b               reg1_loop\r
+\r
+reg1_error_loop\r
+       /* If this line is hit then there was an error in a core register value.\r
+       The loop ensures the loop counter stops incrementing. */\r
+       b       reg1_error_loop\r
+       nop\r
+       nop\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+__asm void vRegTest4Implementation( void )\r
+{\r
+       extern pulRegTest4LoopCounter;\r
+\r
+       PRESERVE8\r
+\r
+       /* Set all the core registers to known values. */\r
+       mov     r0, #-1\r
+       mov     r1, #1\r
+       mov     r2, #2\r
+       mov     r3, #3\r
+       mov     r4, #4\r
+       mov     r5, #5\r
+       mov     r6, #6\r
+       mov     r7, #7\r
+       mov     r8, #8\r
+       mov     r9, #9\r
+       mov     r10, #10\r
+       mov     r11, #11\r
+       mov     r12, #12\r
+\r
+       /* Set all the VFP to known values. */\r
+       vmov    d0, r0, r1\r
+       vmov    d1, r2, r3\r
+       vmov    d2, r4, r5\r
+       vmov    d3, r6, r7\r
+       vmov    d4, r8, r9\r
+       vmov    d5, r10, r11\r
+       vmov    d6, r0, r1\r
+       vmov    d7, r2, r3\r
+       vmov    d8, r4, r5\r
+       vmov    d9, r6, r7\r
+       vmov    d10, r8, r9\r
+       vmov    d11, r10, r11\r
+       vmov    d12, r0, r1\r
+       vmov    d13, r2, r3\r
+       vmov    d14, r4, r5\r
+       vmov    d15, r6, r7\r
+\r
+reg2_loop\r
+\r
+       /* Check all the VFP registers still contain the values set above.\r
+       First save registers that are clobbered by the test. */\r
+       push { r0-r1 }\r
+\r
+       vmov    r0, r1, d0\r
+       cmp     r0, #-1\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #1\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d1\r
+       cmp     r0, #2\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #3\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d2\r
+       cmp     r0, #4\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #5\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d3\r
+       cmp     r0, #6\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #7\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d4\r
+       cmp     r0, #8\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #9\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d5\r
+       cmp     r0, #10\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #11\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d6\r
+       cmp     r0, #-1\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #1\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d7\r
+       cmp     r0, #2\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #3\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d8\r
+       cmp     r0, #4\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #5\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d9\r
+       cmp     r0, #6\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #7\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d10\r
+       cmp     r0, #8\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #9\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d11\r
+       cmp     r0, #10\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #11\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d12\r
+       cmp     r0, #-1\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #1\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d13\r
+       cmp     r0, #2\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #3\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d14\r
+       cmp     r0, #4\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #5\r
+       bne     reg2_error_loopf\r
+       vmov    r0, r1, d15\r
+       cmp     r0, #6\r
+       bne     reg2_error_loopf\r
+       cmp     r1, #7\r
+       bne     reg2_error_loopf\r
+\r
+       /* Restore the registers that were clobbered by the test. */\r
+       pop     {r0-r1}\r
+\r
+       /* VFP register test passed.  Jump to the core register test. */\r
+       b               reg2_loopf_pass\r
+\r
+reg2_error_loopf\r
+       /* If this line is hit then a VFP register value was found to be\r
+       incorrect. */\r
+       b reg2_error_loopf\r
+\r
+reg2_loopf_pass\r
+\r
+       cmp     r0, #-1\r
+       bne     reg2_error_loop\r
+       cmp     r1, #1\r
+       bne     reg2_error_loop\r
+       cmp     r2, #2\r
+       bne     reg2_error_loop\r
+       cmp     r3, #3\r
+       bne     reg2_error_loop\r
+       cmp     r4, #4\r
+       bne     reg2_error_loop\r
+       cmp     r5, #5\r
+       bne     reg2_error_loop\r
+       cmp     r6, #6\r
+       bne     reg2_error_loop\r
+       cmp     r7, #7\r
+       bne     reg2_error_loop\r
+       cmp     r8, #8\r
+       bne     reg2_error_loop\r
+       cmp     r9, #9\r
+       bne     reg2_error_loop\r
+       cmp     r10, #10\r
+       bne     reg2_error_loop\r
+       cmp     r11, #11\r
+       bne     reg2_error_loop\r
+       cmp     r12, #12\r
+       bne     reg2_error_loop\r
+\r
+       /* Increment the loop counter so the check task knows this task is\r
+       still running. */\r
+       push    { r0-r1 }\r
+       ldr     r0, =pulRegTest4LoopCounter\r
+       ldr     r0, [r0]\r
+       ldr     r1, [r0]\r
+       adds    r1, r1, #1\r
+       str     r1, [r0]\r
+       pop { r0-r1 }\r
+\r
+       /* Yield to increase test coverage. */\r
+       SVC #1\r
+\r
+       /* Start again. */\r
+       b reg2_loop\r
+\r
+reg2_error_loop\r
+       /* If this line is hit then there was an error in a core register value.\r
+       This loop ensures the loop counter variable stops incrementing. */\r
+       b reg2_error_loop\r
+       nop\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+/* Fault handlers are here for convenience as they use compiler specific syntax\r
+and this file is specific to the Keil compiler. */\r
+void hard_fault_handler( uint32_t * hardfault_args )\r
+{\r
+volatile uint32_t stacked_r0;\r
+volatile uint32_t stacked_r1;\r
+volatile uint32_t stacked_r2;\r
+volatile uint32_t stacked_r3;\r
+volatile uint32_t stacked_r12;\r
+volatile uint32_t stacked_lr;\r
+volatile uint32_t stacked_pc;\r
+volatile uint32_t stacked_psr;\r
+\r
+       stacked_r0 = ((uint32_t) hardfault_args[ 0 ]);\r
+       stacked_r1 = ((uint32_t) hardfault_args[ 1 ]);\r
+       stacked_r2 = ((uint32_t) hardfault_args[ 2 ]);\r
+       stacked_r3 = ((uint32_t) hardfault_args[ 3 ]);\r
+\r
+       stacked_r12 = ((uint32_t) hardfault_args[ 4 ]);\r
+       stacked_lr = ((uint32_t) hardfault_args[ 5 ]);\r
+       stacked_pc = ((uint32_t) hardfault_args[ 6 ]);\r
+       stacked_psr = ((uint32_t) hardfault_args[ 7 ]);\r
+\r
+       /* Inspect stacked_pc to locate the offending instruction. */\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void HardFault_Handler( void );\r
+__asm void HardFault_Handler( void )\r
+{\r
+       extern hard_fault_handler\r
+\r
+       tst lr, #4\r
+       ite eq\r
+       mrseq r0, msp\r
+       mrsne r0, psp\r
+       ldr r1, [r0, #24]\r
+       ldr r2, hard_fault_handler\r
+       bx r2\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void MemManage_Handler( void );\r
+__asm void MemManage_Handler( void )\r
+{\r
+       extern hard_fault_handler\r
+\r
+       tst lr, #4\r
+       ite eq\r
+       mrseq r0, msp\r
+       mrsne r0, psp\r
+       ldr r1, [r0, #24]\r
+       ldr r2, hard_fault_handler\r
+       bx r2\r
+}\r
+/*-----------------------------------------------------------*/\r
diff --git a/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/startup_MPS_CM4.S b/FreeRTOS/Demo/CORTEX_MPU_Simulator_Keil_GCC/Keil_Specific/startup_MPS_CM4.S
new file mode 100644 (file)
index 0000000..8534aa2
--- /dev/null
@@ -0,0 +1,172 @@
+;/*****************************************************************************\r
+; * @file:    startup_MPS_CM4.s\r
+; * @purpose: CMSIS Cortex-M4 Core Device Startup File\r
+; *           for the ARM 'Microcontroller Prototyping System'\r
+; * @version: V1.00\r
+; * @date:    1. Jun. 2010\r
+; *------- <<< Use Configuration Wizard in Context Menu >>> ------------------\r
+; *\r
+; * Copyright (C) 2008-2010 ARM Limited. All rights reserved.\r
+; * ARM Limited (ARM) is supplying this software for use with Cortex-M4\r
+; * processor based microcontrollers.  This file can be freely distributed\r
+; * within development tools that are supporting such ARM based processors.\r
+; *\r
+; * THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED\r
+; * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\r
+; * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.\r
+; * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR\r
+; * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.\r
+; *\r
+; ****************************************************************************/\r
+\r
+\r
+; <h> Stack Configuration\r
+;   <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>\r
+; </h>\r
+Stack_Size      EQU     0x00000800\r
+\r
+                AREA    STACK, NOINIT, READWRITE, ALIGN=3\r
+Stack_Mem       SPACE   Stack_Size\r
+__initial_sp\r
+\r
+\r
+; <h> Heap Configuration\r
+;   <o>  Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>\r
+; </h>\r
+\r
+Heap_Size       EQU     0x00000000\r
+\r
+                AREA    HEAP, NOINIT, READWRITE, ALIGN=3\r
+__heap_base\r
+Heap_Mem        SPACE   Heap_Size\r
+__heap_limit\r
+\r
+\r
+                PRESERVE8\r
+                THUMB\r
+\r
+\r
+; Vector Table Mapped to Address 0 at Reset\r
+\r
+                AREA    RESET, DATA, READONLY\r
+                EXPORT  __Vectors\r
+\r
+__Vectors       DCD     __initial_sp              ; Top of Stack\r
+                DCD     Reset_Handler             ; Reset Handler\r
+                DCD     NMI_Handler               ; NMI Handler\r
+                DCD     HardFault_Handler         ; Hard Fault Handler\r
+                DCD     MemManage_Handler         ; MPU Fault Handler\r
+                DCD     BusFault_Handler          ; Bus Fault Handler\r
+                DCD     UsageFault_Handler        ; Usage Fault Handler\r
+                DCD     0                         ; Reserved\r
+                DCD     0                         ; Reserved\r
+                DCD     0                         ; Reserved\r
+                DCD     0                         ; Reserved\r
+                DCD     SVC_Handler               ; SVCall Handler\r
+                DCD     DebugMon_Handler          ; Debug Monitor Handler\r
+                DCD     0                         ; Reserved\r
+                DCD     PendSV_Handler            ; PendSV Handler\r
+                DCD     SysTick_Handler           ; SysTick Handler\r
+\r
+\r
+                AREA    |.text|, CODE, READONLY\r
+;                AREA    RESET, CODE, READONLY\r
+\r
+; Reset Handler\r
+\r
+Reset_Handler   PROC\r
+                EXPORT  Reset_Handler             [WEAK]\r
+                IMPORT  __main\r
+\r
+                ; Remap vector table\r
+                LDR     R0, =__Vectors\r
+                LDR     R1, =0xE000ED08\r
+                STR     R0,  [r1]\r
+                NOP\r
+\r
+                IF      {CPU} = "Cortex-M4.fp"\r
+                LDR     R0, =0xE000ED88           ; Enable CP10,CP11\r
+                LDR     R1,[R0]\r
+                ORR     R1,R1,#(0xF << 20)\r
+                STR     R1,[R0]\r
+                ENDIF\r
+\r
+                LDR     R0, =__main\r
+                BX      R0\r
+                ENDP\r
+\r
+\r
+; Dummy Exception Handlers (infinite loops which can be modified)\r
+\r
+NMI_Handler     PROC\r
+                EXPORT  NMI_Handler               [WEAK]\r
+                B       .\r
+                ENDP\r
+HardFault_Handler\\r
+                PROC\r
+                EXPORT  HardFault_Handler         [WEAK]\r
+                B       .\r
+                ENDP\r
+MemManage_Handler\\r
+                PROC\r
+                EXPORT  MemManage_Handler         [WEAK]\r
+                B       .\r
+                ENDP\r
+BusFault_Handler\\r
+                PROC\r
+                EXPORT  BusFault_Handler          [WEAK]\r
+                B       .\r
+                ENDP\r
+UsageFault_Handler\\r
+                PROC\r
+                EXPORT  UsageFault_Handler        [WEAK]\r
+                B       .\r
+                ENDP\r
+SVC_Handler     PROC\r
+                EXPORT  SVC_Handler               [WEAK]\r
+                B       .\r
+                ENDP\r
+DebugMon_Handler\\r
+                PROC\r
+                EXPORT  DebugMon_Handler          [WEAK]\r
+                B       .\r
+                ENDP\r
+PendSV_Handler  PROC\r
+                EXPORT  PendSV_Handler            [WEAK]\r
+                B       .\r
+                ENDP\r
+SysTick_Handler PROC\r
+                EXPORT  SysTick_Handler           [WEAK]\r
+                B       .\r
+                ENDP\r
+\r
+\r
+                ALIGN\r
+\r
+\r
+; User Initial Stack & Heap\r
+\r
+                IF      :DEF:__MICROLIB\r
+\r
+                EXPORT  __initial_sp\r
+                EXPORT  __heap_base\r
+                EXPORT  __heap_limit\r
+\r
+                ELSE\r
+\r
+                IMPORT  __use_two_region_memory\r
+                EXPORT  __user_initial_stackheap\r
+__user_initial_stackheap\r
+\r
+                LDR     R0, =  Heap_Mem\r
+                LDR     R1, =(Stack_Mem + Stack_Size)\r
+                LDR     R2, = (Heap_Mem +  Heap_Size)\r
+                LDR     R3, = Stack_Mem\r
+                BX      LR\r
+\r
+                ALIGN\r
+\r
+                ENDIF\r
+\r
+\r
+                END\r
index 080046e114863792e8df984d17f719b3d36af475..f8556063f857fc870ed1e69606972cf48461991e 100644 (file)
 \r
 /*\r
  * This file demonstrates the use of FreeRTOS-MPU.  It creates tasks in both\r
- * 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
- * task function itself.\r
+ * User mode and Privileged mode, and using both the xTaskCreate() and\r
+ * xTaskCreateRestricted() API functions.  The purpose of each created task is\r
+ * documented in the comments above the task function prototype (in this file),\r
+ * with the task behaviour demonstrated and documented within the task function\r
+ * itself.\r
  *\r
  * In addition a queue is used to demonstrate passing data between\r
  * protected/restricted tasks as well as passing data between an interrupt and\r
- * a protected/restricted task, and a software timer is used.\r
+ * a protected/restricted task.  A software timer is also used.\r
  */\r
 \r
 /* Standard includes. */\r
 /* Misc constants. */\r
 #define mainDONT_BLOCK                                 ( 0 )\r
 \r
-/* Definitions for the messages that can be sent to the check task. */\r
-#define mainREG_TEST_1_STILL_EXECUTING ( 0 )\r
-#define mainREG_TEST_2_STILL_EXECUTING ( 1 )\r
-#define mainPRINT_SYSTEM_STATUS                        ( 2 )\r
-\r
 /* GCC specifics. */\r
 #define mainALIGN_TO( x )                              __attribute__((aligned(x)))\r
 \r
 /* Hardware register addresses. */\r
-#define mainVTOR                                       ( * ( volatile uint32_t * ) 0xE000ED08 )\r
-#define mainNVIC_AUX_ACTLR                     ( * ( volatile uint32_t * ) 0xE000E008 )\r
-#define mainEC_INTERRUPT_CONTROL       ( * ( volatile uint32_t * ) 0x4000FC18 )\r
+#define mainVTOR                                               ( * ( volatile uint32_t * ) 0xE000ED08 )\r
 \r
 /* The period of the timer must be less than the rate at which\r
-mainPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the\r
+configPRINT_SYSTEM_STATUS messages are sent to the check task - otherwise the\r
 check task will think the timer has stopped. */\r
-#define mainTIMER_PERIOD                       pdMS_TO_TICKS( 200 )\r
+#define mainTIMER_PERIOD                               pdMS_TO_TICKS( 200 )\r
 \r
 /* The name of the task that is deleted by the Idle task is used in a couple of\r
 places, so is #defined. */\r
-#define mainTASK_TO_DELETE_NAME                "DeleteMe"\r
+#define mainTASK_TO_DELETE_NAME                        "DeleteMe"\r
 \r
 /*-----------------------------------------------------------*/\r
 /* Prototypes for functions that implement tasks. -----------*/\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
+ * NOTE:  The filling and checking of the registers in the following two tasks\r
+ *        is only actually performed when the GCC compiler is used.  Use of the\r
+ *        queue to communicate with the check task is done with all compilers.\r
+ *\r
+ * Prototype for the first two register test tasks, which execute in User mode.\r
+ * Amongst other things, these fill the CPU registers (other than the FPU\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
- * in the context switch mechanism can be caught.  Both reg test tasks execute\r
- * at the idle priority so will get preempted regularly.  Each task repeatedly\r
- * sends a message on a queue so long as it remains functioning correctly.  If\r
- * an error is detected within the task the task is simply deleted.\r
+ * in the context switch mechanism can be caught.  Both tasks execute at the\r
+ * idle priority so will get preempted regularly.  Each task repeatedly sends a\r
+ * message on a queue to a 'check' task so the check task knows the register\r
+ * check task is still executing and has not detected any errors.  If an error\r
+ * is detected within the task the task is simply deleted so it no longer sends\r
+ * messages.\r
+ *\r
+ * For demonstration and test purposes, both tasks obtain access to the queue\r
+ * handle in different ways; vRegTest1Implementation() is created in Privileged\r
+ * mode and copies the queue handle to its local stack before setting itself to\r
+ * User mode, and vRegTest2Implementation() receives the task handle using its\r
+ * parameter.\r
  */\r
-static void prvRegTest1Task( void *pvParameters );\r
-static void prvRegTest2Task( void *pvParameters );\r
+extern void vRegTest1Implementation( void *pvParameters );\r
+extern void vRegTest2Implementation( void *pvParameters );\r
+\r
+/*\r
+ * The second two register test tasks are similar to the first two, but do test\r
+ * the floating point registers, execute in Privileged mode, and signal their\r
+ * execution status to the 'check' task by incrementing a loop counter on each\r
+ * iteration instead of sending a message on a queue.  The loop counters use a\r
+ * memory region to which the User mode 'check' task has read access.\r
+ *\r
+ * The functions ending 'Implementation' are called by the register check tasks.\r
+ */\r
+static void prvRegTest3Task( void *pvParameters );\r
+extern void vRegTest3Implementation( void );\r
+static void prvRegTest4Task( void *pvParameters );\r
+extern void vRegTest4Implementation( void );\r
 \r
 /*\r
  * Prototype for the check task.  The check task demonstrates various features\r
@@ -142,13 +162,13 @@ static void prvRegTest2Task( void *pvParameters );
  *\r
  * Two types of messages can be processes:\r
  *\r
- * 1) "I'm Alive" messages sent from the reg test tasks, indicating that the\r
- *    task is still operational.\r
+ * 1) "I'm Alive" messages sent from the first two register test tasks and a\r
+ *    software timer callback, as described above.\r
  *\r
  * 2) "Print Status commands" sent periodically by the tick hook function (and\r
- *    therefore from within an interrupt) which command the check task to write\r
+ *    therefore from within an interrupt) which commands the check task to write\r
  *    either pass or fail to the terminal, depending on the status of the reg\r
- *    test tasks.\r
+ *    test tasks (no write is performed in the simulator!).\r
  */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
@@ -189,15 +209,16 @@ static void prvSetupHardware( void );
  * is simpler to call from asm code than the normal vTaskDelete() API function.\r
  * It has the noinline attribute because it is called from asm code.\r
  */\r
-static void prvDeleteMe( void ) __attribute__((noinline));\r
+void vMainDeleteMe( void ) __attribute__((noinline));\r
 \r
 /*\r
- * Used by both reg test tasks to send messages to the check task.  The message\r
- * just lets the check task know that the task is still functioning correctly.\r
- * 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
+ * Used by the first two reg test tasks and a software timer callback function\r
+ * to send messages to the check task.  The message just lets the check task\r
+ * know that the tasks and timer are still functioning correctly.  If a reg test\r
+ * task detects an error it will delete itself, and in so doing prevent itself\r
+ * from sending any more 'I'm Alive' messages to the check task.\r
  */\r
-static void prvSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );\r
+void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber );\r
 \r
 /*\r
  * The check task is created with access to three memory regions (plus its\r
@@ -218,11 +239,11 @@ static void prvTimerCallback( TimerHandle_t xExpiredTimer );
 /*-----------------------------------------------------------*/\r
 \r
 /* 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
+and interrupts.  Note that this is a global 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
 further information. */\r
-static QueueHandle_t xFileScopeCheckQueue = NULL;\r
+QueueHandle_t xGlobalScopeCheckQueue = NULL;\r
 \r
 /* Holds the handle of a task that is deleted in the idle task hook - this is\r
 done for code coverage test purposes only. */\r
@@ -231,6 +252,27 @@ static TaskHandle_t xTaskToDelete = NULL;
 /* The timer that periodically sends data to the check task on the queue. */\r
 static TimerHandle_t xTimer = NULL;\r
 \r
+#if defined ( __GNUC__ )\r
+       extern uint32_t __FLASH_segment_start__[];\r
+       extern uint32_t __FLASH_segment_end__[];\r
+       extern uint32_t __SRAM_segment_start__[];\r
+       extern uint32_t __SRAM_segment_end__[];\r
+       extern uint32_t __privileged_functions_start__[];\r
+       extern uint32_t __privileged_functions_end__[];\r
+       extern uint32_t __privileged_data_start__[];\r
+       extern uint32_t __privileged_data_end__[];\r
+       extern uint32_t __privileged_functions_actual_end__[];\r
+       extern uint32_t __privileged_data_actual_end__[];\r
+#else\r
+       const uint32_t * __FLASH_segment_start__ = ( uint32_t * ) 0x00UL;\r
+       const uint32_t * __FLASH_segment_end__ = ( uint32_t * ) 0x00080000UL;\r
+       const uint32_t * __SRAM_segment_start__ = ( uint32_t * ) 0x20000000UL;\r
+       const uint32_t * __SRAM_segment_end__ = ( uint32_t * ) 0x20008000UL;\r
+       const uint32_t * __privileged_functions_start__ = ( uint32_t * ) 0x00UL;\r
+       const uint32_t * __privileged_functions_end__ = ( uint32_t * ) 0x8000UL;\r
+       const uint32_t * __privileged_data_start__ = ( uint32_t * ) 0x20000000UL;\r
+       const uint32_t * __privileged_data_end__ = ( uint32_t * ) 0x20000200UL;\r
+#endif\r
 /*-----------------------------------------------------------*/\r
 /* Data used by the 'check' task. ---------------------------*/\r
 /*-----------------------------------------------------------*/\r
@@ -267,13 +309,23 @@ 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
+/* The following two variables are used to communicate the status of the second\r
+two register check tasks (tasks 3 and 4) to the check task.  If the variables\r
+keep incrementing, then the register check tasks have not discovered any errors.\r
+If a variable stops incrementing, then an error has been found.  The variables\r
+overlay the array that the check task has access to so they can be read by the\r
+check task without causing a memory fault.  The check task has the highest\r
+priority so will have finished with the array before the register test tasks\r
+start to access it. */\r
+volatile uint32_t *pulRegTest3LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulRegTest4LoopCounter = ( uint32_t * ) &( cReadWriteArray[ 4 ] );\r
+\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 TaskParameters_t xCheckTaskParameters =\r
 {\r
        prvCheckTask,                                                           /* pvTaskCode - the function that implements the task. */\r
-       "Check",                                                                        /* pcName                       */\r
-       mainCHECK_TASK_STACK_SIZE_WORDS,                        /* usStackDepth - defined in words, not bytes. */\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
        xCheckTaskStack,                                                        /* puxStackBuffer - the array to use as the task stack, as declared above. */\r
@@ -312,13 +364,13 @@ static portSTACK_TYPE xRegTest2Stack[ mainREG_TEST_STACK_SIZE_WORDS ] mainALIGN_
 /* 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
-       "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
-       xRegTest1Stack,                                                 /* puxStackBuffer - the array to use as the task stack, as declared above. */\r
-       {                                                                               /* xRegions - this task does not use any non-stack data hence all members are zero. */\r
+       vRegTest1Implementation,                                                        /* pvTaskCode - the function that implements the task. */\r
+       "RegTest1",                                                                     /* pcName                       */\r
+       mainREG_TEST_STACK_SIZE_WORDS,                          /* usStackDepth         */\r
+       ( void * ) configREG_TEST_TASK_1_PARAMETER,     /* 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
+       xRegTest1Stack,                                                         /* puxStackBuffer - the array to use as the task stack, as declared above. */\r
+       {                                                                                       /* xRegions - this task does not use any non-stack data hence all members are zero. */\r
                /* Base address         Length          Parameters */\r
                { 0x00,                         0x00,                   0x00 },\r
                { 0x00,                         0x00,                   0x00 },\r
@@ -329,7 +381,7 @@ static const TaskParameters_t xRegTest1Parameters =
 \r
 static TaskParameters_t xRegTest2Parameters =\r
 {\r
-       prvRegTest2Task,                                /* pvTaskCode - the function that implements the task. */\r
+       vRegTest2Implementation,                                /* pvTaskCode - the function that implements the task. */\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
@@ -343,8 +395,6 @@ static TaskParameters_t xRegTest2Parameters =
        }\r
 };\r
 \r
-/*-----------------------------------------------------------*/\r
-\r
 /*-----------------------------------------------------------*/\r
 /* Configures the task that is deleted. ---------------------*/\r
 /*-----------------------------------------------------------*/\r
@@ -363,10 +413,10 @@ static portSTACK_TYPE xDeleteTaskStack[ mainDELETE_TASK_STACK_SIZE_WORDS ] mainA
 static TaskParameters_t xTaskToDeleteParameters =\r
 {\r
        prvTaskToDelete,                                        /* pvTaskCode - the function that implements the task. */\r
-       mainTASK_TO_DELETE_NAME,                        /* pcName                       */\r
-       mainDELETE_TASK_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 + 1,                           /* uxPriority           */\r
+       mainTASK_TO_DELETE_NAME,                        /* pcName */\r
+       mainDELETE_TASK_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 + 1,                           /* uxPriority */\r
        xDeleteTaskStack,                                       /* puxStackBuffer - the array to use as the task stack, as declared above. */\r
        {                                                                       /* xRegions - this task does not use any non-stack data hence all members are zero. */\r
                /* Base address         Length          Parameters */\r
@@ -378,28 +428,32 @@ static TaskParameters_t xTaskToDeleteParameters =
 \r
 /*-----------------------------------------------------------*/\r
 \r
+volatile uint32_t ul1 = 0x123, ul2 = 0;\r
+\r
 int main( void )\r
 {\r
+       configASSERT( ul1 == 0x123 );\r
+       configASSERT( ul2 == 0 );\r
        prvSetupHardware();\r
 \r
        /* Create the queue used to pass "I'm alive" messages to the check task. */\r
-       xFileScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) );\r
+       xGlobalScopeCheckQueue = xQueueCreate( 1, sizeof( uint32_t ) );\r
 \r
        /* One check task uses the task parameter to receive the queue handle.\r
        This allows the file scope variable to be accessed from within the task.\r
        The pvParameters member of xRegTest2Parameters can only be set after the\r
        queue has been created so is set here. */\r
-       xRegTest2Parameters.pvParameters = xFileScopeCheckQueue;\r
+       xRegTest2Parameters.pvParameters = xGlobalScopeCheckQueue;\r
 \r
-       /* Create the three test tasks.  Handles to the created tasks are not\r
-       required, hence the second parameter is NULL. */\r
+       /* Create three test tasks.  Handles to the created tasks are not required,\r
+       hence the second parameter is NULL. */\r
        xTaskCreateRestricted( &xRegTest1Parameters, NULL );\r
     xTaskCreateRestricted( &xRegTest2Parameters, NULL );\r
        xTaskCreateRestricted( &xCheckTaskParameters, NULL );\r
 \r
        /* Create a task that does nothing but ensure some of the MPU API functions\r
        can be called correctly, then get deleted.  This is done for code coverage\r
-       test purposes only.  The task's handle is saved in xTaskToDelete so it can \r
+       test purposes only.  The task's handle is saved in xTaskToDelete so it can\r
        get deleted in the idle task hook. */\r
        xTaskCreateRestricted( &xTaskToDeleteParameters, &xTaskToDelete );\r
 \r
@@ -421,6 +475,11 @@ int main( void )
                                        NULL                                                    /* Handle. */\r
                                );\r
 \r
+       /* Create the third and fourth register check tasks, as described at the top\r
+       of this file. */\r
+       xTaskCreate( prvRegTest3Task, "Reg3", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_3_PARAMETER, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( prvRegTest4Task, "Reg4", configMINIMAL_STACK_SIZE, configREG_TEST_TASK_4_PARAMETER, tskIDLE_PRIORITY, NULL );\r
+\r
        /* Create and start the software timer. */\r
        xTimer = xTimerCreate( "Timer",                         /* Test name for the timer. */\r
                                                        mainTIMER_PERIOD,       /* Period of the timer. */\r
@@ -436,7 +495,6 @@ int main( void )
        /* Will only get here if there was insufficient memory to create the idle\r
        task. */\r
        for( ;; );\r
-       return 0;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -446,12 +504,21 @@ 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
-QueueHandle_t xQueue = xFileScopeCheckQueue;\r
+QueueHandle_t xQueue = xGlobalScopeCheckQueue;\r
 int32_t lMessage;\r
-uint32_t ulStillAliveCounts[ 2 ] = { 0 };\r
+uint32_t ulStillAliveCounts[ 3 ] = { 0 };\r
 const char *pcStatusMessage = "PASS\r\n";\r
-volatile uint32_t ulStatus = pdPASS;\r
+uint32_t ulLastRegTest3CountValue = 0, ulLastRegTest4Value = 0;\r
+\r
+/* The register test tasks that also test the floating point registers increment\r
+a counter on each iteration of their loop.  The counters are inside the array\r
+that this task has access to. */\r
+volatile uint32_t *pulOverlaidCounter3 = ( uint32_t * ) &( cReadWriteArray[ 0 ] ), *pulOverlaidCounter4 = ( uint32_t * ) &( cReadWriteArray[ 4 ] );\r
 \r
+/* ulCycleCount is incremented on each cycle of the check task.  It can be \r
+viewed updating in the Keil watch window as the simulator does not print to\r
+the ITM port. */\r
+volatile uint32_t ulCycleCount = 0;\r
 \r
        /* Just to remove compiler warning. */\r
        ( void ) pvParameters;\r
@@ -460,8 +527,9 @@ volatile uint32_t ulStatus = pdPASS;
        The task privilege level is set down to user mode within this function. */\r
        prvTestMemoryRegions();\r
 \r
-       /* Tests are done so lower the privilege status. */\r
-       portSWITCH_TO_USER_MODE();\r
+       /* Clear overlaid reg test counters before entering the loop below. */\r
+       *pulOverlaidCounter3 = 0UL;\r
+       *pulOverlaidCounter4 = 0UL;\r
 \r
        /* This loop performs the main function of the task, which is blocking\r
        on a message queue then processing each message as it arrives. */\r
@@ -472,42 +540,61 @@ volatile uint32_t ulStatus = pdPASS;
 \r
                switch( lMessage )\r
                {\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
-                                       /* Message from task 2, so task 2 must still be executing. */\r
-                                       ( ulStillAliveCounts[ 1 ] )++;\r
+                       case configREG_TEST_1_STILL_EXECUTING   :\r
+                       case configREG_TEST_2_STILL_EXECUTING   :\r
+                       case configTIMER_STILL_EXECUTING                :\r
+                                       /* Message from the first or second register check task, or\r
+                                       the timer callback function.  Increment the count of the\r
+                                       number of times the message source has sent the message as\r
+                                       the message source must still be executed. */\r
+                                       ( ulStillAliveCounts[ lMessage ] )++;\r
                                        break;\r
 \r
-                       case mainPRINT_SYSTEM_STATUS            :\r
+                       case configPRINT_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
+                                       status.  If messages have stopped arriving from either of\r
+                                       the first two reg test task or the timer callback then the\r
+                                       status must be set to fail. */\r
+                                       if( ( ulStillAliveCounts[ 0 ] == 0 ) || ( ulStillAliveCounts[ 1 ] == 0 ) || ( ulStillAliveCounts[ 2 ] == 0 ) )\r
                                        {\r
                                                /* One or both of the test tasks are no longer sending\r
                                                'still alive' messages. */\r
                                                pcStatusMessage = "FAIL\r\n";\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               /* Reset the count of 'still alive' messages. */\r
+                                               memset( ( void * ) ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) );\r
+                                       }\r
+\r
+                                       /* Check that the register test 3 task is still incrementing\r
+                                       its counter, and therefore still running. */\r
+                                       if( ulLastRegTest3CountValue == *pulOverlaidCounter3 )\r
+                                       {\r
+                                               pcStatusMessage = "FAIL\r\n";\r
+                                       }\r
+                                       ulLastRegTest3CountValue = *pulOverlaidCounter3;\r
 \r
-                                               /* ulStatus can be viewed (live) in the Keil watch window. */\r
-                                               ulStatus = pdFAIL;\r
-                                               ( void ) ulStatus;\r
+                                       /* Check that the register test 4 task is still incrementing\r
+                                       its counter, and therefore still running. */\r
+                                       if( ulLastRegTest4Value == *pulOverlaidCounter4 )\r
+                                       {\r
+                                               pcStatusMessage = "FAIL\r\n";\r
                                        }\r
+                                       ulLastRegTest4Value = *pulOverlaidCounter4;\r
 \r
-                                       /**** print pcStatusMessage here. ****/\r
+                                       /**** Print pcStatusMessage here. ****/\r
                                        ( void ) pcStatusMessage;\r
-\r
-                                       /* Reset the count of 'still alive' messages. */\r
-                                       memset( ulStillAliveCounts, 0x00, sizeof( ulStillAliveCounts ) );\r
+                                       \r
+                                       /* The cycle count can be viewed updating in the Keil watch\r
+                                       window if ITM printf is not being used. */\r
+                                       ulCycleCount++;\r
                                        break;\r
 \r
                default :\r
                                        /* Something unexpected happened.  Delete this task so the\r
                                        error is apparent (no output will be displayed). */\r
-                                       prvDeleteMe();\r
+                                       vMainDeleteMe();\r
                                        break;\r
                }\r
        }\r
@@ -527,7 +614,7 @@ char cTemp;
        {\r
                /* Something unexpected happened.  Delete this task so the error is\r
                apparent (no output will be displayed). */\r
-               prvDeleteMe();\r
+               vMainDeleteMe();\r
        }\r
 \r
        /* Writing off the end of the RAM allocated to this task will *NOT* cause a\r
@@ -550,7 +637,7 @@ char cTemp;
                {\r
                        /* Something unexpected happened.  Delete this task so the error is\r
                        apparent (no output will be displayed). */\r
-                       prvDeleteMe();\r
+                       vMainDeleteMe();\r
                }\r
        }\r
 \r
@@ -585,150 +672,6 @@ char cTemp;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvRegTest1Task( void *pvParameters )\r
-{\r
-/* This task is created in privileged mode so can access the file scope\r
-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
-QueueHandle_t xQueue = xFileScopeCheckQueue;\r
-\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
-\r
-       /* First check that the parameter value is as expected. */\r
-       if( pvParameters != ( void * ) 0x12345678 )\r
-       {\r
-               /* Error detected.  Delete the task so it stops communicating with\r
-               the check task. */\r
-               prvDeleteMe();\r
-       }\r
-\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
-                       "               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
-                       "               MOV     R8, #108                        \n"\r
-                       "               MOV     R9, #109                        \n"\r
-                       "               MOV     R10, #110                       \n"\r
-                       "               MOV     R11, #111                       \n"\r
-                       "reg1loop:                                              \n"\r
-                       "               MOV     R0, #100                        \n" /* Set the scratch registers to known values - done inside the loop as they get clobbered. */\r
-                       "               MOV     R1, #101                        \n"\r
-                       "               MOV     R2, #102                        \n"\r
-                       "               MOV R3, #103                    \n"\r
-                       "               MOV     R12, #112                       \n"\r
-                       "               SVC #1                                  \n" /* Yield just to increase test coverage. */\r
-                       "               CMP     R0, #100                        \n" /* Check all the registers still contain their expected values. */\r
-                       "               BNE     prvDeleteMe                     \n" /* Value was not as expected, delete the task so it stops communicating with the check task. */\r
-                       "               CMP     R1, #101                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R2, #102                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP R3, #103                    \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
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R8, #108                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R9, #109                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R10, #110                       \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R11, #111                       \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R12, #112                       \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       :::"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
-               task is still functioning. */\r
-               prvSendImAlive( xQueue, mainREG_TEST_1_STILL_EXECUTING );\r
-\r
-               /* Go back to check all the register values again. */\r
-               __asm volatile( "               B reg1loop      " );\r
-       }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-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
-method. */\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
-                       "               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
-                       "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
-                       "               MOV     R2, #2                          \n"\r
-                       "               MOV R3, #3                              \n"\r
-                       "               MOV     R12, #12                        \n"\r
-                       "               CMP     R0, #13                         \n" /* Check all the registers still contain their expected values. */\r
-                       "               BNE     prvDeleteMe                     \n" /* Value was not as expected, delete the task so it stops communicating with the check task */\r
-                       "               CMP     R1, #1                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R2, #2                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP R3, #3                              \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R4, #4                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R5, #5                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R6, #6                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R8, #8                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R9, #9                          \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R10, #10                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R11, #11                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       "               CMP     R12, #12                        \n"\r
-                       "               BNE     prvDeleteMe                     \n"\r
-                       :::"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
-               task is still functioning. */\r
-               prvSendImAlive( xQueue, mainREG_TEST_2_STILL_EXECUTING );\r
-\r
-               /* Go back to check all the register values again. */\r
-               __asm volatile( "               B reg2loop      " );\r
-       }\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 static void prvExerciseEventGroupAPI( void )\r
 {\r
 EventGroupHandle_t xEventGroup;\r
@@ -864,12 +807,7 @@ static void prvTaskToDelete( void *pvParameters )
 \r
 void vApplicationIdleHook( void )\r
 {\r
-extern uint32_t __SRAM_segment_end__[];\r
-extern uint32_t __privileged_data_start__[];\r
-extern uint32_t __privileged_data_end__[];\r
-extern uint32_t __FLASH_segment_start__[];\r
-extern uint32_t __FLASH_segment_end__[];\r
-volatile uint32_t *pul;\r
+volatile const uint32_t *pul;\r
 volatile uint32_t ulReadData;\r
 \r
        /* The idle task, and therefore this function, run in Supervisor mode and\r
@@ -916,20 +854,14 @@ volatile uint32_t ulReadData;
 \r
 static void prvOldStyleUserModeTask( void *pvParameters )\r
 {\r
-extern uint32_t __privileged_data_start__[];\r
-extern uint32_t __privileged_data_end__[];\r
-extern uint32_t __SRAM_segment_end__[];\r
-extern uint32_t __privileged_functions_end__[];\r
-extern uint32_t __FLASH_segment_start__[];\r
-extern uint32_t __FLASH_segment_end__[];\r
 /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/\r
-volatile uint32_t *pul;\r
+volatile const uint32_t *pul;\r
 volatile uint32_t ulReadData;\r
 \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 uint32_t __privileged_functions_start__[];\r
-const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014;*/\r
+/* extern uint32_t __privileged_functions_start__[]; */\r
+/* const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; */\r
 \r
        ( void ) pvParameters;\r
 \r
@@ -987,14 +919,7 @@ const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0
 \r
 static void prvOldStylePrivilegedModeTask( void *pvParameters )\r
 {\r
-extern uint32_t __privileged_data_start__[];\r
-extern uint32_t __privileged_data_end__[];\r
-extern uint32_t __SRAM_segment_end__[];\r
-extern uint32_t __privileged_functions_start__[];\r
-extern uint32_t __privileged_functions_end__[];\r
-extern uint32_t __FLASH_segment_start__[];\r
-extern uint32_t __FLASH_segment_end__[];\r
-volatile uint32_t *pul;\r
+volatile const uint32_t *pul;\r
 volatile uint32_t ulReadData;\r
 const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0xe000e014; /* Systick */\r
 /*const volatile uint32_t *pulStandardPeripheralRegister = ( volatile uint32_t * ) 0x40000000;*/\r
@@ -1044,13 +969,13 @@ const volatile uint32_t *pulSystemPeripheralRegister = ( volatile uint32_t * ) 0
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvDeleteMe( void )\r
+void vMainDeleteMe( void )\r
 {\r
        vTaskDelete( NULL );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber )\r
+void vMainSendImAlive( QueueHandle_t xHandle, uint32_t ulTaskNumber )\r
 {\r
        if( xHandle != NULL )\r
        {\r
@@ -1066,9 +991,9 @@ static void prvSetupHardware( void )
 \r
 void vApplicationTickHook( void )\r
 {\r
-static uint32_t ulCallCount;\r
-const uint32_t ulCallsBetweenSends = 5000UL / configTICK_RATE_HZ;\r
-const uint32_t ulMessage = mainPRINT_SYSTEM_STATUS;\r
+static uint32_t ulCallCount = 0;\r
+const uint32_t ulCallsBetweenSends = pdMS_TO_TICKS( 1000 );\r
+const uint32_t ulMessage = configPRINT_SYSTEM_STATUS;\r
 portBASE_TYPE xDummy;\r
 \r
        /* If configUSE_TICK_HOOK is set to 1 then this function will get called\r
@@ -1087,8 +1012,8 @@ portBASE_TYPE xDummy;
 \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
-               xQueueSendFromISR( xFileScopeCheckQueue, &ulMessage, &xDummy );\r
+               so can access xGlobalScopeCheckQueue directly. */\r
+               xQueueSendFromISR( xGlobalScopeCheckQueue, &ulMessage, &xDummy );\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -1112,75 +1037,6 @@ void vApplicationMallocFailedHook( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void hard_fault_handler( uint32_t * hardfault_args )\r
-{\r
-volatile uint32_t stacked_r0;\r
-volatile uint32_t stacked_r1;\r
-volatile uint32_t stacked_r2;\r
-volatile uint32_t stacked_r3;\r
-volatile uint32_t stacked_r12;\r
-volatile uint32_t stacked_lr;\r
-volatile uint32_t stacked_pc;\r
-volatile uint32_t stacked_psr;\r
-\r
-       stacked_r0 = ((uint32_t) hardfault_args[ 0 ]);\r
-       stacked_r1 = ((uint32_t) hardfault_args[ 1 ]);\r
-       stacked_r2 = ((uint32_t) hardfault_args[ 2 ]);\r
-       stacked_r3 = ((uint32_t) hardfault_args[ 3 ]);\r
-\r
-       stacked_r12 = ((uint32_t) hardfault_args[ 4 ]);\r
-       stacked_lr = ((uint32_t) hardfault_args[ 5 ]);\r
-       stacked_pc = ((uint32_t) hardfault_args[ 6 ]);\r
-       stacked_psr = ((uint32_t) hardfault_args[ 7 ]);\r
-\r
-       /* Inspect stacked_pc to locate the offending instruction. */\r
-       for( ;; );\r
-\r
-       ( void ) stacked_psr;\r
-       ( void ) stacked_pc;\r
-       ( void ) stacked_lr;\r
-       ( void ) stacked_r12;\r
-    ( void ) stacked_r0;\r
-    ( void ) stacked_r1;\r
-    ( void ) stacked_r2;\r
-    ( void ) stacked_r3;\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void HardFault_Handler( void ) __attribute__((naked));\r
-void HardFault_Handler( void )\r
-{\r
-       __asm volatile\r
-       (\r
-               " tst lr, #4                                                                            \n"\r
-               " ite eq                                                                                        \n"\r
-               " mrseq r0, msp                                                                         \n"\r
-               " mrsne r0, psp                                                                         \n"\r
-               " ldr r1, [r0, #24]                                                                     \n"\r
-               " ldr r2, handler_address_const                                         \n"\r
-               " bx r2                                                                                         \n"\r
-               " handler_address_const: .word hard_fault_handler       \n"\r
-       );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
-void MemManage_Handler( void ) __attribute__((naked));\r
-void MemManage_Handler( void )\r
-{\r
-       __asm volatile\r
-       (\r
-               " tst lr, #4                                                                            \n"\r
-               " ite eq                                                                                        \n"\r
-               " mrseq r0, msp                                                                         \n"\r
-               " mrsne r0, psp                                                                         \n"\r
-               " ldr r1, [r0, #24]                                                                     \n"\r
-               " ldr r2, handler2_address_const                                        \n"\r
-               " bx r2                                                                                         \n"\r
-               " handler2_address_const: .word hard_fault_handler      \n"\r
-       );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
 static void prvTimerCallback( TaskHandle_t xExpiredTimer )\r
 {\r
 uint32_t ulCount;\r
@@ -1192,6 +1048,9 @@ uint32_t ulCount;
        /* Increment the count, and save it back into the timer's ID. */\r
        ulCount++;\r
        vTimerSetTimerID( xTimer, ( void * ) ulCount );\r
+\r
+       /* Let the check task know the timer is still running. */\r
+       vMainSendImAlive( xGlobalScopeCheckQueue, configTIMER_STILL_EXECUTING );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -1243,3 +1102,41 @@ static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
        configMINIMAL_STACK_SIZE is specified in words, not bytes. */\r
        *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTest3Task( void *pvParameters )\r
+{\r
+       /* Although the regtest task is written in assembler, its entry point is\r
+       written in C for convenience of checking the task parameter is being passed\r
+       in correctly. */\r
+       if( pvParameters == configREG_TEST_TASK_3_PARAMETER )\r
+       {\r
+               /* Start the part of the test that is written in assembler. */\r
+               vRegTest3Implementation();\r
+       }\r
+\r
+       /* The following line will only execute if the task parameter is found to\r
+       be incorrect.  The check task will detect that the regtest loop counter is\r
+       not being incremented and flag an error. */\r
+       vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTest4Task( void *pvParameters )\r
+{\r
+       /* Although the regtest task is written in assembler, its entry point is\r
+       written in C for convenience of checking the task parameter is being passed\r
+       in correctly. */\r
+       if( pvParameters == configREG_TEST_TASK_4_PARAMETER )\r
+       {\r
+               /* Start the part of the test that is written in assembler. */\r
+               vRegTest4Implementation();\r
+       }\r
+\r
+       /* The following line will only execute if the task parameter is found to\r
+       be incorrect.  The check task will detect that the regtest loop counter is\r
+       not being incremented and flag an error. */\r
+       vTaskDelete( NULL );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
index 06a53802cb4cd71ff9425f70c63bd8fabb772976..b1da73e7505dac5ad4f687832597e4281129ca93 100644 (file)
@@ -348,7 +348,7 @@ BaseType_t xRunningPrivileged = xPortRaisePrivilege();
 #endif\r
 /*-----------------------------------------------------------*/\r
 \r
-#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
+#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) )\r
        void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer )\r
        {\r
        BaseType_t xRunningPrivileged = xPortRaisePrivilege();\r