Merge pull request #14275 from rwalton-arm/dev/rwalton-arm/fix-more-st-targets

Fix ST targets naming and linker script issues
pull/14243/head
Martin Kojtal 2021-02-15 14:34:36 +00:00 committed by GitHub
commit 266e5f8c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 34 deletions

View File

@ -72,6 +72,20 @@ target_compile_definitions(mbed-core
${MBED_CONFIG_DEFINITIONS} ${MBED_CONFIG_DEFINITIONS}
) )
# We need to generate a "response file" to pass to the C preprocessor when we preprocess the linker
# script, because of path length limitations on Windows. We set the response file and bind the path
# to a global property here. The MBED_TARGET being built queries this global property when it sets
# the linker script.
#
# We must set this global property before the targets subdirectory is added to the project. This is
# required because the MBED_TARGET depends on the response file. If the path to the response file
# is not defined when the target requests it the config definitions will not be passed to CPP.
#
# TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
# using response files or global properties.
mbed_generate_options_for_linker(mbed-core RESPONSE_FILE_PATH)
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${RESPONSE_FILE_PATH})
# Add compile definitions for backward compatibility with the toolchain # Add compile definitions for backward compatibility with the toolchain
# supported. New source files should instead check for __GNUC__ and __clang__ # supported. New source files should instead check for __GNUC__ and __clang__
# for the GCC_ARM and ARM toolchains respectively. # for the GCC_ARM and ARM toolchains respectively.
@ -144,15 +158,6 @@ endif()
# Note, this function will be removed in the next revisions # Note, this function will be removed in the next revisions
# #
function(mbed_configure_app_target target) function(mbed_configure_app_target target)
# We need to generate a "response file" to pass to the C preprocessor because of path length
# limitations on Windows. We set the response file and bind the path to a global property here.
# We query this global property when we set the linker script for the MBED_TARGET being built.
#
# TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without
# using global properties.
mbed_generate_options_for_linker(${target} LINKER_PREPROCESS_DEFINITIONS)
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${LINKER_PREPROCESS_DEFINITIONS})
# Gcc Arm requires memap to be set with app name, equally to ARMClang # Gcc Arm requires memap to be set with app name, equally to ARMClang
# TODO: move this to toolchain and set properly # TODO: move this to toolchain and set properly
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM") if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")

View File

@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f072xb.sct) set(LINKER_FILE TOOLCHAIN_ARM/stm32f072xb.sct)
endif() endif()
add_library(mbed-stm32f072xB INTERFACE) add_library(mbed-stm32f072xb INTERFACE)
target_sources(mbed-stm32f072xB target_sources(mbed-stm32f072xb
INTERFACE INTERFACE
system_clock.c system_clock.c
${STARTUP_FILE} ${STARTUP_FILE}
) )
target_include_directories(mbed-stm32f072xB target_include_directories(mbed-stm32f072xb
INTERFACE INTERFACE
. .
) )
mbed_set_linker_script(mbed-stm32f072xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) mbed_set_linker_script(mbed-stm32f072xb ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
target_link_libraries(mbed-stm32f072xB INTERFACE mbed-stm32f0) target_link_libraries(mbed-stm32f072xb INTERFACE mbed-stm32f0)

View File

@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32f103xb.sct) set(LINKER_FILE TOOLCHAIN_ARM/stm32f103xb.sct)
endif() endif()
add_library(mbed-stm32f103xB INTERFACE) add_library(mbed-stm32f103xb INTERFACE)
target_sources(mbed-stm32f103xB target_sources(mbed-stm32f103xb
INTERFACE INTERFACE
system_clock.c system_clock.c
${STARTUP_FILE} ${STARTUP_FILE}
) )
target_include_directories(mbed-stm32f103xB target_include_directories(mbed-stm32f103xb
INTERFACE INTERFACE
. .
) )
mbed_set_linker_script(mbed-stm32f103xB ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) mbed_set_linker_script(mbed-stm32f103xb ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
target_link_libraries(mbed-stm32f103xB INTERFACE mbed-stm32f1) target_link_libraries(mbed-stm32f103xb INTERFACE mbed-stm32f1)

View File

@ -27,4 +27,4 @@ target_include_directories(mbed-stm32g0
. .
) )
target_link_libraries(mbed-stm32g0 INTERFACE mbed-stm mbed-stm32g0cube-few) target_link_libraries(mbed-stm32g0 INTERFACE mbed-stm mbed-stm32g0cube-fw)

