diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-09-06 20:48:39 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-09-06 20:48:39 +0000 |
commit | 2939906ef52709a869fc46b289d0c0bffe9e8aba (patch) | |
tree | 4bf1bde6e98458f5e9a926a4282db8a39fafd256 /nuttx/arch/arm/src | |
parent | 74c1e661abf325a99cc8185492214a7bde852fd5 (diff) | |
download | px4-nuttx-2939906ef52709a869fc46b289d0c0bffe9e8aba.tar.gz px4-nuttx-2939906ef52709a869fc46b289d0c0bffe9e8aba.tar.bz2 px4-nuttx-2939906ef52709a869fc46b289d0c0bffe9e8aba.zip |
Fix heap layout issue
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2925 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r-- | nuttx/arch/arm/src/arm/pg_macros.h | 11 | ||||
-rwxr-xr-x | nuttx/arch/arm/src/lpc313x/lpc313x_allocateheap.c | 19 |
2 files changed, 24 insertions, 6 deletions
diff --git a/nuttx/arch/arm/src/arm/pg_macros.h b/nuttx/arch/arm/src/arm/pg_macros.h index 499093781..fc50f6146 100644 --- a/nuttx/arch/arm/src/arm/pg_macros.h +++ b/nuttx/arch/arm/src/arm/pg_macros.h @@ -281,9 +281,14 @@ /* This is the total number of pages used in the text/data mapping: */ -#define PG_TOTAL_NPPAGES (PG_TEXT_NPPAGES + PG_DATA_PAGES + PG_PGTABLE_NPAGES) -#define PG_TOTAL_NVPAGES (PG_TEXT_NVPAGES + PG_DATA_PAGES + PG_PGTABLE_NPAGES) -#if PG_TOTAL_NPPAGES >PG_RAM_PAGES +#define PG_TOTAL_NPPAGES (PG_TEXT_NPPAGES + PG_DATA_NPAGES + PG_PGTABLE_NPAGES) +#define PG_TOTAL_NVPAGES (PG_TEXT_NVPAGES + PG_DATA_NPAGES + PG_PGTABLE_NPAGES) +#define PG_TOTAL_PSIZE (PG_TOTAL_NPPAGES << PAGESHIFT) +#define PG_TOTAL_VSIZE (PG_TOTAL_NVPAGES << PAGESHIFT) + +/* Sanity check: */ + +#if PG_TOTAL_NPPAGES > PG_RAM_PAGES # error "Total pages required exceeds RAM size" #endif diff --git a/nuttx/arch/arm/src/lpc313x/lpc313x_allocateheap.c b/nuttx/arch/arm/src/lpc313x/lpc313x_allocateheap.c index e6b587fd3..79ba8464e 100755 --- a/nuttx/arch/arm/src/lpc313x/lpc313x_allocateheap.c +++ b/nuttx/arch/arm/src/lpc313x/lpc313x_allocateheap.c @@ -51,6 +51,11 @@ #include "up_internal.h" #include "lpc313x_memorymap.h" +#ifdef CONFIG_PAGING +# include <nuttx/page.h> +# include "pg_macros.h" +#endif + /************************************************************************ * Pre-processor Definitions ************************************************************************/ @@ -121,10 +126,18 @@ * will let the heap run all the way to the end of SRAM. */ -#ifdef PGTABLE_IN_HIGHSRAM -# define LPC313X_HEAP_VEND (LPC313X_INTSRAM_VSECTION + LPC313X_ISRAM_SIZE - PGTABLE_SIZE) +#ifdef CONFIG_PAGING +# ifdef PGTABLE_IN_HIGHSRAM +# define LPC313X_HEAP_VEND (PG_LOCKED_VBASE + PG_TOTAL_VSIZE - PGTABLE_SIZE) +# else +# define LPC313X_HEAP_VEND (PG_LOCKED_VBASE + PG_TOTAL_VSIZE) +# endif #else -# define LPC313X_HEAP_VEND (LPC313X_INTSRAM_VSECTION + LPC313X_ISRAM_SIZE) +# ifdef PGTABLE_IN_HIGHSRAM +# define LPC313X_HEAP_VEND (LPC313X_INTSRAM_VSECTION + LPC313X_ISRAM_SIZE - PGTABLE_SIZE) +# else +# define LPC313X_HEAP_VEND (LPC313X_INTSRAM_VSECTION + LPC313X_ISRAM_SIZE) +# endif #endif /************************************************************************ |