diff --git a/CMakeLists.txt b/CMakeLists.txt index 40a7ef023c..e99b369f66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,6 +140,10 @@ add_subdirectory(drivers) add_subdirectory(hal) add_subdirectory(platform) add_subdirectory(rtos) + +# Target provides includes for core to find device.h/cmsis.h or nvic related files +add_library(${MBED_TARGET_CONVERTED}-core INTERFACE) + add_subdirectory(targets) # The directories below contain optional target libraries @@ -152,7 +156,8 @@ add_subdirectory(features EXCLUDE_FROM_ALL) add_subdirectory(cmsis/CMSIS_5/CMSIS/RTOS2 EXCLUDE_FROM_ALL) add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL) -target_link_libraries(mbed-core-obj PRIVATE ${MBED_TARGET_CONVERTED}) +# TODO: remove this now +target_link_libraries(mbed-core-obj PRIVATE ${MBED_TARGET_CONVERTED}-core) # # Converts output file of `target` to binary file and to Intel HEX file. diff --git a/targets/TARGET_Maxim/CMakeLists.txt b/targets/TARGET_Maxim/CMakeLists.txt index 30cb3fd53b..222430ba94 100644 --- a/targets/TARGET_Maxim/CMakeLists.txt +++ b/targets/TARGET_Maxim/CMakeLists.txt @@ -8,7 +8,7 @@ add_subdirectory(TARGET_MAX32625 EXCLUDE_FROM_ALL) add_subdirectory(TARGET_MAX32630 EXCLUDE_FROM_ALL) add_library(mbed-maxim INTERFACE) -add_library(mbed-maxim-obj OBJECT) +add_library(mbed-maxim-obj INTERFACE) target_include_directories(mbed-maxim INTERFACE @@ -16,10 +16,13 @@ target_include_directories(mbed-maxim ) target_sources(mbed-maxim-obj - PRIVATE + INTERFACE USBPhy_Maxim.cpp ) -mbed_attach_object_lib_with_interface_lib(mbed-maxim) +target_include_directories(${MBED_TARGET_CONVERTED}-core + INTERFACE + . +) -target_link_libraries(mbed-maxim-obj PRIVATE mbed-cmsis-cortex-m mbed-core) +target_link_libraries(mbed-maxim INTERFACE mbed-cmsis-cortex-m mbed-core) diff --git a/targets/TARGET_Maxim/TARGET_MAX32620C/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32620C/CMakeLists.txt index 1c28875707..33e2a0bbf3 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32620C/CMakeLists.txt +++ b/targets/TARGET_Maxim/TARGET_MAX32620C/CMakeLists.txt @@ -15,7 +15,7 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") endif() add_library(mbed-maxim-max32620c INTERFACE) -add_library(mbed-maxim-max32620c-obj OBJECT) +add_library(mbed-maxim-max32620c-obj INTERFACE) target_include_directories(mbed-maxim-max32620c INTERFACE @@ -24,10 +24,20 @@ target_include_directories(mbed-maxim-max32620c mxc ) +target_include_directories(${MBED_TARGET_CONVERTED}-core + INTERFACE + . + device + mxc +) + +target_link_libraries(${MBED_TARGET_CONVERTED}-core INTERFACE mbed-cmsis-cortex-m) + + mbed_set_linker_script(mbed-maxim-max32620c ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) target_sources(mbed-maxim-max32620c-obj - PRIVATE + INTERFACE PeripheralPins.c analogin_api.c flash_api.c @@ -81,7 +91,7 @@ target_sources(mbed-maxim-max32620c-obj target_link_libraries(mbed-maxim-max32620c INTERFACE mbed-maxim + mbed-cmsis-cortex-m + mbed-core ) -mbed_attach_object_lib_with_interface_lib(mbed-maxim-max32620c) - diff --git a/targets/TARGET_Maxim/TARGET_MAX32620C/TARGET_MAX32620FTHR/CMakeLists.txt b/targets/TARGET_Maxim/TARGET_MAX32620C/TARGET_MAX32620FTHR/CMakeLists.txt index bd859d478e..29c210049f 100644 --- a/targets/TARGET_Maxim/TARGET_MAX32620C/TARGET_MAX32620FTHR/CMakeLists.txt +++ b/targets/TARGET_Maxim/TARGET_MAX32620C/TARGET_MAX32620FTHR/CMakeLists.txt @@ -2,6 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 add_library(mbed-max32620fthr INTERFACE) +add_library(mbed-max32620fthr-obj OBJECT) target_include_directories(mbed-max32620fthr INTERFACE @@ -9,3 +10,10 @@ target_include_directories(mbed-max32620fthr ) target_link_libraries(mbed-max32620fthr INTERFACE mbed-maxim-max32620c) + +target_include_directories(${MBED_TARGET_CONVERTED}-core + INTERFACE + . +) + +target_sources(mbed-max32620fthr-obj PRIVATE $)