Le 01/03/2012 11:25, Richard Zetterberg a écrit :
I have a ATmega328-PU chip which I have programmed with a bare minimum
program which sets PB0 to output and then runs a function which sets the
pin to HIGH. The problem is that the voltage output of the pin is at
10-20% of what it should be, identical to what it would be if the pin
was set as input and the pull upp would be active. However if I set the
function as static, it works as expected. I have tried this on 3
ATMega328-PU's with default fuse settings to minimize the things that
could contribute to the problem.
The only difference that appears in the different examples is the
function call for the non-static version: is the stack pointer correctly
initialized? If what you show is a complete disassembly then it misses
r1 init, stack pointer init, etc. Code should also be generated for
addresses higher than 0x0 since the interrupt vectors are starting at
this place. Seems like avr-libc isn't considered at link time.
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list