[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Setting pin to high in function instead of main, inst
From: |
David Kelly |
Subject: |
Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run? |
Date: |
Thu, 1 Mar 2012 10:07:46 -0600 |
On Mar 1, 2012, at 9:45 AM, Johannes Bauer wrote:
>> Pardon me for tuning in late but since when did main() start ending with an
>> "rjmp .-2" infinite loop as shown at 0x8a above? Is supposed to ret to
>> caller which then calls _exit or perhaps calls something else. But my point
>> is that int main() is a function that is supposed to return to caller.
>
> Because his code looks like this:
>
> int main(void)
> {
> DDRB |= (1 << PB0);
> turn_on_pb();
> for (;;) {
> }
> return 0;
> }
>
> The for(;;) is the interesting part ;-)
Thanks!
Use for(;;) or while(1) all the time for infinite loops. Was confused because
the disassembly didn't list the code which generated rjmp .-2. Was concerned
whether for some reason main() was now getting special treatment but now
reassured that it is not.
--
David Kelly N4HHE, address@hidden
============================================================
Whom computers would destroy, they must first drive mad.
- [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Richard Zetterberg, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Peter Fuhrmann, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Richard Zetterberg, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Johannes Bauer, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Richard Zetterberg, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Richard Zetterberg, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, David Kelly, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Johannes Bauer, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?,
David Kelly <=
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Johannes Bauer, 2012/03/01
- Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Johannes Bauer, 2012/03/01
Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Georg-Johann Lay, 2012/03/01
Re: [avr-gcc-list] Setting pin to high in function instead of main, instructions in main never run?, Bernard Fouché, 2012/03/05