Skip to content

Commit 7cb2407

Browse files
CMake: add support for Nordic targets
1 parent 643233e commit 7cb2407

File tree

12 files changed

+120
-77
lines changed

12 files changed

+120
-77
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ if("NRF52" IN_LIST MBED_TARGET_LABELS)
55
add_subdirectory(TARGET_NRF52)
66
endif()
77

8-
if("SDK_11" IN_LIST MBED_TARGET_LABELS)
9-
add_subdirectory(TARGET_SDK_11)
10-
elseif("SDK_15_0" IN_LIST MBED_TARGET_LABELS)
8+
if("SDK_15_0" IN_LIST MBED_TARGET_LABELS)
119
add_subdirectory(TARGET_SDK_15_0)
1210
endif()
1311

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/CMakeLists.txt

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

4-
if("MCU_NRF52840" IN_LIST MBED_TARGET_LABELS)
4+
if("MCU_NRF52832" IN_LIST MBED_TARGET_LABELS)
5+
add_subdirectory(TARGET_MCU_NRF52832)
6+
elseif("MCU_NRF52840" IN_LIST MBED_TARGET_LABELS)
57
add_subdirectory(TARGET_MCU_NRF52840)
68
endif()
79

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if("NRF52_DK" IN_LIST MBED_TARGET_LABELS)
5+
target_include_directories(mbed-core
6+
INTERFACE
7+
TARGET_NRF52_DK
8+
)
9+
elseif("SDT52832B" IN_LIST MBED_TARGET_LABELS)
10+
target_include_directories(mbed-core
11+
INTERFACE
12+
TARGET_SDT52832B
13+
)
14+
endif()
15+
16+
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
17+
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/nRF52832.sct)
18+
set(STARTUP_FILE device/TOOLCHAIN_ARM_STD/startup_nrf52832.S)
19+
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
20+
set(LINKER_FILE device/TOOLCHAIN_GCC_ARM/NRF52832.ld)
21+
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_NRF52832.S)
22+
endif()
23+
24+
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
25+
26+
target_include_directories(mbed-core
27+
INTERFACE
28+
.
29+
config
30+
device
31+
)
32+
33+
target_sources(mbed-core
34+
INTERFACE
35+
PeripheralPins.c
36+
37+
device/cmsis_nvic.c
38+
device/system_nrf52.c
39+
40+
${STARTUP_FILE}
41+
)

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_ARM_STD/nRF52832.sct

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! armcc -E
1+
#! armclang -E --target=arm-arm-none-eabi -x c -mcpu=cortex-m4
22

33
/* Default to no softdevice */
44
#if !defined(MBED_APP_START)
Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if("NRF52840_DK" IN_LIST MBED_TARGET_LABELS)
5-
add_subdirectory(TARGET_NRF52840_DK)
4+
if ("ARDUINO_NANO33BLE" IN_LIST MBED_TARGET_LABELS)
5+
target_include_directories(mbed-core
6+
INTERFACE
7+
TARGET_ARDUINO_NANO33BLE
8+
)
9+
elseif("EP_AGORA" IN_LIST MBED_TARGET_LABELS)
10+
target_include_directories(mbed-core
11+
INTERFACE
12+
TARGET_EP_AGORA
13+
)
14+
target_sources(mbed-core
15+
INTERFACE
16+
TARGET_EP_AGORA/ONBOARD_TELIT_ME910.cpp
17+
)
18+
elseif("EP_ATLAS" IN_LIST MBED_TARGET_LABELS)
19+
target_include_directories(mbed-core
20+
INTERFACE
21+
TARGET_EP_ATLAS
22+
)
23+
elseif("NRF52840_DK" IN_LIST MBED_TARGET_LABELS)
24+
target_include_directories(mbed-core
25+
INTERFACE
26+
TARGET_NRF52840_DK
27+
)
628
endif()
729

