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 2022/05/12 20:14:07 UTC
[incubator-nuttx] 02/02: boards: rv-virt: Add knsh64 related files
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
commit dc2a01e75a89ea0e90dbc37aebbc7822f1d846e9
Author: Masayuki Ishikawa <ma...@gmail.com>
AuthorDate: Mon May 9 11:02:46 2022 +0900
boards: rv-virt: Add knsh64 related files
Summary:
- This commit adds knsh64 related files
Impact:
- None
Testing:
- Tested with qemu-6.2
Signed-off-by: Masayuki Ishikawa <Ma...@jp.sony.com>
---
.../qemu-rv/rv-virt/configs/knsh64/defconfig | 96 ++++++++++++++
.../qemu-rv/rv-virt/include/board_memorymap.h | 98 ++++++++++++++
boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs | 4 +
.../qemu-rv/rv-virt/scripts/ld-kernel.script | 143 +++++++++++++++++++++
4 files changed, 341 insertions(+)
diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig
new file mode 100644
index 0000000000..ce821e008a
--- /dev/null
+++ b/boards/risc-v/qemu-rv/rv-virt/configs/knsh64/defconfig
@@ -0,0 +1,96 @@
+#
+# This file is autogenerated: PLEASE DO NOT EDIT IT.
+#
+# You can use "make menuconfig" to make any modifications to the installed .config file.
+# You can then do "make savedefconfig" to generate a new defconfig file that includes your
+# modifications.
+#
+# CONFIG_DISABLE_OS_API is not set
+# CONFIG_NSH_DISABLE_LOSMART is not set
+CONFIG_16550_ADDRWIDTH=0
+CONFIG_16550_UART0=y
+CONFIG_16550_UART0_BASE=0x10000000
+CONFIG_16550_UART0_CLOCK=3686400
+CONFIG_16550_UART0_IRQ=35
+CONFIG_16550_UART0_SERIAL_CONSOLE=y
+CONFIG_16550_UART=y
+CONFIG_ARCH="risc-v"
+CONFIG_ARCH_ADDRENV=y
+CONFIG_ARCH_BOARD="rv-virt"
+CONFIG_ARCH_BOARD_QEMU_RV_VIRT=y
+CONFIG_ARCH_CHIP="qemu-rv"
+CONFIG_ARCH_CHIP_QEMU_RV64=y
+CONFIG_ARCH_CHIP_QEMU_RV=y
+CONFIG_ARCH_CHIP_QEMU_RV_ISA_A=y
+CONFIG_ARCH_CHIP_QEMU_RV_ISA_C=y
+CONFIG_ARCH_CHIP_QEMU_RV_ISA_M=y
+CONFIG_ARCH_DATA_NPAGES=128
+CONFIG_ARCH_DATA_VBASE=0xC0000000
+CONFIG_ARCH_HEAP_NPAGES=128
+CONFIG_ARCH_HEAP_VBASE=0x00000000
+CONFIG_ARCH_INTERRUPTSTACK=2048
+CONFIG_ARCH_KERNEL_STACKSIZE=3072
+CONFIG_ARCH_PGPOOL_MAPPING=y
+CONFIG_ARCH_PGPOOL_PBASE=0x80400000
+CONFIG_ARCH_PGPOOL_SIZE=4194304
+CONFIG_ARCH_PGPOOL_VBASE=0x80400000
+CONFIG_ARCH_RISCV=y
+CONFIG_ARCH_STACKDUMP=y
+CONFIG_ARCH_TEXT_NPAGES=0
+CONFIG_ARCH_TEXT_VBASE=0x00000000
+CONFIG_ARCH_USE_MMU=y
+CONFIG_ARCH_USE_MPU=y
+CONFIG_ARCH_USE_S_MODE=y
+CONFIG_BOARD_LOOPSPERMSEC=6366
+CONFIG_BUILD_KERNEL=y
+CONFIG_DEBUG_ASSERTIONS=y
+CONFIG_DEBUG_ERROR=y
+CONFIG_DEBUG_FEATURES=y
+CONFIG_DEBUG_FULLOPT=y
+CONFIG_DEBUG_SYMBOLS=y
+CONFIG_DEV_ZERO=y
+CONFIG_ELF=y
+CONFIG_EXAMPLES_HELLO=m
+CONFIG_FS_HOSTFS=y
+CONFIG_FS_PROCFS=y
+CONFIG_IDLETHREAD_STACKSIZE=3072
+CONFIG_INIT_FILEPATH="/system/bin/init"
+CONFIG_INIT_MOUNT=y
+CONFIG_INIT_MOUNT_DATA="fs=../apps"
+CONFIG_INIT_MOUNT_FLAGS=0x1
+CONFIG_INIT_MOUNT_FSTYPE="hostfs"
+CONFIG_INIT_MOUNT_SOURCE=""
+CONFIG_INIT_MOUNT_TARGET="/system"
+CONFIG_INIT_STACKSIZE=3072
+CONFIG_INTELHEX_BINARY=y
+CONFIG_LIBC_ENVPATH=y
+CONFIG_LIBC_EXECFUNCS=y
+CONFIG_LIBC_FLOATINGPOINT=y
+CONFIG_LIBC_PERROR_STDOUT=y
+CONFIG_LIBC_STRERROR=y
+CONFIG_MEMSET_64BIT=y
+CONFIG_MEMSET_OPTSPEED=y
+CONFIG_MM_PGALLOC=y
+CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
+CONFIG_NSH_ARCHINIT=y
+CONFIG_NSH_FILEIOSIZE=512
+CONFIG_NSH_FILE_APPS=y
+CONFIG_NSH_READLINE=y
+CONFIG_PATH_INITIAL="/system/bin"
+CONFIG_PREALLOC_TIMERS=0
+CONFIG_RAM_SIZE=1048576
+CONFIG_RAM_START=0x80100000
+CONFIG_READLINE_CMD_HISTORY=y
+CONFIG_RISCV_SEMIHOSTING_HOSTFS=y
+CONFIG_RR_INTERVAL=200
+CONFIG_SCHED_WAITPID=y
+CONFIG_SERIAL_UART_ARCH_MMIO=y
+CONFIG_STACK_COLORATION=y
+CONFIG_START_MONTH=12
+CONFIG_START_YEAR=2021
+CONFIG_SYMTAB_ORDEREDBYNAME=y
+CONFIG_SYSLOG_TIMESTAMP=y
+CONFIG_SYSTEM_NSH=y
+CONFIG_SYSTEM_NSH_PROGNAME="init"
+CONFIG_TESTING_GETPRIME=y
+CONFIG_USEC_PER_TICK=1000
diff --git a/boards/risc-v/qemu-rv/rv-virt/include/board_memorymap.h b/boards/risc-v/qemu-rv/rv-virt/include/board_memorymap.h
new file mode 100644
index 0000000000..c0c6336b01
--- /dev/null
+++ b/boards/risc-v/qemu-rv/rv-virt/include/board_memorymap.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+ * boards/risc-v/qemu-rv/rv-virt/include/board_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 __BOARDS_RISCV_QEMURV_RVVIRT_INCLUDE_BOARD_MEMORYMAP_H
+#define __BOARDS_RISCV_QEMURV_RVVIRT_INCLUDE_BOARD_MEMORYMAP_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <stdint.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+/* DDR start address */
+
+#define QEMURV_DDR_BASE (0x80000000)
+#define QEMURV_DDR_SIZE (0x40000000)
+
+/* Kernel code memory (RX) */
+
+#define KFLASH_START (uintptr_t)&__kflash_start
+#define KFLASH_SIZE (uintptr_t)&__kflash_size
+#define KSRAM_START (uintptr_t)&__ksram_start
+#define KSRAM_SIZE (uintptr_t)&__ksram_size
+#define KSRAM_END (uintptr_t)&__ksram_end
+
+/* Kernel RAM (RW) */
+
+#define PGPOOL_START (uintptr_t)&__pgheap_start
+#define PGPOOL_SIZE (uintptr_t)&__pgheap_size
+
+/* Page pool (RWX) */
+
+#define PGPOOL_START (uintptr_t)&__pgheap_start
+#define PGPOOL_SIZE (uintptr_t)&__pgheap_size
+#define PGPOOL_END (PGPOOL_START + PGPOOL_SIZE)
+
+/* User flash */
+
+#define UFLASH_START (uintptr_t)&__uflash_start
+#define UFLASH_SIZE (uintptr_t)&__uflash_size
+
+/* User RAM */
+
+#define USRAM_START (uintptr_t)&__usram_start
+#define USRAM_SIZE (uintptr_t)&__usram_size
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* Kernel code memory (RX) */
+
+extern uintptr_t __kflash_start;
+extern uintptr_t __kflash_size;
+
+/* Kernel RAM (RW) */
+
+extern uintptr_t __ksram_start;
+extern uintptr_t __ksram_size;
+extern uintptr_t __ksram_end;
+
+/* Page pool (RWX) */
+
+extern uintptr_t __pgheap_start;
+extern uintptr_t __pgheap_size;
+
+/* User code memory (RX) */
+
+extern uintptr_t __uflash_start;
+extern uintptr_t __uflash_size;
+
+/* User RAM (RW) */
+
+extern uintptr_t __usram_start;
+extern uintptr_t __usram_size;
+
+#endif /* __BOARDS_RISC_V_QEMURV_RVVIRT_INCLUDE_BOARD_MEMORYMAP_H */
diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs b/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs
index 596a800bbb..051f362e18 100644
--- a/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs
+++ b/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs
@@ -23,8 +23,12 @@ include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/risc-v/src/common/Toolchain.defs
ifeq ($(CONFIG_ARCH_CHIP_QEMU_RV),y)
+ifeq ($(CONFIG_BUILD_KERNEL),y)
+ LDSCRIPT = ld-kernel.script
+else
LDSCRIPT = ld.script
endif
+endif
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/ld-kernel.script b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-kernel.script
new file mode 100755
index 0000000000..1c29fa58cf
--- /dev/null
+++ b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-kernel.script
@@ -0,0 +1,143 @@
+/****************************************************************************
+ * boards/risc-v/qemu-rv/rv-virt/scripts/ld.script
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+MEMORY
+{
+ kflash (rx) : ORIGIN = 0x80000000, LENGTH = 2048K /* w/ cache */
+ ksram (rwx) : ORIGIN = 0x80200000, LENGTH = 2048K /* w/ cache */
+ pgram (rwx) : ORIGIN = 0x80400000, LENGTH = 4096K /* w/ cache */
+}
+
+OUTPUT_ARCH("riscv")
+
+/* Provide the kernel boundaries */
+
+__kflash_start = ORIGIN(kflash);
+__kflash_size = LENGTH(kflash);
+__ksram_start = ORIGIN(ksram);
+__ksram_size = LENGTH(ksram);
+__ksram_end = ORIGIN(ksram) + LENGTH(ksram);
+
+/* Page heap */
+
+__pgheap_start = ORIGIN(pgram);
+__pgheap_size = LENGTH(pgram);
+
+SECTIONS
+{
+ . = 0x80000000;
+
+ .text :
+ {
+ _stext = . ;
+ *(.text)
+ *(.text.*)
+ *(.gnu.warning)
+ *(.stub)
+ *(.glue_7)
+ *(.glue_7t)
+ *(.jcr)
+
+ /* C++ support: The .init and .fini sections contain specific logic
+ * to manage static constructors and destructors.
+ */
+
+ *(.gnu.linkonce.t.*)
+ *(.init) /* Old ABI */
+ *(.fini) /* Old ABI */
+ _etext = . ;
+ }
+
+ .rodata :
+ {
+ _srodata = . ;
+ *(.rodata)
+ *(.rodata1)
+ *(.rodata.*)
+ *(.gnu.linkonce.r*)
+ _erodata = . ;
+ }
+
+ .tdata : {
+ _stdata = ABSOLUTE(.);
+ *(.tdata .tdata.* .gnu.linkonce.td.*);
+ _etdata = ABSOLUTE(.);
+ }
+
+ .tbss : {
+ _stbss = ABSOLUTE(.);
+ *(.tbss .tbss.* .gnu.linkonce.tb.* .tcommon);
+ _etbss = ABSOLUTE(.);
+ }
+
+ _eronly = ABSOLUTE(.);
+
+ .data :
+ {
+ _sdata = . ;
+ *(.data)
+ *(.data1)
+ *(.data.*)
+ *(.gnu.linkonce.d*)
+ . = ALIGN(4);
+ _edata = . ;
+ }
+
+ .bss :
+ {
+ _sbss = . ;
+ *(.bss)
+ *(.bss.*)
+ *(.sbss)
+ *(.sbss.*)
+ *(.gnu.linkonce.b*)
+ *(COMMON)
+ _ebss = . ;
+ } > ksram
+
+ /* Page tables here, align to 4K boundary */
+
+ .pgtables : ALIGN(0x1000) {
+ *(.pgtables)
+ . = ALIGN(4);
+ } > ksram
+
+ /* Stack top */
+
+ .stack_top : {
+ . = ALIGN(32);
+ _ebss = ABSOLUTE(.);
+ } > ksram
+
+ /* Stabs debugging sections. */
+
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_info 0 : { *(.debug_info) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ .debug_aranges 0 : { *(.debug_aranges) }
+}