#49 simulation code not compileable

closed-remind
5
2008-05-06
2008-05-03
No

I use the new current CVS checkout of the nesC compiler which says that it's in version 1.3 alpha.

If I compile code for the simulation e.g. the Blink-application with "make micaz sim" the following error is outputed:

In file included from /usr/include/sys/types.h:373,
from /usr/include/sys/unistd.h:9,
from /usr/include/unistd.h:4,
from /opt/tinyos-2.x/tos/lib/tossim/tos.h:44:
/usr/include/cygwin/types.h:190: syntax error before `u_int64_t'
In file included from /opt/tinyos-2.x/tos/lib/tossim/tos.h:70:
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.h:60: syntax error before `event'
In file included from /opt/tinyos-2.x/tos/lib/tossim/tos.h:87:
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:42: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: In function `sim_queue_insert':
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:43: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:44: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: At top level:
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:66: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:66: conflicting types for `sim_queue_cleanup_none'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.h:65: previous declaration of `sim_queue_cleanup_none'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: In function `sim_queue_cleanup_none':
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:67: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: At top level:
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:71: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:71: conflicting types for `sim_queue_cleanup_event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.h:66: previous declaration of `sim_queue_cleanup_event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: In function `sim_queue_cleanup_event':
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:72: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:73: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: At top level:
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:76: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:76: conflicting types for `sim_queue_cleanup_data'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.h:67: previous declaration of `sim_queue_cleanup_data'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: In function `sim_queue_cleanup_data':
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:77: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:78: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: At top level:
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:82: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:82: conflicting types for `sim_queue_cleanup_total'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.h:68: previous declaration of `sim_queue_cleanup_total'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c: In function `sim_queue_cleanup_total':
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:83: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:84: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_event_queue.c:86: syntax error before `event'
In file included from /usr/include/time.h:140,
from /usr/include/sys/select.h:24,
from /usr/include/cygwin/sys_time.h:13,
from /usr/include/sys/time.h:27,
from /opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:39,
from /opt/tinyos-2.x/tos/lib/tossim/tos.h:88:
/usr/include/signal.h: At top level:
/usr/include/signal.h:21: syntax error before `signal'
In file included from /opt/tinyos-2.x/tos/lib/tossim/tos.h:88:
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:96:10: warning: integer constant is too large for its type
In file included from /opt/tinyos-2.x/tos/lib/tossim/tos.h:88:
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c: In function `sim_ticks_per_sec':
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:96: warning: integer constant out of range
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c: In function `sim_run_next_event':
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:110: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:111: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:112: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:116: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:117: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:121: syntax error before `event'
/opt/tinyos-2.x/tos/lib/tossim/sim_tossim.c:126: syntax error before `event'
In file included from /opt/tinyos-2.x/tos/lib/tossim/TinySchedulerC.nc:39:
In component `SimSchedulerBasicP':
/opt/tinyos-2.x/tos/lib/tossim/SimSchedulerBasicP.nc: In function `sim_scheduler_event_init':
/opt/tinyos-2.x/tos/lib/tossim/SimSchedulerBasicP.nc:100: warning: assignment from incompatible pointer type
In file included from /opt/tinyos-2.x/tos/lib/tossim/MainC.nc:49,
from BlinkAppC.nc:45:
In component `SimMoteP':
/opt/tinyos-2.x/tos/lib/tossim/SimMoteP.nc: In function `sim_mote_enqueue_boot_event':
/opt/tinyos-2.x/tos/lib/tossim/SimMoteP.nc:179: warning: assignment from incompatible pointer type
In file included from /opt/tinyos-2.x/tos/lib/tossim/MainC.nc:64,
from BlinkAppC.nc:45:
In component `TossimActiveMessageP':
/opt/tinyos-2.x/tos/lib/tossim/TossimActiveMessageP.nc: In function `allocate_deliver_event':
/opt/tinyos-2.x/tos/lib/tossim/TossimActiveMessageP.nc:243: warning: assignment from incompatible pointer type
In file included from /opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncC.nc:53,
from /opt/tinyos-2.x/tos/chips/atm128/timer/Atm128AlarmAsyncC.nc:33,
from /opt/tinyos-2.x/tos/platforms/mica/AlarmCounterMilliP.nc:33,
from /opt/tinyos-2.x/tos/platforms/mica/sim/HilTimerMilliC.nc:41,
from /opt/tinyos-2.x/tos/system/TimerMilliP.nc:41,
from /opt/tinyos-2.x/tos/system/TimerMilliC.nc:40,
from BlinkAppC.nc:46:
In component `HplAtm128Timer0AsyncP':
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc: In function `allocate_compare':
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc:219: warning: assignment from incompatible pointer type
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc: In function `allocate_overflow':
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc:496: warning: assignment from incompatible pointer type
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc: In function `cancel_overflow':
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc:541: warning: assignment from incompatible pointer type
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc: In function `cancel_compare':
/opt/tinyos-2.x/tos/chips/atm128/timer/sim/HplAtm128Timer0AsyncP.nc:573: warning: assignment from incompatible pointer type
make: *** [sim-exe] Error 1

If I compile the same program with nesc 1.2.9 for simulation everything is okay. Seems that changes must made to the TinyOS source tree or the compiler is broken.

Discussion

  • David Gay

    David Gay - 2008-05-05

    Logged In: YES
    user_id=398311
    Originator: NO

    This should be fixed now (latest CVS). Please reopen if there are still problems...

    David Gay

     
  • David Gay

    David Gay - 2008-05-05
    • status: open --> closed-fixed
     
  • Christoph Tornau

    compiliation error for simulation

     
  • Christoph Tornau

    • status: closed-fixed --> open-fixed
     
  • Christoph Tornau

    Logged In: YES
    user_id=672026
    Originator: YES

    The fix doesn't work. The error becomes a different one. Please see the attached error.txt for details.

    Thank you very much for caring for the problem!
    File Added: error.txt

     
  • Christoph Tornau

    • status: open-fixed --> open-remind
     
  • David Gay

    David Gay - 2008-05-06

    Logged In: YES
    user_id=398311
    Originator: NO

    Can you attach the generated build/micaz/app.c file?

     
  • Christoph Tornau

    app.c file which has been generated by nesc and fails compiling by gcc

     
  • Christoph Tornau

    Logged In: YES
    user_id=672026
    Originator: YES

    Please find the app.c file attached.

    Christoph
    File Added: app.c

     
  • David Gay

    David Gay - 2008-05-06

    Logged In: YES
    user_id=398311
    Originator: NO

    Can you attach the generated build/micaz/app.c file?

     
  • Christoph Tornau

    Logged In: YES
    user_id=672026
    Originator: YES

    File is already attached. Please see attachments in the bug report at the section "Attached Files".

     
  • David Gay

    David Gay - 2008-05-06

    Logged In: YES
    user_id=398311
    Originator: NO

    Ok, it should hopefully work now. The bug was related to handling old-style function declarations (e.g. int blah();) - strangely your header files seem to be declaring malloc&co with old-style parameter lists. E.g., your app.c contains:
    # 23 "/usr/include/string.h" 3
    int memcmp(void);
    char *memcpy(void);

    char *memset(void);

    the bug was that that should've been
    int memcmp();
    char *memcpy();

    char *memset();

    Note that as far as I can tell, 1.2.9 had this same bug - did you change your header files since then? (and why are they old-style function declarations?)

     
  • Christoph Tornau

    Logged In: YES
    user_id=672026
    Originator: YES

    Hi David,

    thank you very much for the fix. The problem is solved now. Also the simulation compiles fine now. (I haven't tried to execute it yet).

    I use the nesc-compiler on a Windows Vista machine with Cygwin installed. Currently the following GCC version is installed (which is quite old but working with nesc 1.2.9 and now also with nesc 1.3alpha):

    Christoph@Fish /opt/tinyos-2.x/apps/Blink
    $ ncc --version
    ncc: 1.2.4
    nescc: 1.3.0alpha
    gcc: gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
    Copyright (C) 2004 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    Maybe it has to do with my old Gcc-version. The only thing I change switching from nesc 1.2.9 to nesc 1.3alpha is moving to the directory with the source code extracted from the stable release file or retrieved from the CVS and execute ./Bootstrap; ./configure; make; make install; That installs the version from the current source directory. No libraries are changed.

    Christoph

     
  • Christoph Tornau

    • status: open-remind --> closed-remind
     
  • David Gay

    David Gay - 2008-05-06

    Logged In: YES
    user_id=398311
    Originator: NO

    FWIW, I think the problem is related to how simulation invokes ncc (I need to bug the tossim people by the look of it) - they're telling ncc that the target is a micaz when compiling for simulation when the actual target is a PC. That's going to cause preprocessing problems (the PC's C libraries contain #ifdef's for symbols which are not set when the target is a micaz).

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks