riscv/qemu: add CMake for PROTECTED

This adds CMake support for PROTECTED build mode on rv-virt target.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
Yanfeng Liu 2024-07-14 08:48:37 +08:00 committed by Xiang Xiao
parent 34a30e577e
commit 46f4a24d59
4 changed files with 37 additions and 4 deletions

View File

@ -39,4 +39,8 @@ if(CONFIG_MM_PGALLOC)
list(APPEND SRCS qemu_rv_pgalloc.c) list(APPEND SRCS qemu_rv_pgalloc.c)
endif() endif()
if(CONFIG_BUILD_PROTECTED)
list(APPEND SRCS qemu_rv_userspace.c)
endif()
target_sources(arch PRIVATE ${SRCS}) target_sources(arch PRIVATE ${SRCS})

View File

@ -19,3 +19,10 @@
# ############################################################################## # ##############################################################################
add_subdirectory(src) add_subdirectory(src)
if(CONFIG_BUILD_PROTECTED)
add_subdirectory(kernel)
set_property(
GLOBAL PROPERTY LD_SCRIPT_USER
${CMAKE_CURRENT_LIST_DIR}/scripts/ld-userland.script)
endif()

View File

@ -0,0 +1,21 @@
# ##############################################################################
# boards/risc-v/qemu-rv/rv-virt/kernel/CMakeLists.txt
#
# 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.
#
# ##############################################################################
target_sources(nuttx_user PRIVATE rv_virt_userspace.c)

View File

@ -31,11 +31,12 @@ endif()
target_sources(board PRIVATE ${SRCS}) target_sources(board PRIVATE ${SRCS})
if(CONFIG_ARCH_CHIP_QEMU_RV) if(CONFIG_ARCH_CHIP_QEMU_RV)
if(CONFIG_BUILD_KERNEL) if(CONFIG_NUTTSBI)
set(LDFILE ld-nuttsbi.script)
elseif(CONFIG_BUILD_KERNEL)
set(LDFILE ld-kernel.script) set(LDFILE ld-kernel.script)
if(CONFIG_NUTTSBI) elseif(CONFIG_BUILD_PROTECTED)
set(LDFILE ld-nuttsbi.script) set(LDFILE ld-protected.script)
endif()
else() else()
set(LDFILE ld.script) set(LDFILE ld.script)
endif() endif()