=== // Bare minimum start (faulty behavior) ===
#include<avr/io.h>
void turn_on_pb(void);
int main(void)
{
DDRB |= (1<< PB0);
turn_on_pb();
for (;;) {
}
return 0;
}
void turn_on_pb(void)
{
PORTB |= (1<< PB0);
}
--- --- Disassembly start --- ---
00000000<turn_on_pb>:
return 0;
}
void turn_on_pb(void)
{
PORTB |= (1<< PB0);
0: 28 9a sbi 0x05, 0 ; 5
}
2: 08 95 ret
00000004<main>:
void turn_on_pb(void);
int main(void)
{
DDRB |= (1<< PB0);
4: 20 9a sbi 0x04, 0 ; 4
turn_on_pb();
6: 0e 94 00 00 call 0 ; 0x0<turn_on_pb>
a: 00 c0 rjmp .+0 ; 0xc<main+0x8>
--- --- Disassembly end --- ---
=== \\ Bare minimum end ===
The assembly looks correct. This should work. Maybe the RAM of your AVR
is faulty so function return doesn't work, or the powersupply is
unstable. I think this is most likely to be a hardware problem.
Another possibilitty ist that the Stack Pointer isn't set up properly in
the startup code, so the function can not return.
Could you try another chip or another Board ?
Best Regards,
Peter
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list