]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/main.c
Update version number to 9.0.0rc2.
[freertos] / FreeRTOS / Demo / CORTEX_STM32F103_GCC_Rowley / main.c
index c4e3e94c0d6cc6a5aebf66443069461239942f43..aeecddafcb28a3504ce97fc828c61c371fcd5922 100644 (file)
@@ -1,75 +1,70 @@
 /*\r
-    FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.\r
-\r
-    FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
-    http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
-     *    Complete, revised, and edited pdf reference manuals are also       *\r
-     *    available.                                                         *\r
-     *                                                                       *\r
-     *    Purchasing FreeRTOS documentation will not only help you, by       *\r
-     *    ensuring you get running as quickly as possible and with an        *\r
-     *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
-     *    the FreeRTOS project to continue with its mission of providing     *\r
-     *    professional grade, cross platform, de facto standard solutions    *\r
-     *    for microcontrollers - completely free of charge!                  *\r
-     *                                                                       *\r
-     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
-     *                                                                       *\r
-     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
-     *                                                                       *\r
-    ***************************************************************************\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2016 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
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
 \r
-    >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
-    distribute a combined work that includes FreeRTOS without being obliged to\r
-    provide the source code for proprietary components outside of the FreeRTOS\r
-    kernel.\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.  See the GNU General Public License for more\r
-    details. You should have received a copy of the GNU General Public License\r
-    and the FreeRTOS license exception along with FreeRTOS; if not it can be\r
-    viewed here: http://www.freertos.org/a00114.html and also obtained by\r
-    writing to Real Time Engineers Ltd., contact details for whom are available\r
-    on the FreeRTOS WEB site.\r
-\r
-    1 tab == 4 spaces!\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
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\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
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\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 - Documentation, books, training, latest versions, \r
-    license and Real Time Engineers Ltd. contact details.\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, and our new\r
-    fully thread aware and reentrant UDP/IP stack.\r
-\r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
-    Integrity Systems, who sell the code with commercial support, \r
-    indemnification and middleware, under the OpenRTOS brand.\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
+    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
 \r
  * defined and/or created within this file:\r
  *\r
  * "Check" task - This only executes every five seconds but has the highest\r
- * priority so is guaranteed to get processor time.  Its main function is to \r
+ * priority so is guaranteed to get processor time.  Its main function is to\r
  * check that all the standard demo tasks are still operational. The check task\r
  * will toggle LED 3 (PB11) every five seconds so long as no errors have been\r
- * detected.  The toggle rate will increase to half a second if an error has \r
+ * detected.  The toggle rate will increase to half a second if an error has\r
  * been found in any task.\r
  *\r
- * "Echo" task - This is a very basic task that simply echoes any characters \r
+ * "Echo" task - This is a very basic task that simply echoes any characters\r
  * received on COM0 (USART1).  This can be tested by transmitting a text file\r
  * from a dumb terminal to the STM32 USART then observing or capturing the text\r
- * that is echoed back.  Missing characters will be all the more obvious if the \r
+ * that is echoed back.  Missing characters will be all the more obvious if the\r
  * file contains a simple repeating string of fixed width.\r
  *\r
- * Currently this demo does not include interrupt nesting examples.  High \r
+ * Currently this demo does not include interrupt nesting examples.  High\r
  * frequency timer and simpler nesting examples can be found in most Cortex-M3\r
  * demo applications.\r
  *\r
- * The functions used to initialise, set and clear LED outputs are normally \r
- * defined in partest.c.  This demo includes two partest files, one that is \r
- * configured for use with the Keil MCBSTM32 evaluation board (called \r
+ * The functions used to initialise, set and clear LED outputs are normally\r
+ * defined in partest.c.  This demo includes two partest files, one that is\r
+ * configured for use with the Keil MCBSTM32 evaluation board (called\r
  * ParTest_MCBSTM32.c) and one that is configured for use with the official\r
  * ST Eval board (called ParTest_ST_Eval.c).  One one of these files should be\r
- * included in the build at any one time, as appropriate for the hardware \r
+ * included in the build at any one time, as appropriate for the hardware\r
  * actually being used.\r
  */\r
 \r
 \r
 /* The time between cycles of the 'check' task - which depends on whether the\r
 check task has detected an error or not. */\r
-#define mainCHECK_DELAY_NO_ERROR                       ( ( portTickType ) 5000 / portTICK_RATE_MS )\r
-#define mainCHECK_DELAY_ERROR                          ( ( portTickType ) 500 / portTICK_RATE_MS )\r
+#define mainCHECK_DELAY_NO_ERROR                       ( ( TickType_t ) 5000 / portTICK_PERIOD_MS )\r
+#define mainCHECK_DELAY_ERROR                          ( ( TickType_t ) 500 / portTICK_PERIOD_MS )\r
 \r
 /* The LED controlled by the 'check' task. */\r
 #define mainCHECK_LED                                          ( 3 )\r
