You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/02/02 02:45:35 UTC

[incubator-nuttx] branch master updated: arch/risc-v: Don't declare riscv_addregion if CONFIG_MM_REGIONS is < 1.

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 37b93bd  arch/risc-v: Don't declare riscv_addregion if CONFIG_MM_REGIONS is < 1.
37b93bd is described below

commit 37b93bd49897e5a50ee75f86965e820b57b245e5
Author: Abdelatif Guettouche <ab...@espressif.com>
AuthorDate: Mon Feb 1 19:03:49 2021 +0100

    arch/risc-v: Don't declare riscv_addregion if CONFIG_MM_REGIONS is < 1.
    
    Don't declare riscv_addregion if CONFIG_MM_REGIONS is < 1, so we won't
    have to provide a dummy stub for every chip.
    Also rename the function from up_addregion to riscv_addregion since it's
    not exported outside the arch directory.
    
    Signed-off-by: Abdelatif Guettouche <ab...@espressif.com>
---
 arch/risc-v/src/bl602/bl602_allocateheap.c | 24 ++++++++++++++++--------
 arch/risc-v/src/common/riscv_initialize.c  |  2 +-
 arch/risc-v/src/common/riscv_internal.h    |  7 ++++++-
 arch/risc-v/src/fe310/fe310_allocateheap.c | 11 +++++++++--
 arch/risc-v/src/gap8/gap8_allocateheap.c   |  6 ++++--
 arch/risc-v/src/k210/k210_allocateheap.c   | 12 ++++++++++--
 arch/risc-v/src/litex/litex_allocateheap.c | 12 ++++++++++--
 arch/risc-v/src/nr5m100/nr5_allocateheap.c |  7 +++++--
 8 files changed, 61 insertions(+), 20 deletions(-)

diff --git a/arch/risc-v/src/bl602/bl602_allocateheap.c b/arch/risc-v/src/bl602/bl602_allocateheap.c
index 065c30c..4d41404 100644
--- a/arch/risc-v/src/bl602/bl602_allocateheap.c
+++ b/arch/risc-v/src/bl602/bl602_allocateheap.c
@@ -38,14 +38,6 @@ extern uint8_t _heap_size;
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_addregion
- ****************************************************************************/
-
-void up_addregion(void)
-{
-}
-
-/****************************************************************************
  * Name: up_allocate_heap
  *
  * Description:
@@ -65,3 +57,19 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
   *heap_start = (FAR void *)&_heap_start;
   *heap_size  = (size_t)&_heap_size;
 }
+
+/****************************************************************************
+ * Name: riscv_addregion
+ *
+ * Description:
+ *   RAM may be added in non-contiguous chunks.  This routine adds all chunks
+ *   that may be used for heap.
+ *
+ ****************************************************************************/
+
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void)
+{
+}
+#endif
+
diff --git a/arch/risc-v/src/common/riscv_initialize.c b/arch/risc-v/src/common/riscv_initialize.c
index 1fb5bc1..be180ba 100644
--- a/arch/risc-v/src/common/riscv_initialize.c
+++ b/arch/risc-v/src/common/riscv_initialize.c
@@ -114,7 +114,7 @@ void up_initialize(void)
 
   /* Add any extra memory fragments to the memory manager */
 
-  up_addregion();
+  riscv_addregion();
 
 #ifdef CONFIG_PM
   /* Initialize the power management subsystem.  This MCU-specific function
diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h
index 34b850c..46c6d0b 100644
--- a/arch/risc-v/src/common/riscv_internal.h
+++ b/arch/risc-v/src/common/riscv_internal.h
@@ -172,7 +172,12 @@ void up_boot(void);
 
 /* Memory allocation ********************************************************/
 
-void up_addregion(void);
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void);
+#else
+# define riscv_addregion()
+#endif
+
 void up_allocate_heap(FAR void **heap_start, size_t *heap_size);
 
 /* IRQ initialization *******************************************************/
diff --git a/arch/risc-v/src/fe310/fe310_allocateheap.c b/arch/risc-v/src/fe310/fe310_allocateheap.c
index a7ed59a..9e7212a 100644
--- a/arch/risc-v/src/fe310/fe310_allocateheap.c
+++ b/arch/risc-v/src/fe310/fe310_allocateheap.c
@@ -45,9 +45,16 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_addregion
+ * Name: riscv_addregion
+ *
+ * Description:
+ *   RAM may be added in non-contiguous chunks.  This routine adds all chunks
+ *   that may be used for heap.
+ *
  ****************************************************************************/
 
-void up_addregion(void)
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void)
 {
 }
+#endif
diff --git a/arch/risc-v/src/gap8/gap8_allocateheap.c b/arch/risc-v/src/gap8/gap8_allocateheap.c
index 687cbdb..5eb5909 100644
--- a/arch/risc-v/src/gap8/gap8_allocateheap.c
+++ b/arch/risc-v/src/gap8/gap8_allocateheap.c
@@ -82,7 +82,7 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
 }
 
 /****************************************************************************
- * Name: up_addregion
+ * Name: riscv_addregion
  *
  * Description:
  *   RAM may be added in non-contiguous chunks.  This routine adds all chunks
@@ -90,7 +90,9 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
  *
  ****************************************************************************/
 
-void up_addregion(void)
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void)
 {
   /* TODO: add L1 memorie */
 }
+#endif
diff --git a/arch/risc-v/src/k210/k210_allocateheap.c b/arch/risc-v/src/k210/k210_allocateheap.c
index e2f420e..a88ee4c 100644
--- a/arch/risc-v/src/k210/k210_allocateheap.c
+++ b/arch/risc-v/src/k210/k210_allocateheap.c
@@ -94,9 +94,17 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
 #endif
 
 /****************************************************************************
- * Name: up_addregion
+ * Name: riscv_addregion
+ *
+ * Description:
+ *   RAM may be added in non-contiguous chunks.  This routine adds all chunks
+ *   that may be used for heap.
+ *
  ****************************************************************************/
 
-void up_addregion(void)
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void)
 {
 }
+#endif
+
diff --git a/arch/risc-v/src/litex/litex_allocateheap.c b/arch/risc-v/src/litex/litex_allocateheap.c
index 2edc5ba..7349cc7 100644
--- a/arch/risc-v/src/litex/litex_allocateheap.c
+++ b/arch/risc-v/src/litex/litex_allocateheap.c
@@ -33,9 +33,17 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: up_addregion
+ * Name: riscv_addregion
+ *
+ * Description:
+ *   RAM may be added in non-contiguous chunks.  This routine adds all chunks
+ *   that may be used for heap.
+ *
  ****************************************************************************/
 
-void up_addregion(void)
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void)
 {
 }
+#endif
+
diff --git a/arch/risc-v/src/nr5m100/nr5_allocateheap.c b/arch/risc-v/src/nr5m100/nr5_allocateheap.c
index dc1fcbc..2cba18a 100644
--- a/arch/risc-v/src/nr5m100/nr5_allocateheap.c
+++ b/arch/risc-v/src/nr5m100/nr5_allocateheap.c
@@ -49,7 +49,7 @@
  ************************************************************************************/
 
 /************************************************************************************
- * Name: up_addregion
+ * Name: riscv_addregion
  *
  * Description:
  *   RAM may be added in non-contiguous chunks.  This routine adds all chunks
@@ -57,6 +57,9 @@
  *
  ************************************************************************************/
 
-void up_addregion(void)
+#if CONFIG_MM_REGIONS > 1
+void riscv_addregion(void)
 {
 }
+#endif
+