This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/AM5728: GCC CLAGS optimization options

Part Number: AM5728


Tool/software: TI C/C++ Compiler

Do you have recommended settings to use for the GCC CLAGS options for the AM572x processor family? The top level Rules.make file in the SDK example-applications folder uses "CFLAGS= -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard", but I would like to know if there are tuning options that will produce code optimized for this processor.

  • Code Composer Studio comes with a GCC ARM compiler.  Even if you use a different GCC ARM compiler, the documentation in the CCS installation is still worth using.  The location of the PDF file is similar to ...

    C:\ti\ccsv8\tools\compiler\gcc-arm-none-eabi-7-2017-q4-major-win32\share\doc\gcc-arm-none-eabi\pdf\gcc\gcc.pdf

    I recommend you look through the options specific to ARM.  Search for the sub-chapter titled ARM Options.  Pay particular attention to -mtune.  Also look through the options in the sub-chapter titled Options That Control Optimization.

    Thanks and regards,

    -George

  • Thanks for that. I am asking for expert advice from TI on exactly that please. What does TI recommend for -mtune=, -mfpu= and even -march= (since -march has options such as +fp, +mp, +simd, etc.) for an AM5728 board based on the AM572x EVM?

  • Following your discussion with George

    I would like to add my statement:

    ChickenDuck said:
    The top level Rules.make file in the SDK example-applications folder uses "CFLAGS= -march=armv7-a -marm -mfpu=neon -mfloat-abi=hard", but I would like to know if there are tuning options that will produce code optimized for this processor.

    Code optimization is multi-criteria math issue. Code size optimization affects speed of  execution and vice versa, both code and speed optimizations affect debugging capabilities like stack tracing and protection. Like with a car, the same brand, engine, gear box and color, and optimal could be sedan or cabrio. 

    Start with "The top level Rules.make file in the SDK example", do some "test drives"  and find what is optimal for your needs. 

    Also, please read appropriate GCC optimization sections. 

  • Hi,

    ChickenDuck said:

    Thanks for that. I am asking for expert advice from TI on exactly that please. What does TI recommend for -mtune=, -mfpu= and even -march= (since -march has options such as +fp, +mp, +simd, etc.) for an AM5728 board based on the AM572x EVM?

    For our processors we recommend specifying only the -mcpu parameter, which causes GCC to derive the -march and -mtune parameters automatically (for historical reasons we also specify the -mtune by default, but that will be removed from future revisions). Reference at:

    https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#ARM-Options 

    Specifically for the Cortex A15 of both the C66AK2 and the AM57x family of devices, simply pass -mcpu=cortex-a15 and the core will be accurately described for the optimizations to be placed. 

    If you intend to use floating point, you can also add -float-abi=hard -mfpu=vfpv4

    If you intend to use floating point + NEON, issue -float-abi=hard and -mfpu=neon-vfpv4 

    The floating point option will also be added by default in future revisions. 

    A good article is shown at:

    https://community.arm.com/tools/b/blog/posts/arm-cortex-a-processors-and-gcc-command-lines 

    Hope this helps,

    Rafael

  • Very helpful, thanks very much!