From 52bb5e561c2407937d80545c127e37da6d2c3a04 Mon Sep 17 00:00:00 2001 From: px4dev Date: Sat, 6 Apr 2013 12:57:53 -0700 Subject: [PATCH] Fix memory sizing so that we get the extra 64K we promised. --- nuttx/arch/arm/src/stm32/stm32_allocateheap.c | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/nuttx/arch/arm/src/stm32/stm32_allocateheap.c b/nuttx/arch/arm/src/stm32/stm32_allocateheap.c index 4b8707a2b7..c53ff31372 100644 --- a/nuttx/arch/arm/src/stm32/stm32_allocateheap.c +++ b/nuttx/arch/arm/src/stm32/stm32_allocateheap.c @@ -118,19 +118,23 @@ # undef CONFIG_STM32_CCMEXCLUDE # define CONFIG_STM32_CCMEXCLUDE 1 -/* All members of the STM32F20xxx and STM32F40xxx families have 192Kb in three banks: +/* All members of the STM32F20xxx and STM32F40xxx families have 192KiB in three banks: * - * 1) 112Kb of System SRAM beginning at address 0x2000:0000 - * 2) 16Kb of System SRAM beginning at address 0x2001:c000 - * 3) 64Kb of CCM SRAM beginning at address 0x1000:0000 + * 1) 112KiB of System SRAM beginning at address 0x2000:0000 + * 2) 16KiB of System SRAM beginning at address 0x2001:c000 + * 3) 64KiB of CCM SRAM beginning at address 0x1000:0000 * - * As determined by ld.script, g_heapbase lies in the 112Kb memory + * The STM32F427/437 have an additional 64KiB of System SRAM beginning at + * address 0x2002:0000 for a total of 256KiB. + * + * As determined by ld.script, g_heapbase lies in the 112KiB memory * region and that extends to 0x2001:0000. But the first and second memory * regions are contiguous and treated as one in this logic that extends to - * 0x2002:0000. + * 0x2002:0000 (or 0x2003:0000 for the F427/F437). * - * As a complication, it appears that CCM SRAM cannot be used for DMA. So, if - * STM32 DMA is enabled, CCM SRAM should probably be excluded from the heap. + * As a complication, CCM SRAM cannot be used for DMA. So, if STM32 DMA is enabled, + * CCM SRAM should probably be excluded from the heap or the application must take + * extra care to ensure that DMA buffers are not allocated in CCM SRAM. * * In addition, external FSMC SRAM may be available. */ @@ -147,7 +151,11 @@ /* Set the end of system SRAM */ -# define SRAM1_END 0x20020000 +# if defined(CONFIG_STM32_STM32F427) +# define SRAM1_END 0x20030000 +# else +# define SRAM1_END 0x20020000 +# endif /* Set the range of CCM SRAM as well (although we may not use it) */