30+
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
31+
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/nRF52840.sct)
32+
set(STARTUP_FILE device/TOOLCHAIN_ARM_STD/startup_nrf52840.S)
33+
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
34+
set(LINKER_FILE device/TOOLCHAIN_GCC_ARM/NRF52840.ld)
35+
set(STARTUP_FILE device/TOOLCHAIN_GCC_ARM/startup_NRF52840.S)
36+
endif()
37+
38+
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
39+
840
target_include_directories(mbed-core
941
INTERFACE
1042
.
11-
./config
43+
config
44+
device
1245
)
1346

1447
target_sources(mbed-core
1548
INTERFACE
1649
PeripheralPins.c
1750
USBPhy_Nordic.cpp
18-
)
1951

20-
add_subdirectory(device)
52+
device/cmsis_nvic.c
53+
device/system_nrf52840.c
54+
55+
${STARTUP_FILE}
56+
)

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/TARGET_NRF52840_DK/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52840/device/CMakeLists.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/TARGET_SOFTDEVICE_NONE/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
target_include_directories(mbed-core
66
INTERFACE
7-
./libraries
8-
./libraries/fstorage
9-
./nrf_soc_nosd/
7+
libraries
8+
libraries/fstorage
9+
nrf_soc_nosd
1010
)
1111

1212
target_sources(mbed-core

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44

55
target_include_directories(mbed-core
66
INTERFACE
7-
./libraries
8-
./libraries/atomic
9-
./libraries/atomic_fifo
10-
./libraries/balloc
11-
./libraries/delay
12-
./libraries/experimental_log
13-
./libraries/experimental_log/src
14-
./libraries/experimental_memobj
15-
./libraries/experimental_section_vars
16-
./libraries/fds
17-
./libraries/fstorage
18-
./libraries/queue
19-
./libraries/spi_mngr
20-
./libraries/strerror
21-
./libraries/twi_mngr
22-
./libraries/util
7+
libraries
8+
libraries/atomic
9+
libraries/atomic_fifo
10+
libraries/balloc
11+
libraries/delay
12+
libraries/experimental_log
13+
libraries/experimental_log/src
14+
libraries/experimental_memobj
15+
libraries/experimental_section_vars
16+
libraries/fds
17+
libraries/fstorage
18+
libraries/queue
19+
libraries/spi_mngr
20+
libraries/strerror
21+
libraries/twi_mngr
22+
libraries/util
2323
)
2424

2525
target_sources(mbed-core

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/integration/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
target_include_directories(mbed-core
55
INTERFACE
66
.
7-
./nrfx
8-
./nrfx/legacy
9-
./nrfx/legacy/ble_flash
7+
nrfx
8+
nrfx/legacy
9+
nrfx/legacy/ble_flash
1010
)
1111

1212
target_sources(mbed-core

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/modules/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
target_include_directories(mbed-core
55
INTERFACE
66
.
7-
./nrfx
8-
./nrfx/drivers
9-
./nrfx/drivers/include
10-
./nrfx/drivers/src
11-
./nrfx/drivers/src/prs
12-
./nrfx/hal
13-
./nrfx/mdk
14-
./nrfx/soc
15-
./softdevice
16-
./softdevice/common
7+
nrfx
8+
nrfx/drivers
9+
nrfx/drivers/include
10+
nrfx/drivers/src
11+
nrfx/drivers/src/prs
12+
nrfx/hal
13+
nrfx/mdk
14+
nrfx/soc
15+
softdevice
16+
softdevice/common
1717
)
1818

1919
target_sources(mbed-core

tools/cmake/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ The full profile with the selected printf and C libraries.
1919
Only a limited set of targets is supported at the moment.
2020

2121
The following targets are supported:
22-
- NRF52840_DK
2322
- Ambiq Micro targets
2423
- Analog Devices targets
2524
- ARM FM targets
2625
- Cypress targets
2726
- Freescale targets
2827
- GigaDevice targets
2928
- MAXIM targets
29+
- Nordic targets
3030
- NXP targets
3131
- Renesas targets
3232
- Samsung targets

0 commit comments

Comments
 (0)