AnsweredAssumed Answered

Nice problem with IAR ARM Compiler

Question asked by karpavicius.linas on Aug 4, 2015
Latest reply on Aug 5, 2015 by karpavicius.linas
So many of you know i am having hard time to make my STM32F4 program work with STM32F7 micro.
Latest finding for me looks just not acceptable.
So many people to make programs shorted use function calls inside IF statement like this:

if(read_spi(0)==222)
{
//todo
}
So my uint16_t read_spi(uint16_t address) function simply was returning camera id based on register so i could upload register for proper operation. It does not matter what read_spi returned, it always get into //todo statement !!!!!!!

So if i make this function a bit more to hardware by first reading id to register, and using register RX for if statement, it does work as it should. This is to be expected.

uint16_t reg = 0;
reg = read_spi(0);
if(reg ==222)
{
//todo
}

So in general, it just does not like function calls, as example if(fabsf(-50.0f)==100.0f) does give answer YES. So question, this is normal, that each time i have to supply compiler with correct program flow, or it is just bug  ?

Outcomes