From: richardbarry Date: Sat, 28 Oct 2006 09:23:09 +0000 (+0000) Subject: git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@50 1d2547de-c912-0410-9cb9... X-Git-Tag: V4.1.3~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=db8d89494c2cfe1ce7d8bbe4667fad732a097d17;p=freertos git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@50 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Opt b/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Opt index 124f4d6eb..a78d564ce 100644 --- a/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Opt +++ b/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Opt @@ -13,7 +13,7 @@ Target (FreeRTOS_Demo), 0x0004 // Tools: 'ARM-ADS' GRPOPT 1,(Demo_Source),1,0,0 GRPOPT 2,(Libraries),1,0,0 -GRPOPT 3,(RTOS_Source),0,0,0 +GRPOPT 3,(RTOS_Source),1,0,0 GRPOPT 4,(Documentation),1,0,0 OPTFFF 1,1,2,0,0,0,0,0,<.\startup_rvmdk.S> @@ -23,9 +23,9 @@ OPTFFF 1,4,1,0,0,0,0,0,<..\Common\Minimal\semtest.c> OPTFFF 1,5,1,989855744,0,0,0,0,<..\Common\Minimal\integer.c> OPTFFF 1,6,1,939524096,0,0,0,0,<..\Common\Minimal\PollQ.c> OPTFFF 1,7,1,201326592,0,0,0,0,<..\Common\Minimal\BlockQ.c> -OPTFFF 1,8,1,0,0,0,0,0,<..\..\Source\portable\MemMang\heap_2.c> +OPTFFF 1,8,1,0,0,0,0,0,<.\heap\heap_1.c> OPTFFF 2,9,4,0,0,0,0,0, -OPTFFF 3,10,1,503316481,0,0,0,0,<..\..\Source\tasks.c> +OPTFFF 3,10,1,0,0,0,0,0,<..\..\Source\tasks.c> OPTFFF 3,11,1,0,0,0,0,0,<..\..\Source\list.c> OPTFFF 3,12,1,0,0,0,0,0,<..\..\Source\queue.c> OPTFFF 3,13,1,0,0,0,0,0,<..\..\Source\portable\RVDS\ARM_CM3\port.c> @@ -47,7 +47,6 @@ TARGOPT 1, (FreeRTOS_Demo) OPTKEY 0,(DLGTARM)() OPTKEY 0,(ARMDBGFLAGS)(-T5F) OPTKEY 0,(LMIDK-AGDI)(-B0 -O1792) - OPTBB 0,0,106,1,3002,0,0,0,0,1,()() OPTDF 0x84 OPTLE <> OPTLC <> diff --git a/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Uv2 b/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Uv2 index 9b8635a6d..737a39bf0 100644 --- a/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Uv2 +++ b/Demo/CORTEX_LM3S811_KEIL/RTOSDemo.Uv2 @@ -8,19 +8,19 @@ Group (Libraries) Group (RTOS_Source) Group (Documentation) -File 1,2,<.\startup_rvmdk.S> 0x44FB12E0 -File 1,1,<.\LuminaryCode\osram96x16.c> 0x44F9AFC1 -File 1,1,<.\main.c> 0x44FC00B0 -File 1,1,<..\Common\Minimal\semtest.c> 0x44F30401 -File 1,1,<..\Common\Minimal\integer.c> 0x44F30401 -File 1,1,<..\Common\Minimal\PollQ.c> 0x44F30401 -File 1,1,<..\Common\Minimal\BlockQ.c> 0x44F30403 -File 1,1,<..\..\Source\portable\MemMang\heap_2.c> 0x44F30418 +File 1,2,<.\startup_rvmdk.S> 0x45431C95 +File 1,1,<.\LuminaryCode\osram96x16.c> 0x452BAD20 +File 1,1,<.\main.c> 0x452A35C1 +File 1,1,<..\Common\Minimal\semtest.c> 0x452A35D8 +File 1,1,<..\Common\Minimal\integer.c> 0x452A35D8 +File 1,1,<..\Common\Minimal\PollQ.c> 0x452A35D8 +File 1,1,<..\Common\Minimal\BlockQ.c> 0x4538ECC1 +File 1,1,<.\heap\heap_1.c> 0x45431CD6 File 2,4, 0x44F892D1 -File 3,1,<..\..\Source\tasks.c> 0x44F303D7 -File 3,1,<..\..\Source\list.c> 0x44F303E1 -File 3,1,<..\..\Source\queue.c> 0x44F303E0 -File 3,1,<..\..\Source\portable\RVDS\ARM_CM3\port.c> 0x44F30423 +File 3,1,<..\..\Source\tasks.c> 0x452A35A8 +File 3,1,<..\..\Source\list.c> 0x452A35BA +File 3,1,<..\..\Source\queue.c> 0x452A35BA +File 3,1,<..\..\Source\portable\RVDS\ARM_CM3\port.c> 0x452A35FB File 4,5,<.\readme.txt> 0x44FC00DA @@ -66,7 +66,7 @@ Options 1,0,0 // Target 'FreeRTOS_Demo' BrunUsr 1 0 <> SVCSID <> GLFLAGS=1790 - ADSFLGA { 16,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + ADSFLGA { 176,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } ACPUTYP (Cortex-M3) ADSTFLGA { 0,12,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } OCMADSOCM { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } @@ -100,7 +100,7 @@ Options 1,0,0 // Target 'FreeRTOS_Demo' ADSLDSC () ADSLDIB () ADSLDIC () - ADSLDMC (--entry Reset_Handler) + ADSLDMC (--entry Reset_Handler --last xHeap) ADSLDIF () ADSLDDW () OPTDL (SARMCM3.DLL)()(DLM.DLL)(-pLM3S811)(SARMCM3.DLL)()(TLM.DLL)(-pLM3S811) diff --git a/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c b/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c new file mode 100644 index 000000000..683874aa0 --- /dev/null +++ b/Demo/CORTEX_LM3S811_KEIL/heap/heap_1.c @@ -0,0 +1,120 @@ +/* + FreeRTOS.org V4.1.2 - Copyright (C) 2003-2006 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org 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. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + *************************************************************************** +*/ + + + +/* + * The simplest possible implementation of pvPortMalloc(). Note that this + * implementation does NOT allow allocated memory to be freed again. + * + * See heap_2.c and heap_3.c for alternative implementations, and the memory + * management pages of http://www.FreeRTOS.org for more information. + */ +#include +#include "FreeRTOS.h" +#include "task.h" + +/* Setup the correct byte alignment mask for the defined byte alignment. */ +#if portBYTE_ALIGNMENT == 4 + #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0003 ) +#endif + +#if portBYTE_ALIGNMENT == 2 + #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0001 ) +#endif + +#if portBYTE_ALIGNMENT == 1 + #define heapBYTE_ALIGNMENT_MASK ( ( size_t ) 0x0000 ) +#endif + +#ifndef heapBYTE_ALIGNMENT_MASK + #error "Invalid portBYTE_ALIGNMENT definition" +#endif + +/* Allocate the memory for the heap. The struct is used to force byte +alignment without using any non-portable code. */ +extern struct xRTOS_HEAP +{ + unsigned portLONG ulDummy; + unsigned portCHAR ucHeap[ configTOTAL_HEAP_SIZE ]; +} xHeap; + +static size_t xNextFreeByte = ( size_t ) 0; +/*-----------------------------------------------------------*/ + +void *pvPortMalloc( size_t xWantedSize ) +{ +void *pvReturn = NULL; + + /* Ensure that blocks are always aligned to the required number of bytes. */ + #if portBYTE_ALIGNMENT != 1 + if( xWantedSize & heapBYTE_ALIGNMENT_MASK ) + { + /* Byte alignment required. */ + xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & heapBYTE_ALIGNMENT_MASK ) ); + } + #endif + + vTaskSuspendAll(); + { + /* Check there is enough room left for the allocation. */ + if( ( ( xNextFreeByte + xWantedSize ) < configTOTAL_HEAP_SIZE ) && + ( ( xNextFreeByte + xWantedSize ) > xNextFreeByte ) )/* Check for overflow. */ + { + /* Return the next free byte then increment the index past this + block. */ + pvReturn = &( xHeap.ucHeap[ xNextFreeByte ] ); + xNextFreeByte += xWantedSize; + } + } + xTaskResumeAll(); + + return pvReturn; +} +/*-----------------------------------------------------------*/ + +void vPortFree( void *pv ) +{ + /* Memory cannot be freed using this scheme. See heap_2.c and heap_3.c + for alternative implementations, and the memory management pages of + http://www.FreeRTOS.org for more information. */ + ( void ) pv; +} +/*-----------------------------------------------------------*/ + +void vPortInitialiseBlocks( void ) +{ + /* Only required when static memory is not cleared. */ + xNextFreeByte = ( size_t ) 0; +} + + diff --git a/Demo/CORTEX_LM3S811_KEIL/startup_rvmdk.S b/Demo/CORTEX_LM3S811_KEIL/startup_rvmdk.S index 53c3d8c97..e22c13e83 100644 --- a/Demo/CORTEX_LM3S811_KEIL/startup_rvmdk.S +++ b/Demo/CORTEX_LM3S811_KEIL/startup_rvmdk.S @@ -217,6 +217,19 @@ __user_initial_stackheap ;****************************************************************************** ALIGN +; Note: +; Using READWRITE places Section .RTOSHeap in Region ER_RW. +; Using NOINIT places Section .RTOSHeap in Region ER_ZI,which means +; "ZEROINITIALIZE" (sic), and which is the last region in memory. Then +; we need to make this section the last section, which is somewhat tricky, +; because we cannot use the sectionname, but need to use a defined symbol: +; Linker option: "--last xHeap" + + EXPORT xHeap + + AREA RTOSHeap, DATA, NOINIT +xHeap + ;****************************************************************************** ; ; Tell the assembler that we're done.