]> git.sur5r.net Git - freertos/commitdiff
Developing STM32L152 demo - still a work in progress.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 19 Dec 2010 20:31:41 +0000 (20:31 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 19 Dec 2010 20:31:41 +0000 (20:31 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1174 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/Cortex_STM32L152_IAR/FreeRTOSConfig.h
Demo/Cortex_STM32L152_IAR/RTOSDemo.ewp
Demo/Cortex_STM32L152_IAR/main.c
Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.dni
Demo/Cortex_STM32L152_IAR/settings/RTOSDemo.wsdt

index 7d6cf4cc8646e939d2c8c17b256f858e5c2d398e..75f29bd88370f516f2fc8b3f7e388dc2f6c48744 100644 (file)
@@ -68,7 +68,7 @@
 \r
 #define configUSE_PREEMPTION           1\r
 #define configUSE_IDLE_HOOK                    0\r
-#define configUSE_TICK_HOOK                    0\r
+#define configUSE_TICK_HOOK                    1\r
 #define configCPU_CLOCK_HZ                     ( 32000000UL )  \r
 #define configTICK_RATE_HZ                     ( ( portTickType ) 1000 )\r
 #define configMAX_PRIORITIES           ( ( unsigned portBASE_TYPE ) 5 )\r
index 3da15ae98f5c9bc9f73bc1dcab22ef0710590472..1148e8bb48cde65b177064a01f562455d7fc2a47 100644 (file)
   </group>\r
   <group>\r
     <name>Standard_Demo_Code</name>\r
+    <file>\r
+      <name>$PROJ_DIR$\..\Common\Minimal\dynamic.c</name>\r
+    </file>\r
     <file>\r
       <name>$PROJ_DIR$\..\Common\Minimal\flash.c</name>\r
     </file>\r
index 06476f6485136841bf55190c87057a2a4d4e78e9..2433edd981a8c8b7c3d7251b3d8d6d0d35cee092 100644 (file)
@@ -62,6 +62,7 @@
 /* Demo application includes. */\r
 #include "partest.h"\r
 #include "flash.h"\r
+#include "dynamic.h"\r
 \r
 /* ST driver includes. */\r
 #include "stm32l1xx_usart.h"\r
@@ -82,6 +83,7 @@
 #define mainMESSAGE_BUTTON_LEFT                        ( 3 )\r
 #define mainMESSAGE_BUTTON_RIGHT               ( 4 )\r
 #define mainMESSAGE_BUTTON_SEL                 ( 5 )\r
+#define mainMESSAGE_STATUS                             ( 6 )\r
 \r
 /*\r
  * System configuration is performed prior to main() being called, this function\r
@@ -111,12 +113,12 @@ void main( void )
        {\r
                xTaskCreate( prvLCDTask, ( signed char * ) "LCD", mainLCD_TASK_STACK_SIZE, NULL, mainLCD_TASK_PRIORITY, NULL );\r
                xTaskCreate( vTempTask, ( signed char * ) "Temp", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+               vStartDynamicPriorityTasks();\r
+               vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
+               \r
+               vTaskStartScheduler();\r
        }\r
        \r
-       vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
-       \r
-       vTaskStartScheduler();\r
-       \r
        for( ;; );\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -132,7 +134,7 @@ static char cBuffer[ 32 ];
        {\r
                xQueueReceive( xLCDQueue, &xReceivedMessage, portMAX_DELAY );\r
 \r
-               if( lLine >= Line9 )\r
+               if( lLine > Line9 )\r
                {\r
                        LCD_Clear( Blue );\r
                        lLine = 0;\r
@@ -142,13 +144,15 @@ static char cBuffer[ 32 ];
                {\r
                        case mainMESSAGE_BUTTON_UP              :       sprintf( cBuffer, "Button up = %d", xReceivedMessage.lMessageValue );\r
                                                                                                break;\r
-                       case mainMESSAGE_BUTTON_DOWN    :\r
+                       case mainMESSAGE_BUTTON_DOWN    :       sprintf( cBuffer, "Button down = %d", xReceivedMessage.lMessageValue );\r
                                                                                                break;\r
-                       case mainMESSAGE_BUTTON_LEFT    :\r
+                       case mainMESSAGE_BUTTON_LEFT    :       sprintf( cBuffer, "Button left = %d", xReceivedMessage.lMessageValue );\r
                                                                                                break;\r
-                       case mainMESSAGE_BUTTON_RIGHT   :\r
+                       case mainMESSAGE_BUTTON_RIGHT   :       sprintf( cBuffer, "Button right = %d", xReceivedMessage.lMessageValue );\r
                                                                                                break;\r
-                       case mainMESSAGE_BUTTON_SEL             :\r
+                       case mainMESSAGE_BUTTON_SEL             :       sprintf( cBuffer, "Select interrupt!" );\r
+                                                                                               break;\r
+                       case mainMESSAGE_STATUS                 :       sprintf( cBuffer, "Task status = %s", ( ( xReceivedMessage.lMessageValue ) ? "PASS" : "FAIL" ) );\r
                                                                                                break;\r
                        default                                                 :       sprintf( cBuffer, "Unknown message" );\r
                                                                                                break;\r
@@ -160,9 +164,41 @@ static char cBuffer[ 32 ];
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+void EXTI9_5_IRQHandler( void )\r
+{\r
+const xQueueMessage xMessage = { mainMESSAGE_BUTTON_SEL, 0 };\r
+long lHigherPriorityTaskWoken = pdFALSE;\r
+\r
+       xQueueSendFromISR( xLCDQueue, &xMessage, &lHigherPriorityTaskWoken );\r
+       EXTI_ClearITPendingBit( SEL_BUTTON_EXTI_LINE );\r
+       portEND_SWITCHING_ISR( lHigherPriorityTaskWoken );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationTickHook( void )\r
+{\r
+static unsigned long ulCounter = 0;\r
+static const unsigned long ulCheckFrequency = 5000UL / portTICK_RATE_MS;\r
+static xQueueMessage xStatusMessage = { mainMESSAGE_STATUS, pdPASS };\r
+long lHigherPriorityTaskWoken = pdFALSE; /* Not used in this case as this is the tick hook. */\r
+\r
+       ulCounter++;\r
+       if( ulCounter >= ulCheckFrequency )\r
+       {\r
+               if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
+               {\r
+                       xStatusMessage.lMessageValue = pdFAIL;\r
+               }\r
+               \r
+               xQueueSendFromISR( xLCDQueue, &xStatusMessage, &lHigherPriorityTaskWoken );\r
+               ulCounter = 0;\r
+       }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 static void vTempTask( void *pv )\r
 {\r
-long lLastState = pdFALSE;\r
+long lLastState = pdTRUE;\r
 long lState;\r
 xQueueMessage xMessage;\r
 \r
@@ -187,13 +223,20 @@ static void prvSetupHardware( void )
        /* Initialise the LEDs. */\r
        vParTestInitialise();\r
 \r
-       //BUTTON_MODE_EXTI\r
+       //\r
        /* Initialise the joystick inputs. */\r
        STM_EVAL_PBInit( BUTTON_UP, BUTTON_MODE_GPIO );\r
        STM_EVAL_PBInit( BUTTON_DOWN, BUTTON_MODE_GPIO );\r
        STM_EVAL_PBInit( BUTTON_LEFT, BUTTON_MODE_GPIO );\r
        STM_EVAL_PBInit( BUTTON_RIGHT, BUTTON_MODE_GPIO );\r
-       STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_GPIO );\r
+       \r
+       /* The select button in the middle of the joystick is configured to generate\r
+       an interrupt.  The Eval board library will configure the interrupt\r
+       priority to be the lowest priority available - this is important as the\r
+       interrupt service routine makes use of a FreeRTOS API function so must\r
+       therefore use a priority equal to or below that set by the\r
+       configMAX_SYSCALL_INTERRUPT_PRIORITY() value set in FreeRTOSConfig.h. */\r
+       STM_EVAL_PBInit( BUTTON_SEL, BUTTON_MODE_EXTI );\r
 \r
 #if 0  \r
 USART_InitTypeDef USART_InitStructure;\r
index 241c15162dbd2473d37e59a4ca5305dfbf7cd229..943e2414e543b3d846569e364fb6ac5ea89f309e 100644 (file)
@@ -1,5 +1,5 @@
 [DebugChecksum]\r
-Checksum=1807629591\r
+Checksum=685534858\r
 [DisAssemblyWindow]\r
 NumStates=_ 1\r
 State 1=_ 1\r
@@ -41,6 +41,10 @@ ActionState=1
 [TraceHelper]\r
 Enabled=0\r
 ShowSource=1\r
+[Disassemble mode]\r
+mode=0\r
+[Breakpoints]\r
+Count=0\r
 [Log file]\r
 LoggingEnabled=_ 0\r
 LogFile=_ ""\r
@@ -48,6 +52,9 @@ Category=_ 0
 [TermIOLog]\r
 LoggingEnabled=_ 0\r
 LogFile=_ ""\r
+[Aliases]\r
+Count=0\r
+SuppressDialog=0\r
 [CallStackLog]\r
 Enabled=0\r
 [DriverProfiling]\r
@@ -55,10 +62,3 @@ Enabled=0
 Mode=995247177\r
 Graph=0\r
 Symbiont=0\r
-[Disassemble mode]\r
-mode=0\r
-[Breakpoints]\r
-Count=0\r
-[Aliases]\r
-Count=0\r
-SuppressDialog=0\r
index af878919cffbeaa222063234c785b8d57d2fe87d..d2fbefbc7008e3844628bf7bdf75017cda81895b 100644 (file)
@@ -17,7 +17,7 @@
     <Build><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build><TerminalIO/><Debug-Log><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log></Static>\r
     <Windows>\r
       \r
-    <Wnd2>\r
+    <Wnd0>\r
         <Tabs>\r
           <Tab>\r
             <Identity>TabID-27630-4718</Identity>\r
             <Factory>Workspace</Factory>\r
             <Session>\r
               \r
-            <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode></NodeDict></Session>\r
+            <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS_Source</ExpandedNode><ExpandedNode>RTOSDemo/Standard_Demo_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Eval_Board_Library</ExpandedNode><ExpandedNode>RTOSDemo/System_and_ST_Code/Peripheral_Library</ExpandedNode></NodeDict></Session>\r
           </Tab>\r
         </Tabs>\r
         \r
-      <SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-10002-7709</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-18437-21512</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
+      <SelectedTab>0</SelectedTab></Wnd0><Wnd1><Tabs><Tab><Identity>TabID-10002-7709</Identity><TabName>Build</TabName><Factory>Build</Factory><Session/></Tab><Tab><Identity>TabID-18437-21512</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd1></Windows>\r
     <Editor>\r
       \r
       \r
       \r
       \r
-    <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>11</YPos><SelStart>3083</SelStart><SelEnd>3083</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>58</YPos><SelStart>3560</SelStart><SelEnd>3560</SelEnd></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval.c</Filename><XPos>0</XPos><YPos>269</YPos><SelStart>10954</SelStart><SelEnd>10954</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_syscfg.c</Filename><XPos>0</XPos><YPos>125</YPos><SelStart>4815</SelStart><SelEnd>4815</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\startup_stm32l1xx_md.s</Filename><XPos>0</XPos><YPos>309</YPos><SelStart>10065</SelStart><SelEnd>10083</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portmacro.h</Filename><XPos>0</XPos><YPos>91</YPos><SelStart>4341</SelStart><SelEnd>4381</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\portasm.s</Filename><XPos>0</XPos><YPos>92</YPos><SelStart>4644</SelStart><SelEnd>4644</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\queue.c</Filename><XPos>0</XPos><YPos>794</YPos><SelStart>29177</SelStart><SelEnd>29177</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\Common\Minimal\dynamic.c</Filename><XPos>0</XPos><YPos>388</YPos><SelStart>15479</SelStart><SelEnd>15515</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>1107</YPos><SelStart>38209</SelStart><SelEnd>38209</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\FreeRTOSConfig.h</Filename><XPos>0</XPos><YPos>50</YPos><SelStart>3695</SelStart><SelEnd>3695</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L152_EVAL\stm32l152_eval_lcd.c</Filename><XPos>0</XPos><YPos>6</YPos><SelStart>1224</SelStart><SelEnd>1224</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_gpio.c</Filename><XPos>0</XPos><YPos>302</YPos><SelStart>9524</SelStart><SelEnd>9524</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\system_and_ST_code\STM32L1xx_StdPeriph_Driver\src\stm32l1xx_spi.c</Filename><XPos>0</XPos><YPos>20</YPos><SelStart>1472</SelStart><SelEnd>1472</SelEnd></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CM3\port.c</Filename><XPos>0</XPos><YPos>162</YPos><SelStart>7128</SelStart><SelEnd>7128</SelEnd></Tab></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-012aae80><key>iaridepm.enu1</key></Toolbar-012aae80></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>285</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>170833</sizeVertCX><sizeVertCY>755601</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+    <Top><Row0><Sizes><Toolbar-012aae88><key>iaridepm.enu1</key></Toolbar-012aae88></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd0><Rect><Top>-2</Top><Left>-2</Left><Bottom>740</Bottom><Right>285</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>170833</sizeVertCX><sizeVertCY>755601</sizeVertCY></Rect></Wnd0></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203666</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203666</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
   </Desktop>\r
 </Workspace>\r
 \r