You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/01/29 12:20:20 UTC

[GitHub] [incubator-nuttx] Ouss4 commented on a change in pull request #175: imxrt - interrupt serial storm, add DTCM and set up I and D cache

Ouss4 commented on a change in pull request #175: imxrt - interrupt serial storm, add DTCM and set up I and D cache 
URL: https://github.com/apache/incubator-nuttx/pull/175#discussion_r372335648
 
 

 ##########
 File path: arch/arm/src/imxrt/imxrt_allocateheap.c
 ##########
 @@ -110,32 +111,64 @@
  */
 
 /* There there then several memory configurations with a one primary memory
- * region and up to two additional memory regions which may be OCRAM,
+ * region and up to two additional memory regions which may be OCRAM, DTCM
  * external SDRAM, or external SRAM.
  */
 
 #undef IMXRT_OCRAM_ASSIGNED
+#undef IMXRT_DCTM_ASSIGNED
 #undef IMXRT_SDRAM_ASSIGNED
 #undef IMXRT_SRAM_ASSIGNED
 
-/* REVISIT: Assume that if OCRAM is the primary RAM, then DTCM and ITCM are
- * not being used.
- * When configured DTCM and ITCM consume OCRAM from the address space
+/* When configured DTCM and ITCM consume OCRAM from the address space
  * labeled IMXRT_OCRAM_BASE that uses the FlexRAM controller to allocate
  * the function of OCRAM.
  *
  * The 1 MB version of the SOC have a second 512Kib of OCRAM that can not
  * be consumed by the DTCM or ITCM.
+ *
+ * If we order the memory with the FlexRAM controller from high to low banks
+ * as ITCM DTCM OCRAM we can achieve an continuous RAM layout of
+ *
+ * High  OCRAM-(DTCM Size, ITCM Size)
+ * Low   OCRAM2
+ *
+ * The pieces of the OCRAM used for DTCM and ITCM DTCM and ITCM memory spaces
  */
 
 #if defined(IMXRT_OCRAM2_BASE)
 # define _IMXRT_OCRAM_BASE IMXRT_OCRAM2_BASE
 #else
 # define _IMXRT_OCRAM_BASE IMXRT_OCRAM_BASE
 #endif
+
+#define CONFIG_ITCM_USED 0
+#if defined(CONFIG_IMXRT_ITCM)
+#  if (CONFIG_IMXRT_ITCM % 32) != 0
+#    error IMXRT_ITCM must be divisible by 32
+#  endif
+#  undef CONFIG_ITCM_USED
+#  define CONFIG_ITCM_USED (CONFIG_IMXRT_ITCM * 1024)
+#else
+#  define CONFIG_IMXRT_ITCM 0
+#endif
+
+#define CONFIG_DTCM_USED 0
+#if defined(CONFIG_IMXRT_DTCM)
+#  if (CONFIG_IMXRT_DTCM % 32) != 0
+#    error CONFIG_IMXRT_DTCM must be divisible by 32
+#  endif
+#  undef CONFIG_DTCM_USED
+#  define CONFIG_DTCM_USED (CONFIG_IMXRT_DTCM * 1024)
+#else
+#  define IMXRT_DTCM 0
+#endif
+
+#define FLEXRAM_REMAINING_K ((IMXRT_OCRAM_SIZE / 1024) - (CONFIG_IMXRT_DTCM + CONFIG_IMXRT_DTCM))
+
 #if defined(CONFIG_IMXRT_OCRAM_PRIMARY)
-#  define PRIMARY_RAM_START    _IMXRT_OCRAM_BASE        /* CONFIG_RAM_START */
-#  define PRIMARY_RAM_SIZE     IMXRT_OCRAM_SIZE         /* CONFIG_RAM_SIZE */
+#  define PRIMARY_RAM_START    _IMXRT_OCRAM_BASE
+#  define PRIMARY_RAM_SIZE     IMXRT_OCRAM_SIZE-(CONFIG_ITCM_USED+CONFIG_DTCM_USED)
 
 Review comment:
   ```suggestion
   #  define PRIMARY_RAM_SIZE     IMXRT_OCRAM_SIZE - (CONFIG_ITCM_USED + CONFIG_DTCM_USED)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services