AnsweredAssumed Answered

IMX. RT Passing parameter "float" to function i.MX RT

Question asked by arni pol on Jun 8, 2020
Latest reply on Jun 17, 2020 by Felipe García

IMX.RT 1062 

 

I have a poroblem with passing flaot parameter to function.

 

There are two functions  wich have the same body. Both print float parameter: ScalingFactor = 1;

First one prints wrong value = 0, the second one good value = 1

 

    Task_AdcToSensorUnit(NULL, NULL, (uint32_t)0, 1.0f);

    Task_AdcToSensorUnit2(NULL, NULL, (uint32_t)0, 1.0f);

 

This one is defined in main module

 

void Task_AdcToSensorUnit2(int16_t* InputBuff, float* OutputBuff, uint32_t SamplesNumber, float ScalingFactor){

PRINTF("\nscaling factor = %f", ScalingFactor);

}

 

This one is defined in other module

 

void Task_AdcToSensorUnit(int16_t* InputBuff, float* OutputBuff, uint32_t SamplesNumber, float ScalingFactor){

PRINTF("\nscaling factor1 = %f", ScalingFactor);

}

 

I checked assambly code and have noticed that first one is passing parameter by double precision register d0 (Pic1), the second one by single precison register s0 (pic1). But both of them to print value are using single precision register s0 - (Pic2 and Pic3)

The library i am using is  newlib, floating point: FPv5-D16(Hard ABI).

What could be the problem?

 

Pic1

 

Pic2

Pic3

 

I will be grateful for any help

Arek

Outcomes