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

pkarashchenko 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 cfebb5a5c1 risc-v: Move common memory map to its own file from 
riscv_internal
cfebb5a5c1 is described below

commit cfebb5a5c1c6660bca734ff69c82c3d9b36b481c
Author: Ville Juven <ville.ju...@unikie.com>
AuthorDate: Thu Jun 23 09:51:11 2022 +0300

    risc-v: Move common memory map to its own file from riscv_internal
    
    Move the linker defined symbols to a separate file, so they can be
    accessed without pulling in everything from riscv_internal.h and
    whatever it includes (e.g. syscall.h drags in a lot).
---
 arch/risc-v/src/c906/c906_memorymap.h           |   2 +-
 arch/risc-v/src/common/riscv_common_memorymap.h | 105 ++++++++++++++++++++++++
 arch/risc-v/src/common/riscv_internal.h         |  54 +-----------
 arch/risc-v/src/fe310/fe310_memorymap.h         |   2 +-
 arch/risc-v/src/k210/k210_memorymap.h           |   2 +-
 arch/risc-v/src/mpfs/mpfs_memorymap.h           |   2 +-
 arch/risc-v/src/qemu-rv/qemu_rv_memorymap.h     |   2 +
 7 files changed, 113 insertions(+), 56 deletions(-)

diff --git a/arch/risc-v/src/c906/c906_memorymap.h 
b/arch/risc-v/src/c906/c906_memorymap.h
index 55b136bd88..7a7c2bbf42 100644
--- a/arch/risc-v/src/c906/c906_memorymap.h
+++ b/arch/risc-v/src/c906/c906_memorymap.h
@@ -25,7 +25,7 @@
  * Included Files
  ****************************************************************************/
 
-#include "riscv_internal.h"
+#include "riscv_common_memorymap.h"
 #include "hardware/c906_memorymap.h"
 #include "hardware/c906_uart.h"
 #include "hardware/c906_clint.h"
