Command to find ARM GCC Port

38 views Asked by At

I'm really new to understanding the GNU GCC ARM compiler. I need to find the correct ARM compiler type (CM4F, CM0, et cetera). I know it depends on the target, but for the simplicity of this question I am just using an existing example. I'd really like to see if there was a command line solution, or compiler directive to find out exactly which one is needed. However, I'm using verbose, and instead I'm just getting "arm-none-eabi" which I'm not sure why, as for the sample application, it is the CM4F. How would I find this out, if I didn't already know the answer was CM4F? Thanks in advance!

What I've already tried:

The verbose compiler command/directive (I apologize, I'm not always good with precise technical definitions).

Looking at the GNU GCC ARM documentation (online, quick search)

1

There are 1 answers

0
Nate Eldredge On

The arm target for GCC includes all supported 32-bit ARM architectures and CPUs. You select the desired one when compiling your program, using the -march/-mcpu/-mtune options. See https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/ARM-Options.html for details. The lists of architectures and CPUs is found under the -march and -mtune options respectively.

So for example, if you want to compile code that only needs to run on a Cortex M4, you can use -mcpu=cortex-m4. If you want backward compatibility with ARMv6 but best performance on Cortex M0, use -march=armv6 -mtune=cortex-m0.