I was working toward some precision delays that I needed.
I was starting with this function:

#include <inttypes.h>
#include "util/delay.h"
inline void delay_us( uint8_t delay_u8 )
{
  uint8_t irq_state_u8 = SREG;
  __disable_interrupt(); /* Macro to cli */

_delay_us( (double) delay_u8 ); /* Also tried without the cast, same results */

  SREG = irq_state_u8;
}

main()
{
/* stuff */
 delay_us( 15 );
/* more stuff */
}

I realize in the end I'll need to compensate for the SREGs save/restore time etc,
but I wanted to start with something simple and generic before I started
refining it.

The problem is that the list files shows that floating point library
is being used, when comments in delay.h say that should not happen.
Also the function was not inlined when I called it.

I have -Os for optimization.  This is with WinAVR345.

Where did I go wrong?





_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to