I am just a hobby programmer. Far from an expert.
My suspicion is that your code is being optimised away by the compiler.
The compiler seems to be smart enough to see that the result coeff is not used, so gets rid of what it thinks is pointless code
I think that you need to make use of the result coeff.
I did this by sending coeff to a random PORT. This is a meaningless thing to do for a float value, but just a way to make use of the result coeff.
Code: Select all
// random pow() test code found on forum
// tested using STM32407 on EasyMx PRO v7 board
// necto studio legacy setup
static double p = 0.188228105404814; // power value
static double rntc = 77318.7772925764; // base value
int main(void)
{
volatile double coeff = pow(rntc, p); // expect about 8.32 as result of approx 77318 ^ 0.188
(void)coeff; // absolutely no idea what this is for, but seems harmless
GPIO_Digital_Output(&GPIOD_ODR, _GPIO_PINMASK_ALL); // Set PORTD as all output
GPIOD_ODR = coeff; // use the result to prevent optimiser removing
while (1)
{
}
return 0;
}
I am very curious as to what this line of code does
Code: Select all
(void)coeff; // absolutely no idea what this is for, but seems harmless
I have never seen anything like this.
What is the purpose of this line please?