Skip to content

Commit 266e5f8

Browse files
authored
Merge pull request #14275 from rwalton-arm/dev/rwalton-arm/fix-more-st-targets
Fix ST targets naming and linker script issues
2 parents 4c58112 + fd63d33 commit 266e5f8

File tree

9 files changed

+43
-34
lines changed

9 files changed

+43
-34
lines changed

CMakeLists.txt

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@ target_compile_definitions(mbed-core
7272
${MBED_CONFIG_DEFINITIONS}
7373
)
7474

75+
# We need to generate a "response file" to pass to the C preprocessor when we preprocess the linker
76+
# script, because of path length limitations on Windows. We set the response file and bind the path
77+
# to a global property here. The MBED_TARGET being built queries this global property when it sets
78+
# the linker script.
79+
#
80+
# We must set this global property before the targets subdirectory is added to the project. This is
81+
# required because the MBED_TARGET depends on the response file. If the path to the response file
82+
# is not defined when the target requests it the config definitions will not be passed to CPP.
83+
#
84+
# TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
85+
# using response files or global properties.
86+
mbed_generate_options_for_linker(mbed-core RESPONSE_FILE_PATH)
87+
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${RESPONSE_FILE_PATH})
88+
7589
# Add compile definitions for backward compatibility with the toolchain
7690
# supported. New source files should instead check for __GNUC__ and __clang__
7791
# for the GCC_ARM and ARM toolchains respectively.
@@ -144,15 +158,6 @@ endif()
144158
# Note, this function will be removed in the next revisions
145159
#
146160
function(mbed_configure_app_target target)
147-
# We need to generate a "response file" to pass to the C preprocessor because of path length
148-
# limitations on Windows. We set the response file and bind the path to a global property here.
149-
# We query this global property when we set the linker script for the MBED_TARGET being built.
150-
#
151-
# TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
152-
# using global properties.
153-
mbed_generate_options_for_linker(${target} LINKER_PREPROCESS_DEFINITIONS)
154-
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${LINKER_PREPROCESS_DEFINITIONS})
155-
156161
# Gcc Arm requires memap to be set with app name, equally to ARMClang
157162
# TODO: move this to toolchain and set properly
158163
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")

targets/TARGET_STM/TARGET_STM32F0/TARGET_STM32F072xB/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1111
set(LINKER_FILE TOOLCHAIN_ARM/stm32f072xb.sct)
1212
endif()
1313

14-
add_library(mbed-stm32f072xB INTERFACE)
14+
add_library(mbed-stm32f072xb INTERFACE)
1515

