Skip to content
Merged
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,14 @@ add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
# preventing CMake from working its usage requirements magic and forcing us to set the linker
# script globally.
#
# Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix.
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")

# TODO: Remove when all MBED_TARGETS have been converted to build system targets.
if(TARGET ${MBED_TARGET})
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET})
if(TARGET ${MBED_TARGET_CONVERTED})
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
else()
get_property(LINKER_SCRIPT GLOBAL PROPERTY MBED_TARGET_LINKER_FILE)
mbed_set_linker_script(mbed-core ${LINKER_SCRIPT})
Expand Down
6 changes: 3 additions & 3 deletions targets/TARGET_STM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ add_subdirectory(TARGET_STM32L5 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32WB EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32WL EXCLUDE_FROM_ALL)

add_library(STM INTERFACE)
add_library(mbed-stm INTERFACE)

target_include_directories(STM
target_include_directories(mbed-stm
INTERFACE
.
)

target_sources(STM
target_sources(mbed-stm
INTERFACE
USBPhy_STM32.cpp
analogin_api.c
Expand Down
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F0/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ add_subdirectory(TARGET_STM32F070xB EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32F030x8 EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(STM32F0 INTERFACE)
add_library(mbed-stm32f0 INTERFACE)

target_include_directories(STM32F0
target_include_directories(mbed-stm32f0
INTERFACE
.
)

target_sources(STM32F0
target_sources(mbed-stm32f0
INTERFACE
analogin_device.c
analogout_device.c
Expand All @@ -26,4 +26,4 @@ target_sources(STM32F0
spi_api.c
)

target_link_libraries(STM32F0 INTERFACE STM STM32F0Cube_FW)
target_link_libraries(mbed-stm32f0 INTERFACE mbed-stm mbed-stm32f0cube-fw)
6 changes: 3 additions & 3 deletions targets/TARGET_STM/TARGET_STM32F0/STM32Cube_FW/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(STM32F0Cube_FW INTERFACE)
add_library(mbed-stm32f0cube-fw INTERFACE)

target_sources(STM32F0Cube_FW
target_sources(mbed-stm32f0cube-fw
INTERFACE
STM32F0xx_HAL_Driver/Legacy/stm32f0xx_hal_can_legacy.c
STM32F0xx_HAL_Driver/stm32f0xx_hal.c
Expand Down Expand Up @@ -68,7 +68,7 @@ target_sources(STM32F0Cube_FW
system_stm32f0xx.c
)

target_include_directories(STM32F0Cube_FW
target_include_directories(mbed-stm32f0cube-fw
INTERFACE
.
CMSIS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f030x8.sct)
endif()

add_library(STM32F030x8 INTERFACE)
add_library(mbed-stm32f030x8 INTERFACE)

target_sources(STM32F030x8
target_sources(mbed-stm32f030x8
INTERFACE
${STARTUP_FILE}
)

target_include_directories(STM32F030x8
target_include_directories(mbed-stm32f030x8
INTERFACE
.
)

mbed_set_linker_script(STM32F030x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-stm32f030x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(STM32F030x8 INTERFACE STM32F0)
target_link_libraries(mbed-stm32f030x8 INTERFACE mbed-stm32f0)
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f070xb.sct)
endif()

add_library(STM32F070xB INTERFACE)
add_library(mbed-stm32f070xb INTERFACE)

target_sources(STM32F070xB
target_sources(mbed-stm32f070xb
INTERFACE
system_clock.c
${STARTUP_FILE}
)

target_include_directories(STM32F070xB
target_include_directories(mbed-stm32f070xb
INTERFACE
.
)

mbed_set_linker_script(STM32F070xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-stm32f070xb ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(STM32F070xB INTERFACE STM32F0)
target_link_libraries(mbed-stm32f070xb INTERFACE mbed-stm32f0)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(NUCLEO_F070RB INTERFACE)
add_library(mbed-nucleo-f070rb INTERFACE)

target_sources(NUCLEO_F070RB
target_sources(mbed-nucleo-f070rb
INTERFACE
PeripheralPins.c
)

target_include_directories(NUCLEO_F070RB
target_include_directories(mbed-nucleo-f070rb
INTERFACE
.
)

target_link_libraries(NUCLEO_F070RB INTERFACE STM32F070xB)
target_link_libraries(mbed-nucleo-f070rb INTERFACE mbed-stm32f070xb)
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f072xb.sct)
endif()

add_library(STM32F072xB INTERFACE)
add_library(mbed-stm32f072xB INTERFACE)

target_sources(STM32F072xB
target_sources(mbed-stm32f072xB
INTERFACE
system_clock.c
${STARTUP_FILE}
)

target_include_directories(STM32F072xB
target_include_directories(mbed-stm32f072xB
INTERFACE
.
)

mbed_set_linker_script(STM32F072xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-stm32f072xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(STM32F072xB INTERFACE STM32F0)
target_link_libraries(mbed-stm32f072xB INTERFACE mbed-stm32f0)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(NUCLEO_F072RB INTERFACE)
add_library(mbed-nucleo-f072rb INTERFACE)

target_sources(NUCLEO_F072RB
target_sources(mbed-nucleo-f072rb
INTERFACE
PeripheralPins.c
)

target_include_directories(NUCLEO_F072RB
target_include_directories(mbed-nucleo-f072rb
INTERFACE
.
)

target_link_libraries(NUCLEO_F072RB INTERFACE STM32F072xB)
target_link_libraries(mbed-nucleo-f072rb INTERFACE mbed-stm32f072xb)
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f091xc.sct)
endif()

add_library(STM32F091xC INTERFACE)
add_library(mbed-stm32f091xc INTERFACE)

target_sources(STM32F091xC
target_sources(mbed-stm32f091xc
INTERFACE
system_clock.c
${STARTUP_FILE}
)

target_include_directories(STM32F091xC
target_include_directories(mbed-stm32f091xc
INTERFACE
.
)

mbed_set_linker_script(STM32F091xC ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-stm32f091xc ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(STM32F091xC INTERFACE STM32F0)
target_link_libraries(mbed-stm32f091xc INTERFACE mbed-stm32f0)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(NUCLEO_F091RC INTERFACE)
add_library(mbed-nucleo-f091rc INTERFACE)

target_sources(NUCLEO_F091RC
target_sources(mbed-nucleo-f091rc
INTERFACE
PeripheralPins.c
)

target_include_directories(NUCLEO_F091RC
target_include_directories(mbed-nucleo-f091rc
INTERFACE
.
)

target_link_libraries(NUCLEO_F091RC INTERFACE STM32F091xC)
target_link_libraries(mbed-nucleo-f091rc INTERFACE mbed-stm32f091xc)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ add_subdirectory(TARGET_STM32F103x8 EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_STM32F103xB EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(STM32F1 INTERFACE)
add_library(mbed-stm32f1 INTERFACE)

target_sources(STM32F1
target_sources(mbed-stm32f1
INTERFACE
analogin_device.c
flash_api.c
Expand All @@ -17,9 +17,9 @@ target_sources(STM32F1
spi_api.c
)

target_include_directories(STM32F1
target_include_directories(mbed-stm32f1
INTERFACE
.
)

target_link_libraries(STM32F1 INTERFACE STM STM32F1Cube_FW)
target_link_libraries(mbed-stm32f1 INTERFACE mbed-stm mbed-stm32f1cube-fw)
6 changes: 3 additions & 3 deletions targets/TARGET_STM/TARGET_STM32F1/STM32Cube_FW/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(STM32F1Cube_FW INTERFACE)
add_library(mbed-stm32f1cube-fw INTERFACE)

target_sources(STM32F1Cube_FW
target_sources(mbed-stm32f1cube-fw
INTERFACE
STM32F1xx_HAL_Driver/Legacy/stm32f1xx_hal_can_legacy.c
STM32F1xx_HAL_Driver/stm32f1xx_hal.c
Expand Down Expand Up @@ -67,7 +67,7 @@ target_sources(STM32F1Cube_FW
system_stm32f1xx.c
)

target_include_directories(STM32F1Cube_FW
target_include_directories(mbed-stm32f1cube-fw
INTERFACE
.
CMSIS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f103x8.sct)
endif()

add_library(STM32F103x8 INTERFACE)
add_library(mbed-stm32f103x8 INTERFACE)

target_sources(STM32F103x8
target_sources(mbed-stm32f103x8
INTERFACE
system_clock.c
${STARTUP_FILE}
)

target_include_directories(STM32F103x8
target_include_directories(mbed-stm32f103x8
INTERFACE
.
)

mbed_set_linker_script(STM32F103x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-stm32f103x8 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(STM32F103x8 INTERFACE STM32F1)
target_link_libraries(mbed-stm32f103x8 INTERFACE mbed-stm32f1)
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f103xb.sct)
endif()

add_library(STM32F103xB INTERFACE)
add_library(mbed-stm32f103xB INTERFACE)

target_sources(STM32F103xB
target_sources(mbed-stm32f103xB
INTERFACE
system_clock.c
${STARTUP_FILE}
)

target_include_directories(STM32F103xB
target_include_directories(mbed-stm32f103xB
INTERFACE
.
)

mbed_set_linker_script(STM32F103xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-stm32f103xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_link_libraries(STM32F103xB INTERFACE STM32F1)
target_link_libraries(mbed-stm32f103xB INTERFACE mbed-stm32f1)
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(NUCLEO_F103RB INTERFACE)
add_library(mbed-nucleo-f103rb INTERFACE)

target_sources(NUCLEO_F103RB
target_sources(mbed-nucleo-f103rb
INTERFACE
PeripheralPins.c
)

target_include_directories(NUCLEO_F103RB
target_include_directories(mbed-nucleo-f103rb
INTERFACE
.
)

target_link_libraries(NUCLEO_F103RB INTERFACE STM32F103xB)
target_link_libraries(mbed-nucleo-f103rb INTERFACE mbed-stm32f103xb)
8 changes: 4 additions & 4 deletions targets/TARGET_STM/TARGET_STM32F2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
add_subdirectory(TARGET_STM32F207xG EXCLUDE_FROM_ALL)
add_subdirectory(STM32Cube_FW EXCLUDE_FROM_ALL)

add_library(STM32F2 INTERFACE)
add_library(mbed-stm32f2 INTERFACE)

target_sources(STM32F2
target_sources(mbed-stm32f2
INTERFACE
analogin_device.c
analogout_device.c
Expand All @@ -17,7 +17,7 @@ target_sources(STM32F2
spi_api.c
)

target_include_directories(STM32F2
target_include_directories(mbed-stm32f2
INTERFACE
.
./STM32Cube_FW
Expand All @@ -26,4 +26,4 @@ target_include_directories(STM32F2
./STM32Cube_FW/STM32F2xx_HAL_Driver/Legacy
)

target_link_libraries(STM32F2 INTERFACE STM STM32F2Cube_FW)
target_link_libraries(mbed-stm32f2 INTERFACE mbed-stm mbed-stm32f2cube-fw)
Loading