diff --git a/arch/risc-v/src/common/riscv_common_memorymap.h 
b/arch/risc-v/src/common/riscv_common_memorymap.h
new file mode 100644
index 0000000000..67ee7efbe8
--- /dev/null
+++ b/arch/risc-v/src/common/riscv_common_memorymap.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * arch/risc-v/src/common/riscv_common_memorymap.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __ARCH_RISC_V_SRC_COMMON_RISCV_COMMON_MEMORYMAP_H
+#define __ARCH_RISC_V_SRC_COMMON_RISCV_COMMON_MEMORYMAP_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <sys/types.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define _START_TEXT  &_stext
+#define _END_TEXT    &_etext
+#define _START_BSS   &_sbss
+#define _END_BSS     &_ebss
+#define _DATA_INIT   &_eronly
+#define _START_DATA  &_sdata
+#define _END_DATA    &_edata
+#define _START_TDATA &_stdata
+#define _END_TDATA   &_etdata
+#define _START_TBSS  &_stbss
+#define _END_TBSS    &_etbss
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C"
+{
+#else
+#define EXTERN extern
+#endif
+
+#ifndef __ASSEMBLY__
+EXTERN uintptr_t g_idle_topstack;
+
+/* Address of per-cpu idle stack base */
+
+EXTERN const uint8_t * const g_cpu_basestack[CONFIG_SMP_NCPUS];
+
+/* Address of the saved user stack pointer */
+
+#if CONFIG_ARCH_INTERRUPTSTACK > 15
+EXTERN uint32_t g_intstackalloc; /* Allocated stack base */
+EXTERN uint32_t g_intstacktop;   /* Initial top of interrupt stack */
+#endif
+
+/* These 'addresses' of these values are setup by the linker script.  They
+ * are not actual uint32_t storage locations! They are only used meaningfully
+ * in the following way:
+ *
+ *  - The linker script defines, for example, the symbol_sdata.
+ *  - The declaration extern uint32_t _sdata; makes C happy.  C will believe
+ *    that the value _sdata is the address of a uint32_t variable _data (it
+ *    is not!).
+ *  - We can recover the linker value then by simply taking the address of
+ *    of _data.  like:  uint32_t *pdata = &_sdata;
+ */
+
+EXTERN uint32_t _stext;           /* Start of .text */
+EXTERN uint32_t _etext;           /* End_1 of .text + .rodata */
+EXTERN const uint32_t _eronly;    /* End+1 of read only section (.text + 
.rodata) */
+EXTERN uint32_t _sdata;           /* Start of .data */
+EXTERN uint32_t _edata;           /* End+1 of .data */
+EXTERN uint32_t _sbss;            /* Start of .bss */
+EXTERN uint32_t _ebss;            /* End+1 of .bss */
+EXTERN uint32_t _stdata;          /* Start of .tdata */
+EXTERN uint32_t _etdata;          /* End+1 of .tdata */
+EXTERN uint32_t _stbss;           /* Start of .tbss */
+EXTERN uint32_t _etbss;           /* End+1 of .tbss */
+
+#endif /* __ASSEMBLY__ */
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif /* __ARCH_RISC_V_SRC_COMMON_RISCV_COMMON_MEMORYMAP_H */
diff --git a/arch/risc-v/src/common/riscv_internal.h 
b/arch/risc-v/src/common/riscv_internal.h
index ea1e723cd0..dc2575f678 100644
--- a/arch/risc-v/src/common/riscv_internal.h
+++ b/arch/risc-v/src/common/riscv_internal.h
@@ -35,6 +35,8 @@
 #  include <syscall.h>
 #endif
 
+#include "riscv_common_memorymap.h"
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -73,18 +75,6 @@
 #define riscv_savestate(regs) (regs = (uintptr_t *)CURRENT_REGS)
 #define riscv_restorestate(regs) (CURRENT_REGS = regs)
 
-#define _START_TEXT  &_stext
-#define _END_TEXT    &_etext
-#define _START_BSS   &_sbss
-#define _END_BSS     &_ebss
-#define _DATA_INIT   &_eronly
-#define _START_DATA  &_sdata
-#define _END_DATA    &_edata
-#define _START_TDATA &_stdata
-#define _END_TDATA   &_etdata
-#define _START_TBSS  &_stbss
-#define _END_TBSS    &_etbss
-
 /* Determine which (if any) console driver to use.  If a console is enabled
  * and no other console device is specified, then a serial console is
  * assumed.
@@ -164,46 +154,6 @@ extern "C"
 #define EXTERN extern
 #endif
 
-#ifndef __ASSEMBLY__
-EXTERN uintptr_t g_idle_topstack;
-
-/* Address of per-cpu idle stack base */
-
-EXTERN const uint8_t * const g_cpu_basestack[CONFIG_SMP_NCPUS];
-
-/* Address of the saved user stack pointer */
-
-#if CONFIG_ARCH_INTERRUPTSTACK > 15
-EXTERN uint32_t g_intstackalloc; /* Allocated stack base */
-EXTERN uint32_t g_intstacktop;   /* Initial top of interrupt stack */
-#endif
-
-/* These 'addresses' of these values are setup by the linker script.  They
- * are not actual uint32_t storage locations! They are only used meaningfully
- * in the following way:
- *
- *  - The linker script defines, for example, the symbol_sdata.
- *  - The declaration extern uint32_t _sdata; makes C happy.  C will believe
- *    that the value _sdata is the address of a uint32_t variable _data (it
- *    is not!).
- *  - We can recover the linker value then by simply taking the address of
- *    of _data.  like:  uint32_t *pdata = &_sdata;
- */
-
-EXTERN uint32_t _stext;           /* Start of .text */
-EXTERN uint32_t _etext;           /* End_1 of .text + .rodata */
-EXTERN const uint32_t _eronly;    /* End+1 of read only section (.text + 
.rodata) */
-EXTERN uint32_t _sdata;           /* Start of .data */
-EXTERN uint32_t _edata;           /* End+1 of .data */
-EXTERN uint32_t _sbss;            /* Start of .bss */
-EXTERN uint32_t _ebss;            /* End+1 of .bss */
-EXTERN uint32_t _stdata;          /* Start of .tdata */
-EXTERN uint32_t _etdata;          /* End+1 of .tdata */
-EXTERN uint32_t _stbss;           /* Start of .tbss */
-EXTERN uint32_t _etbss;           /* End+1 of .tbss */
-
-#endif /* __ASSEMBLY__ */
-
 /****************************************************************************
 * Public Function Prototypes
   ***************************************************************************/
diff --git a/arch/risc-v/src/fe310/fe310_memorymap.h 
b/arch/risc-v/src/fe310/fe310_memorymap.h
index 85a22f0095..0af1b76eb2 100644
--- a/arch/risc-v/src/fe310/fe310_memorymap.h
+++ b/arch/risc-v/src/fe310/fe310_memorymap.h
@@ -25,7 +25,7 @@
  * Included Files
  ****************************************************************************/
 
-#include "riscv_internal.h"
+#include "riscv_common_memorymap.h"
 #include "hardware/fe310_memorymap.h"
 #include "hardware/fe310_uart.h"
 #include "hardware/fe310_clint.h"
diff --git a/arch/risc-v/src/k210/k210_memorymap.h 
b/arch/risc-v/src/k210/k210_memorymap.h
index 0b49d46ac3..ba263bf81e 100644
--- a/arch/risc-v/src/k210/k210_memorymap.h
+++ b/arch/risc-v/src/k210/k210_memorymap.h
@@ -25,7 +25,7 @@
  * Included Files
  ****************************************************************************/
 
-#include "riscv_internal.h"
+#include "riscv_common_memorymap.h"
 #include "hardware/k210_memorymap.h"
 #include "hardware/k210_uart.h"
 #include "hardware/k210_clint.h"
diff --git a/arch/risc-v/src/mpfs/mpfs_memorymap.h 
b/arch/risc-v/src/mpfs/mpfs_memorymap.h
index 4b1026254f..19efd4f151 100755
--- a/arch/risc-v/src/mpfs/mpfs_memorymap.h
+++ b/arch/risc-v/src/mpfs/mpfs_memorymap.h
@@ -25,7 +25,7 @@
  * Included Files
  ****************************************************************************/
 
-#include "riscv_internal.h"
+#include "riscv_common_memorymap.h"
 #include "hardware/mpfs_clint.h"
 #include "hardware/mpfs_memorymap.h"
 #include "hardware/mpfs_plic.h"
diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_memorymap.h 
b/arch/risc-v/src/qemu-rv/qemu_rv_memorymap.h
index 76b85cbc59..705e3289fb 100644
--- a/arch/risc-v/src/qemu-rv/qemu_rv_memorymap.h
+++ b/arch/risc-v/src/qemu-rv/qemu_rv_memorymap.h
@@ -25,6 +25,8 @@
  * Included Files
  ****************************************************************************/
 
+#include "riscv_common_memorymap.h"
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/

Reply via email to