Skip to content

CMake: Refactor Silicon Laboratories targets #14279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions targets/TARGET_Silicon_Labs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("EFM32" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_EFM32)
endif()
add_subdirectory(TARGET_EFM32 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SL_RAIL EXCLUDE_FROM_ALL)

if("SL_RAIL" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_SL_RAIL)
endif()
add_library(mbed-silicon-labs INTERFACE)

target_include_directories(mbed-core
target_include_directories(mbed-silicon-labs
INTERFACE
.
)
20 changes: 10 additions & 10 deletions targets/TARGET_Silicon_Labs/TARGET_EFM32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("EFM32GG" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_EFM32GG)
elseif("EFM32GG11" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_EFM32GG11)
elseif("EFR32MG12" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_EFR32MG12)
endif()
add_subdirectory(TARGET_EFM32GG EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_EFM32GG11 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_EFR32MG12 EXCLUDE_FROM_ALL)

target_include_directories(mbed-core
add_library(mbed-efm32 INTERFACE)

target_include_directories(mbed-efm32
INTERFACE
.
common
emlib/inc
trng
)

target_sources(mbed-core
target_sources(mbed-efm32
INTERFACE
analogin_api.c
analogout_api.c
Expand Down Expand Up @@ -95,3 +93,5 @@ target_sources(mbed-core
trng/sl_trng.c
trng/trng_api.c
)

target_link_libraries(mbed-efm32 INTERFACE mbed-silicon-labs)
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("EFM32GG_STK3700" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_EFM32GG_STK3700
)
endif()
add_library(mbed-1024k INTERFACE)

if("1024K" IN_LIST MBED_TARGET_LABELS)
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TARGET_1024K/TOOLCHAIN_ARM_STD/efm32gg.sct)
set(STARTUP_FILE device/TARGET_1024K/TOOLCHAIN_ARM_STD/startup_efm32gg.S)
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LINKER_FILE device/TARGET_1024K/TOOLCHAIN_GCC_ARM/efm32gg.ld)
set(STARTUP_FILE device/TARGET_1024K/TOOLCHAIN_GCC_ARM/startup_efm32gg.S)
endif()
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TARGET_1024K/TOOLCHAIN_ARM_STD/efm32gg.sct)
set(STARTUP_FILE device/TARGET_1024K/TOOLCHAIN_ARM_STD/startup_efm32gg.S)
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LINKER_FILE device/TARGET_1024K/TOOLCHAIN_GCC_ARM/efm32gg.ld)
set(STARTUP_FILE device/TARGET_1024K/TOOLCHAIN_GCC_ARM/startup_efm32gg.S)
endif()

set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_include_directories(mbed-core
target_include_directories(mbed-1024k
INTERFACE
device
)

target_sources(mbed-core
target_sources(mbed-1024k
INTERFACE
PeripheralPins.c

device/system_efm32gg.c
${STARTUP_FILE}
)

mbed_set_linker_script(mbed-1024k ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

add_library(mbed-efm32gg990f1024 INTERFACE)

target_link_libraries(mbed-efm32gg990f1024 INTERFACE mbed-efm32 mbed-1024k)

add_library(mbed-efm32gg-stk3700 INTERFACE)

target_include_directories(mbed-efm32gg-stk3700
INTERFACE
TARGET_EFM32GG_STK3700
)

target_link_libraries(mbed-efm32gg-stk3700 INTERFACE mbed-efm32gg990f1024)
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("EFM32GG11_STK3701" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_EFM32GG11_STK3701
)
endif()
add_library(mbed-efm32gg11 INTERFACE)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/efm32gg11.sct)
Expand All @@ -16,17 +11,28 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_efm32gg11.S)
endif()

set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_include_directories(mbed-core
target_include_directories(mbed-efm32gg11
INTERFACE
device
)

target_sources(mbed-core
target_sources(mbed-efm32gg11
INTERFACE
PeripheralPins.c

device/system_efm32gg11b.c
${STARTUP_FILE}
)

target_link_libraries(mbed-efm32gg11 INTERFACE mbed-efm32)

mbed_set_linker_script(mbed-efm32gg11 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

add_library(mbed-efm32gg11-stk3701 INTERFACE)

target_include_directories(mbed-efm32gg11-stk3701
INTERFACE
TARGET_EFM32GG11_STK3701
)

target_link_libraries(mbed-efm32gg11-stk3701 INTERFACE mbed-efm32gg11)
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("TB_SENSE_12" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_TB_SENSE_12
)
endif()
add_library(mbed-efm32mg12 INTERFACE)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/efr32mg12p.sct)
Expand All @@ -16,17 +11,28 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_efr32mg12p.S)
endif()

set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_include_directories(mbed-core
target_include_directories(mbed-efm32mg12
INTERFACE
device
)

target_sources(mbed-core
target_sources(mbed-efm32mg12
INTERFACE
PeripheralPins.c

device/system_efr32mg12p.c
${STARTUP_FILE}
)

target_link_libraries(mbed-efm32mg12 INTERFACE mbed-efm32)

mbed_set_linker_script(mbed-efm32mg12 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

add_library(mbed-tb-sense-12 INTERFACE)

target_include_directories(mbed-tb-sense-12
INTERFACE
TARGET_TB_SENSE_12
)

target_link_libraries(mbed-tb-sense-12 INTERFACE mbed-efm32mg12 mbed-sl-rail-efr32-12)
18 changes: 9 additions & 9 deletions targets/TARGET_Silicon_Labs/TARGET_SL_RAIL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("EFR32_12" IN_LIST MBED_TARGET_LABELS)
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIB_RAIL efr32-rf-driver/rail/TARGET_EFR32_12/librail_efr32xg12_release.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIB_RAIL efr32-rf-driver/rail/TARGET_EFR32_12/librail_efr32xg12_release.a)
endif()
add_library(mbed-sl-rail-efr32-12 INTERFACE)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LIB_RAIL efr32-rf-driver/rail/TARGET_EFR32_12/librail_efr32xg12_release.ar)
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(LIB_RAIL efr32-rf-driver/rail/TARGET_EFR32_12/librail_efr32xg12_release.a)
endif()

target_link_libraries(mbed-core INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_RAIL})
target_link_libraries(mbed-sl-rail-efr32-12 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/${LIB_RAIL})


target_include_directories(mbed-core
target_include_directories(mbed-sl-rail-efr32-12
INTERFACE
efr32-rf-driver/rail
efr32-rf-driver/rail/ble
Expand Down