Skip to content

Commit 4c58112

Browse files
authored
Merge pull request #14270 from 0xc0170/cmake-refactor-maxim
CMake Maxim: fix targets naming
2 parents fa62e80 + 94f3c7b commit 4c58112

File tree

11 files changed

+136
-74
lines changed

11 files changed

+136
-74
lines changed

targets/TARGET_Maxim/CMakeLists.txt

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

4-
if("MAX32620C" IN_LIST MBED_TARGET_LABELS)
5-
add_subdirectory(TARGET_MAX32620C)
6-
elseif("MAX32625" IN_LIST MBED_TARGET_LABELS)
7-
add_subdirectory(TARGET_MAX32625)
8-
elseif("MAX32630" IN_LIST MBED_TARGET_LABELS)
9-
add_subdirectory(TARGET_MAX32630)
10-
endif()
114

12-
target_include_directories(mbed-core
5+
add_subdirectory(TARGET_MAX32620C EXCLUDE_FROM_ALL)
6+
add_subdirectory(TARGET_MAX32625 EXCLUDE_FROM_ALL)
7+
add_subdirectory(TARGET_MAX32630 EXCLUDE_FROM_ALL)
8+
9+
add_library(mbed-maxim INTERFACE)
10+
11+
target_include_directories(mbed-maxim
1312
INTERFACE
1413
.
1514
)
1615

17-
target_sources(mbed-core
16+
target_sources(mbed-maxim
1817
INTERFACE
1918
USBPhy_Maxim.cpp
2019
)

targets/TARGET_Maxim/TARGET_MAX32620C/CMakeLists.txt

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

4-
if("MAX32620FTHR" IN_LIST MBED_TARGET_LABELS)
5-
target_include_directories(mbed-core
6-
INTERFACE
7-
TARGET_MAX32620FTHR
8-
)
9-
elseif("SDT32620B" IN_LIST MBED_TARGET_LABELS)
10-
target_include_directories(mbed-core
11-
INTERFACE
12-
TARGET_SDT32620B
13-
)
14-
endif()
4+
add_subdirectory(TARGET_MAX32620FTHR EXCLUDE_FROM_ALL)
5+
add_subdirectory(TARGET_SDT32620B EXCLUDE_FROM_ALL)
156

167
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
178
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/MAX32620.sct)
@@ -21,16 +12,18 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
2112
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_max32620.S)
2213
endif()
2314

24-
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
15+
add_library(mbed-maxim-max32620c INTERFACE)
2516

26-
target_include_directories(mbed-core
17+
target_include_directories(mbed-maxim-max32620c
2718
INTERFACE
2819
.
2920
device
3021
mxc
3122
)
3223

33-
target_sources(mbed-core
24+
mbed_set_linker_script(mbed-maxim-max32620c ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
25+
26+
target_sources(mbed-maxim-max32620c
3427
INTERFACE
3528
PeripheralPins.c
3629
analogin_api.c
@@ -81,3 +74,8 @@ target_sources(mbed-core
8174

8275
${STARTUP_FILE}
8376
)
77+
78+
target_link_libraries(mbed-maxim-max32620c
79+
INTERFACE
80+
mbed-maxim
81+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-max32620fthr INTERFACE)
5+
6+
target_include_directories(mbed-max32620fthr
7+
INTERFACE
8+
.
9+
)
10+
11+
target_link_libraries(mbed-max32620fthr INTERFACE mbed-maxim-max32620c)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-sdt32620b INTERFACE)
5+
6+
target_include_directories(mbed-sdt32620b
7+
INTERFACE
8+
.
9+
)
10+
11+
target_link_libraries(mbed-sdt32620b INTERFACE mbed-maxim-max32620c)

targets/TARGET_Maxim/TARGET_MAX32625/CMakeLists.txt

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

4-
if("MAX32625MBED" IN_LIST MBED_TARGET_LABELS)
5-
target_include_directories(mbed-core
6-
INTERFACE
7-
TARGET_MAX32625MBED
8-
)
9-
elseif("MAX32625PICO" IN_LIST MBED_TARGET_LABELS)
10-
target_include_directories(mbed-core
11-
INTERFACE
12-
TARGET_MAX32625PICO
13-
)
14-
15-
target_sources(mbed-core
16-
INTERFACE
17-
TARGET_MAX32625PICO/low_level_init.c
18-
)
19-
elseif("SDT32625B" IN_LIST MBED_TARGET_LABELS)
20-
target_include_directories(mbed-core
21-
INTERFACE
22-
TARGET_SDT32625B
23-
)
24-
endif()
4+
add_subdirectory(TARGET_MAX32625MBED EXCLUDE_FROM_ALL)
5+
add_subdirectory(TARGET_MAX32625PICO EXCLUDE_FROM_ALL)
6+
add_subdirectory(TARGET_SDT32625B EXCLUDE_FROM_ALL)
7+
add_subdirectory(device EXCLUDE_FROM_ALL)
258

269
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
27-
if("MAX32625_BOOT" IN_LIST MBED_TARGET_LABELS)
28-
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/TARGET_MAX32625_BOOT/MAX32625.sct)
29-
elseif("MAX32625_NO_BOOT" IN_LIST MBED_TARGET_LABELS)
30-
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/TARGET_MAX32625_NO_BOOT/MAX32625.sct)
31-
endif()
32-
3310
set(STARTUP_FILE device/TOOLCHAIN_ARM_STD/startup_MAX32625.S)
3411
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
35-
if("MAX32625_BOOT" IN_LIST MBED_TARGET_LABELS)
36-
set(LINKER_FILE device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_BOOT/max32625.ld)
37-
elseif("MAX32625_NO_BOOT" IN_LIST MBED_TARGET_LABELS)
38-
set(LINKER_FILE device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_NO_BOOT/max32625.ld)
39-
endif()
40-
4112
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_max32625.S)
4213
endif()
4314

