Daniel,
In general, TOSSIM doesn't simulate all mote hardware. There are
functions which have not been implemented, or been implemented
differently in simulation than in the real hardware. (I would bet one
such case is here:
/opt/tinyos-2.x/tos/chips/atm128/adc/Atm128AdcC.nc:65) One example is
the printf function of tinyos. In hardware, there is a buffer that
holds the printf string, and only automatically flushes it when the
buffer is more than half full. If you want an immediate flush, you need
to use the function printfflush(). In TOSSIM, printf always flushes
immediately, and printfflush is not defined.
I found that a lot of times, i had to write a lot of compiler if
statements with:
#ifndef <Some custom define stating that we are compiling for TOSSIM>
...
#endif
or
#ifndef ...
...
#else
...
#endif
If you want to work with both the real hardware and tossim.
Just a word of warning, do not use "TOSSIM" as the define variable
because it can muck up the build in other places that use it for a
different purpose.
-Paul
Daniel Garcia Aubert wrote:
Hi,
I ´m doing a job in TinyOS 2.x installed Xubuntos. I am working on
MicaZ platform that uses the component TempC MTS300 sensor, but when
compiling to simulate "make micaz sim " gives the following error:
$ make micaz sim
mkdir -p build/micaz
placing object files in build/micaz
writing XML schema to app.xml
compiling SenseHopAppC to object file sim.o
ncc -c -shared -fPIC -o build/micaz/sim.o -g -O0 -tossim
-fnesc-nido-tosnodes=1000 -fnesc-simulate
-fnesc-nido-motenumber=sim_node\(\) -finline-limit=100000 -Wall
-Wshadow -Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c
-board=mts300 -DIDENT_PROGRAM_NAME=\"SenseHopAppC\"
-DIDENT_USER_ID=\"sueko\" -DIDENT_HOSTNAME=\"sueko-desktop\"
-DIDENT_USER_HASH=0xa8ec4319L -DIDENT_UNIX_TIME=0x4b031de6L
-DIDENT_UID_HASH=0xe92f65e4L -Wno-nesc-data-race SenseHopAppC.nc
-fnesc-dump=components -fnesc-dump=variables -fnesc-dump=constants
-fnesc-dump=typedefs -fnesc-dump=interfacedefs -fnesc-dump=tags
-fnesc-dumpfile=app.xml
In component `Atm128AdcC':
/opt/tinyos-2.x/tos/chips/atm128/adc/Atm128AdcC.nc:65: no match
make: *** [sim-exe] Error 1
But if I compile with "make micaz":
$ make micaz
mkdir -p build/micaz
compiling SenseHopAppC to a micaz binary
ncc -o build/micaz/main.exe -Os -finline-limit=100000 -Wall -Wshadow
-Wnesc-all -target=micaz -fnesc-cfile=build/micaz/app.c -board=mts300
-DIDENT_PROGRAM_NAME=\"SenseHopAppC\" -DIDENT_USER_ID=\"sueko\"
-DIDENT_HOSTNAME=\"sueko-desktop\" -DIDENT_USER_HASH=0xa8ec4319L
-DIDENT_UNIX_TIME=0x4b03110cL -DIDENT_UID_HASH=0xcb64349dL
-fnesc-dump=wiring -fnesc-dump='interfaces(!abstract())'
-fnesc-dump='referenced(interfacedefs, components)'
-fnesc-dumpfile=build/micaz/wiring-check.xml SenseHopAppC.nc -lm
SenseHopC.nc: In function `SenseHopC$Receive$receive':
SenseHopC.nc:74: warning: unused variable `valor'
compiled SenseHopAppC to build/micaz/main.exe
13268 bytes in ROM
316 bytes in RAM
avr-objcopy --output-target=srec build/micaz/main.exe
build/micaz/main.srec
avr-objcopy --output-target=ihex build/micaz/main.exe
build/micaz/main.ihex
writing TOS image
The same occurs with the example
"/apps/tests/mts300/PhotoTemp/Oscilloscope"
Do I have a configuration problem?
Thanks and regards.
--
Daniel García Aubert
Ingeniero Técnico en Informática de Gestión.
Universidad Carlos III de Madrid.
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help