System Workbench for STM32

giving parameters into math function

If I call in C, math function `”trunc” in math library is define as:

extern double trunc _PARAMSdouble;
and in my main file call it:

int i = (int)trunc(2.5);

It works fine, no problems. But if I try to pass double passively, like:

double d = 2.5;
int i = (int)trunc(d);

It won’t work?!? In my microprocessor STM32F4 IDE it goes in debugger mode into:

b Infinite_Loop

and it stuck there. I also change double and try float, int, unit8_t,... no one isn’t working.
Also other math functions will work fine as I call them like this:

i = sin(1);
i = cos(1);

But, it will crashed the same, if called like this:

int a = 1;
i = sin(a);
i = cos(a);

I am running this code on microprocessor STM32F4 Discovery,IDE is Eclipse Ac6

according to this

trun returns a double not an int. the hard fault could result from the invalid type conversion from double to int.
Ints are 4 byte long (on an STM32) doubles are 8 byte long.

try to do something like that
double intput = 1.4;
double res = truc(input);

does this still result in a hardfault?

I tried, but still the same error going to Infinite_Loop. I am looking into Linker problems now. What I meant is, whenever there is a constant number in function, everything is fine, but variable has a problem. So in a case of constants, Linker must calculate values correctly, but program can’t do it?