Skip to content

Ambiq Micro: refactor CMake targets #14242

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 4 commits into from
Feb 12, 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
12 changes: 6 additions & 6 deletions targets/TARGET_Ambiq_Micro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +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("Apollo3" IN_LIST MBED_TARGET_LABELS)
add_subdirectory(TARGET_Apollo3)
endif()
add_subdirectory(TARGET_Apollo3 EXCLUDE_FROM_ALL)

target_include_directories(mbed-core
add_library(mbed-ambiq-micro INTERFACE)

target_include_directories(mbed-ambiq-micro
INTERFACE
sdk/devices
sdk/utils
)

target_sources(mbed-core
target_sources(mbed-ambiq-micro
INTERFACE
sdk/devices/am_devices_button.c
sdk/devices/am_devices_led.c
Expand Down
142 changes: 17 additions & 125 deletions targets/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,128 +1,19 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if("hm01b0" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
COMPONENT_hm01b0/hm01b0
)
add_subdirectory(COMPONENT_hm01b0/hm01b0 EXCLUDE_FROM_ALL)
add_subdirectory(COMPONENT_lis2dh12/lis2dh12 EXCLUDE_FROM_ALL)

target_sources(mbed-core
INTERFACE
COMPONENT_hm01b0/hm01b0/HM01B0.c
)
endif()

if("lis2dh12" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
COMPONENT_lis2dh12/lis2dh12
)

target_sources(mbed-core
INTERFACE
COMPONENT_lis2dh12/lis2dh12/lis2dh12_platform_apollo3.c
COMPONENT_lis2dh12/lis2dh12/lis2dh12_reg.c
)
endif()

if("SFE_ARTEMIS" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS
TARGET_SFE_ARTEMIS/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS/bsp/am_bsp.c
TARGET_SFE_ARTEMIS/bsp/am_bsp_pins.c
)
elseif("SFE_ARTEMIS_ATP" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_ATP
TARGET_SFE_ARTEMIS_ATP/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_ATP/bsp/am_bsp.c
TARGET_SFE_ARTEMIS_ATP/bsp/am_bsp_pins.c
)
elseif("SFE_ARTEMIS_DK" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_DK
TARGET_SFE_ARTEMIS_DK/bsp
)
add_subdirectory(TARGET_SFE_ARTEMIS EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_ARTEMIS_ATP EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_ARTEMIS_DK EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_ARTEMIS_MODULE EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_ARTEMIS_NANO EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_ARTEMIS_THING_PLUS EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_EDGE EXCLUDE_FROM_ALL)
add_subdirectory(TARGET_SFE_EDGE2 EXCLUDE_FROM_ALL)

target_sources(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_DK/bsp/am_bsp.c
TARGET_SFE_ARTEMIS_DK/bsp/am_bsp_pins.c
)
elseif("SFE_ARTEMIS_MODULE" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_MODULE
TARGET_SFE_ARTEMIS_MODULE/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_MODULE/bsp/am_bsp.c
TARGET_SFE_ARTEMIS_MODULE/bsp/am_bsp_pins.c
)
elseif("SFE_ARTEMIS_NANO" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_NANO
TARGET_SFE_ARTEMIS_NANO/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_NANO/bsp/am_bsp.c
TARGET_SFE_ARTEMIS_NANO/bsp/am_bsp_pins.c
)
elseif("SFE_ARTEMIS_THING_PLUS" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_THING_PLUS
TARGET_SFE_ARTEMIS_THING_PLUS/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_ARTEMIS_THING_PLUS/bsp/am_bsp.c
TARGET_SFE_ARTEMIS_THING_PLUS/bsp/am_bsp_pins.c
)
elseif("SFE_EDGE" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_EDGE
TARGET_SFE_EDGE/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_EDGE/bsp/am_bsp.c
TARGET_SFE_EDGE/bsp/am_bsp_pins.c
)
elseif("SFE_EDGE2" IN_LIST MBED_TARGET_LABELS)
target_include_directories(mbed-core
INTERFACE
TARGET_SFE_EDGE2
TARGET_SFE_EDGE2/bsp
)

target_sources(mbed-core
INTERFACE
TARGET_SFE_EDGE2/bsp/am_bsp.c
TARGET_SFE_EDGE2/bsp/am_bsp_pins.c
)
endif()
add_library(mbed-apollo3 INTERFACE)

if(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM_STD/AMA3B1KK.sct)
Expand All @@ -132,9 +23,9 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
set(STARTUP_FILE TOOLCHAIN_GCC_ARM/startup_gcc.c)
endif()

set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
mbed_set_linker_script(mbed-apollo3 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})

target_include_directories(mbed-core
target_include_directories(mbed-apollo3
INTERFACE
device
sdk/CMSIS/AmbiqMicro/Include
Expand All @@ -144,7 +35,7 @@ target_include_directories(mbed-core
sdk/mcu/apollo3/regs
)

target_sources(mbed-core
target_sources(mbed-apollo3
INTERFACE
device/PeripheralPinConfigs.c
device/PeripheralPins.c
Expand Down Expand Up @@ -200,7 +91,8 @@ target_sources(mbed-core
${STARTUP_FILE}
)

target_link_libraries(mbed-core
target_link_libraries(mbed-apollo3
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/sdk/CMSIS/ARM/Lib/ARM/libarm_cortexM4lf_math.a
mbed-ambiq-micro
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-hm01b0 INTERFACE)

target_include_directories(mbed-hm01b0
INTERFACE
.
)

target_sources(mbed-hm01b0
INTERFACE
HM01B0.c
)

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

add_library(mbed-lis2dh12 INTERFACE)

target_include_directories(mbed-lis2dh12
INTERFACE
.
)

target_sources(mbed-lis2dh12
INTERFACE
lis2dh12_platform_apollo3.c
lis2dh12_reg.c
)

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

add_library(mbed-sfe-artemis INTERFACE)

target_include_directories(mbed-sfe-artemis
INTERFACE
.
bsp
)

target_sources(mbed-sfe-artemis
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-artemis INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-artemis-atp INTERFACE)

target_include_directories(mbed-sfe-artemis-atp
INTERFACE
.
bsp
)

target_sources(mbed-sfe-artemis-atp
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-artemis-atp INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-artemis-dk INTERFACE)

target_include_directories(mbed-sfe-artemis-dk
INTERFACE
.
bsp
)

target_sources(mbed-sfe-artemis-dk
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-artemis-dk INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-artemis-module INTERFACE)

target_include_directories(mbed-sfe-artemis-module
INTERFACE
.
bsp
)

target_sources(mbed-sfe-artemis-module
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-artemis-module INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-artemis-nano INTERFACE)

target_include_directories(mbed-sfe-artemis-nano
INTERFACE
.
bsp
)

target_sources(mbed-sfe-artemis-nano
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-artemis-nano INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-artemis-thing-plus INTERFACE)

target_include_directories(mbed-sfe-artemis-thing-plus
INTERFACE
.
bsp
)

target_sources(mbed-sfe-artemis-thing-plus
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-artemis-thing-plus INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-edge INTERFACE)

target_include_directories(mbed-sfe-edge
INTERFACE
.
bsp
)

target_sources(mbed-sfe-edge
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-edge INTERFACE mbed-apollo3)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

add_library(mbed-sfe-edge2 INTERFACE)

target_include_directories(mbed-sfe-edge2
INTERFACE
.
bsp
)

target_sources(mbed-sfe-edge2
INTERFACE
bsp/am_bsp.c
bsp/am_bsp_pins.c
)

target_link_libraries(mbed-sfe-edge2 INTERFACE mbed-apollo3)