-
Notifications
You must be signed in to change notification settings - Fork 3k
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
CMake: Set required toolchain and processor flags globally, instead of per-target #13987
Changes from 1 commit
78be77e
6da2cbb
bb7391a
a942b2e
423e8b0
f07c0cd
0972738
3628802
975a871
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- mbed-os-6.17.0
- mbed-os-6.17.0-rc3
- mbed-os-6.17.0-rc2
- mbed-os-6.17.0-rc1
- mbed-os-6.16.0
- mbed-os-6.16.0-rc1
- mbed-os-6.15.1
- mbed-os-6.15.1-rc1
- mbed-os-6.15.0
- mbed-os-6.15.0-rc3
- mbed-os-6.15.0-rc2
- mbed-os-6.15.0-rc1
- mbed-os-6.14.0
- mbed-os-6.14.0-rc1
- mbed-os-6.13.0
- mbed-os-6.13.0-rc1
- mbed-os-6.12.0
- mbed-os-6.12.0-rc1
- mbed-os-6.11.0
- mbed-os-6.11.0-rc1
- mbed-os-6.10.0
- mbed-os-6.10.0-rc1
- mbed-os-6.9.0
- mbed-os-6.9.0-rc1
- mbed-os-6.8.0
- mbed-os-6.8.0-rc1
- mbed-os-6.7.0
- mbed-os-6.7.0-rc1
- mbed-os-6.6.0
- mbed-os-6.6.0-rc1
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,48 +8,40 @@ set(CMAKE_AR "armar") | |
set(ARM_ELF2BIN "fromelf") | ||
set_property(GLOBAL PROPERTY ELF2BIN ${ARM_ELF2BIN}) | ||
|
||
# Sets toolchain options | ||
function(mbed_set_toolchain_options target) | ||
list(APPEND common_options | ||
"-c" | ||
"--target=arm-arm-none-eabi" | ||
"-mthumb" | ||
"-Wno-armcc-pragma-push-pop" | ||
"-Wno-armcc-pragma-anon-unions" | ||
"-Wno-reserved-user-defined-literal" | ||
"-Wno-deprecated-register" | ||
"-fdata-sections" | ||
"-fno-exceptions" | ||
"-fshort-enums" | ||
"-fshort-wchar" | ||
) | ||
# tell cmake about compiler targets. | ||
# This will cause it to add the --target flag. | ||
set(CMAKE_C_COMPILER_TARGET arm-arm-none-eabi) | ||
set(CMAKE_CXX_COMPILER_TARGET arm-arm-none-eabi) | ||
|
||
target_compile_options(${target} | ||
INTERFACE | ||
$<$<COMPILE_LANGUAGE:C>:${common_options}> | ||
# Sets toolchain options | ||
list(APPEND common_options | ||
"-mthumb" | ||
"-Wno-armcc-pragma-push-pop" | ||
"-Wno-armcc-pragma-anon-unions" | ||
"-Wno-reserved-user-defined-literal" | ||
"-Wno-deprecated-register" | ||
"-fdata-sections" | ||
"-fno-exceptions" | ||
"-fshort-enums" | ||
"-fshort-wchar" | ||
) | ||
|
||
target_compile_options(${target} | ||
INTERFACE | ||
$<$<COMPILE_LANGUAGE:CXX>:${common_options}> | ||
list(APPEND asm_compile_options | ||
-masm=auto | ||
--target=arm-arm-none-eabi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's not CMAKE_ASM_COMPILER_TARGET as we do above for C/CXX ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't believe so... though it kinda depends on how ARM implemented the CMake scripts for ARM Compiler. You could try adding it (and removing the manual --target flag) and see if it works. |
||
) | ||
|
||
target_compile_options(${target} | ||
INTERFACE | ||
$<$<COMPILE_LANGUAGE:ASM>:--target=arm-arm-none-eabi -masm=auto> | ||
list(APPEND link_options | ||
"--map" | ||
) | ||
|
||
# Add linking time preprocessor macro for TFM targets | ||
if(MBED_CPU_CORE MATCHES "\-NS$") | ||
list(APPEND link_options | ||
"--predefine=\"-DDOMAIN_NS=0x1\"" | ||
# Add linking time preprocessor macro for TFM targets | ||
if(MBED_CPU_CORE MATCHES "-NS$") | ||
) | ||
endif() | ||
endif() | ||
|
||
target_link_options(${target} | ||
INTERFACE | ||
${link_options} | ||
) | ||
function(mbed_set_toolchain_options target) | ||
# blank for ARMClang | ||
endfunction() | ||
|
||
# Configure the toolchain to select the selected C library | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-c
was removed as it's not required, just checking if it was intentionally removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep that was intentional, CMake will add -c as needed.