X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=FreeRTOS%2FDemo%2FCORTEX_A53_64-bit_UltraScale_MPSoC%2FRTOSDemo_A53%2Fsrc%2Fmain.c;h=46dfa732947234e9645e77f23adf053d82eb3fda;hb=afe3a0193fb04714e0130b62a8352804c203064d;hp=724d4328db06d9dca17339d8e30d3025a6288f28;hpb=70f0bb6133065c1f0049f8258d0454027d37f657;p=freertos diff --git a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c index 724d4328d..46dfa7329 100644 --- a/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c +++ b/FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/main.c @@ -1,96 +1,49 @@ /* - FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd. - All rights reserved - - VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. - - 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. !<< - *************************************************************************** - - 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 on the following - link: http://www.freertos.org/a00114.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 * - * * - *************************************************************************** - - http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading - the FAQ page "My application does not run, what could be wrong?". Have you - defined configASSERT()? - - http://www.FreeRTOS.org/support - In return for receiving this top quality - embedded software for free we request you assist our global community by - participating in the support forum. - - http://www.FreeRTOS.org/training - Investing in training allows your team to - be as productive as possible as early as possible. Now you can receive - FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers - Ltd, and the world's leading authority on the world's leading RTOS. - - http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, - 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 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 - mission critical applications that require provable dependability. - - 1 tab == 4 spaces! -*/ + * FreeRTOS Kernel V10.2.0 + * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ /****************************************************************************** - * This project provides two demo applications. A simple blinky style project, - * and a more comprehensive test and demo application. The - * mainSELECTED_APPLICATION setting (defined in this file) is used to select - * between the two. The simply blinky demo is implemented and described in - * main_blinky.c. The more comprehensive test and demo application is - * implemented and described in main_full.c. * - * This file implements the code that is not demo specific, including the - * hardware setup and FreeRTOS hook functions. + * See http://www.FreeRTOS.org/RTOS-Xilinx-UltraScale_MPSoC_64-bit.html for + * additional information on this demo. * - * !!! IMPORTANT NOTE !!! - * Some GCC libraries can make use of the floating point registers. To avoid - * this causing corruption it is necessary to avoid their use. For this reason - * main.c contains very basic C implementations of the standard C library - * functions memset(), memcpy() and memcmp(), which are are used by FreeRTOS - * itself. Defining these functions in the project prevents the linker pulling - * them in from the library. Any other standard C library functions that are - * used by the application must likewise be defined in C. + * NOTE 1: This project provides two demo applications. A simple blinky + * style project, and a more comprehensive test and demo application. The + * mainSELECTED_APPLICATION setting in main.c is used to select between the two. + * See the notes on using mainSELECTED_APPLICATION where it is defined below. * - * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON - * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO - * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT! + * NOTE 2: This file only contains the source code that is not specific to + * either the simply blinky or full demos - this includes initialisation code + * and callback functions. * + * NOTE 3: This project builds the FreeRTOS source code, so is expecting the + * BSP project to be configured as a 'standalone' bsp project rather than a + * 'FreeRTOS' bsp project. However the BSP project MUST still be build with + * the FREERTOS_BSP symbol defined (-DFREERTOS_BSP must be added to the + * command line in the BSP configuration). */ /* Standard includes. */ @@ -99,14 +52,6 @@ /* Scheduler include files. */ #include "FreeRTOS.h" #include "task.h" -#include "semphr.h" - -/* Standard demo includes. */ -#include "partest.h" -#include "QueueOverwrite.h" -#include "EventGroupsDemo.h" -#include "TaskNotify.h" -#include "IntSemTest.h" /* Xilinx includes. */ #include "platform.h" @@ -122,7 +67,7 @@ * When mainSELECTED_APPLICATION is set to 1 the comprehensive test and demo * application will be run. */ -#define mainSELECTED_APPLICATION 0 +#define mainSELECTED_APPLICATION 1 /*-----------------------------------------------------------*/ @@ -160,6 +105,9 @@ XScuGic xInterruptController; int main( void ) { + /* See http://www.FreeRTOS.org/RTOS-Xilinx-UltraScale_MPSoC_64-bit.html for + additional information on this demo. */ + /* Configure the hardware ready to run the demo. */ prvSetupHardware(); @@ -249,104 +197,84 @@ volatile size_t xFreeHeapSpace; } /*-----------------------------------------------------------*/ -void vAssertCalled( const char * pcFile, unsigned long ulLine ) -{ -volatile unsigned long ul = 0; - - ( void ) pcFile; - ( void ) ulLine; - - taskENTER_CRITICAL(); - { - #if( configUSE_TRACE_FACILITY == 1 ) - { - vTraceStop(); - } - #endif - - /* Set ul to a non-zero value using the debugger to step out of this - function. */ - while( ul == 0 ) - { - portNOP(); - } - } - taskEXIT_CRITICAL(); -} -/*-----------------------------------------------------------*/ - void vApplicationTickHook( void ) { #if( mainSELECTED_APPLICATION == 1 ) { - /* Call the periodic event group from ISR demo. */ - vPeriodicEventGroupsProcessing(); - - /* Use task notifications from an interrupt. */ - xNotifyTaskFromISR(); - - /* Use mutexes from interrupts. */ - vInterruptSemaphorePeriodicTest(); + /* Only the comprehensive demo actually uses the tick hook. */ + extern void vFullDemoTickHook( void ); + vFullDemoTickHook(); } #endif } /*-----------------------------------------------------------*/ -void *memcpy( void *pvDest, const void *pvSource, size_t xBytes ) +/* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an +implementation of vApplicationGetIdleTaskMemory() to provide the memory that is +used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) { -/* The compiler used during development seems to err unless these volatiles are -included at -O3 optimisation. */ -volatile unsigned char *pcDest = ( volatile unsigned char * ) pvDest, *pcSource = ( volatile unsigned char * ) pvSource; -size_t x; - - /* Extremely crude standard library implementations in lieu of having a C - library. */ - if( pvDest != pvSource ) - { - for( x = 0; x < xBytes; x++ ) - { - pcDest[ x ] = pcSource[ x ]; - } - } - - return pvDest; +/* If the buffers to be provided to the Idle task are declared inside this +function then they must be declared static - otherwise they will be allocated on +the stack and so not exists after this function exits. */ +static StaticTask_t xIdleTaskTCB; +static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } /*-----------------------------------------------------------*/ -void *memset( void *pvDest, int iValue, size_t xBytes ) +/* configUSE_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the +application must provide an implementation of vApplicationGetTimerTaskMemory() +to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) { -/* The compiler used during development seems to err unless these volatiles are -included at -O3 optimisation. */ -volatile unsigned char * volatile pcDest = ( volatile unsigned char * volatile ) pvDest; -volatile size_t x; - - /* Extremely crude standard library implementations in lieu of having a C - library. */ - for( x = 0; x < xBytes; x++ ) - { - pcDest[ x ] = ( unsigned char ) iValue; - } - - return pvDest; +/* If the buffers to be provided to the Timer task are declared inside this +function then they must be declared static - otherwise they will be allocated on +the stack and so not exists after this function exits. */ +static StaticTask_t xTimerTaskTCB; +static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } /*-----------------------------------------------------------*/ -int memcmp( const void *pvMem1, const void *pvMem2, size_t xBytes ) +void vMainAssertCalled( const char *pcFileName, uint32_t ulLineNumber ) { -const volatile unsigned char *pucMem1 = pvMem1, *pucMem2 = pvMem2; -volatile size_t x; - - /* Extremely crude standard library implementations in lieu of having a C - library. */ - for( x = 0; x < xBytes; x++ ) - { - if( pucMem1[ x ] != pucMem2[ x ] ) - { - break; - } - } - - return xBytes - x; + xil_printf( "ASSERT! Line %lu of file %s\r\n", ulLineNumber, pcFileName ); + taskENTER_CRITICAL(); + for( ;; ); } -/*-----------------------------------------------------------*/ +void *____memset(void *str, int c, size_t n) +{ +size_t x; +uint8_t *puc = ( uint8_t * ) str; + + for( x = 0; x < c; x++ ) + { + puc[ x ] = ( uint8_t ) c; + } + + return str; +}