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.

ARM Compiler v5.02 with Cortex-M4 target

Hi,

Target is a Stellaris LM4F microcontroller, and I have CCSv5.3 which has the ARM Compiler Tools v5.02 installed.

 

The ARM Cortex M4 DSP Instructions are available for this microcontroller.  Can you help me to understand if the compiler optimizations actually utilizes these M4 DSP instructions as part of the optimization process?  Any additional information would be greatly appreciated.  I'm trying to understand how to use the Cortex M4 DSP instructions on the Stellaris LM4F MCU, and am hoping that maybe the ARM Compiler does some of this during the optimization processing.

  Best,

      Rick Nardone

      MCU FAE

 

  • Support for Cortex-M4 was introduced in compiler version 4.9.0.  The following is copied from the readme file for that release ...

    -------------------------------------------------------------------------------
    2.) Cortex-M4 Support

    -------------------------------------------------------------------------------

    This release includes support for the Cortex-M4 device as well as support
    for the FPv4-SPD16 floating point extension. Included in this release:

    1.) Assembly support for all Cortex-M4 instructions
    2.) Code generation of applicable Cortex-M4 instructions from C/C++
    3.) Assembly support for all FPv4-SPD16 instructions. This includes the
    fused multiply-add instructions and the 16-bit <-> 32-bit floating point
    conversion instructions.
    4.) Code generation of applicable FPv4-SPD16 instructions from C/C++

    The new support is enabled through the use of two options.

    --silicon_version=7M4 - Enables support for the core Cortex-M4 instructions
    --float_support=FPv4SPD16 - Enables support for the FPv4-SPD16 extension.

    The --abi=eabi option must be used when using floating point support. Floating
    point support is turned on by default for Cortex-M4. If the user does not
    want to use the floating point unit, the option --float_support=fpalib can
    be specified on the command line.

    Thanks and regards,

    -George

  • Hi George,

       Thanks for the response! 

        I see #2 above is of most interest.  Can you provide additional information describing how the compiler uses the Cortex-M4 DSP instructions with different optimization levels please?  I am trying to understand if I can rely on the compiler to get the best performance out of the M4, or if I need to go in and write M4 assembly with the DSP instructions, to get the best performance on this MCU.  I'm hoping that the compiler does a good job of using the DSP instructions with high levels of optimization selected.

        Any additioinal information would be greatly appreciated. 

        Best,

         Rick

  • Rick Nardone said:
    Can you provide additional information describing how the compiler uses the Cortex-M4 DSP instructions with different optimization levels please?

    We don't have anything like that at this time.  Just try it and see.

    Start with C code that expresses the algorithm in a straightforward manner.  Compile it with --silicon_version=7M4 --opt_level=4.  Experiment with different values for --opt_for_speed.  For a lot of your code, this will be good enough.

    Some of your performance sensitive code could improve by changing the source to use intrinsics.  An intrinsic looks and acts like a C function, but is (usually) implemented with a single instruction.  All the intrinsics, including those for Cortex-M4, are documented in the section titled ARM Instruction Intrinsics of the ARM compiler manual.

    There may be some very performance sensitive part of your code that you have to hand code in assembly.  Ideally, things won't get to this point, but no one can offer any guarantee.

    Thanks and regards,

    -George