summaryrefslogtreecommitdiff
path: root/scripts/cmake/platforms/simple_platform/build_configuration.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cmake/platforms/simple_platform/build_configuration.cmake')
-rw-r--r--scripts/cmake/platforms/simple_platform/build_configuration.cmake14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/cmake/platforms/simple_platform/build_configuration.cmake b/scripts/cmake/platforms/simple_platform/build_configuration.cmake
index 74b3896..3536c5b 100644
--- a/scripts/cmake/platforms/simple_platform/build_configuration.cmake
+++ b/scripts/cmake/platforms/simple_platform/build_configuration.cmake
@@ -1,5 +1,5 @@
#----------------------------------------------------------------------------
-# SPDX-FileCopyrightText: Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
+# SPDX-FileCopyrightText: Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,6 +21,7 @@ function(set_platform_global_defaults)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_DIR}/bare-metal-gcc.cmake
CACHE FILEPATH "Toolchain file")
endif()
+
set(LINKER_SCRIPT_NAME "simple_platform" PARENT_SCOPE)
set(PLATFORM_DRIVERS_DIR "${HAL_PLATFORM_DIR}/simple" PARENT_SCOPE)
endfunction()
@@ -30,8 +31,15 @@ function(platform_custom_post_build)
cmake_parse_arguments(PARSED "" "${oneValueArgs}" "" ${ARGN} )
set_target_properties(${PARSED_TARGET_NAME} PROPERTIES SUFFIX ".axf")
- # Add link options for the linker script to be used:
+ # For GNU toolchain, we have different linker scripts for Debug and Release
+ # as the code footprint difference between the two is quite big.
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ string(TOLOWER ${CMAKE_BUILD_TYPE} LINKER_SCRIPT_SUFFIX)
+ set(LINKER_SCRIPT_NAME "${LINKER_SCRIPT_NAME}_${LINKER_SCRIPT_SUFFIX}" PARENT_SCOPE FORCE)
+ endif()
+
+ # Add link options for the linker script to be used:
add_linker_script(
${PARSED_TARGET_NAME} # Target
${CMAKE_SCRIPTS_DIR}/platforms/simple_platform # Directory path
@@ -56,4 +64,4 @@ function(platform_custom_post_build)
AXF_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.axf
SECTION_PATTERNS "${LINKER_SECTION_TAGS}"
OUTPUT_BIN_NAMES "${LINKER_OUTPUT_BIN_TAGS}")
-endfunction() \ No newline at end of file
+endfunction()