X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCORTEX_STM32F103_Keil%2Fmain.c;h=1167d01d9d1e4018e41373ac22193bd88a8315b5;hb=04f5830e5a04fd6d0d953fefe62e3c2ae922a5b1;hp=598d4cc35157671fc1d4fbfa2b01af547eda35f5;hpb=b18af6b07e944b8c932a9be32fbce2344510896c;p=freertos diff --git a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c index 598d4cc35..1167d01d9 100644 --- a/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c +++ b/FreeRTOS/Demo/CORTEX_STM32F103_Keil/main.c @@ -1,36 +1,23 @@ /* - FreeRTOS V7.5.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd. + All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - *************************************************************************** - * * - * FreeRTOS provides completely free yet professionally developed, * - * robust, strictly quality controlled, supported, and cross * - * platform software that has become a de facto standard. * - * * - * Help yourself get started quickly and support the FreeRTOS * - * project by purchasing a FreeRTOS tutorial book, reference * - * manual, or both from: http://www.FreeRTOS.org/Documentation * - * * - * Thank you! * - * * - *************************************************************************** - This file is part of the FreeRTOS distribution. FreeRTOS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (version 2) as published by the Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception. - >>! NOTE: The modification to the GPL is included to allow you to distribute - >>! a combined work that includes FreeRTOS without being obliged to provide - >>! the source code for proprietary components outside of the FreeRTOS - >>! kernel. + >>! NOTE: The modification to the GPL is included to allow you to !<< + >>! distribute a combined work that includes FreeRTOS without being !<< + >>! obliged to provide the source code for proprietary components !<< + >>! outside of the FreeRTOS kernel. !<< FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. Full license text is available from the following + FOR A PARTICULAR PURPOSE. Full license text is available on the following link: http://www.freertos.org/a00114.html 1 tab == 4 spaces! @@ -38,12 +25,53 @@ *************************************************************************** * * * Having a problem? Start by reading the FAQ "My application does * - * not run, what could be wrong?" * + * not run, what could be wrong?". Have you defined configASSERT()? * * * * http://www.FreeRTOS.org/FAQHelp.html * * * *************************************************************************** + *************************************************************************** + * * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that is more than just the market leader, it * + * is the industry's de facto standard. * + * * + * Help yourself get started quickly while simultaneously helping * + * to support the FreeRTOS project by purchasing a FreeRTOS * + * tutorial book, reference manual, or both: * + * http://www.FreeRTOS.org/Documentation * + * * + *************************************************************************** + + *************************************************************************** + * * + * Investing in training allows your team to be as productive as * + * possible as early as possible, lowering your overall development * + * cost, and enabling you to bring a more robust product to market * + * earlier than would otherwise be possible. Richard Barry is both * + * the architect and key author of FreeRTOS, and so also the world's * + * leading authority on what is the world's most popular real time * + * kernel for deeply embedded MCU designs. Obtaining your training * + * from Richard ensures your team will gain directly from his in-depth * + * product knowledge and years of usage experience. Contact Real Time * + * Engineers Ltd to enquire about the FreeRTOS Masterclass, presented * + * by Richard Barry: http://www.FreeRTOS.org/contact + * * + *************************************************************************** + + *************************************************************************** + * * + * You are receiving this top quality software for free. Please play * + * fair and reciprocate by reporting any suspected issues and * + * participating in the community forum: * + * http://www.FreeRTOS.org/support * + * * + * Thank you! * + * * + *************************************************************************** + http://www.FreeRTOS.org - Documentation, books, training, latest versions, license and Real Time Engineers Ltd. contact details. @@ -51,9 +79,12 @@ including FreeRTOS+Trace - an indispensable productivity tool, a DOS compatible FAT file system, and our tiny thread aware UDP/IP stack. + http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. + Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. + http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High - Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS - licenses offer ticketed support, indemnification and middleware. + Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and commercial middleware. http://www.SafeRTOS.com - High Integrity Systems also provide a safety engineered and independently SIL3 certified version for use in safety and @@ -146,10 +177,10 @@ time. */ #define mainMAX_MSG_LEN 25 /* The time between cycles of the 'check' task. */ -#define mainCHECK_DELAY ( ( portTickType ) 5000 / portTICK_RATE_MS ) +#define mainCHECK_DELAY ( ( TickType_t ) 5000 / portTICK_PERIOD_MS ) /* The number of nano seconds between each processor clock. */ -#define mainNS_PER_CLOCK ( ( unsigned portLONG ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) +#define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) configCPU_CLOCK_HZ ) * 1000000000.0 ) ) /* Baud rate used by the comtest tasks. */ #define mainCOM_TEST_BAUD_RATE ( 115200 ) @@ -204,7 +235,7 @@ extern void vSetupTimerTest( void ); /*-----------------------------------------------------------*/ /* The queue used to send messages to the LCD task. */ -xQueueHandle xLCDQueue; +QueueHandle_t xLCDQueue; /*-----------------------------------------------------------*/ @@ -219,7 +250,7 @@ int main( void ) /* Create the queue used by the LCD task. Messages for display on the LCD are received via this queue. */ xLCDQueue = xQueueCreate( mainLCD_QUEUE_SIZE, sizeof( xLCDMessage ) ); - + /* Start the standard demo tasks. */ vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vCreateBlockTimeTasks(); @@ -230,20 +261,20 @@ int main( void ) vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED ); /* Start the tasks defined within this file/specific to this demo. */ - xTaskCreate( vCheckTask, ( signed portCHAR * ) "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( vLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vCheckTask, "Check", mainCHECK_TASK_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL ); + xTaskCreate( vLCDTask, "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); /* The suicide tasks must be created last as they need to know how many tasks were running prior to their creation in order to ascertain whether or not the correct/expected number of tasks are running at any given time. */ vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - + /* Configure the timers used by the fast interrupt timer test. */ vSetupTimerTest(); - + /* Start the scheduler. */ vTaskStartScheduler(); - + /* Will only get here if there was not enough heap space to create the idle task. */ return 0; @@ -256,7 +287,7 @@ xLCDMessage xMessage; /* Initialise the LCD and display a startup message. */ prvConfigureLCD(); - LCD_DrawMonoPict( ( unsigned portLONG * ) pcBitmap ); + LCD_DrawMonoPict( ( unsigned long * ) pcBitmap ); for( ;; ) { @@ -264,21 +295,21 @@ xLCDMessage xMessage; while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); /* Display the message. Print each message to a different position. */ - printf( ( portCHAR const * ) xMessage.pcMessage ); + printf( ( char const * ) xMessage.pcMessage ); } } /*-----------------------------------------------------------*/ static void vCheckTask( void *pvParameters ) { -portTickType xLastExecutionTime; +TickType_t xLastExecutionTime; xLCDMessage xMessage; -static signed portCHAR cPassMessage[ mainMAX_MSG_LEN ]; -extern unsigned portSHORT usMaxJitter; +static signed char cPassMessage[ mainMAX_MSG_LEN ]; +extern unsigned short usMaxJitter; xLastExecutionTime = xTaskGetTickCount(); xMessage.pcMessage = cPassMessage; - + for( ;; ) { /* Perform this check every mainCHECK_DELAY milliseconds. */ @@ -313,10 +344,10 @@ extern unsigned portSHORT usMaxJitter; else if( xAreComTestTasksStillRunning() != pdTRUE ) { xMessage.pcMessage = "ERROR IN COM TEST\n"; - } + } else { - sprintf( ( portCHAR * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned portLONG ) usMaxJitter ) * mainNS_PER_CLOCK ); + sprintf( ( char * ) cPassMessage, "PASS [%uns]\n", ( ( unsigned long ) usMaxJitter ) * mainNS_PER_CLOCK ); } /* Send the message to the LCD gatekeeper for display. */ @@ -339,7 +370,7 @@ static void prvSetupHardware( void ) } /* 2 wait states required on the flash. */ - *( ( unsigned portLONG * ) 0x40022000 ) = 0x02; + *( ( unsigned long * ) 0x40022000 ) = 0x02; /* HCLK = SYSCLK */ RCC_HCLKConfig( RCC_SYSCLK_Div1 ); @@ -381,10 +412,10 @@ static void prvSetupHardware( void ) NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 ); NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 ); - + /* Configure HCLK clock as SysTick clock source. */ SysTick_CLKSourceConfig( SysTick_CLKSource_HCLK ); - + vParTestInitialise(); } /*-----------------------------------------------------------*/ @@ -417,8 +448,8 @@ GPIO_InitTypeDef GPIO_InitStructure; int fputc( int ch, FILE *f ) { -static unsigned portSHORT usColumn = 0, usRefColumn = mainCOLUMN_START; -static unsigned portCHAR ucLine = 0; +static unsigned short usColumn = 0, usRefColumn = mainCOLUMN_START; +static unsigned char ucLine = 0; if( ( usColumn == 0 ) && ( ucLine == 0 ) ) { @@ -429,10 +460,10 @@ static unsigned portCHAR ucLine = 0; { /* Display one character on LCD */ LCD_DisplayChar( ucLine, usRefColumn, (u8) ch ); - + /* Decrement the column position by 16 */ usRefColumn -= mainCOLUMN_INCREMENT; - + /* Increment the character counter */ usColumn++; if( usColumn == mainMAX_COLUMN ) @@ -447,7 +478,7 @@ static unsigned portCHAR ucLine = 0; /* Move back to the first column of the next line. */ ucLine += mainROW_INCREMENT; usRefColumn = mainCOLUMN_START; - usColumn = 0; + usColumn = 0; } /* Wrap back to the top of the display. */ @@ -455,14 +486,14 @@ static unsigned portCHAR ucLine = 0; { ucLine = 0; } - + return ch; } /*-----------------------------------------------------------*/ #ifdef DEBUG /* Keep the linker happy. */ -void assert_failed( unsigned portCHAR* pcFile, unsigned portLONG ulLine ) +void assert_failed( unsigned char* pcFile, unsigned long ulLine ) { for( ;; ) {