Skip to content

Commit 65892db

Browse files
committed
cmake:fix protected build link option break,init canmv230 protected
build Signed-off-by: xuxin19 <[email protected]>
1 parent 55d711d commit 65892db

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

CMakeLists.txt

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

781781
# reset link options for userspace to prevent sections from being accidentally
782-
# deleted
783-
set_target_properties(nuttx_user PROPERTIES LINK_OPTIONS "")
782+
# deleted Toolchain link options
783+
get_target_property(nuttx_user_LINK_OPTIONS nuttx_user LINK_OPTIONS)
784+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,--gc-sections")
785+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,--cref")
786+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,-Map=nuttx.map")
787+
list(REMOVE_ITEM nuttx_user_LINK_OPTIONS "-Wl,--entry=__start")
788+
set_target_properties(nuttx_user PROPERTIES LINK_OPTIONS
789+
"${nuttx_user_LINK_OPTIONS}")
784790

785791
target_link_options(
786792
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +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)
42+
list(APPEND SRCS lib_psa_getstackaddr.c lib_psa_setstackaddr.c)
4543
endif()
4644

4745
if(CONFIG_DEBUG_FEATURES)
48-
list(APPEND SRCS lib_psa_dump.c)
46+
list(APPEND SRCS lib_psfa_dump.c lib_psa_dump.c)
4947
endif()
5048

5149
target_sources(c PRIVATE ${SRCS})

0 commit comments

Comments
 (0)