forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextensions.cmake
60 lines (54 loc) · 2.03 KB
/
extensions.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
function(get_board_without_ns_suffix board_in board_out)
string(REGEX REPLACE "(_?ns)$" "" board_in_without_suffix ${board_in})
if(NOT ${board_in} STREQUAL ${board_in_without_suffix})
if (NOT CONFIG_ARM_NONSECURE_FIRMWARE)
message(FATAL_ERROR "${board_in} is not a valid name for a board without "
"'CONFIG_ARM_NONSECURE_FIRMWARE' set. This because the 'ns'/'_ns' ending "
"indicates that the board is the non-secure variant in a TrustZone "
"enabled system.")
endif()
set(${board_out} ${board_in_without_suffix} PARENT_SCOPE)
message("Changed board to secure ${board_in_without_suffix} (NOT NS)")
else()
set(${board_out} ${board_in} PARENT_SCOPE)
endif()
endfunction()
# Add a kconfig overlay file to a child image.
# This can be used by a parent image to set kconfig values in its child images.
# This must be invoked before 'add_child_image(image)'
function(add_overlay_config image overlay_file)
set(old_conf ${${image}_OVERLAY_CONFIG})
string(FIND "${old_conf}" "${overlay_file}" found)
if (${found} EQUAL -1)
set(${image}_OVERLAY_CONFIG
"${old_conf} ${overlay_file}"
CACHE INTERNAL "")
endif()
endfunction()
# Add a partition manager configuration file to the build.
# Note that is only one image is included in the build,
# you must set CONFIG_PM_SINGLE_IMAGE=y for the partition manager
# configuration to take effect.
function(ncs_add_partition_manager_config config_file)
get_filename_component(pm_path ${config_file} REALPATH)
get_filename_component(pm_filename ${config_file} NAME)
if (NOT EXISTS ${pm_path})
message(FATAL_ERROR
"Could not find specified partition manager configuration file "
"${config_file} at ${pm_path}"
)
endif()
set_property(GLOBAL APPEND PROPERTY
PM_SUBSYS_PATHS
${pm_path}
)
set_property(GLOBAL APPEND PROPERTY
PM_SUBSYS_OUTPUT_PATHS
${CMAKE_CURRENT_BINARY_DIR}/${pm_filename}
)
endfunction()