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.

TMS320F28384S: CM - Float values/variables issues

Part Number: TMS320F28384S
Other Parts Discussed in Thread: C2000WARE

Hello,
I am developing an application on the Cortex core (Connectivity Manager) and I have some problems when using single precision floating point variables and values.


Example 1
If I assign a double precision floating-point value to a float variable (single-precision), I have an Hard Fault.

float a;
a = 1.0;


Example 2
If I divide a int32 variable with a single precision floating-point variable, I have an Hard Fault.

uint32_t b;
uint32_t c;

b = 1600;
c = b / 1.0F;

Example 3
The same of example 2, but in this case I eliminate the F suffix from the floatig-point value (double-precision).
In this case I have no problems.

b = 1600;
c = b / 1.0;

Why I have these exceptions when working with single precision floating-point values?

Thank you,
Carlo

  • Hi Carlo,

    The Cortex M4 core in the F2838x does not have float support. Have you enabled this in your project settings?

    Regards,

    Veena

  • Hello Veena,
    I was coming to the same conclusions.

    Infact, studing better the Cortex-M profile, I learned FPU is an optional feature on Cortex-M4 processors.

    Theese are the processor options that I use:

    The hard fault occours when I force to use single-precision values, for example by appending the F suffix.

    In this case, I see that the exception occours when try to execute the VMOV instructions to load the floating point value in the S0 register, that doesn't exist on CM. Isn't it?

    Regards,
    Carlo

  • Yes, The device does not include the FPU module in the cortex M4. So, if you enable the float_support, compiler generates the FPU instructions which cannot be run on the Cortex M4 present in that device. Please set that option to "none".

    I recommend you refer to the examples available in C2000ware for the compile flags to be used

    Regards,

    Veena

  • Thank you Veena.

    In effect, looking at the C2000Ware examples, the FPU support option is set to 'none'.

    I was misled from an error in the document "F28838x Firmware Development Package" (F2838x_FRM_EX_UG.pdf) deployed with C2000Ware 4.02.00.00.
    In this document, in section 2.2 Project Creation / CM Subsystem Project Creation, it says to set the FPU support option 'FPv4SPD16'. 

    Regards,
    Carlo