From f0dd0fbf1bae663e9594b7a08badb745d6ed953c Mon Sep 17 00:00:00 2001 From: rtel Date: Sun, 22 Nov 2015 21:14:39 +0000 Subject: [PATCH] FreeRTOS source changes: + heap_1.c and heap_2.c now support configAPPLICATION_ALLOCATED_HEAP (heap_4.c already did) which allows the heap to be placed by the user rather than the linker. Demo app changes: + SAMD20 project has been updated to use Atmel Studio 7. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2394 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../RTOSDemo/RTOSDemo.cproj | 70 ++----------------- .../RTOSDemo/src/main.c | 2 +- FreeRTOS/License/license.txt | 32 ++++++--- FreeRTOS/Source/portable/MemMang/heap_1.c | 14 +++- FreeRTOS/Source/portable/MemMang/heap_2.c | 11 ++- 5 files changed, 50 insertions(+), 79 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/RTOSDemo.cproj b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/RTOSDemo.cproj index f6369af17..8f0de0298 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/RTOSDemo.cproj +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/RTOSDemo.cproj @@ -2,7 +2,7 @@ 2.0 - 6.1 + 7.0 {2a475b6a-78b0-4237-8947-341bd379ab5c} $(MSBuildProjectName) $(MSBuildProjectName) @@ -165,7 +165,7 @@ - + @@ -216,6 +216,8 @@ 000591000435 J-Link + true + @@ -282,38 +284,6 @@ True -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam0/utils/linker_scripts/samd20/gcc/samd20j18_flash.ld - - - ../src - ../src/ASF/common/boards - ../src/ASF/common/utils - ../src/ASF/sam0/boards - ../src/ASF/sam0/boards/samd20_xplained_pro - ../src/ASF/sam0/drivers/port - ../src/ASF/sam0/drivers/system - ../src/ASF/sam0/drivers/system/clock - ../src/ASF/sam0/drivers/system/interrupt - ../src/ASF/sam0/drivers/system/pinmux - ../src/ASF/sam0/utils - ../src/ASF/sam0/utils/cmsis/samd20/include - ../src/ASF/sam0/utils/cmsis/samd20/include/component - ../src/ASF/sam0/utils/cmsis/samd20/include/instance - ../src/ASF/sam0/utils/cmsis/samd20/include/pio - ../src/ASF/sam0/utils/cmsis/samd20/source - ../src/ASF/sam0/utils/header_files - ../src/ASF/sam0/utils/preprocessor - ../src/ASF/thirdparty/CMSIS/Include - ../src/ASF/thirdparty/CMSIS/Lib/GCC - ../src/config - %24(ToolchainDir)\..\..\CMSIS_Atmel - %24(ToolchainDir)\..\..\CMSIS_Atmel\CMSIS\Include - %24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL - %24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL\samd20\include - ../src/ASF/common/services/serial - ../src/ASF/sam0/drivers/sercom - ../src/ASF/sam0/drivers/sercom/usart - - -DARM_MATH_CM0=true -DBOARD=SAMD20_XPLAINED_PRO -D__SAMD20J18__ -DUSART_CALLBACK_MODE=true @@ -419,38 +389,6 @@ True -Wl,--entry=Reset_Handler -Wl,--cref -mthumb -T../src/ASF/sam0/utils/linker_scripts/samd20/gcc/samd20j18_flash.ld - - - ../src - ../src/ASF/common/boards - ../src/ASF/common/utils - ../src/ASF/sam0/boards - ../src/ASF/sam0/boards/samd20_xplained_pro - ../src/ASF/sam0/drivers/port - ../src/ASF/sam0/drivers/system - ../src/ASF/sam0/drivers/system/clock - ../src/ASF/sam0/drivers/system/interrupt - ../src/ASF/sam0/drivers/system/pinmux - ../src/ASF/sam0/utils - ../src/ASF/sam0/utils/cmsis/samd20/include - ../src/ASF/sam0/utils/cmsis/samd20/include/component - ../src/ASF/sam0/utils/cmsis/samd20/include/instance - ../src/ASF/sam0/utils/cmsis/samd20/include/pio - ../src/ASF/sam0/utils/cmsis/samd20/source - ../src/ASF/sam0/utils/header_files - ../src/ASF/sam0/utils/preprocessor - ../src/ASF/thirdparty/CMSIS/Include - ../src/ASF/thirdparty/CMSIS/Lib/GCC - ../src/config - %24(ToolchainDir)\..\..\CMSIS_Atmel - %24(ToolchainDir)\..\..\CMSIS_Atmel\CMSIS\Include - %24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL - %24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL\samd20\include - ../src/ASF/common/services/serial - ../src/ASF/sam0/drivers/sercom - ../src/ASF/sam0/drivers/sercom/usart - - Default (-g) -DARM_MATH_CM0=true -DBOARD=SAMD20_XPLAINED_PRO -D__SAMD20J18__ -DUSART_CALLBACK_MODE=true diff --git a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c index e385ece54..c244efdf4 100644 --- a/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c +++ b/FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo/src/main.c @@ -137,7 +137,7 @@ int main (void) /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top of this file. */ - #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 + #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) { main_blinky(); } diff --git a/FreeRTOS/License/license.txt b/FreeRTOS/License/license.txt index f96767fc1..9667958ca 100644 --- a/FreeRTOS/License/license.txt +++ b/FreeRTOS/License/license.txt @@ -1,17 +1,30 @@ +The FreeRTOS open source license covers the FreeRTOS source files, +which are located in the /FreeRTOS/Source directory of the official FreeRTOS +download. It also covers most of the source files in the demo application +projects, which are located in the /FreeRTOS/Demo directory of the official +FreeRTOS download. The demo projects may also include third party software that +is not part of FreeRTOS and is licensed separately to FreeRTOS. Examples of +third party software includes header files provided by chip or tools vendors, +linker scripts, peripheral drivers, etc. All the software in subdirectories of +the /FreeRTOS directory is either open source or distributed with permission, +and is free for use. For the avoidance of doubt, refer to the comments at the +top of each source file. + ---------------------------------------------------------------------------- -NOTE: The modification to the GPL documented below is included to allow you to -distribute a combined work that includes FreeRTOS without being obliged to -provide the source code for proprietary components. +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. ---------------------------------------------------------------------------- -The FreeRTOS GPL Exception Text: +Applying to FreeRTOS V8.2.3 up to the latest version, the FreeRTOS GPL Exception +Text follows: -Any FreeRTOS source code, whether modified or in it's original release form, +Any FreeRTOS *source code*, whether modified or in it's original release form, or whether in whole or in part, can only be distributed by you under the terms -of version 2 of the GNU General Public License plus this exception. An -independent module is a module which is not derived from or based on FreeRTOS. +of the GNU General Public License plus this exception. An independent module is +a module which is not derived from or based on FreeRTOS. Clause 1: @@ -35,9 +48,12 @@ express permission of Real Time Engineers Ltd. (this is the norm within the industry and is intended to ensure information accuracy). + -------------------------------------------------------------------- -The standard GPL v2 text follows: + + +The standard GPL V2 text: GNU GENERAL PUBLIC LICENSE diff --git a/FreeRTOS/Source/portable/MemMang/heap_1.c b/FreeRTOS/Source/portable/MemMang/heap_1.c index aeca28735..bd98d5409 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_1.c +++ b/FreeRTOS/Source/portable/MemMang/heap_1.c @@ -91,7 +91,15 @@ task.h is included from an application file. */ #define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT ) /* Allocate the memory for the heap. */ -static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; +/* Allocate the memory for the heap. */ +#if( configAPPLICATION_ALLOCATED_HEAP == 1 ) + /* The application writer has already defined the array used for the RTOS + heap - probably so it can be placed in a special segment or address. */ + extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; +#else + static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; +#endif /* configAPPLICATION_ALLOCATED_HEAP */ + static size_t xNextFreeByte = ( size_t ) 0; /*-----------------------------------------------------------*/ @@ -102,12 +110,14 @@ void *pvReturn = NULL; static uint8_t *pucAlignedHeap = NULL; /* Ensure that blocks are always aligned to the required number of bytes. */ - #if portBYTE_ALIGNMENT != 1 + #if( portBYTE_ALIGNMENT != 1 ) + { if( xWantedSize & portBYTE_ALIGNMENT_MASK ) { /* Byte alignment required. */ xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) ); } + } #endif vTaskSuspendAll(); diff --git a/FreeRTOS/Source/portable/MemMang/heap_2.c b/FreeRTOS/Source/portable/MemMang/heap_2.c index 2e7aa19c8..2d95e4411 100644 --- a/FreeRTOS/Source/portable/MemMang/heap_2.c +++ b/FreeRTOS/Source/portable/MemMang/heap_2.c @@ -97,7 +97,14 @@ task.h is included from an application file. */ static void prvHeapInit( void ); /* Allocate the memory for the heap. */ -static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; +#if( configAPPLICATION_ALLOCATED_HEAP == 1 ) + /* The application writer has already defined the array used for the RTOS + heap - probably so it can be placed in a special segment or address. */ + extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; +#else + static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ]; +#endif /* configAPPLICATION_ALLOCATED_HEAP */ + /* Define the linked list structure. This is used to link free blocks in order of their size. */ @@ -127,7 +134,7 @@ static size_t xFreeBytesRemaining = configADJUSTED_HEAP_SIZE; */ #define prvInsertBlockIntoFreeList( pxBlockToInsert ) \ { \ -BlockLink_t *pxIterator; \ +BlockLink_t *pxIterator; \ size_t xBlockSize; \ \ xBlockSize = pxBlockToInsert->xBlockSize; \ -- 2.39.2