diff --git a/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst b/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst index 1eb02876df6..e0a2a8a2b37 100644 --- a/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst +++ b/Documentation/platforms/risc-v/qemu-rv/boards/rv-virt/index.rst @@ -90,7 +90,7 @@ If testing with S-mode build, remove the ``-bios none`` option. S-mode build requires SBI to function properly. For BUILD_PROTECTED the user-space binary must also be loaded, which can be -done by adding ``-device loader,file=./nuttx_user.elf`` to the command line +done by adding ``-device loader,file=./nuttx_user`` to the command line arguments. citest diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_start.c b/arch/risc-v/src/qemu-rv/qemu_rv_start.c index 841a2f0e6d9..89a771d2561 100644 --- a/arch/risc-v/src/qemu-rv/qemu_rv_start.c +++ b/arch/risc-v/src/qemu-rv/qemu_rv_start.c @@ -89,6 +89,27 @@ static void qemu_rv_clear_bss(void) } } +#ifdef CONFIG_BUILD_PROTECTED +static void qemu_rv_copy_data(void) +{ + const uint32_t *src; + uint32_t *dest; + + /* Move the initialized data from their temporary holding spot at FLASH + * into the correct place in SRAM. The correct place in SRAM is given + * by _sdata and _edata. The temporary location is in FLASH at the + * end of all of the other read-only data (.text, .rodata) at _eronly. + */ + + for (src = (const uint32_t *)_eronly, + dest = (uint32_t *)_sdata; dest < (uint32_t *)_edata; + ) + { + *dest++ = *src++; + } +} +#endif + #ifdef CONFIG_ARCH_USE_S_MODE static void qemu_boot_secondary(int mhartid, uintptr_t dtb) { @@ -153,6 +174,10 @@ void qemu_rv_start(int mhartid, const char *dtb) qemu_rv_clear_bss(); +#ifdef CONFIG_BUILD_PROTECTED + qemu_rv_copy_data(); +#endif + #ifdef CONFIG_RISCV_PERCPU_SCRATCH riscv_percpu_add_hart(mhartid); #endif diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_userspace.h b/arch/risc-v/src/qemu-rv/qemu_rv_userspace.h index 11f8b8d52fd..1d528c0ae2d 100644 --- a/arch/risc-v/src/qemu-rv/qemu_rv_userspace.h +++ b/arch/risc-v/src/qemu-rv/qemu_rv_userspace.h @@ -18,8 +18,8 @@ * ****************************************************************************/ -#ifndef __ARCH_RISC_V_SRC_QEMURV_QEMURV_USERSPACE_H -#define __ARCH_RISC_V_SRC_QEMURV_QEMURV_USERSPACE_H +#ifndef __ARCH_RISCV_SRC_QEMU_RV_QEMU_RV_USERSPACE_H +#define __ARCH_RISCV_SRC_QEMU_RV_QEMU_RV_USERSPACE_H /**************************************************************************** * Included Files @@ -46,4 +46,4 @@ void qemu_rv_userspace(void); #endif -#endif /* __ARCH_RISC_V_SRC_QEMURV_QEMURV_USERSPACE_H */ +#endif /* __ARCH_RISCV_SRC_QEMU_RV_QEMU_RV_USERSPACE_H */ diff --git a/boards/risc-v/qemu-rv/rv-virt/.gitignore b/boards/risc-v/qemu-rv/rv-virt/.gitignore new file mode 100644 index 00000000000..5c144adb580 --- /dev/null +++ b/boards/risc-v/qemu-rv/rv-virt/.gitignore @@ -0,0 +1,2 @@ +kernel/nuttx_user* +scripts/*.tmp diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/pnsh/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/pnsh/defconfig new file mode 100644 index 00000000000..8cb3545cb5a --- /dev/null +++ b/boards/risc-v/qemu-rv/rv-virt/configs/pnsh/defconfig @@ -0,0 +1,75 @@ +# +# 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=37 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART=y +CONFIG_ARCH="risc-v" +CONFIG_ARCH_BOARD="rv-virt" +CONFIG_ARCH_BOARD_QEMU_RV_VIRT=y +CONFIG_ARCH_CHIP="qemu-rv" +CONFIG_ARCH_CHIP_QEMU_RV32=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_INTERRUPTSTACK=2048 +CONFIG_ARCH_RISCV=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_USE_MPU=y +CONFIG_BOARDCTL_POWEROFF=y +CONFIG_BOARD_LOOPSPERMSEC=6366 +CONFIG_BUILD_PROTECTED=y +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DEV_ZERO=y +CONFIG_ELF=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_FS_HOSTFS=y +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=3072 +CONFIG_LIBC_ENVPATH=y +CONFIG_LIBC_EXECFUNCS=y +CONFIG_LIBC_PERROR_STDOUT=y +CONFIG_LIBC_STRERROR=y +CONFIG_LIBM=y +CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_NUTTX_USERSPACE=0x80040000 +CONFIG_PASS1_BUILDIR="boards/risc-v/qemu-rv/rv-virt/kernel" +CONFIG_PATH_INITIAL="/system/bin" +CONFIG_RAM_SIZE=3145728 +CONFIG_RAM_START=0x80000000 +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RISCV_PERCPU_SCRATCH=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_SYSTEM_NSH=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/risc-v/qemu-rv/rv-virt/configs/pnsh64/defconfig b/boards/risc-v/qemu-rv/rv-virt/configs/pnsh64/defconfig index f3a255a1880..f04ed94d0e8 100644 --- a/boards/risc-v/qemu-rv/rv-virt/configs/pnsh64/defconfig +++ b/boards/risc-v/qemu-rv/rv-virt/configs/pnsh64/defconfig @@ -26,14 +26,11 @@ CONFIG_ARCH_CHIP_QEMU_RV_ISA_M=y CONFIG_ARCH_INTERRUPTSTACK=2048 CONFIG_ARCH_RISCV=y CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_USE_MMU=y CONFIG_ARCH_USE_MPU=y -CONFIG_BCH=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BOARD_LOOPSPERMSEC=6366 CONFIG_BUILD_PROTECTED=y CONFIG_BUILTIN=y -CONFIG_CANCELLATION_POINTS=y CONFIG_DEBUG_ASSERTIONS=y CONFIG_DEBUG_FEATURES=y CONFIG_DEBUG_FULLOPT=y @@ -46,8 +43,6 @@ CONFIG_FS_HOSTFS=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_INIT_ENTRYPOINT="nsh_main" -CONFIG_INIT_STACKSIZE=3072 -CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_ENVPATH=y CONFIG_LIBC_EXECFUNCS=y CONFIG_LIBC_PERROR_STDOUT=y @@ -58,17 +53,14 @@ CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y -CONFIG_NUTTX_USERSPACE=0x80400000 +CONFIG_NUTTX_USERSPACE=0x80040000 CONFIG_PASS1_BUILDIR="boards/risc-v/qemu-rv/rv-virt/kernel" CONFIG_PATH_INITIAL="/system/bin" -CONFIG_PRIORITY_INHERITANCE=y -CONFIG_RAM_SIZE=4194304 +CONFIG_RAM_SIZE=3145728 CONFIG_RAM_START=0x80000000 CONFIG_READLINE_CMD_HISTORY=y -CONFIG_RISCV_MEMCPY=y -CONFIG_RISCV_MEMSET=y +CONFIG_RISCV_PERCPU_SCRATCH=y CONFIG_RISCV_SEMIHOSTING_HOSTFS=y -CONFIG_RISCV_STRCMP=y CONFIG_RR_INTERVAL=200 CONFIG_SCHED_WAITPID=y CONFIG_SERIAL_UART_ARCH_MMIO=y @@ -77,7 +69,6 @@ CONFIG_START_MONTH=12 CONFIG_START_YEAR=2021 CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYSTEM_NSH=y -CONFIG_SYSTEM_NSH_STACKSIZE=3072 CONFIG_TESTING_GETPRIME=y CONFIG_TESTING_OSTEST=y CONFIG_USEC_PER_TICK=1000 diff --git a/boards/risc-v/qemu-rv/rv-virt/kernel/Makefile b/boards/risc-v/qemu-rv/rv-virt/kernel/Makefile index e1bdf61284c..2c069dbdb2b 100644 --- a/boards/risc-v/qemu-rv/rv-virt/kernel/Makefile +++ b/boards/risc-v/qemu-rv/rv-virt/kernel/Makefile @@ -25,26 +25,25 @@ include $(TOPDIR)/Make.defs CONFIG_INIT_ENTRYPOINT ?= user_start ENTRYPT = $(patsubst "%",%,$(CONFIG_INIT_ENTRYPOINT)) -# The memory layout - -MEM_LAYOUT = memory.ld # Get the paths to the libraries and the links script path in format that # is appropriate for the host OS USER_LIBPATHS = $(addprefix -L,$(call CONVERT_PATH,$(addprefix $(TOPDIR)$(DELIM),$(dir $(USERLIBS))))) -USER_LDSCRIPT = -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)memory.ld) -USER_LDSCRIPT += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)user-space.ld) +USER_LDSCRIPT = $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)ld-userland.script) USER_HEXFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.hex) USER_SRECFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.srec) USER_BINFILE += $(call CONVERT_PATH,$(TOPDIR)$(DELIM)nuttx_user.bin) -USER_LDFLAGS = -melf64lriscv --undefined=$(ENTRYPT) --entry=$(ENTRYPT) $(USER_LDSCRIPT) +USER_LDFLAGS = --undefined=$(ENTRYPT) --entry=$(ENTRYPT) -T $(addsuffix .tmp,$(USER_LDSCRIPT)) USER_LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(USERLIBS)))) USER_LIBGCC = "${shell "$(CC)" $(ARCHCPUFLAGS) -print-libgcc-file-name}" -# Make a map, woo -USER_LDFLAGS += -Map=nuttx_user.map +ifeq ($(CONFIG_ARCH_RV32),y) + USER_LDFLAGS += --oformat elf32-littleriscv +else + USER_LDFLAGS += --oformat elf64-littleriscv +endif # Source files @@ -54,49 +53,47 @@ OBJS = $(COBJS) # Targets: -all: $(TOPDIR)$(DELIM)nuttx_user.elf $(TOPDIR)$(DELIM)User.map $(TOPDIR)$(DELIM)nuttx_user.map -.PHONY: nuttx_user.elf depend clean distclean +all: $(TOPDIR)$(DELIM)nuttx_user $(TOPDIR)$(DELIM)User.map +.PHONY: nuttx_user depend clean distclean $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -# Create the nuttx_user.elf file containing all of the user-mode code +$(addsuffix .tmp,$(USER_LDSCRIPT)): $(USER_LDSCRIPT) + $(call PREPROCESS,$(patsubst %.tmp,%,$@),$@) -nuttx_user.elf: $(OBJS) +# Create the nuttx_user file containing all of the user-mode code + +nuttx_user: $(OBJS) $(addsuffix .tmp,$(USER_LDSCRIPT)) $(Q) $(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) $(OBJS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC) -$(TOPDIR)$(DELIM)nuttx_user.elf: nuttx_user.elf - @echo "LD: nuttx_user.elf" - $(Q) cp -a nuttx_user.elf $(TOPDIR)$(DELIM)nuttx_user.elf +$(TOPDIR)$(DELIM)nuttx_user: nuttx_user + @echo "LD: nuttx_user" + $(Q) cp -a $^ $(TOPDIR)$(DELIM)$^ ifeq ($(CONFIG_INTELHEX_BINARY),y) @echo "CP: nuttx_user.hex" - $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex nuttx_user.elf $(USER_HEXFILE) + $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O ihex $^ $(USER_HEXFILE) endif ifeq ($(CONFIG_MOTOROLA_SREC),y) @echo "CP: nuttx_user.srec" - $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec nuttx_user.elf $(USER_SRECFILE) + $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O srec $^ $(USER_SRECFILE) endif ifeq ($(CONFIG_RAW_BINARY),y) @echo "CP: nuttx_user.bin" - $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary nuttx_user.elf $(USER_BINFILE) + $(Q) $(OBJCOPY) $(OBJCOPYARGS) -O binary $^ $(USER_BINFILE) endif -$(TOPDIR)$(DELIM)User.map: nuttx_user.elf +$(TOPDIR)$(DELIM)User.map: nuttx_user @echo "MK: User.map" - $(Q) $(NM) -n nuttx_user.elf >$(TOPDIR)$(DELIM)User.map - $(Q) $(CROSSDEV)size nuttx_user.elf - -$(TOPDIR)$(DELIM)nuttx_user.map: nuttx_user.elf - @echo "CP: nuttx_user.map" - $(Q) cp -a nuttx_user.map $(TOPDIR)$(DELIM)nuttx_user.map + $(Q) $(NM) -n $^ >$(TOPDIR)$(DELIM)User.map .depend: depend: .depend clean: - $(call DELFILE, nuttx_user.elf) - $(call DELFILE, nuttx_user.map) + $(call DELFILE, nuttx_user) + $(call DELFILE, $(addsuffix .tmp,$(USER_LDSCRIPT))) $(call DELFILE, "$(TOPDIR)$(DELIM)nuttx_user.*") $(call DELFILE, "$(TOPDIR)$(DELIM)User.map") $(call CLEAN) 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 0d699b520d2..d253fdb391d 100644 --- a/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs +++ b/boards/risc-v/qemu-rv/rv-virt/scripts/Make.defs @@ -30,16 +30,10 @@ ifeq ($(CONFIG_BUILD_KERNEL),y) LDSCRIPT = ld-nuttsbi.script endif else ifeq ($(CONFIG_BUILD_PROTECTED),y) - LDMEMORY = memory.ld - LDSCRIPT = kernel-space.ld -else - LDSCRIPT = ld.script + LDSCRIPT = ld-protected.script endif endif -ifneq ($(LDMEMORY),) - ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDMEMORY) -endif ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) ARCHPICFLAGS = -fpic -msingle-pic-base diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.mem b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.mem new file mode 100644 index 00000000000..5d67adf8e51 --- /dev/null +++ b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.mem @@ -0,0 +1,66 @@ +/**************************************************************************** + * boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.mem + * + * 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. + * + ****************************************************************************/ + +#include + +/* Memory layout for ld-protected.script and ld-userland.script + * + * |-CONFIG_RAM_START + * | |-CONFIG_NUTTX_USERSPACE + * +--------+----------+--------+--------+ + * | kflash | uflash | ksram | usram | + * +--------+----------+--------+--------+ + * |>-- FLASH_SIZE ---<|>-- SRAM_SIZE --<| + * + */ + +#define KFLASH_ADDR (CONFIG_RAM_START) +#define UFLASH_ADDR (CONFIG_NUTTX_USERSPACE) +#define KFLASH_SIZE (UFLASH_ADDR - KFLASH_ADDR) +#define UFLASH_SIZE (KFLASH_SIZE) + +#define FLASH_SIZE (0x100000) /* needs be POT */ +#define SRAM_SIZE (0x200000) /* needs be POT */ + +#if KFLASH_SIZE < 0 +#error "Invalid KFLASH_SIZE!" +#endif + +#if KFLASH_SIZE + UFLASH_SIZE > FLASH_SIZE +#error "Adjust FLASH_SIZE please!" +#endif + +#if CONFIG_RAM_SIZE < FLASH_SIZE + SRAM_SIZE +#error "CONFIG_RAM_SIZE too small?" +#endif + +#define KSRAM_SIZE (SRAM_SIZE / 2) +#define USRAM_SIZE (SRAM_SIZE - KSRAM_SIZE) + +#define KSRAM_ADDR (KFLASH_ADDR + FLASH_SIZE) +#define USRAM_ADDR (KSRAM_ADDR + KSRAM_SIZE) + +MEMORY +{ + kflash (rx) : ORIGIN = KFLASH_ADDR, LENGTH = KFLASH_SIZE + uflash (rx) : ORIGIN = UFLASH_ADDR, LENGTH = UFLASH_SIZE + ksram (rwx) : ORIGIN = KSRAM_ADDR, LENGTH = KSRAM_SIZE + usram (rwx) : ORIGIN = USRAM_ADDR, LENGTH = USRAM_SIZE +} diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/kernel-space.ld b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.script similarity index 90% rename from boards/risc-v/qemu-rv/rv-virt/scripts/kernel-space.ld rename to boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.script index 1fd48c82eb1..bc34cd40476 100644 --- a/boards/risc-v/qemu-rv/rv-virt/scripts/kernel-space.ld +++ b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.script @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/qemu-rv/rv-virt/scripts/kernel-space.ld + * boards/risc-v/qemu-rv/rv-virt/scripts/ld-protected.script * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,13 +18,11 @@ * ****************************************************************************/ -/* NOTE: This depends on the memory.ld script having been included prior to - * this script. - */ +#include "ld-protected.mem" OUTPUT_ARCH("riscv") -/* Provide these so there is no need for using config files for this */ +/* Provide these to avoid using config files for them */ __uflash_start = ORIGIN(uflash); __uflash_size = LENGTH(uflash); @@ -77,7 +75,7 @@ SECTIONS CONSTRUCTORS . = ALIGN(4); _edata = ABSOLUTE(.); - } > kflash + } > ksram AT > kflash PROVIDE(__global_pointer$ = _sdata + ((_edata - _sdata) / 2)); @@ -88,7 +86,12 @@ SECTIONS *(.gnu.linkonce.b.*) *(.gnu.linkonce.sb.*) *(COMMON) - . = ALIGN(4); + } > ksram + + /* Page tables here, align to 4K boundary */ + .pgtables (NOLOAD) : ALIGN(0x1000) { + *(.pgtables) + . = ALIGN(32); _ebss = ABSOLUTE(.); } > ksram diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/user-space.ld b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-userland.script similarity index 93% rename from boards/risc-v/qemu-rv/rv-virt/scripts/user-space.ld rename to boards/risc-v/qemu-rv/rv-virt/scripts/ld-userland.script index 816e66823d5..297df64947a 100644 --- a/boards/risc-v/qemu-rv/rv-virt/scripts/user-space.ld +++ b/boards/risc-v/qemu-rv/rv-virt/scripts/ld-userland.script @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/risc-v/qemu-rv/rv-virt/scripts/user-space.ld + * boards/risc-v/qemu-rv/rv-virt/scripts/ld-userland.script * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,9 +18,7 @@ * ****************************************************************************/ -/* NOTE: This depends on the memory.ld script having been included prior to - * this script. - */ +#include "ld-protected.mem" OUTPUT_ARCH("riscv") @@ -88,7 +86,7 @@ SECTIONS _ebss = ABSOLUTE(.); } > usram - /* Stabs debugging sections */ + /* Stabs debugging sections. */ .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } diff --git a/boards/risc-v/qemu-rv/rv-virt/scripts/memory.ld b/boards/risc-v/qemu-rv/rv-virt/scripts/memory.ld deleted file mode 100644 index 1a341372034..00000000000 --- a/boards/risc-v/qemu-rv/rv-virt/scripts/memory.ld +++ /dev/null @@ -1,28 +0,0 @@ -/**************************************************************************** - * boards/risc-v/qemu-rv/rv-virt/scripts/memory.ld - * - * 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 = 2M /* w/ cache */ - ksram (rx) : ORIGIN = 0x80200000, LENGTH = 2M /* w/ cache */ - - uflash (rx) : ORIGIN = 0x80400000, LENGTH = 4M /* w/ cache */ - usram (rwx) : ORIGIN = 0x80800000, LENGTH = 4M /* w/ cache */ -}