View File

@ -1,17 +1,17 @@
# Copyright (c) 2020 ARM Limited. All rights reserved. # Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
add_library(mbed-nucleo-h743ZI2 INTERFACE) add_library(mbed-nucleo-h743zi2 INTERFACE)
target_sources(mbed-nucleo-h743ZI2 target_sources(mbed-nucleo-h743zi2
INTERFACE INTERFACE
PeripheralPins.c PeripheralPins.c
system_clock.c system_clock.c
) )
target_include_directories(mbed-nucleo-h743ZI2 target_include_directories(mbed-nucleo-h743zi2
INTERFACE INTERFACE
. .
) )
target_link_libraries(mbed-nucleo-h743ZI2 INTERFACE mbed-stm32h743xi) target_link_libraries(mbed-nucleo-h743zi2 INTERFACE mbed-stm32h743xi)

View File

@ -32,7 +32,7 @@ target_link_libraries(mbed-xdot-l151cc INTERFACE mbed-stm32l1)
# Same target as XDOT_L151CC # Same target as XDOT_L151CC
add_library(mbed-ff-1705-l151cc INTERFACE) add_library(mbed-ff1705-l151cc INTERFACE)
target_link_libraries(mbed-xdot-l151cc INTERFACE mbed-xdot-l151cc) target_link_libraries(mbed-ff1705-l151cc INTERFACE mbed-xdot-l151cc)

View File

@ -14,3 +14,7 @@ target_include_directories(mbed-nucleo-l496zg
) )
target_link_libraries(mbed-nucleo-l496zg INTERFACE mbed-stm32l496xg) target_link_libraries(mbed-nucleo-l496zg INTERFACE mbed-stm32l496xg)
add_library(mbed-nucleo-l496zg-p INTERFACE)
target_link_libraries(mbed-nucleo-l496zg-p INTERFACE mbed-nucleo-l496zg)

View File

@ -11,19 +11,19 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
set(LINKER_FILE TOOLCHAIN_ARM/stm32l4r9xi.sct) set(LINKER_FILE TOOLCHAIN_ARM/stm32l4r9xi.sct)
endif() endif()
add_library(mbed-stm32l4r9xI INTERFACE) add_library(mbed-stm32l4r9xi INTERFACE)
target_sources(mbed-stm32l4r9xI target_sources(mbed-stm32l4r9xi
INTERFACE INTERFACE
system_clock.c system_clock.c
${STARTUP_FILE} ${STARTUP_FILE}
) )
target_include_directories(mbed-stm32l4r9xI target_include_directories(mbed-stm32l4r9xi
INTERFACE INTERFACE
. .
) )
mbed_set_linker_script(mbed-stm32l4r9xI ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE}) mbed_set_linker_script(mbed-stm32l4r9xi ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
target_link_libraries(mbed-stm32l4r9xI INTERFACE mbed-stm32l4) target_link_libraries(mbed-stm32l4r9xi INTERFACE mbed-stm32l4)

View File

@ -2,9 +2,9 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# Generate a file containing compile definitions # Generate a file containing compile definitions
function(mbed_generate_options_for_linker target definitions_file) function(mbed_generate_options_for_linker target output_response_file_path)
set(_compile_definitions set(_compile_definitions
"$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>" "$<TARGET_PROPERTY:${target},INTERFACE_COMPILE_DEFINITIONS>"
) )
# Remove macro definitions that contain spaces as the lack of escape sequences and quotation marks # 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)
"$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions}, -D>>" "$<$<BOOL:${_compile_definitions}>:-D$<JOIN:${_compile_definitions}, -D>>"
) )
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt" CONTENT "${_compile_definitions}\n") file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt" CONTENT "${_compile_definitions}\n")
set(${definitions_file} @${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE) set(${output_response_file_path} @${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE)
endfunction() endfunction()
# Set the system processor depending on the CPU core type # Set the system processor depending on the CPU core type
if (MBED_CPU_CORE STREQUAL Cortex-A9) if (MBED_CPU_CORE STREQUAL Cortex-A9)