Skip to content

CMake: Refactor Nordic targets to be CMake buildsystem targets #14267

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 2 commits into from
Feb 11, 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
10 changes: 5 additions & 5 deletions targets/TARGET_NORDIC/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("NRF5x" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_NRF5x)
endif()
add_subdirectory(TARGET_NRF5x EXCLUDE_FROM_ALL)

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

target_include_directories(mbed-nordic
INTERFACE
.
)
17 changes: 8 additions & 9 deletions targets/TARGET_NORDIC/TARGET_NRF5x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("NRF52" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_NRF52)
endif()
add_subdirectory(TARGET_NRF52 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SDK_15_0 EXCLUDE_FROM_ALL)

if("SDK_15_0" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_SDK_15_0)
endif()
add_library(mbed-nrf5x INTERFACE)

target_include_directories(mbed-core
target_include_directories(mbed-nrf5x
INTERFACE
.
)

target_sources(mbed-core
target_sources(mbed-nrf5x
INTERFACE
lp_ticker.c
pinmap.c
port_api.c
qspi_api.c
rtc_api.c
)

target_link_libraries(mbed-nrf5x INTERFACE mbed-nordic)
17 changes: 9 additions & 8 deletions targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("MCU_NRF52832" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_MCU_NRF52832)
elseif("MCU_NRF52840" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_MCU_NRF52840)
endif()
add_subdirectory(TARGET_MCU_NRF52832 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_MCU_NRF52840 EXCLUDE_FROM_ALL)

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

target_include_directories(mbed-nrf52
INTERFACE
.
)

target_sources(mbed-core
target_sources(mbed-nrf52
INTERFACE
PeripheralPinsDefault.c
analogin_api.c
Expand All @@ -33,3 +32,5 @@ target_sources(mbed-core
us_ticker.c
watchdog_api.c
)

target_link_libraries(mbed-nrf52 INTERFACE mbed-nrf5x)
Original file line number Diff line number Diff line change
@@ -1,17 +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("NRF52_DK" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_NRF52_DK
)
elseif("SDT52832B" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SDT52832B
)
endif()
add_library(mbed-nrf52-dk INTERFACE)
add_library(mbed-sdt52832b INTERFACE)

target_include_directories(mbed-nrf52-dk
INTERFACE
TARGET_NRF52_DK
)

target_include_directories(mbed-sdt52832b
INTERFACE
TARGET_SDT52832B
)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/nRF52832.sct)
Expand All @@ -21,16 +22,16 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S)
endif()

set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
add_library(mbed-mcu-nrf52832 INTERFACE)

target_include_directories(mbed-core
target_include_directories(mbed-mcu-nrf52832
INTERFACE
.
config
device
)

target_sources(mbed-core
target_sources(mbed-mcu-nrf52832
INTERFACE
PeripheralPins.c

Expand All @@ -39,3 +40,9 @@ target_sources(mbed-core

${STARTUP_FILE}
)

mbed_set_linker_script(mbed-mcu-nrf52832 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(mbed-mcu-nrf52832 INTERFACE mbed-nrf52 mbed-sdk-15-0)
target_link_libraries(mbed-nrf52-dk INTERFACE mbed-mcu-nrf52832)
target_link_libraries(mbed-sdt52832b INTERFACE mbed-mcu-nrf52832)
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if ("ARDUINO_NANO33BLE" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_ARDUINO_NANO33BLE
)
elseif("EP_AGORA" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_EP_AGORA
)
target_sources(mbed-core
INTERFACE
TARGET_EP_AGORA/ONBOARD_TELIT_ME910.cpp
)
elseif("EP_ATLAS" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_EP_ATLAS
)
elseif("NRF52840_DK" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_NRF52840_DK
)
endif()
add_library(mbed-arduino-nano33ble INTERFACE)
add_library(mbed-ep-agora INTERFACE)
add_library(mbed-ep-atlas INTERFACE)
add_library(mbed-nrf52840-dk INTERFACE)

target_include_directories(mbed-arduino-nano33ble
INTERFACE
TARGET_ARDUINO_NANO33BLE
)

target_include_directories(mbed-ep-agora
INTERFACE
TARGET_EP_AGORA
)
target_sources(mbed-ep-agora
INTERFACE
TARGET_EP_AGORA/ONBOARD_TELIT_ME910.cpp
)

target_include_directories(mbed-ep-atlas
INTERFACE
TARGET_EP_ATLAS
)

target_include_directories(mbed-nrf52840-dk
INTERFACE
TARGET_NRF52840_DK
)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/nRF52840.sct)
Expand All @@ -35,16 +38,16 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_NRF52840.S)
endif()

set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
add_library(mbed-mcu-nrf52840 INTERFACE)

target_include_directories(mbed-core
target_include_directories(mbed-mcu-nrf52840
INTERFACE
.
config
device
)

target_sources(mbed-core
target_sources(mbed-mcu-nrf52840
INTERFACE
PeripheralPins.c
USBPhy_Nordic.cpp
Expand All @@ -54,3 +57,11 @@ target_sources(mbed-core

${STARTUP_FILE}
)

mbed_set_linker_script(mbed-mcu-nrf52840 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(mbed-mcu-nrf52840 INTERFACE mbed-nrf52 mbed-sdk-15-0)
target_link_libraries(mbed-arduino-nano33ble INTERFACE mbed-mcu-nrf52840)
target_link_libraries(mbed-ep-agora INTERFACE mbed-mcu-nrf52840)
target_link_libraries(mbed-ep-atlas INTERFACE mbed-mcu-nrf52840)
target_link_libraries(mbed-nrf52840-dk INTERFACE mbed-mcu-nrf52840)
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("SOFTDEVICE_NONE" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_SOFTDEVICE_NONE)
endif()
add_library(mbed-sdk-15-0 INTERFACE)

add_subdirectory(components)
add_subdirectory(integration)
add_subdirectory(modules)
add_subdirectory(TARGET_SOFTDEVICE_NONE EXCLUDE_FROM_ALL)
add_subdirectory(components EXCLUDE_FROM_ALL)
add_subdirectory(integration EXCLUDE_FROM_ALL)
add_subdirectory(modules EXCLUDE_FROM_ALL)

target_link_libraries(mbed-sdk-15-0 INTERFACE mbed-softdevice-none)
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-softdevice-none INTERFACE)

target_include_directories(mbed-core
target_include_directories(mbed-softdevice-none
INTERFACE
libraries
libraries/fstorage
nrf_soc_nosd
)

target_sources(mbed-core
target_sources(mbed-softdevice-none
INTERFACE
libraries/fstorage/nrf_fstorage_nvmc.c

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0


target_include_directories(mbed-core
target_include_directories(mbed-sdk-15-0
INTERFACE
libraries
libraries/atomic
Expand All @@ -22,7 +22,7 @@ target_include_directories(mbed-core
libraries/util
)

target_sources(mbed-core
target_sources(mbed-sdk-15-0
INTERFACE
libraries/atomic/nrf_atomic.c

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

target_include_directories(mbed-core
target_include_directories(mbed-sdk-15-0
INTERFACE
.
nrfx
nrfx/legacy
nrfx/legacy/ble_flash
)

target_sources(mbed-core
target_sources(mbed-sdk-15-0
INTERFACE
nrfx/legacy/nrf_drv_rng.c
nrfx/legacy/nrf_drv_usbd.c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +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

target_include_directories(mbed-core
target_include_directories(mbed-sdk-15-0
INTERFACE
.
nrfx
Expand All @@ -16,7 +16,7 @@ target_include_directories(mbed-core
softdevice/common
)

target_sources(mbed-core
target_sources(mbed-sdk-15-0
INTERFACE
nrfx/drivers/src/nrfx_adc.c
nrfx/drivers/src/nrfx_clock.c
Expand Down