@@ -164,7 +159,7 @@ static void prvSetupHardware( void );
 /* The 'check' task as described at the top of this file. */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
-/* A simple task that echoes all the characters that are received on COM0 \r
+/* A simple task that echoes all the characters that are received on COM0\r
 (USART1). */\r
 static void prvUSARTEchoTask( void *pvParameters );\r
 \r
@@ -190,10 +185,10 @@ int main( void )
     vStartRecursiveMutexTasks();\r
 \r
        /* Create the 'echo' task, which is also defined within this file. */\r
-       xTaskCreate( prvUSARTEchoTask, ( signed char * ) "Echo", configMINIMAL_STACK_SIZE, NULL, mainECHO_TASK_PRIORITY, NULL );\r
+       xTaskCreate( prvUSARTEchoTask, "Echo", configMINIMAL_STACK_SIZE, NULL, mainECHO_TASK_PRIORITY, NULL );\r
 \r
        /* Create the 'check' task, which is also defined within this file. */\r
-       xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
+       xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
     /* Start the scheduler. */\r
        vTaskStartScheduler();\r
@@ -207,7 +202,7 @@ int main( void )
 /* Described at the top of this file. */\r
 static void prvCheckTask( void *pvParameters )\r
 {\r
-portTickType xLastExecutionTime;\r
+TickType_t xLastExecutionTime;\r
 unsigned long ulTicksToWait = mainCHECK_DELAY_NO_ERROR;\r
 \r
        /* Just to remove the compiler warning about the unused parameter. */\r
@@ -263,7 +258,7 @@ signed char cChar;
 \r
 /* String declared static to ensure it does not end up on the stack, no matter\r
 what the optimisation level. */\r
-static const char *pcLongishString = \r
+static const char *pcLongishString =\r
 "ABBA was a Swedish pop music group formed in Stockholm in 1972, consisting of Anni-Frid Frida Lyngstad, "\r
 "Björn Ulvaeus, Benny Andersson and Agnetha Fältskog. Throughout the band's existence, Fältskog and Ulvaeus "\r
 "were a married couple, as were Lyngstad and Andersson - although both couples later divorced. They became one "\r
@@ -302,41 +297,41 @@ static const char *pcLongishString =
 static void prvSetupHardware( void )\r
 {\r
        /* RCC system reset(for debug purpose). */\r
-       RCC_DeInit ();                        \r
+       RCC_DeInit ();\r
 \r
     /* Enable HSE. */\r
-       RCC_HSEConfig( RCC_HSE_ON );           \r
-       \r
+       RCC_HSEConfig( RCC_HSE_ON );\r
+\r
        /* Wait till HSE is ready. */\r
        while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);\r
-       \r
+\r
     /* HCLK = SYSCLK. */\r
-       RCC_HCLKConfig( RCC_SYSCLK_Div1 );   \r
+       RCC_HCLKConfig( RCC_SYSCLK_Div1 );\r
 \r
     /* PCLK2  = HCLK. */\r
-       RCC_PCLK2Config( RCC_HCLK_Div1 );     \r
+       RCC_PCLK2Config( RCC_HCLK_Div1 );\r
 \r
     /* PCLK1  = HCLK/2. */\r
-       RCC_PCLK1Config( RCC_HCLK_Div2 );     \r
+       RCC_PCLK1Config( RCC_HCLK_Div2 );\r
 \r
        /* ADCCLK = PCLK2/4. */\r
-       RCC_ADCCLKConfig( RCC_PCLK2_Div4 );    \r
-       \r
+       RCC_ADCCLKConfig( RCC_PCLK2_Div4 );\r
+\r
     /* Flash 2 wait state. */\r
-       *( volatile unsigned long  * )0x40022000 = 0x01;           \r
-       \r
+       *( volatile unsigned long  * )0x40022000 = 0x01;\r
+\r
        /* PLLCLK = 8MHz * 9 = 72 MHz */\r
        RCC_PLLConfig( RCC_PLLSource_HSE_Div1, RCC_PLLMul_9 );\r
-       \r
+\r
     /* Enable PLL. */\r
        RCC_PLLCmd( ENABLE );\r
-       \r
+\r
        /* Wait till PLL is ready. */\r
        while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);\r
-       \r
+\r
        /* Select PLL as system clock source. */\r
        RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);\r
-       \r
+\r
        /* Wait till PLL is used as system clock source. */\r
        while (RCC_GetSYSCLKSource() != 0x08);\r
 \r
@@ -360,7 +355,7 @@ static void prvSetupHardware( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
 {\r
        /* This function will get called if a task overflows its stack.   If the\r
        parameters are corrupt then inspect pxCurrentTCB to find which was the\r