diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2009-05-19 15:17:28 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2009-05-19 15:17:28 +0000 |
commit | d2f880e0bce67ac1bba7f75e915115789d29bcf4 (patch) | |
tree | b765b95fcd05979fdf62f8fea9cea9a32899ad39 /nuttx/mm | |
parent | 8de99d03e5f457d838d569d0fab504a921e53c64 (diff) |
Fix heap setup problem
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1793 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/mm')
-rw-r--r-- | nuttx/mm/mm_initialize.c | 34 | ||||
-rw-r--r-- | nuttx/mm/mm_mallinfo.c | 36 |
2 files changed, 37 insertions, 33 deletions
diff --git a/nuttx/mm/mm_initialize.c b/nuttx/mm/mm_initialize.c index d903b6b56d..f3f0731425 100644 --- a/nuttx/mm/mm_initialize.c +++ b/nuttx/mm/mm_initialize.c @@ -1,7 +1,7 @@ -/************************************************************ +/**************************************************************************** * mm_initialize.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,22 +31,22 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include "mm_environment.h" #include "mm_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Variables - ************************************************************/ + ****************************************************************************/ /* This is the size of the heap provided to mm */ @@ -68,11 +68,11 @@ int g_nregions; FAR struct mm_freenode_s g_nodelist[MM_NNODES]; -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Function: mm_initialize * * Description: @@ -88,12 +88,14 @@ FAR struct mm_freenode_s g_nodelist[MM_NNODES]; * * Assumptions: * - ************************************************************/ + ****************************************************************************/ void mm_initialize(FAR void *heapstart, size_t heapsize) { int i; + mlldbg("Heap: start=%p size=%u\n", heapstart, heapsize); + /* The following two lines have cause problems for some ZiLog compilers * in the past. Life is easier if we just the suppress them for those * tools. @@ -132,7 +134,7 @@ void mm_initialize(FAR void *heapstart, size_t heapsize) mm_addregion(heapstart, heapsize); } -/************************************************************ +/**************************************************************************** * Function: mm_addregion * * Description: @@ -148,7 +150,7 @@ void mm_initialize(FAR void *heapstart, size_t heapsize) * * Assumptions: * - ************************************************************/ + ****************************************************************************/ void mm_addregion(FAR void *heapstart, size_t heapsize) { diff --git a/nuttx/mm/mm_mallinfo.c b/nuttx/mm/mm_mallinfo.c index 0e6ae4e788..5dbe266098 100644 --- a/nuttx/mm/mm_mallinfo.c +++ b/nuttx/mm/mm_mallinfo.c @@ -1,7 +1,7 @@ -/************************************************************ - * mm_mallinfo.c +/**************************************************************************** + * mm/mm_mallinfo.c * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,39 +31,39 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Included Files - ************************************************************/ + ****************************************************************************/ #include <assert.h> #include "mm_environment.h" #include "mm_internal.h" -/************************************************************ +/**************************************************************************** * Definitions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Data - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Private Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * Public Functions - ************************************************************/ + ****************************************************************************/ -/************************************************************ +/**************************************************************************** * mallinfo * * Description: * mallinfo returns a copy of updated current mallinfo. * - ************************************************************/ + ****************************************************************************/ #ifdef CONFIG_CAN_PASS_STRUCTS struct mallinfo mallinfo(void) @@ -103,6 +103,7 @@ int mallinfo(struct mallinfo *info) node < g_heapend[region]; node = (struct mm_allocnode_s *)((char*)node + node->size)) { + mvdbg("region=%d node=%p preceding=%p\n", region, node, node->preceding); if (node->preceding & MM_ALLOC_BIT) { uordblks += node->size; @@ -118,6 +119,7 @@ int mallinfo(struct mallinfo *info) } } + mvdbg("region=%d node=%p g_heapend=%p\n", region, node, g_heapend[region]); DEBUGASSERT(node == g_heapend[region]); uordblks += SIZEOF_MM_ALLOCNODE; /* account for the tail node */ } |