]> git.sur5r.net Git - freertos/commitdiff
Read the RL78 demo for release.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 9 Sep 2011 12:36:32 +0000 (12:36 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Fri, 9 Sep 2011 12:36:32 +0000 (12:36 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1589 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/RL78_RL78G13_Promo_Board_IAR/main.c
Demo/RL78_RL78G13_Promo_Board_IAR/settings/rtosdemo.dbgdt
Demo/RL78_RL78G13_Promo_Board_IAR/settings/rtosdemo.dni
Demo/RL78_RL78G13_Promo_Board_IAR/settings/rtosdemo.wsdt

index d046e443649d6784bbf3fe5f67137ad6869955a9..55555dcc723da55b09de45054af132fa0da3091e 100644 (file)
     licensing and training services.\r
 */\r
 \r
-/* Standard includes. */\r
-#include <stdlib.h>\r
-#include <string.h>\r
+/*\r
+ *\r
+ * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
+ * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
+ * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!\r
+ *\r
+ *\r
+ * main() creates the demo application tasks and timers, then starts the\r
+ * scheduler.\r
+ *\r
+ * This demo is configured to run on the RL78/G13 Promotion Board, which is\r
+ * fitted with a R5F100LEA microcontroller.  The R5F100LEA contains a little\r
+ * under 4K bytes of usable internal RAM.  The RAM size restricts the number of\r
+ * demo tasks that can be created, and the demo creates 13 tasks, 4 queues and\r
+ * two timers.  The RL78 range does however include parts with up to 32K bytes\r
+ * of RAM (at the time of writing).  Using FreeRTOS on such a part will allow an\r
+ * application to make a more comprehensive use of FreeRTOS tasks, and other\r
+ * FreeRTOS features.\r
+ *\r
+ * In addition to the standard demo tasks, the following tasks, tests and timers\r
+ * are created within this file:\r
+ *\r
+ * "Reg test" tasks - These fill the registers with known values, then check\r
+ * that each register still contains its expected value.  Each task uses a\r
+ * different set of values.  The reg test tasks execute with a very low priority,\r
+ * so get preempted very frequently.  A register containing an unexpected value\r
+ * is indicative of an error in the context switching mechanism.\r
+ *\r
+ * The "Demo" Timer and Callback Function:\r
+ * The demo timer callback function does nothing more than increment a variable.\r
+ * The period of the demo timer is set relative to the period of the check timer\r
+ * (described below).  This allows the check timer to know how many times the\r
+ * demo timer callback function should execute between each execution of the\r
+ * check timer callback function.  The variable incremented in the demo timer\r
+ * callback function is used to determine how many times the callback function\r
+ * has executed.\r
+ *\r
+ * The "Check" Timer and Callback Function:\r
+ * The check timer period is initially set to three seconds.  The check timer\r
+ * callback function checks that all the standard demo tasks, the reg test tasks,\r
+ * and the demo timer are not only still executing, but are executing without\r
+ * reporting any errors.  If the check timer discovers that a task or timer has\r
+ * stalled, or reported an error, then it changes its own period from the\r
+ * initial three seconds, to just 200ms.  The check timer callback function also\r
+ * toggles the user LED each time it is called.  This provides a visual\r
+ * indication of the system status:  If the LED toggles every three seconds,\r
+ * then no issues have been discovered.  If the LED toggles every 200ms, then an\r
+ * issue has been discovered with at least one task.\r
+ *\r
+ */\r
 \r
 /* Scheduler include files. */\r
 #include "FreeRTOS.h"\r
@@ -76,19 +123,20 @@ have been reported by any of the standard demo tasks.  ms are converted to the
 equivalent in ticks using the portTICK_RATE_MS constant. */\r
 #define mainCHECK_TIMER_PERIOD_MS                      ( 3000UL / portTICK_RATE_MS )\r
 \r
-/* These are used to set the period of the demo timer.  The demo timer period\r
-is always relative to the check timer period, so the check timer can determine\r
-if the demo timer has expired the expected number of times between its own\r
-executions. */\r
-#define mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEROUT     ( 100UL )\r
-#define mainDEMO_TIMER_PERIOD_MS                       ( mainCHECK_TIMER_PERIOD_MS / mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEROUT )\r
-\r
 /* The period at which the check timer will expire, in ms, if an error has been\r
-reported in one of the standard demo tasks.  ms are converted to the equivalent\r
-in ticks using the portTICK_RATE_MS constant. */\r
+reported in one of the standard demo tasks, the check tasks, or the demo timer.\r
+ms are converted to the equivalent in ticks using the portTICK_RATE_MS\r
+constant. */\r
 #define mainERROR_CHECK_TIMER_PERIOD_MS        ( 200UL / portTICK_RATE_MS )\r
 \r
-/* The LED toggled by the check task. */\r
+/* These two definitions are used to set the period of the demo timer.  The demo\r
+timer period is always relative to the check timer period, so the check timer\r
+can determine if the demo timer has expired the expected number of times between\r
+its own executions. */\r
+#define mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT      ( 100UL )\r
+#define mainDEMO_TIMER_PERIOD_MS                       ( mainCHECK_TIMER_PERIOD_MS / mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT )\r
+\r
+/* The LED toggled by the check timer. */\r
 #define mainLED_0                                              P7_bit.no7\r
 \r
 /* A block time of zero simple means "don't block". */\r
@@ -113,7 +161,7 @@ static void prvDemoTimerCallback( xTimerHandle xTimer );
 int __low_level_init(void);\r
 \r
 /*\r
- * Functions that define the RegTest tasks as described at the top of this file.\r
+ * Functions that define the RegTest tasks, as described at the top of this file.\r
  */\r
 extern void vRegTest1( void *pvParameters );\r
 extern void vRegTest2( void *pvParameters );\r
@@ -122,7 +170,7 @@ extern void vRegTest2( void *pvParameters );
 /*-----------------------------------------------------------*/\r
 \r
 /* If an error is discovered by one of the RegTest tasks then this flag is set\r
-to pdFAIL.  The 'check' task then inspects this flag to detect errors within\r
+to pdFAIL.  The 'check' timer then inspects this flag to detect errors within\r
 the RegTest tasks. */\r
 static short sRegTestStatus = pdPASS;\r
 \r
@@ -130,7 +178,7 @@ static short sRegTestStatus = pdPASS;
 function. */\r
 static xTimerHandle xCheckTimer = NULL;\r
 \r
-/* This time is just for demo purposes. */\r
+/* The demo timer.  This uses prvDemoTimerCallback() as its callback function. */\r
 static xTimerHandle xDemoTimer = NULL;\r
 \r
 /* This variable is incremented each time the demo timer expires. */\r
@@ -213,6 +261,7 @@ static void prvCheckTimerCallback( xTimerHandle xTimer )
 static portBASE_TYPE xChangedTimerPeriodAlready = pdFALSE, xErrorStatus = pdPASS;\r
 static unsigned long ulLastDemoTimerCounter = 0UL;\r
 \r
+       /* Inspect the status of the standard demo tasks. */\r
        if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
        {\r
                xErrorStatus = pdFAIL;\r
@@ -228,15 +277,16 @@ static unsigned long ulLastDemoTimerCounter = 0UL;
                xErrorStatus = pdFAIL;\r
        }\r
 \r
+       /* Inspect the status of the reg test tasks. */\r
        if( sRegTestStatus != pdPASS )\r
        {\r
                xErrorStatus = pdFAIL;\r
        }\r
        \r
        /* Ensure that the demo timer has expired at\r
-       mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEROUT times in between\r
+       mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT times in between\r
        each call of this function. */\r
-       if( ( ulDemoTimerCounter - ulLastDemoTimerCounter ) < ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEROUT - 1 ) )\r
+       if( ( ulDemoTimerCounter - ulLastDemoTimerCounter ) < ( mainDEMO_TIMER_INCREMENTS_PER_CHECK_TIMER_TIMEOUT - 1 ) )\r
        {\r
                xErrorStatus = pdFAIL;\r
        }\r
index d7c608e742d28cfab135a4ac59c15c320a36e46e..022efa0733f963a9cca3e51d483c6bb5a7930693 100644 (file)
       \r
       \r
       \r
-    <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>134</YPos><SelStart>6308</SelStart><SelEnd>6308</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\MemMang\heap_1.c</Filename><XPos>0</XPos><YPos>105</YPos><SelStart>4982</SelStart><SelEnd>4982</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>1089</YPos><SelStart>38372</SelStart><SelEnd>38372</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\timers.c</Filename><XPos>0</XPos><YPos>186</YPos><SelStart>9465</SelStart><SelEnd>9465</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>69</YPos><SelStart>4454</SelStart><SelEnd>4454</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\RegTest.s87</Filename><XPos>0</XPos><YPos>109</YPos><SelStart>5308</SelStart><SelEnd>5308</SelEnd></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+    <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>182</YPos><SelStart>8899</SelStart><SelEnd>8899</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>420</YPos><SelStart>19276</SelStart><SelEnd>19276</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>128</YPos><SelStart>6118</SelStart><SelEnd>6130</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\queue.c</Filename><XPos>0</XPos><YPos>236</YPos><SelStart>12907</SelStart><SelEnd>12907</SelEnd></Tab><ActiveTab>3</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
     <Positions>\r
       \r
       \r
       \r
       \r
       \r
-    <Top><Row0><Sizes><Toolbar-013362c8><key>iaridepm.enu1</key></Toolbar-013362c8></Sizes></Row0><Row1><Sizes><Toolbar-0b06e580><key>debuggergui.enu1</key></Toolbar-0b06e580><Toolbar-0ad5a4f8><key>rl78ocd.enu1</key></Toolbar-0ad5a4f8></Sizes></Row1><Row2><Sizes/></Row2><Row3><Sizes/></Row3><Row4><Sizes/></Row4><Row5><Sizes/></Row5><Row6><Sizes/></Row6><Row7><Sizes/></Row7><Row8><Sizes/></Row8><Row9><Sizes/></Row9><Row10><Sizes/></Row10><Row11><Sizes/></Row11><Row12><Sizes/></Row12><Row13><Sizes/></Row13><Row14><Sizes/></Row14><Row15><Sizes/></Row15><Row16><Sizes/></Row16><Row17><Sizes/></Row17><Row18><Sizes/></Row18><Row19><Sizes/></Row19><Row20><Sizes/></Row20><Row21><Sizes/></Row21><Row22><Sizes/></Row22><Row23><Sizes/></Row23><Row24><Sizes/></Row24><Row25><Sizes/></Row25><Row26><Sizes/></Row26><Row27><Sizes/></Row27><Row28><Sizes/></Row28><Row29><Sizes/></Row29><Row30><Sizes/></Row30><Row31><Sizes/></Row31><Row32><Sizes/></Row32><Row33><Sizes/></Row33><Row34><Sizes/></Row34><Row35><Sizes/></Row35><Row36><Sizes/></Row36></Top><Left><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>662</Bottom><Right>344</Right><x>-2</x><y>-2</y><xscreen>346</xscreen><yscreen>254</yscreen><sizeHorzCX>205952</sizeHorzCX><sizeHorzCY>258656</sizeHorzCY><sizeVertCX>205952</sizeVertCX><sizeVertCY>676171</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>252</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>254</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>258656</sizeHorzCY><sizeVertCX>205952</sizeVertCX><sizeVertCY>258656</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+    <Top><Row0><Sizes><Toolbar-013362c8><key>iaridepm.enu1</key></Toolbar-013362c8></Sizes></Row0><Row1><Sizes><Toolbar-0addce38><key>debuggergui.enu1</key></Toolbar-0addce38><Toolbar-04af27d0><key>rl78ocd.enu1</key></Toolbar-04af27d0></Sizes></Row1><Row2><Sizes/></Row2><Row3><Sizes/></Row3><Row4><Sizes/></Row4><Row5><Sizes/></Row5><Row6><Sizes/></Row6></Top><Left><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>662</Bottom><Right>344</Right><x>-2</x><y>-2</y><xscreen>346</xscreen><yscreen>254</yscreen><sizeHorzCX>205952</sizeHorzCX><sizeHorzCY>258656</sizeHorzCY><sizeVertCX>205952</sizeVertCX><sizeVertCY>676171</sizeVertCY></Rect></Wnd3></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>252</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>254</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>258656</sizeHorzCY><sizeVertCX>205952</sizeVertCX><sizeVertCY>258656</sizeVertCY></Rect></Wnd2></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
   </Desktop>\r
 </Project>\r
 \r
index 9c561957f8d8b47e109ec59ccb815ed290db3621..4b5616c741c6a0bf4ab32b47f4573d9d0727e965 100644 (file)
@@ -15,7 +15,7 @@ TypeViolation=1
 UnspecRange=1\r
 ActionState=1\r
 [DebugChecksum]\r
-Checksum=-1910636464\r
+Checksum=1319205784\r
 [DisAssemblyWindow]\r
 NumStates=_ 1\r
 State 1=_ 1\r
index 12f572b343b82271f97d78d383f96e8f0f5204fa..8d805fea09334d6da7c6627a6ce7527f6fac9319 100644 (file)
@@ -17,7 +17,7 @@
     <Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>684</ColumnWidth1><ColumnWidth2>182</ColumnWidth2><ColumnWidth3>45</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1218</ColumnWidth1></Debug-Log><Disassembly><MixedMode>1</MixedMode><CodeCovShow>1</CodeCovShow><InstrProfShow>1</InstrProfShow></Disassembly><Find-in-Files><ColumnWidth0>439</ColumnWidth0><ColumnWidth1>62</ColumnWidth1><ColumnWidth2>753</ColumnWidth2></Find-in-Files></Static>\r
     <Windows>\r
       \r
-    <Wnd0>\r
+    <Wnd2>\r
         <Tabs>\r
           <Tab>\r
             <Identity>TabID-25565-17041</Identity>\r
           </Tab>\r
         </Tabs>\r
         \r
-      <SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-4654-17433</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-14113-4559</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab><Tab><Identity>TabID-7454-1824</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>\r
+      <SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-4654-17433</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-14113-4559</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab><Tab><Identity>TabID-7454-1824</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
     <Editor>\r
       \r
       \r
       \r
       \r
-    <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>134</YPos><SelStart>6308</SelStart><SelEnd>6308</SelEnd></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+    <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>57</YPos><SelStart>3555</SelStart><SelEnd>3555</SelEnd></Tab><ActiveTab>0</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
     <Positions>\r
       \r
       \r
       \r
       \r
       \r
-    <Top><Row0><Sizes><Toolbar-013362c8><key>iaridepm.enu1</key></Toolbar-013362c8></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2><Row3><Sizes/></Row3><Row4><Sizes/></Row4><Row5><Sizes/></Row5><Row6><Sizes/></Row6><Row7><Sizes/></Row7><Row8><Sizes/></Row8><Row9><Sizes/></Row9><Row10><Sizes/></Row10><Row11><Sizes/></Row11><Row12><Sizes/></Row12><Row13><Sizes/></Row13><Row14><Sizes/></Row14><Row15><Sizes/></Row15><Row16><Sizes/></Row16><Row17><Sizes/></Row17><Row18><Sizes/></Row18><Row19><Sizes/></Row19><Row20><Sizes/></Row20><Row21><Sizes/></Row21><Row22><Sizes/></Row22><Row23><Sizes/></Row23><Row24><Sizes/></Row24><Row25><Sizes/></Row25><Row26><Sizes/></Row26><Row27><Sizes/></Row27><Row28><Sizes/></Row28><Row29><Sizes/></Row29><Row30><Sizes/></Row30><Row31><Sizes/></Row31><Row32><Sizes/></Row32><Row33><Sizes/></Row33><Row34><Sizes/></Row34><Row35><Sizes/></Row35><Row36><Sizes/></Row36><Row37><Sizes/></Row37><Row38><Sizes/></Row38></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>629</Bottom><Right>318</Right><x>-2</x><y>-2</y><xscreen>263</xscreen><yscreen>200</yscreen><sizeHorzCX>156548</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>190476</sizeVertCX><sizeVertCY>642566</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>309</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>311</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>316701</sizeHorzCY><sizeVertCX>205357</sizeVertCX><sizeVertCY>258656</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+    <Top><Row0><Sizes><Toolbar-013362c8><key>iaridepm.enu1</key></Toolbar-013362c8></Sizes></Row0><Row1><Sizes/></Row1><Row2><Sizes/></Row2><Row3><Sizes/></Row3><Row4><Sizes/></Row4><Row5><Sizes/></Row5><Row6><Sizes/></Row6><Row7><Sizes/></Row7><Row8><Sizes/></Row8><Row9><Sizes/></Row9><Row10><Sizes/></Row10></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>629</Bottom><Right>318</Right><x>-2</x><y>-2</y><xscreen>263</xscreen><yscreen>200</yscreen><sizeHorzCX>156548</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>190476</sizeVertCX><sizeVertCY>642566</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>309</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>311</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>316701</sizeHorzCY><sizeVertCX>205357</sizeVertCX><sizeVertCY>258656</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
   </Desktop>\r
 </Workspace>\r
 \r