[En-Nut-Discussion] Problems compiling NutOS with actual debian unstable avr-gcc / Confusing sleep modes

Ole Reinhardt ole.reinhardt at kernelconcepts.de
Mon Jan 10 12:44:19 CET 2005


Hi all,

with the actual avr-gcc from debian unstable I'm not able any more to
compile NutOS.

The compiler output:

make[1]: Entering directory `/home/ole/work/avr/ethernut/nut/os'
avr-gcc -c -mmcu=atmega128 -Os -Wall -Werror -Wstrict-prototypes
-Wa,-ahlms=nutinit.lst -D__HARVARD_ARCH__ -DNUT3WAIT_STATES
-I../mod/include -I../include nutinit.c -o nutinit.o
In file included from nutinit.c:88:
arch/avr_nutinit.c: In function `NutIdle':
arch/avr_nutinit.c:219: error: parse error before '}' token
arch/avr_nutinit.c:221: error: parse error before '}' token
make[1]: *** [nutinit.o] Fehler 1
make[1]: Leaving directory `/home/ole/work/avr/ethernut/nut/os'
make: *** [all] Fehler 2

Now I took a look into nutinit.c and found the error results in the
NutIdle thread. I don't understand the error but I'm even more confused
by the Sleep mode functions.

That's the code:


THREAD(NutIdle, arg)
{
#ifdef __GNUC__
    u_char sleep_mode;
#endif    
    /* Initialize system timers. */
    NutTimerInit();

    /* Create the main application thread. */
    NutThreadCreate("main", main, 0, NUT_THREAD_MAINSTACK);

    /*
     * Run in an idle loop at the lowest priority. We can still
     * do something useful here, like killing terminated threads
     * or putting the CPU into sleep mode.
     */
    NutThreadSetPriority(254);
    for (;;) {
        NutThreadYield();
        NutThreadDestroy();
        
#ifdef __GNUC__
        if (idle_sleep_mode != SLEEP_MODE_NONE) {
            sleep_mode = MCUCR & SLEEP_MODE_EXT_STANDBY;
            set_sleep_mode(idle_sleep_mode);
            sleep_mode();
            set_sleep_mode(sleep_mode);
        }
#endif
    }
}

My question: 

What does the sleep_mode() command shall do? Sleep mode is defined as a
u_char and is'nt a function? very confusing...

Could anybody explain this?

Thanks and bye,

Ole Reinhardt

-- 
kernel concepts    Tel: +49-271-771091-14
Dreisbachstr. 24   Fax: +49-271-771091-19
D-57250 Netphen    E+ : +49-177-7420433
--





More information about the En-Nut-Discussion mailing list