Thanks!  That works perfectly.  :-)

I was totally misunderstanding the problem. Just one little attribute, but it's a huge help.

Thanks again.

-Paul



Joerg Wunsch wrote:
Paul Stoffregen <p...@pjrc.com> wrote:

Indeed it works great with -O2.  But with -Os, __builtin_constant_p
never returns 1.

It appears to me GCC simply thinks inlining the function would not be
feasible with -Os -- well, partially at least.  If you declare your
function as

static inline void __attribute__((always_inline))
digitalWrite(uint8_t pin, uint8_t val)

(thus overriding GCC's heuristics about inlining), it yields your
desired result:

main:
/* prologue: function */
/* frame size = 0 */
        sbi 43-32,2
        lds r24,num
        ldi r22,lo8(1)
        call _digitalWrite
        sbi 43-32,2
..L2:
        rjmp .L2




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

Reply via email to