math.h pow variable parameters
Hello,
I am facing an odd bug with my stm32f4Discovery board in AC6Workbench based on Eclipse. In fact, I use in my code pow function of math.h library. Build runs well, debugging too. When I try to run my stm32 board (click on reset button) to display the result of my pow function, only where I calculate pow like this “pow(3,2)” works and where I try this one “pow(p,l)” after initialing p and l with 2 (p=l=2) the board stops running.
I found in many forums that I should link the math source c file by checking “Use C math library (-lm)” in “Properties -> Go to C\C++ Build -> Settings -> Tool Settings -> Gcc Linker -> Libraries” or by adding a new library named “m”. I tried all these propositions and many others I found but none of them does work.
Someone could help please.
I thank all in advance
Here is the code:
- include “headers.h”
- include “math.h”
int main (void){
double dd=0, p=2, l=2;
SystemInit();
config_usart(115200);
test_print();
while (1){
dd = pow(3,2);
serial_printel_val((uint32_t)dd);
dd = pow(p,l);
serial_printel_val((uint32_t)dd);
blink_leds();
}
return 0;
}
Here is the displayed result value:
9