Some checks failed
Basic Checks / license-check (push) Has been cancelled
Basic Checks / include-check (push) Has been cancelled
Basic Checks / style-check (push) Has been cancelled
Basic Checks / docs-check (push) Has been cancelled
Basic Checks / python-tests (push) Has been cancelled
Basic Checks / pin-validation (push) Has been cancelled
Basic Checks / cmake-checks (push) Has been cancelled
Basic Checks / frozen-tools-check (push) Has been cancelled
Publish or Update docker image for head of branch / prepare-tags (push) Has been cancelled
Release or update docker image for a released mbed-os version / prepare-tags (push) Has been cancelled
Publish or Update docker image for head of branch / build-container (push) Has been cancelled
Publish or Update docker image for head of branch / test-container (linux/amd64) (push) Has been cancelled
Publish or Update docker image for head of branch / test-container (linux/arm64) (push) Has been cancelled
Publish or Update docker image for head of branch / deploy-container (push) Has been cancelled
Release or update docker image for a released mbed-os version / build-container (push) Has been cancelled
Release or update docker image for a released mbed-os version / test-container (linux/amd64) (push) Has been cancelled
Release or update docker image for a released mbed-os version / test-container (linux/arm64) (push) Has been cancelled
Release or update docker image for a released mbed-os version / deploy-container (push) Has been cancelled
Prune temporary docker images / prune-images (push) Has been cancelled
93 lines
2.4 KiB
CMake
93 lines
2.4 KiB
CMake
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Sets profile options
|
|
function(mbed_set_profile_options target mbed_toolchain)
|
|
set(profile_link_options "")
|
|
|
|
if(${mbed_toolchain} STREQUAL "GCC_ARM")
|
|
list(APPEND profile_c_compile_options
|
|
"-c"
|
|
"-Os"
|
|
)
|
|
target_compile_options(${target}
|
|
INTERFACE
|
|
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
|
)
|
|
|
|
list(APPEND profile_cxx_compile_options
|
|
"-c"
|
|
"-fno-rtti"
|
|
"-Wvla"
|
|
"-Os"
|
|
)
|
|
target_compile_options(${target}
|
|
INTERFACE
|
|
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
|
)
|
|
|
|
list(APPEND profile_asm_compile_options
|
|
"-c"
|
|
"-x" "assembler-with-cpp"
|
|
)
|
|
target_compile_options(${target}
|
|
INTERFACE
|
|
$<$<COMPILE_LANGUAGE:ASM>:${profile_asm_compile_options}>
|
|
)
|
|
|
|
list(APPEND profile_link_options
|
|
"-Wl,--gc-sections"
|
|
"-Wl,--wrap,main"
|
|
"-Wl,--wrap,_malloc_r"
|
|
"-Wl,--wrap,_free_r"
|
|
"-Wl,--wrap,_realloc_r"
|
|
"-Wl,--wrap,_memalign_r"
|
|
"-Wl,--wrap,_calloc_r"
|
|
"-Wl,--wrap,exit"
|
|
"-Wl,--wrap,atexit"
|
|
"-Wl,-n"
|
|
)
|
|
elseif(${mbed_toolchain} STREQUAL "ARM")
|
|
list(APPEND profile_c_compile_options
|
|
"-Oz"
|
|
)
|
|
target_compile_options(${target}
|
|
INTERFACE
|
|
$<$<COMPILE_LANGUAGE:C>:${profile_c_compile_options}>
|
|
)
|
|
|
|
list(APPEND profile_cxx_compile_options
|
|
"-fno-rtti"
|
|
"-fno-c++-static-destructors"
|
|
"-Oz"
|
|
)
|
|
target_compile_options(${target}
|
|
INTERFACE
|
|
$<$<COMPILE_LANGUAGE:CXX>:${profile_cxx_compile_options}>
|
|
)
|
|
|
|
list(APPEND profile_link_options
|
|
"--show_full_path"
|
|
"--legacyalign"
|
|
"--inline"
|
|
"--any_contingency"
|
|
"--keep=os_cb_sections"
|
|
)
|
|
|
|
target_compile_definitions(${target}
|
|
INTERFACE
|
|
__ASSERT_MSG
|
|
)
|
|
endif()
|
|
|
|
target_compile_definitions(${target}
|
|
INTERFACE
|
|
NDEBUG
|
|
)
|
|
|
|
target_link_options(${target}
|
|
INTERFACE
|
|
${profile_link_options}
|
|
)
|
|
endfunction()
|