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).
This commit is contained in:
parent
bc8cf2c501
commit
cfebb5a5c1
@ -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"
|
||||
|
105
arch/risc-v/src/common/riscv_common_memorymap.h
Normal file
105
arch/risc-v/src/common/riscv_common_memorymap.h
Normal file
@ -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 */
|
@ -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
|
||||
***************************************************************************/
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -25,6 +25,8 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "riscv_common_memorymap.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user