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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,467 次查看
arnipol
Contributor II

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

pastedImage_1.png

Pic2

pastedImage_2.png

Pic3

pastedImage_3.png

I will be grateful for any help

Arek

标签 (1)
0 项奖励
回复
4 回复数

1,351 次查看
arnipol
Contributor II

Maybe I said it wrong. Perhaps such functionality is missing. I mean information about warnings.
An example below. If you create function, then compile the file, you will get warning in cosole and inside the file.
But if you miss them and compile once again this information will disappear and the function will not work properly.
Is it possible to make expresso to keep information about warnings for all file even they are not compile in last compilation?

Br Arek

pastedImage_4.png

0 项奖励
回复

1,351 次查看
FelipeGarcia
NXP Employee
NXP Employee

Hi Arek,

 

I solution could be to implement Build and Clean option using a single command. To do this go to Window > Preferences > General > Keys, search "Build clean" and enter your own binding for this command.

 

Hope it helps!

 

Best regards,

Felipe

0 项奖励
回复

1,351 次查看
arnipol
Contributor II

I've found the problem.

If the function body is in another module (file) and you forget to attach its declaration (#inclue ....), it does not work properly. Of course, we receive a warning at the first compilation. However, in the following you can not see it. By the way, can this feature be turned off in expresso?

I'm talking about functions like:

void function(float dana) { .... }

0 项奖励
回复

1,351 次查看
FelipeGarcia
NXP Employee
NXP Employee

Hi Arek,

 

Thanks for providing the solution with the community. Regarding your question, it is not clear to me what is the feature you would like to turn off in MCUXpresso. If you want to re-build your project completely I recommend you to clear the project first and then compile it.

 

Best regards,

Felipe

0 项奖励
回复