Skip to content

Commit 1fd4cfd

Browse files
authored
Merge pull request #14516 from 0xc0170/fix-cmake-project-name
CMake: remove MBED_PATH and use <PROJECT-NAME>_SOURCE_DIR/MODULE_PATH instead
2 parents 076cf35 + 121c828 commit 1fd4cfd

File tree

22 files changed

+68
-44
lines changed

22 files changed

+68
-44
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
77

88
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
9-
include(tools/cmake/set_linker_script.cmake)
9+
include(mbed_set_linker_script)
10+
11+
project(mbed-os)
12+
13+
# Add all paths to the list files within Mbed OS
14+
list(APPEND CMAKE_MODULE_PATH
15+
"${mbed-os_SOURCE_DIR}/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts;${mbed-os_SOURCE_DIR}/targets/TARGET_Cypress/scripts;${mbed-os_SOURCE_DIR}/targets/TARGET_NXP/scripts"
16+
)
1017

1118
add_library(mbed-core INTERFACE)
1219

@@ -214,7 +221,7 @@ function(mbed_generate_map_file target)
214221
TARGET
215222
${target}
216223
POST_BUILD
217-
COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
224+
COMMAND ${Python3_EXECUTABLE} ${mbed-os_SOURCE_DIR}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
218225
WORKING_DIRECTORY
219226
${CMAKE_CURRENT_BINARY_DIR}
220227
COMMENT

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ target_sources(mbed-psa
3939
src/tfm_platform_ipc_api.c
4040
src/tfm_ps_ipc_api.c
4141
)
42+

platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/mbed_set_post_build_tfm.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright (c) 2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
include(${MBED_PATH}/tools/cmake/mbed_set_post_build.cmake)
4+
include(mbed_set_post_build)
5+
6+
set(MBED_POST_BUILD_TFM_DIR "${CMAKE_CURRENT_LIST_DIR}")
57

68
#
79
# Sign TF-M secure and non-secure images and combine them with the bootloader
@@ -17,7 +19,7 @@ function(mbed_post_build_tfm_sign_image
1719
set(mbed_target_name ${mbed_target})
1820
set(post_build_command
1921
COMMAND ${Python3_EXECUTABLE}
20-
${MBED_PATH}/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py
22+
${MBED_POST_BUILD_TFM_DIR}/generate_mbed_image.py
2123
--tfm-target ${tfm_target}
2224
--target-path ${target_path}
2325
--secure-bin ${secure_bin}

targets/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
3-
include(../tools/cmake/set_linker_script.cmake)
3+
4+
include(mbed_set_linker_script)
45

56
add_subdirectory(TARGET_Ambiq_Micro EXCLUDE_FROM_ALL)
67
add_subdirectory(TARGET_Analog_Devices EXCLUDE_FROM_ALL)

targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
include(${MBED_PATH}/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/mbed_set_post_build_tfm.cmake)
4+
if("TFM" IN_LIST MBED_TARGET_LABELS)
5+
include(mbed_set_post_build_tfm)
6+
7+
mbed_post_build_tfm_sign_image(
8+
ARM_MUSCA_B1
9+
musca_b1
10+
${CMAKE_CURRENT_SOURCE_DIR}
11+
${CMAKE_CURRENT_SOURCE_DIR}/tfm_s.bin
12+
)
13+
endif()
514

615
add_library(mbed-arm-musca-b1 INTERFACE)
716

@@ -54,10 +63,3 @@ target_link_libraries(mbed-arm-musca-b1
5463
${CMAKE_CURRENT_SOURCE_DIR}/s_veneers.o
5564
mbed-arm-ssg
5665
)
57-
58-
mbed_post_build_tfm_sign_image(
59-
ARM_MUSCA_B1
60-
musca_b1
61-
${CMAKE_CURRENT_SOURCE_DIR}
62-
${CMAKE_CURRENT_SOURCE_DIR}/tfm_s.bin
63-
)

targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
include(${MBED_PATH}/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/mbed_set_post_build_tfm.cmake)
4+
if("TFM" IN_LIST MBED_TARGET_LABELS)
5+
include(mbed_set_post_build_tfm)
6+
7+
mbed_post_build_tfm_sign_image(
8+
ARM_MUSCA_S1
9+
musca_s1
10+
${CMAKE_CURRENT_SOURCE_DIR}
11+
${CMAKE_CURRENT_SOURCE_DIR}/tfm_s.bin
12+
)
13+
endif()
514

615
add_library(mbed-arm-musca-s1 INTERFACE)
716

@@ -60,10 +69,3 @@ target_link_libraries(mbed-arm-musca-s1
6069
${CMAKE_CURRENT_SOURCE_DIR}/s_veneers.o
6170
mbed-arm-ssg
6271
)
63-
64-
mbed_post_build_tfm_sign_image(
65-
ARM_MUSCA_S1
66-
musca_s1
67-
${CMAKE_CURRENT_SOURCE_DIR}
68-
${CMAKE_CURRENT_SOURCE_DIR}/tfm_s.bin
69-
)

targets/TARGET_Cypress/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ target_compile_definitions(mbed-cy-external-wifi-fw
1111
"CY_STORAGE_WIFI_DATA_OUTPUT=cy_xip"
1212
"CY_EXT_WIFI_FW_STORAGE=QSPIF"
1313
)
14+

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT064B0S2_4343W/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
include(${MBED_PATH}/targets/TARGET_Cypress/scripts/mbed_set_post_build_cypress.cmake)
4+
include(mbed_set_post_build_cypress)
55

66
add_library(mbed-cy8ckit064b0s2-4343w-bsp-design-modus INTERFACE)
77
target_include_directories(mbed-cy8ckit064b0s2-4343w-bsp-design-modus
@@ -86,5 +86,5 @@ mbed_post_build_psoc6_sign_image(
8686
"single_image"
8787
"1"
8888
"16"
89-
"${MBED_PATH}/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CY8CKIT064B0S2_4343W/device/COMPONENT_CM4/hex/psoc6_02_cm0p_secure.hex"
89+
"${CMAKE_CURRENT_SOURCE_DIR}/device/COMPONENT_CM4/hex/psoc6_02_cm0p_secure.hex"
9090
)

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYSBSYSKIT_01/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
include(${MBED_PATH}/targets/TARGET_Cypress/scripts/mbed_set_post_build_cypress.cmake)
4+
include(mbed_set_post_build_cypress)
55

66
add_library(mbed-cysbsyskit-01-bsp-design-modus INTERFACE)
77
target_include_directories(mbed-cysbsyskit-01-bsp-design-modus

targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
include(${MBED_PATH}/targets/TARGET_Cypress/scripts/mbed_set_post_build_cypress.cmake)
4+
include(mbed_set_post_build_cypress)
55

66
add_library(mbed-cytfm-064b0s2-4343w-bsp-design-modus INTERFACE)
77
target_include_directories(mbed-cytfm-064b0s2-4343w-bsp-design-modus
@@ -79,5 +79,5 @@ mbed_post_build_psoc6_sign_image(
7979
"multi_image"
8080
"1"
8181
"16"
82-
${MBED_PATH}/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/COMPONENT_TFM_S_FW/tfm_s.hex
82+
${CMAKE_CURRENT_SOURCE_DIR}/COMPONENT_TFM_S_FW/tfm_s.hex
8383
)

0 commit comments

Comments
 (0)