16-
target_sources(mbed-stm32f072xB
16+
target_sources(mbed-stm32f072xb
1717
INTERFACE
1818
system_clock.c
1919
${STARTUP_FILE}
2020
)
2121

22-
target_include_directories(mbed-stm32f072xB
22+
target_include_directories(mbed-stm32f072xb
2323
INTERFACE
2424
.
2525
)
2626

27-
mbed_set_linker_script(mbed-stm32f072xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
27+
mbed_set_linker_script(mbed-stm32f072xb ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2828

29-
target_link_libraries(mbed-stm32f072xB INTERFACE mbed-stm32f0)
29+
target_link_libraries(mbed-stm32f072xb INTERFACE mbed-stm32f0)

targets/TARGET_STM/TARGET_STM32F1/TARGET_STM32F103xB/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1111
set(LINKER_FILE TOOLCHAIN_ARM/stm32f103xb.sct)
1212
endif()
1313

14-
add_library(mbed-stm32f103xB INTERFACE)
14+
add_library(mbed-stm32f103xb INTERFACE)
1515

16-
target_sources(mbed-stm32f103xB
16+
target_sources(mbed-stm32f103xb
1717
INTERFACE
1818
system_clock.c
1919
${STARTUP_FILE}
2020
)
2121

22-
target_include_directories(mbed-stm32f103xB
22+
target_include_directories(mbed-stm32f103xb
2323
INTERFACE
2424
.
2525
)
2626

27-
mbed_set_linker_script(mbed-stm32f103xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
27+
mbed_set_linker_script(mbed-stm32f103xb ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2828

29-
target_link_libraries(mbed-stm32f103xB INTERFACE mbed-stm32f1)
29+
target_link_libraries(mbed-stm32f103xb INTERFACE mbed-stm32f1)

targets/TARGET_STM/TARGET_STM32G0/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ target_include_directories(mbed-stm32g0
2727
.
2828
)
2929

30-
target_link_libraries(mbed-stm32g0 INTERFACE mbed-stm mbed-stm32g0cube-few)
30+
target_link_libraries(mbed-stm32g0 INTERFACE mbed-stm mbed-stm32g0cube-fw)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
add_library(mbed-nucleo-h743ZI2 INTERFACE)
4+
add_library(mbed-nucleo-h743zi2 INTERFACE)
55

6-
target_sources(mbed-nucleo-h743ZI2
6+
target_sources(mbed-nucleo-h743zi2
77
INTERFACE
88
PeripheralPins.c
99
system_clock.c
1010
)
1111

12-
target_include_directories(mbed-nucleo-h743ZI2
12+
target_include_directories(mbed-nucleo-h743zi2
1313
INTERFACE
1414
.
1515
)
1616

17-
target_link_libraries(mbed-nucleo-h743ZI2 INTERFACE mbed-stm32h743xi)
17+
target_link_libraries(mbed-nucleo-h743zi2 INTERFACE mbed-stm32h743xi)

targets/TARGET_STM/TARGET_STM32L1/TARGET_XDOT_L151CC/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ target_link_libraries(mbed-xdot-l151cc INTERFACE mbed-stm32l1)
3232

3333

3434
# Same target as XDOT_L151CC
35-
add_library(mbed-ff-1705-l151cc INTERFACE)
35+
add_library(mbed-ff1705-l151cc INTERFACE)
3636

37-
target_link_libraries(mbed-xdot-l151cc INTERFACE mbed-xdot-l151cc)
37+
target_link_libraries(mbed-ff1705-l151cc INTERFACE mbed-xdot-l151cc)
3838

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L496xG/TARGET_NUCLEO_L496ZG/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ target_include_directories(mbed-nucleo-l496zg
1414
)
1515

1616
target_link_libraries(mbed-nucleo-l496zg INTERFACE mbed-stm32l496xg)
17+
18+
19+
add_library(mbed-nucleo-l496zg-p INTERFACE)
20+
target_link_libraries(mbed-nucleo-l496zg-p INTERFACE mbed-nucleo-l496zg)

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L4R9xI/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
1111
set(LINKER_FILE TOOLCHAIN_ARM/stm32l4r9xi.sct)
1212
endif()
1313

14-
add_library(mbed-stm32l4r9xI INTERFACE)
14+
add_library(mbed-stm32l4r9xi INTERFACE)
1515

16-
target_sources(mbed-stm32l4r9xI
16+
target_sources(mbed-stm32l4r9xi
1717
INTERFACE
1818
system_clock.c
1919
${STARTUP_FILE}
2020
)
2121

22-
target_include_directories(mbed-stm32l4r9xI
22+
target_include_directories(mbed-stm32l4r9xi
2323
INTERFACE
2424
.
2525
)
2626

27-
mbed_set_linker_script(mbed-stm32l4r9xI ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
27+
mbed_set_linker_script(mbed-stm32l4r9xi ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2828

29-
target_link_libraries(mbed-stm32l4r9xI INTERFACE mbed-stm32l4)
29+
target_link_libraries(mbed-stm32l4r9xi INTERFACE mbed-stm32l4)

tools/cmake/toolchain.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Generate a file containing compile definitions
5-
function(mbed_generate_options_for_linker target definitions_file)
5+
function(mbed_generate_options_for_linker target output_response_file_path)
66
set(_compile_definitions
7-
"$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>"
7+
"$<TARGET_PROPERTY:${target},INTERFACE_COMPILE_DEFINITIONS>"
88
)
99

1010
# Remove macro definitions that contain spaces as the lack of escape sequences and quotation marks
@@ -20,7 +20,7 @@ function(mbed_generate_options_for_linker target definitions_file)
2020
"$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions}, -D>>"
2121
)
2222
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt" CONTENT "${_compile_definitions}\n")
23-
set(${definitions_file} @${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE)
23+
set(${output_response_file_path} @${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE)
2424
endfunction()
2525
# Set the system processor depending on the CPU core type
2626
if (MBED_CPU_CORE STREQUAL Cortex-A9)

0 commit comments

Comments
 (0)