summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/stm32/stm32_allocateheap.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-07 18:27:47 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-02-07 18:27:47 +0000
commit19b930ec0781b037b3b7fdde0a0fddc798861fe8 (patch)
treedf4cf18368bdbafccac69631b5ab8470a78cf59c /nuttx/arch/arm/src/stm32/stm32_allocateheap.c
parentb5f347def1e037ee724266e1366ff1c66d5ebd9d (diff)
downloadnuttx-19b930ec0781b037b3b7fdde0a0fddc798861fe8.tar.gz
nuttx-19b930ec0781b037b3b7fdde0a0fddc798861fe8.tar.bz2
nuttx-19b930ec0781b037b3b7fdde0a0fddc798861fe8.zip
Fixes for STM32 F3 GPIO, pinmap, DMA, and heap allocation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5621 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_allocateheap.c')
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_allocateheap.c81
1 files changed, 77 insertions, 4 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_allocateheap.c b/nuttx/arch/arm/src/stm32/stm32_allocateheap.c
index 4b8707a2b..e4c21ccdb 100644
--- a/nuttx/arch/arm/src/stm32/stm32_allocateheap.c
+++ b/nuttx/arch/arm/src/stm32/stm32_allocateheap.c
@@ -118,10 +118,84 @@
# undef CONFIG_STM32_CCMEXCLUDE
# define CONFIG_STM32_CCMEXCLUDE 1
-/* All members of the STM32F20xxx and STM32F40xxx families have 192Kb in three banks:
+/* Members of teh STM32F30xxx family has a variable amount of SRAM from 24
+ * to 40Kb plus 8KB if CCM SRAM. No external RAM is supported (the F3 family has no
+ * FSMC).
+ *
+ * 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.
+ */
+
+#elif defined(CONFIG_STM32_STM32F30XX)
+
+ /* Set the end of system SRAM */
+
+# define SRAM1_END CONFIG_DRAM_END
+
+ /* Set the range of CCM SRAM as well (although we may not use it) */
+
+# define SRAM2_START 0x10000000
+# define SRAM2_END 0x10002000
+
+ /* There is no FSMC */
+
+# undef CONFIG_STM32_FSMC_SRAM
+
+ /* There are 2 possible SRAM configurations:
+ *
+ * Configuration 1. System SRAM (only)
+ * CONFIG_MM_REGIONS == 1
+ * CONFIG_STM32_CCMEXCLUDE defined
+ * Configuration 2. System SRAM and CCM SRAM
+ * CONFIG_MM_REGIONS == 2
+ * CONFIG_STM32_CCMEXCLUDE NOT defined
+ */
+
+# if CONFIG_MM_REGIONS < 2
+ /* Only one memory region. Force Configuration 1 */
+
+# ifndef CONFIG_STM32_CCMEXCLUDE
+# warning "CCM SRAM excluded from the heap"
+# define CONFIG_STM32_CCMEXCLUDE 1
+# endif
+
+ /* CONFIG_MM_REGIONS may be 2 if CCM SRAM is included in the head */
+
+# elif CONFIG_MM_REGIONS >= 2
+# if CONFIG_MM_REGIONS > 2
+# error "No more than two memory regions can be supported (CONFIG_MM_REGIONS)"
+# undef CONFIG_MM_REGIONS
+# define CONFIG_MM_REGIONS 2
+# endif
+
+ /* Two memory regions is okay if CCM SRAM is not disabled. */
+
+# ifdef CONFIG_STM32_CCMEXCLUDE
+
+ /* Configuration 1: CONFIG_MM_REGIONS should have been 2 */
+
+# error "CONFIG_MM_REGIONS >= 2 but but CCM SRAM is excluded (CONFIG_STM32_CCMEXCLUDE)"
+# undef CONFIG_MM_REGIONS
+# define CONFIG_MM_REGIONS 1
+# else
+
+ /* Configuration 2: DMA should be disabled */
+
+# ifdef CONFIG_ARCH_DMA
+# warning "CCM SRAM is included in the heap AND DMA is enabled"
+# endif
+# endif
+# endif
+
+/* All members of the STM32F20xxx and STM32F40xxx families have 128Kb in two
+ * banks:
*
* 1) 112Kb of System SRAM beginning at address 0x2000:0000
* 2) 16Kb of System SRAM beginning at address 0x2001:c000
+ *
+ * The STM32F40xxx family has an additional 64Kb of CCM SRAM for a total of
+ * 192KB.
+ *
* 3) 64Kb of CCM SRAM beginning at address 0x1000:0000
*
* As determined by ld.script, g_heapbase lies in the 112Kb memory
@@ -129,15 +203,14 @@
* regions are contiguous and treated as one in this logic that extends to
* 0x2002:0000.
*
- * 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.
*
* In addition, external FSMC SRAM may be available.
*/
#elif defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX)
-
/* The STM32 F2 has no CCM SRAM */
# ifdef CONFIG_STM32_STM32F20XX