summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-19 15:17:28 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-19 15:17:28 +0000
commit33e9f0c4422c511ab5db2e9d6743c1d03c3ab38e (patch)
treeb765b95fcd05979fdf62f8fea9cea9a32899ad39
parent0fcd87da6c840554cacc94fe14b5963d59441ab7 (diff)
downloadpx4-nuttx-33e9f0c4422c511ab5db2e9d6743c1d03c3ab38e.tar.gz
px4-nuttx-33e9f0c4422c511ab5db2e9d6743c1d03c3ab38e.tar.bz2
px4-nuttx-33e9f0c4422c511ab5db2e9d6743c1d03c3ab38e.zip
Fix heap setup problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1793 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/arch/arm/src/lm3s/lm3s_hardfault.c2
-rw-r--r--nuttx/configs/eagle100/ostest/defconfig2
-rw-r--r--nuttx/configs/eagle100/src/up_leds.c18
-rw-r--r--nuttx/mm/mm_initialize.c34
-rw-r--r--nuttx/mm/mm_mallinfo.c36
5 files changed, 52 insertions, 40 deletions
diff --git a/nuttx/arch/arm/src/lm3s/lm3s_hardfault.c b/nuttx/arch/arm/src/lm3s/lm3s_hardfault.c
index 64382c328..7a9c76611 100644
--- a/nuttx/arch/arm/src/lm3s/lm3s_hardfault.c
+++ b/nuttx/arch/arm/src/lm3s/lm3s_hardfault.c
@@ -130,7 +130,7 @@ int lm3s_hardfault(int irq, FAR void *context)
if (insn == INSN_SVC0)
{
- llvdbg("Forward SVCall\n");
+ sllvdbg("Forward SVCall\n");
return lm3s_svcall(LM3S_IRQ_SVCALL, context);
}
}
diff --git a/nuttx/configs/eagle100/ostest/defconfig b/nuttx/configs/eagle100/ostest/defconfig
index c1a4a760a..238ffe240 100644
--- a/nuttx/configs/eagle100/ostest/defconfig
+++ b/nuttx/configs/eagle100/ostest/defconfig
@@ -73,7 +73,7 @@ CONFIG_ARCH_BOARD=eagle100
CONFIG_ARCH_BOARD_EAGLE100=y
CONFIG_BOARD_LOOPSPERMSEC=4531
CONFIG_DRAM_SIZE=0x00010000
-CONFIG_DRAM_START=0x00000000
+CONFIG_DRAM_START=0x20000000
CONFIG_DRAM_END=(CONFIG_DRAM_START+CONFIG_DRAM_SIZE)
CONFIG_ARCH_IRQPRIO=y
CONFIG_DRAM_NUTTXENTRY=0x00002000
diff --git a/nuttx/configs/eagle100/src/up_leds.c b/nuttx/configs/eagle100/src/up_leds.c
index 43c9e8e70..5a9d36382 100644
--- a/nuttx/configs/eagle100/src/up_leds.c
+++ b/nuttx/configs/eagle100/src/up_leds.c
@@ -64,6 +64,8 @@
* Public Functions
****************************************************************************/
+static boolean g_nest;
+
/****************************************************************************
* Name: up_ledinit
****************************************************************************/
@@ -78,6 +80,7 @@ void up_ledinit(void)
/* Configure Port E, Bit 1 as an output, initial value=OFF */
lm3s_configgpio(GPIO_FUNC_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORTE | 1);
+ g_nest = 0;
}
/****************************************************************************
@@ -92,12 +95,14 @@ void up_ledon(int led)
case LED_HEAPALLOCATE:
default:
break;
- case LED_IRQSENABLED:
- case LED_STACKCREATED:
+
case LED_INIRQ:
case LED_SIGNAL:
case LED_ASSERTION:
case LED_PANIC:
+ g_nest++;
+ case LED_IRQSENABLED:
+ case LED_STACKCREATED:
modifyreg32(LM3S_GPIOE_DATA, 0, (1 << 1));
break;
}
@@ -113,16 +118,19 @@ void up_ledoff(int led)
{
case LED_IRQSENABLED:
case LED_STACKCREATED:
+ case LED_STARTED:
+ case LED_HEAPALLOCATE:
default:
break;
- case LED_STARTED:
- case LED_HEAPALLOCATE:
case LED_INIRQ:
case LED_SIGNAL:
case LED_ASSERTION:
case LED_PANIC:
- modifyreg32(LM3S_GPIOE_DATA, (1 << 1), 0);
+ if (--g_nest <= 0)
+ {
+ modifyreg32(LM3S_GPIOE_DATA, (1 << 1), 0);
+ }
break;
}
}
diff --git a/nuttx/mm/mm_initialize.c b/nuttx/mm/mm_initialize.c
index d903b6b56..f3f073142 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 0e6ae4e78..5dbe26609 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 */
}