]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_STM32F103_GCC_Rowley/main.c
Update version number ready for next release.
[freertos] / FreeRTOS / Demo / CORTEX_STM32F103_GCC_Rowley / main.c
index a508a52c6cf6b244dcee5c4090e76309ee8f49c9..bb258349034366030e6695f522228e62470763e1 100644 (file)
@@ -1,67 +1,29 @@
 /*\r
-    FreeRTOS V7.5.3 - Copyright (C) 2013 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
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    FreeRTOS provides completely free yet professionally developed,    *\r
-     *    robust, strictly quality controlled, supported, and cross          *\r
-     *    platform software that has become a de facto standard.             *\r
-     *                                                                       *\r
-     *    Help yourself get started quickly and support the FreeRTOS         *\r
-     *    project by purchasing a FreeRTOS tutorial book, reference          *\r
-     *    manual, or both from: http://www.FreeRTOS.org/Documentation        *\r
-     *                                                                       *\r
-     *    Thank you!                                                         *\r
-     *                                                                       *\r
-    ***************************************************************************\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
-    >>! NOTE: The modification to the GPL is included to allow you to distribute\r
-    >>! a combined work that includes FreeRTOS without being obliged to provide\r
-    >>! the source code for proprietary components outside of the FreeRTOS\r
-    >>! kernel.\r
-\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 from the following\r
-    link: http://www.freertos.org/a00114.html\r
-\r
-    1 tab == 4 spaces!\r
-\r
-    ***************************************************************************\r
-     *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\r
-     *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
-     *                                                                       *\r
-    ***************************************************************************\r
-\r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\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.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
-    Integrity Systems to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
-    licenses offer ticketed support, indemnification and 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
+ * FreeRTOS Kernel V10.2.1\r
+ * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\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
@@ -155,7 +117,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
@@ -181,10 +143,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
@@ -198,7 +160,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
@@ -229,18 +191,18 @@ unsigned long ulTicksToWait = mainCHECK_DELAY_NO_ERROR;
                {\r
                        ulTicksToWait = mainCHECK_DELAY_ERROR;\r
                }\r
-           else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
-           {\r
-               ulTicksToWait = mainCHECK_DELAY_ERROR;\r
-           }\r
-           else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
-           {\r
-               ulTicksToWait = mainCHECK_DELAY_ERROR;\r
-           }\r
-           else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
-           {\r
-               ulTicksToWait = mainCHECK_DELAY_ERROR;\r
-           }\r
+               else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainCHECK_DELAY_ERROR;\r
+               }\r
+               else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainCHECK_DELAY_ERROR;\r
+               }\r
+               else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+               {\r
+                       ulTicksToWait = mainCHECK_DELAY_ERROR;\r
+               }\r
 \r
                vParTestToggleLED( mainCHECK_LED );\r
        }\r
@@ -254,7 +216,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
@@ -293,41 +255,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
@@ -351,7 +313,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