44-
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
15+
add_library(mbed-max32625 INTERFACE)
4516

46-
target_include_directories(mbed-core
17+
target_include_directories(mbed-max32625
4718
INTERFACE
4819
.
4920
device
5021
mxc
5122
)
5223

53-
target_sources(mbed-core
24+
target_sources(mbed-max32625
5425
INTERFACE
5526
PeripheralPins.c
5627
analogin_api.c
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-max32625mbed INTERFACE)
5+
6+
target_include_directories(mbed-max32625mbed
7+
INTERFACE
8+
.
9+
)
10+
11+
target_link_libraries(mbed-max32625mbed INTERFACE mbed-max32625 mbed-max32625-no-boot)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-max32625pico INTERFACE)
5+
6+
target_include_directories(mbed-max32625pico
7+
INTERFACE
8+
.
9+
)
10+
11+
target_sources(mbed-max32625pico
12+
INTERFACE
13+
low_level_init.c
14+
)
15+
16+
target_link_libraries(mbed-max32625pico INTERFACE mbed-max32625 mbed-max32625-boot)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-sdt32625bp INTERFACE)
5+
6+
target_include_directories(mbed-sdt32625bp
7+
INTERFACE
8+
.
9+
)
10+
11+
target_link_libraries(mbed-sdt32625bp INTERFACE mbed-max32625 mbed-max32625-no-boot)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-max32625-boot INTERFACE)
5+
6+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
7+
set(LINKER_FILE_BOOT TOOLCHAIN_GCC_ARM/TARGET_MAX32625_BOOT/max32625.ld)
8+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
9+
set(LINKER_FILE_BOOT TOOLCHAIN_ARM_STD/TARGET_MAX32625_BOOT/MAX32625.sct)
10+
endif()
11+
12+
mbed_set_linker_script(mbed-max32625-boot ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE_BOOT})
13+
14+
add_library(mbed-max32625-no-boot INTERFACE)
15+
16+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
17+
set(LINKER_FILE_NO_BOOT device/TOOLCHAIN_GCC_ARM/TARGET_MAX32625_NO_BOOT/max32625.ld)
18+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
19+
set(LINKER_FILE_NO_BOOT device/TOOLCHAIN_ARM_STD/TARGET_MAX32625_NO_BOOT/MAX32625.sct)
20+
endif()
21+
22+
mbed_set_linker_script(mbed-max32625-no-boot ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE_NO_BOOT})

targets/TARGET_Maxim/TARGET_MAX32630/CMakeLists.txt

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

4-
if("MAX32630FTHR" IN_LIST MBED_TARGET_LABELS)
5-
target_include_directories(mbed-core
6-
INTERFACE
7-
TARGET_MAX32630FTHR
8-
)
9-
10-
target_sources(mbed-core
11-
INTERFACE
12-
TARGET_MAX32630FTHR/low_level_init.c
13-
)
14-
endif()
4+
add_subdirectory(TARGET_MAX32630FTHR EXCLUDE_FROM_ALL)
155

166
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
177
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/MAX3263x.sct)
@@ -27,18 +17,18 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
2717
set(LIB_EXACT_LE TOOLCHAIN_GCC_ARM/libexactLE.a)
2818
endif()
2919

30-
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
20+
add_library(mbed-max32630 INTERFACE)
3121

32-
target_link_libraries(mbed-core INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_EXACT_LE})
22+
mbed_set_linker_script(mbed-max32630 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
3323

34-
target_include_directories(mbed-core
24+
target_include_directories(mbed-max32630
3525
INTERFACE
3626
.
3727
device
3828
mxc
3929
)
4030

41-
target_sources(mbed-core
31+
target_sources(mbed-max32630
4232
INTERFACE
4333
PeripheralPins.c
4434
analogin_api.c
@@ -86,3 +76,9 @@ target_sources(mbed-core
8676

8777
${STARTUP_FILE}
8878
)
79+
80+
target_link_libraries(mbed-max32630
81+
INTERFACE
82+
${CMAKE_CURRENT_SOURCE_DIR}/${LIB_EXACT_LE}
83+
mbed-maxim
84+
)

0 commit comments

Comments
 (0)