Antonio:

 

There are a couple of issues here. First, you're compiling utime.c for
the intel platform and want to link the binary into an application for
the telos mote. You need to compile the C file with the msp430-gcc with
the -mmcu=msp430x1611 parameter.

 

The second problem is that you're trying to use gettimeofday, which is
POSIX specific. You will not be able to compile such code for the telos,
because msp430-libc doesn't support it. To get the local time in
milliseconds, use the LocalTime interface provided by HILTimerMilliC.

 

Janos

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
antonio gonga
Sent: Tuesday, April 29, 2008 4:53 AM
To: TINYOS
Subject: [Tinyos-help] C function in a nesC Application

 

Dear all, 
I'm having so many problems to embed a C code in a nesC Application.
File: utime.h
unsigned long getTime();
----------------------
File: utime.c
#include<stdlib.h>
#include<sys/time.h>

struct timeval tm;
unsigned long getTime(){
  gettimeofday(&tm, NULL);
  return tm.tv_usec;
}
----------------
Makefile:
COMPONENT = MyAPP
BUILD_EXTRA_DEPS = utime.o
LDFLAGS = utime.o   //I'm not sure about this flag,

utime.o: utime.c utime.h
        gcc -g -c utime.c
-------------------------
MyApp.nc
#include "utime.h"
module MyAppP{
}implementation{

}

Compilation Error:
mkdir -p build/telosb
gcc -g -c utime.c
    compiling SSIC to a telosb binary
ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow
-DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -target=telosb
-fnesc-cfile=build/telosb/app.c -board= -DIDENT_PROGRAM_NAME=\"SSIC\"
-DIDENT_USER_ID=\"gonga\" -DIDENT_HOSTNAME=\"gongabgTOS\"
-DIDENT_USER_HASH=0x56b2c591L -DIDENT_UNIX_TIME=0x4816edcaL
-DIDENT_UID_HASH=0x00076286L  SSIC.nc -lm utime.o
msp430-ld: utime.o: Relocations in generic ELF (EM: 3)
msp430-ld: utime.o: Relocations in generic ELF (EM: 3)
msp430-ld: utime.o: Relocations in generic ELF (EM: 3)
msp430-ld: utime.o: Relocations in generic ELF (EM: 3)
msp430-ld: utime.o: Relocations in generic ELF (EM: 3)
msp430-ld: utime.o: Relocations in generic ELF (EM: 3)
utime.o: could not read symbols: File in wrong format
make: *** [exe0] Error 1







________________________________

Get news, entertainment and everything you care about at Live.com. Check
it out! <http://www.live.com/getstarted.aspx%20> 

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to