Skip to content

Commit fdaee08

Browse files
committed
cmake:fix protected build link option break,init canmv230 protected
build Signed-off-by: xuxin19 <[email protected]>
1 parent 4b3b22c commit fdaee08

File tree

4 files changed

+44
-13
lines changed

4 files changed

+44
-13
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,14 @@ if(CONFIG_BUILD_PROTECTED)
758758
OUTPUT_VARIABLE nuttx_user_libgcc)
759759

760760
# reset link options for userspace to prevent sections from being accidentally
761-
# deleted
762-
set_target_properties(nuttx_user PROPERTIES LINK_OPTIONS "")
761+
# deleted Toolchain link options
762+
get_target_property(nuttx_user_LINK_OPTIONS nuttx_user LINK_OPTIONS)
763+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,--gc-sections")
764+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,--cref")
765+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,-Map=nuttx.map")
766+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,--entry=__start")
767+
set_target_properties(nuttx_user PROPERTIES LINK_OPTIONS
768+
"${nuttx_user_LINK_OPTIONS}")
763769

764770
target_link_options(
765771
nuttx_user PRIVATE -nostartfiles -nodefaultlibs

boards/risc-v/k230/canmv230/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,10 @@
1919
# ##############################################################################
2020

2121
add_subdirectory(src)
22+
23+
if(CONFIG_BUILD_PROTECTED)
24+
add_subdirectory(kernel)
25+
set_property(
26+
GLOBAL PROPERTY LD_SCRIPT_USER
27+
${CMAKE_CURRENT_LIST_DIR}/scripts/ld-userland.script)
28+
endif()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ##############################################################################
2+
# boards/risc-v/k230/canmv230/kernel/CMakeLists.txt
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
5+
# license agreements. See the NOTICE file distributed with this work for
6+
# additional information regarding copyright ownership. The ASF licenses this
7+
# file to you under the Apache License, Version 2.0 (the "License"); you may not
8+
# use this file except in compliance with the License. You may obtain a copy of
9+
# the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
# License for the specific language governing permissions and limitations under
17+
# the License.
18+
#
19+
# ##############################################################################
20+
21+
target_link_options(nuttx_user PRIVATE "-Wl,-melf64lriscv")
22+
23+
target_sources(nuttx_user PRIVATE k230_userspace.c)

libs/libc/spawn/CMakeLists.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,21 @@ set(SRCS
2929
lib_psa_getschedparam.c
3030
lib_psa_getschedpolicy.c
3131
lib_psa_init.c
32-
lib_psa_destroy.c
3332
lib_psa_setflags.c
3433
lib_psa_setschedparam.c
3534
lib_psa_setschedpolicy.c
3635
lib_psa_getsigmask.c
37-
lib_psa_setsigmask.c)
38-
39-
if(CONFIG_DEBUG_FEATURES)
40-
list(APPEND SRCS lib_psfa_dump.c)
41-
endif()
36+
lib_psa_setsigmask.c
37+
lib_psa_getstacksize.c
38+
lib_psa_setstacksize.c
39+
lib_psa_destroy.c)
4240

4341
if(NOT CONFIG_BUILD_KERNEL)
44-
list(APPEND SRCS lib_psa_getstacksize.c lib_psa_setstacksize.c)
45-
if(CONFIG_LIB_SYSCALL)
46-
list(APPEND SRCS lib_task_spawn.c)
47-
endif()
42+
list(APPEND SRCS lib_psa_getstackaddr.c lib_psa_setstackaddr.c)
4843
endif()
4944

5045
if(CONFIG_DEBUG_FEATURES)
51-
list(APPEND SRCS lib_psa_dump.c)
46+
list(APPEND SRCS lib_psfa_dump.c lib_psa_dump.c)
5247
endif()
5348

5449
target_sources(c PRIVATE ${SRCS})

0 commit comments

Comments
 (0)