-
Notifications
You must be signed in to change notification settings - Fork 3k
CMake cores: fix cpu/fpu flags #14196
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
Conversation
Couple of cores did not have common flag `--mcpu` set
@0xc0170, thank you for your changes. |
tools/cmake/cores/Cortex-A9.cmake
Outdated
@@ -9,6 +9,7 @@ if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") | |||
"-mfpu=vfpv3" | |||
"-mfloat-abi=hard" | |||
"-mno-unaligned-access" | |||
""-mcpu=cortex-a9"" |
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.
Excessive quoting. Shouldn't this replace the -march=armv7-a
?
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.
Good point, checked https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu
On Arm, -mcpu combines -march and -mtune.4 On x86, -mcpu and -mtune are the same.5
.
-mcpu=X: On Arm, this flag is a combination of -march and -mtune. It simultaneously specifies the target architecture and optimizes for a given microarchitecture. On x86 this flag is a deprecated synonym for -mtune.
I'll remove it
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.
This is for Gcc:
This specifies the name of the target ARM processor. GCC uses this name to derive the name of the target ARM architecture
@@ -8,6 +8,7 @@ if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") | |||
"-mfpu=fpv5-sp-d16" | |||
"-mfloat-abi=softfp" | |||
"-march=armv8-m.main" | |||
"-mcpu=cortex-m33+nodsp" |
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.
Again, this should be replacing the -march
. That would possibly have been used due to older toolchains not knowing "cortex-m33". I assume that's valid with whatever we require now?
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.
fixed now (I also fixed dsp options as there were again errors between march or toolchains).
I realized we specified nodsp for M33 core but had march for FE parts enabled with dsp. This fixes it. M33F has no dsp. M33FE cores have dsp enabled.
Pull request has been modified.
I added 2 commits, addressing |
@@ -7,11 +7,11 @@ if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") | |||
"-mthumb" | |||
"-mfpu=fpv5-sp-d16" | |||
"-mfloat-abi=softfp" | |||
"-march=armv8-m.main+dsp" | |||
"-mcpu=cortex-m33+dsp" |
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.
Is +dsp
valid here? Maybe, but don't see it in the docs. They just say cortex-m33
DSP is assumed, and you can specify +nodsp
. (Note we're also not specifying +fp
).
https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
-mcpu
works differently to -march
in this regard - you're always enabling extensions in -march
, but usually disabling them in -mcpu
.
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.
I'll remove dsp from this one
) | ||
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") | ||
list(APPEND common_options | ||
"-mcpu=cortex-m33" | ||
"-mcpu=cortex-m33+dsp" |
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.
Unlike for GCC, this is perfectly fine according to the docs, as +X
and +noX
are always available. But if you do want to say +dsp
to be explicit, why not +fp
too?
I would imagine ARMC6's defaults are the same as GCC's so might be best to keep it the same as GCC.
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.
fixed, I only followed for now what we had (separate fpu settings for both toolchains). To keep both toolchains the same.
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.
Yeah, it's not clear from docs how +fp
/+nofp
(or lack of and hence default) and -mfpu
interact. Maybe don't mess with whatever we know/think works from original python stuff.
Move the fpu settings across all cores so they are aligned. Some cores did not have fpu set for ARMClang. I matched here both toolchains to set up the fpu the same (Only exception is soft vs hard - that is separate issue I would not like to touch in this series).
I aligned fpu settings for all cores. I matched both toolchains. There still might be issues, please review. |
@jeromecoutant I requested review as you also experienced issues with the core flags in CMake. |
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.
I could verify with blinky application on:
- NUCLEO_L552ZE_Q ("Cortex-M33FE")
- NUCLEO_F767ZI ("Cortex-M7F")
- NUCLEO_H743ZI2 ("Cortex-M7FD")
Build and execution OK with ARM and GCC
This pull request has automatically been marked as stale because it has had no recent activity. @ARMmbed/mbed-os-maintainers, please start CI to get the PR merged. |
Ci started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
Couple of cores did not have common flag
--mcpu
set. I also aligned fpu.This one goes along with #14190 - both are needed to have both toolchains fixed for couple of cores.
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers