From 36f28f8037a9e49d8f02313eaff6f49cd8c10e60 Mon Sep 17 00:00:00 2001 From: Mathieu Rondonneau Date: Tue, 5 Jul 2011 21:45:39 -0700 Subject: [PATCH] OP-423: Fixing heap2 (puting back bytes from the post heap stack (used during init) back into the free list). Tested this heap2 at runtime with CC and new compiler since old one (current) triggers strict alliasing error. That's ok since strict aliasing is disabled on OP, and CC only use heap1. --- .../Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c index aec6b41c6..c361a5aaf 100644 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c @@ -280,10 +280,15 @@ void vPortInitialiseBlocks( void ) void xPortIncreaseHeapSize( size_t bytes ) { + xBlockLink *pxNewBlockLink; vTaskSuspendAll(); currentTOTAL_HEAP_SISE = configTOTAL_HEAP_SIZE + bytes; xEnd.xBlockSize = currentTOTAL_HEAP_SISE; xFreeBytesRemaining += bytes; + /* Insert the new block into the list of free blocks. */ + pxNewBlockLink = ( void * ) &xHeap.ucHeap[ configTOTAL_HEAP_SIZE ]; + pxNewBlockLink->xBlockSize = bytes; + prvInsertBlockIntoFreeList( ( pxNewBlockLink ) ); xTaskResumeAll(); } /*-----------------------------------------------------------*/