[Contiki-developers] How to debug in Cooja

1,981 views
Skip to first unread message

Sergio Valcarcel

unread,
Oct 19, 2011, 4:34:54 AM10/19/11
to Contiki developer mailing list
Hi,

Is there any way to debug in Cooja, accessing the variables in the code?

The msp_code_watcher plugin does not work, I have seen an email suggesting a patch, but them another mail says it does not allow breakpoints.

Now, I am just changing the source with extensive printfs to see what happens in the simulation, but to be able to access the variables in running time would be much more efficient.

Please, could you tell me different strategies and even some steps "for-dummies" for debugging in Cooja?

Thank you very much!!!
Sergio

cyril auburtin

unread,
Oct 19, 2011, 5:23:23 AM10/19/11
to Contiki developer mailing list
to me, best ways is to use either minimal-net outside of Cooja (breakpoints possible) , or cooja targets where printf code size will not matter but no code watcher, I don't know if mspcodewatcher would be compatible, not even tried


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Contiki-developers mailing list
Contiki-d...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/contiki-developers

Sergio Valcarcel

unread,
Oct 19, 2011, 6:49:44 AM10/19/11
to Contiki developer mailing list
Hi Ciryl,

Thanks so much for the suggestion! 
I have found this website in the Contiki wiki explaining how to set up RPL over minimal-net and it looks very good:

But since I want to see the "network behavior" with many nodes, the best for us would be to simulate in Cooja. 
I remember that you were able to workaround the lack of uart in the Contiki motes. After checking the thread again, at the end you summarize everything with:

you just have to add in cooja/dev/rs232.c
#include "dev/slip.h"
void
slip_arch_writeb(unsigned char c)
{
  simlog_char(c);
}

void
slip_arch_init(unsigned long ubr)
{
rs232_set_input(slip_input_byte);
}

But you mentioned that while the RPL border router works, the udp-sender won't. Were you able to make the whole RPL work?

Thanks!!
Sergio

cyril auburtin

unread,
Oct 20, 2011, 9:37:13 AM10/20/11
to Contiki developer mailing list
cooja.diff

hope Contiki applies this soon


cooja.diff

cyril auburtin

unread,
Oct 20, 2011, 9:44:39 AM10/20/11
to Contiki developer mailing list
wrong sense


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Ciosco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
cooja.diff

Sergio Valcarcel

unread,
Oct 20, 2011, 1:10:42 PM10/20/11
to Contiki developer mailing list
It looks great!! 
Please, I am not very confidence with the patch command, could you tell me where to execute the patch and with which options?

Thanks!!!!!
Sergio

Sergio Valcarcel

unread,
Oct 21, 2011, 10:16:44 AM10/21/11
to Contiki developer mailing list
Hi Cyril,

Thank you very much for the file!

I patched it creating two directories with contiki, a and b, into a parent directory. Then I patched using "patch -p0 <  cooja.diff" and it did not display any error.

Then I created a new simulation. But when I create the contiki motes with the slip-bridge.c firmware, it complains for some warnings and errors:

> make slip-bridge.cooja TARGET=cooja 
....
gcc -DUIP_CONF_IPV6_RPL -DPROJECT_CONF_H=\"project-conf.h\" -DWEBSERVER=1 -DCONTIKI=1 -DCONTIKI_TARGET_COOJA=1 -DUIP_CONF_IPV6=1 -I'/usr/lib/jvm/java-6-sun/include' -I'/usr/lib/jvm/java-6-sun/include/linux' -fno-builtin-printf -fPIC -Wall -g -I/usr/local/include -DCLASSNAME=Lib1 -DWITH_UIP6=1  -I. -I../../../platform/cooja/. -I../../../platform/cooja/dev -I../../../platform/cooja/lib -I../../../platform/cooja/sys -I../../../platform/cooja/cfs -I../../../platform/cooja/net -I../../../core/dev -I../../../core/lib -I../../../core/net -I../../../core/net/mac -I../../../core/net/rime -I../../../core/net/rpl -I../../../core/sys -I../../../core/cfs -I../../../core/ctk -I../../../core/lib/ctk -I../../../core/loader -I../../../core/. -DCONTIKI_VERSION_STRING=\"Contiki-2.5-1439-g431d536\" -MMD -c ../../../platform/cooja/net/uip-driver.c -o obj_cooja/uip-driver.o
../../../platform/cooja/net/uip-driver.c: In function 'init':
../../../platform/cooja/net/uip-driver.c:67:3: warning: passing argument 1 of 'tcpip_set_outputfunc' from incompatible pointer type
../../../core/./net/tcpip.h:345:6: note: expected 'u8_t (*)(struct uip_lladdr_t *)' but argument is of type 'uint8_t (*)(void)'
ar rcf obj_cooja/mtype337.a obj_cooja/rimeaddr.o obj_cooja/rime.o obj_cooja/timesynch.o obj_cooja/rimestats.o obj_cooja/announcement.o obj_cooja/polite-announcement.o obj_cooja/broadcast-announcement.o obj_cooja/broadcast.o obj_cooja/stbroadcast.o obj_cooja/unicast.o obj_cooja/stunicast.o obj_cooja/runicast.o obj_cooja/abc.o obj_cooja/rucb.o obj_cooja/polite.o obj_cooja/ipolite.o obj_cooja/netflood.o obj_cooja/multihop.o obj_cooja/rmh.o obj_cooja/trickle.o obj_cooja/mesh.o obj_cooja/route.o obj_cooja/route-discovery.o obj_cooja/collect.o obj_cooja/collect-neighbor.o obj_cooja/neighbor-discovery.o obj_cooja/collect-link-estimate.o obj_cooja/rudolph0.o obj_cooja/rudolph1.o obj_cooja/rudolph2.o obj_cooja/chameleon.o obj_cooja/channel.o obj_cooja/chameleon-raw.o obj_cooja/chameleon-bitopt.o obj_cooja/cxmac.o obj_cooja/xmac.o obj_cooja/nullmac.o obj_cooja/lpp.o obj_cooja/frame802154.o obj_cooja/sicslowmac.o obj_cooja/nullrdc.o obj_cooja/nullrdc-noframer.o obj_cooja/mac.o obj_cooja/framer-nullmac.o obj_cooja/framer-802154.o obj_cooja/csma.o obj_cooja/contikimac.o obj_cooja/phase.o obj_cooja/rpl.o obj_cooja/rpl-dag.o obj_cooja/rpl-icmp6.o obj_cooja/rpl-timers.o obj_cooja/rpl-of-etx.o obj_cooja/process.o obj_cooja/procinit.o obj_cooja/autostart.o obj_cooja/elfloader.o obj_cooja/profile.o obj_cooja/timetable.o obj_cooja/timetable-aggregate.o obj_cooja/compower.o obj_cooja/serial-line.o obj_cooja/memb.o obj_cooja/mmem.o obj_cooja/timer.o obj_cooja/list.o obj_cooja/etimer.o obj_cooja/ctimer.o obj_cooja/energest.o obj_cooja/rtimer.o obj_cooja/stimer.o obj_cooja/print-stats.o obj_cooja/ifft.o obj_cooja/crc16.o obj_cooja/random.o obj_cooja/checkpoint.o obj_cooja/ringbuf.o obj_cooja/netstack.o obj_cooja/uip-debug.o obj_cooja/packetbuf.o obj_cooja/queuebuf.o obj_cooja/packetqueue.o obj_cooja/uip6.o obj_cooja/tcpip.o obj_cooja/psock.o obj_cooja/uip-udp-packet.o obj_cooja/uip-split.o obj_cooja/resolv.o obj_cooja/tcpdump.o obj_cooja/uiplib.o obj_cooja/simple-udp.o obj_cooja/uip-icmp6.o obj_cooja/uip-nd6.o obj_cooja/uip-packetqueue.o obj_cooja/sicslowpan.o obj_cooja/neighbor-attr.o obj_cooja/neighbor-info.o obj_cooja/uip-ds6.o obj_cooja/mt.o obj_cooja/nullradio.o obj_cooja/simEnvChange.o obj_cooja/cooja_mt.o obj_cooja/cooja_mtarch.o obj_cooja/rtimer-arch.o obj_cooja/slip.o obj_cooja/watchdog.o obj_cooja/beep.o obj_cooja/button-sensor.o obj_cooja/ip.o obj_cooja/leds-arch.o obj_cooja/moteid.o obj_cooja/pir-sensor.o obj_cooja/rs232.o obj_cooja/vib-sensor.o obj_cooja/clock.o obj_cooja/log.o obj_cooja/cfs-cooja.o obj_cooja/cooja-radio.o obj_cooja/sensors.o obj_cooja/leds.o obj_cooja/symbols.o obj_cooja/uip-driver.o 
Redefining printf
objcopy --redefine-sym printf=log_printf slip-bridge.co;   objcopy --redefine-sym printf=log_printf obj_cooja/mtype337.o;   objcopy --redefine-sym printf=log_printf obj_cooja/slip-bridge.o;   objcopy --redefine-sym printf=log_printf obj_cooja/httpd-simple.o;   objcopy --redefine-sym printf=log_printf obj_cooja/mtype337.a;
objcopy --redefine-sym puts=log_puts slip-bridge.co;   objcopy --redefine-sym puts=log_puts obj_cooja/mtype337.o;   objcopy --redefine-sym puts=log_puts obj_cooja/slip-bridge.o;   objcopy --redefine-sym puts=log_puts obj_cooja/httpd-simple.o;   objcopy --redefine-sym puts=log_puts obj_cooja/mtype337.a;
objcopy --redefine-sym putchar=log_putchar slip-bridge.co;   objcopy --redefine-sym putchar=log_putchar obj_cooja/mtype337.o;   objcopy --redefine-sym putchar=log_putchar obj_cooja/slip-bridge.o;   objcopy --redefine-sym putchar=log_putchar obj_cooja/httpd-simple.o;   objcopy --redefine-sym putchar=log_putchar obj_cooja/mtype337.a;
gcc -I'/usr/lib/jvm/java-6-sun/include' -I'/usr/lib/jvm/java-6-sun/include/linux' -shared -Wl,-Map=obj_cooja/mtype337.map -o obj_cooja/mtype337.cooja slip-bridge.co obj_cooja/mtype337.o obj_cooja/slip-bridge.o obj_cooja/httpd-simple.o obj_cooja/mtype337.a 
obj_cooja/slip-bridge.o:(.data.rel.ro.local+0x0): multiple definition of `rpl_interface'
slip-bridge.co:(.data.rel.ro.local+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [obj_cooja/mtype337.cooja] Error 1
Process returned error code 2

What do you think? Have I done something wrong?

Thanks!!
Sergio

cyril auburtin

unread,
Oct 21, 2011, 11:22:41 AM10/21/11
to Contiki developer mailing list
Can you clean before and retry?


Take a complimentary Learning@Cisco Self-Assessment and learn

Sergio Valcarcel

unread,
Oct 21, 2011, 12:42:39 PM10/21/11
to Contiki developer mailing list
Hi,

I made clean and also remove the obj_cooja folder but I got the same error.

What could be the error caused by?

Thanks so much for your support!
Sergio

cyril auburtin

unread,
Oct 21, 2011, 1:06:05 PM10/21/11
to Contiki developer mailing list
why don't you build
make border-router.cooja TARGET=cooja?

well myself I have some frequent crashes of cooja after several minutes when I use cooja target

see the log enclosed, 
I would like to know the reason


hs_err_pid15207.log

Sergio Valcarcel

unread,
Oct 24, 2011, 6:48:32 AM10/24/11
to Contiki developer mailing list
Hi, thanks Cyril!!

Great! I am able to compile now... :-)
However, why does not it work when I try to compile directly from Cooja, when creating the mote type? 

I am reading and trying to follow the patch and I am wandering what  the minimum changes would be necessary to make the rpl-collect work in a contiki mote.
Please, could you advise me through the process to be able to simulate an rpl-collect example with no-memory-limited contiki motes? I mean, how can I create an uart so the udp-sender and udp-sink do not complain?

Thanks so much!!!
Sergio

Ilias Rinis

unread,
Oct 25, 2011, 3:59:47 AM10/25/11
to Contiki developer mailing list
Hello all,

I am having similar issues while trying to use contiki mote types for
rpl specific examples. I managed to configure the motes so that they
compile and run properly, but I did this only by bypassing the UART
input configuration.

Specifically, I defined BAUD2UBR(x) similarly to Cyril's patch, and
also I skipped the configuration of the input for UART
uart1_set_input(serial_line_input_byte), since there is no
implementation for this mote type. This is enough to compile and run
the motes, but there is still something missing with UART. This
configuration seems to make motes work, but there are problems with
their communication. For example, in the rpl-udp case, the non-sink
mote does not receive any data.

It seems that these problems are related to uart, and, since there is
not an implementation for contiki motes, how could this be fixed?

Thank you all!
Cheers,
Ilias

cyril auburtin

unread,
Oct 25, 2011, 4:32:28 AM10/25/11
to Contiki developer mailing list
for me, with this patch all examples/rpl-*  work
Are you using the lastest Contiki version and well cleaned compiled objects?


Sergio Valcarcel

unread,
Oct 25, 2011, 3:52:07 PM10/25/11
to Contiki developer mailing list
Hi Cyril,

I downloaded the last snapshot and have patched the files udp-sender.c and udp-sink.c as defining BAUD2UBR:

#if defined (CONTIKI_TARGET_COOJA)
#define BAUD2UBR(x) x
#else
#include "dev/uart1.h"
#endif

I also commented the "uart0/1_set_input" in the "collect_common_net_init".

When I try to compile from the shell with "make TARGET=cooja" it gives a lot of errors as:
ld   udp-sender.co obj_cooja/collect-common.o contiki-cooja.a  -o udp-sender.cooja
ld: warning: cannot find entry symbol _start; defaulting to 00000000004000e8
udp-sender.co: In function `collect_common_send':
/home/love/Comonsens/2012-01/Contiki_OS_tests/mod_last_contiki/a/examples/ipv6/rpl-collect/udp-sender.c:129: undefined reference to `memset'
/home/love/Comonsens/2012-01/Contiki_OS_tests/mod_last_contiki/a/examples/ipv6/rpl-collect/udp-sender.c:169: undefined reference to `__stack_chk_fail'
udp-sender.co: In function `set_global_address':
/home/love/Comonsens/2012-01/Contiki_OS_tests/mod_last_contiki/a/examples/ipv6/rpl-collect/udp-sender.c:217: undefined reference to `__stack_chk_fail'
obj_cooja/collect-common.o: In function `strtolong':
... and many more ... up to
contiki-cooja.a(neighbor-attr.o): In function `neighbor_attr_set_data':
/home/love/Comonsens/2012-01/Contiki_OS_tests/mod_last_contiki/a/examples/ipv6/rpl-collect/../../../core/net/neighbor-attr.c:193: undefined reference to `memcpy'
contiki-cooja.a(cooja_mtarch.o): In function `cooja_mtarch_start':
/home/love/Comonsens/2012-01/Contiki_OS_tests/mod_last_contiki/a/examples/ipv6/rpl-collect/../../../platform/cooja/sys/cooja_mtarch.c:93: undefined reference to `memset'
make: *** [udp-sender.cooja] Error 1


However, when I use the command you suggested "make udp-sender.cooja TARGET=cooja" it almost does not complain. Only some warnings at the end, like:
../../../platform/cooja/dev/rs232.c:75:3: warning: implicit declaration of function 'simlog_char'
../../../platform/cooja/cfs/cfs-cooja.c:105:25: warning: implicit declaration of function 'printf'
... or 
../../../platform/cooja/net/uip-driver.c:67:3: warning: passing argument 1 of 'tcpip_set_outputfunc' from incompatible pointer type
../../../core/./net/tcpip.h:345:6: note: expected 'u8_t (*)(struct uip_lladdr_t *)' but argument is of type 'uint8_t (*)(void)'

So I am able to create the motes and start the simulation. However, immediately it stops launching an exception:
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:757)
at se.sics.cooja.SectionMoteMemory.getMemorySegment(SectionMoteMemory.java:84)
at se.sics.cooja.SectionMoteMemory.getByteValueOf(SectionMoteMemory.java:263)
at se.sics.cooja.contikimote.interfaces.ContikiRS232.doActionsAfterTick(ContikiRS232.java:92)
at se.sics.cooja.MoteInterfaceHandler.doActiveActionsAfterTick(MoteInterfaceHandler.java:309)
at se.sics.cooja.contikimote.ContikiMote.execute(ContikiMote.java:157)
at se.sics.cooja.motes.AbstractWakeupMote$1.execute(AbstractWakeupMote.java:48)
at se.sics.cooja.Simulation.run(Simulation.java:270)
at java.lang.Thread.run(Thread.java:679)


Am I missing anything?
Please, what am I doing wrong? 
Could you share your examples/ipv6/rpl-collect directory?

Thanks!!!!!!
Sergio

cyril auburtin

unread,
Oct 26, 2011, 4:58:02 AM10/26/11
to Contiki developer mailing list
right I just used rpl-udp and rpl-border-router, forgot rpl-collect
Of course don't comment the set_input method, you need to replace it by the rs232_set_input of platform/cooja/dev/rs232
and you have many compilation problems, it doesn't find memset or memcpy so check the includes


Sergio Valcarcel

unread,
Oct 26, 2011, 7:55:08 AM10/26/11
to Contiki developer mailing list
Hi Cyril, 
Thanks so much for your support!!!

I substituted the uart_set_init for the rs232_set_init.

I am able to compile both udp-sender and udp-sink from cooja, i.e. with "make rpl-collect TARGET=cooja". However, when I try to compile from the shell with "make TARGET=cooja" all those memcpy and memset undefined reference errors appear, both in rpl-collect and in rpl-border-router.

But, even compiling and creating the motes in cooja, only 5  seconds after starting the simulation a java exception is thrown:
java.lang.ArrayIndexOutOfBoundsException: -1111940991
at java.lang.Integer.getChars(Integer.java:368)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:615)
at java.lang.StringBuilder.append(StringBuilder.java:229)
at se.sics.cooja.interfaces.RimeAddress.getAddressString(RimeAddress.java:107)
at se.sics.cooja.interfaces.RimeAddress$1.execute(RimeAddress.java:76)
at se.sics.cooja.Simulation.run(Simulation.java:270)
at java.lang.Thread.run(Thread.java:679)
 
It may be worthy to remark some warnings that appear during compilation (while creating the motes). 
They appear the same both in udp-sender.c and udp-sink.c. The log is OK up to 'rs232.c: slip_arch_writeb'cfs-cooja.c: 'cfs_write' and uip-driver.c: 'init':

gcc -DUIP_CONF_IPV6_RPL -DCONTIKI=1 -DCONTIKI_TARGET_COOJA=1 -DUIP_CONF_IPV6=1 -I'/usr/lib/jvm/java-6-sun/include' -I'/usr/lib/jvm/java-6-sun/include/linux' -fno-builtin-printf -fPIC -Wall -g -I/usr/local/include -DCLASSNAME=Lib3 -DWITH_UIP6=1  -I. -I../../../platform/cooja/. -I../../../platform/cooja/dev -I../../../platform/cooja/lib -I../../../platform/cooja/sys -I../../../platform/cooja/cfs -I../../../platform/cooja/net -I../../../core/dev -I../../../core/lib -I../../../core/net -I../../../core/net/mac -I../../../core/net/rime -I../../../core/net/rpl -I../../../core/sys -I../../../core/cfs -I../../../core/ctk -I../../../core/lib/ctk -I../../../core/loader -I../../../core/. -I../../../apps/powertrace -I../../../apps/collect-view -MMD -c ../../../platform/cooja/dev/rs232.c -o obj_cooja/rs232.o
../../../platform/cooja/dev/rs232.c: In function 'slip_arch_writeb':
../../../platform/cooja/dev/rs232.c:75:3: warning: implicit declaration of function 'simlog_char'

gcc -DUIP_CONF_IPV6_RPL -DCONTIKI=1 -DCONTIKI_TARGET_COOJA=1 -DUIP_CONF_IPV6=1 -I'/usr/lib/jvm/java-6-sun/include' -I'/usr/lib/jvm/java-6-sun/include/linux' -fno-builtin-printf -fPIC -Wall -g -I/usr/local/include -DCLASSNAME=Lib3 -DWITH_UIP6=1  -I. -I../../../platform/cooja/. -I../../../platform/cooja/dev -I../../../platform/cooja/lib -I../../../platform/cooja/sys -I../../../platform/cooja/cfs -I../../../platform/cooja/net -I../../../core/dev -I../../../core/lib -I../../../core/net -I../../../core/net/mac -I../../../core/net/rime -I../../../core/net/rpl -I../../../core/sys -I../../../core/cfs -I../../../core/ctk -I../../../core/lib/ctk -I../../../core/loader -I../../../core/. -I../../../apps/powertrace -I../../../apps/collect-view -MMD -c ../../../platform/cooja/cfs/cfs-cooja.c -o obj_cooja/cfs-cooja.o
../../../platform/cooja/cfs/cfs-cooja.c: In function 'cfs_write':
../../../platform/cooja/cfs/cfs-cooja.c:105:25: warning: implicit declaration of function 'printf'

gcc -DUIP_CONF_IPV6_RPL -DCONTIKI=1 -DCONTIKI_TARGET_COOJA=1 -DUIP_CONF_IPV6=1 -I'/usr/lib/jvm/java-6-sun/include' -I'/usr/lib/jvm/java-6-sun/include/linux' -fno-builtin-printf -fPIC -Wall -g -I/usr/local/include -DCLASSNAME=Lib3 -DWITH_UIP6=1  -I. -I../../../platform/cooja/. -I../../../platform/cooja/dev -I../../../platform/cooja/lib -I../../../platform/cooja/sys -I../../../platform/cooja/cfs -I../../../platform/cooja/net -I../../../core/dev -I../../../core/lib -I../../../core/net -I../../../core/net/mac -I../../../core/net/rime -I../../../core/net/rpl -I../../../core/sys -I../../../core/cfs -I../../../core/ctk -I../../../core/lib/ctk -I../../../core/loader -I../../../core/. -I../../../apps/powertrace -I../../../apps/collect-view -MMD -c ../../../platform/cooja/net/uip-driver.c -o obj_cooja/uip-driver.o
../../../platform/cooja/net/uip-driver.c: In function 'init':
../../../platform/cooja/net/uip-driver.c:67:3: warning: passing argument 1 of 'tcpip_set_outputfunc' from incompatible pointer type
../../../core/./net/tcpip.h:345:6: note: expected 'u8_t (*)(struct uip_lladdr_t *)' but argument is of type 'uint8_t (*)(void)'


Could you find something I am still missing?

Thanks!!!
Sergio

Sergio Valcarcel

unread,
Oct 26, 2011, 11:45:43 AM10/26/11
to Contiki developer mailing list
Hi Cyril!!!!

It works perfectly!!! At least in instant contiki and during the few minutes that it's been running!!

I do not know why, but in the instant contiki works fine, while in my Ubuntu 11.04 does not. Perhaps it is related also to the fact that I do not see anything in my Collect View either, while the instant contiki shows all the graphs.

Thanks so much for your support!!

Best regards,
Sergio

Moritz Struebe

unread,
Oct 26, 2011, 11:56:08 AM10/26/11
to contiki-d...@lists.sourceforge.net
On 2011-10-26 17:45, Sergio Valcarcel wrote:
> I do not know why, but in the instant contiki works fine, while in my
> Ubuntu 11.04 does not.

Do you use sun-java or open-jdk? (There's an ppa for sun-java)

Cheers
Morty

--
Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter)
Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme)
Friedrich-Alexander-Universität Erlangen-Nürnberg
Martensstr. 1
91058 Erlangen

Tel : +49 9131 85-25419
Fax : +49 9131 85-28732
eMail : str...@informatik.uni-erlangen.de
WWW : http://www4.informatik.uni-erlangen.de/~morty


cyril auburtin

unread,
Oct 26, 2011, 11:58:27 AM10/26/11
to Contiki developer mailing list
well I also have sometimes some crashes, on ubuntu , probably because jni doesn't like some bad C operations
when cooja crashes, does Cooja closes and it reports an error log like the one I showed previously, in this case, you can find the function that causes the error 
or does it block on Cooja


Sergio Valcarcel

unread,
Oct 26, 2011, 12:53:33 PM10/26/11
to Contiki developer mailing list
Hi Morty,
I have been using sun-java installed directly from apt-get. Should I change to open-jdk (I am trying but apt-get does not find it now...)? 

Cyril, it happens both. When running the udp-sender it throws an NoSuchElementException after 5 seconds. It enter the ContikiRS232.java many times (I have checked it with a println) and at 5 seconds it throws the exception inside Cooja, indeed Cooja is not closed.
However, when I run the udp-sink it crashes completely and an error log is generated.

Thanks!
Sergio

cyril auburtin

unread,
Oct 26, 2011, 1:31:57 PM10/26/11
to Contiki developer mailing list
I have open-jdk, which one is advised? java-sun or open-jdk? is it java-sun on instant-contiki?

when Cooja completely crashes
see the error log in console
in "problematic frame" see the instruction number
and then go in the directory of build

and do "objdump -S ***.cooja"
search the instruction number in it and you can fin to which function it is linked


Sergio Valcarcel

unread,
Oct 26, 2011, 2:27:20 PM10/26/11
to Contiki developer mailing list
Hi Cyril, in the log says:

# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0-b17 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x4576c7]  frame::sender(RegisterMap*) const+0x237
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Then... below... I can find:
Stack: [0x00007f6142976000,0x00007f6142a77000],  sp=0x00007f6142a75230,  free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x4576c7]  frame::sender(RegisterMap*) const+0x237
V  [libjvm.so+0x7770e1]  OptoRuntime::handle_exception_C(JavaThread*)+0xd1

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
C  [mtype281.cooja+0x1c9c1]  radio_read+0xa5

[error occurred during error reporting (printing Java stack), id 0xb]


So, when I go to the objdumed file I find:
000000000001c9c1 <radio_send>:
/*---------------------------------------------------------------------------*/
static int
radio_send(const void *payload, unsigned short payload_len)
{
   1c9c1:       55                      push   %rbp
   1c9c2:       48 89 e5                mov    %rsp,%rbp
   1c9c5:       48 83 ec 20             sub    $0x20,%rsp
   1c9c9:       48 89 7d e8             mov    %rdi,-0x18(%rbp)
   1c9cd:       89 f0                   mov    %esi,%eax
   1c9cf:       66 89 45 e4             mov    %ax,-0x1c(%rbp)

Does it mean anything for you?


Thanks!
Sergio

PS> let me know if you want me to send you the log and objdumped files.
PS2> Sorry for forwarding this part of the email twice, it was quoted and hidden in the first one.




On Wed, Oct 26, 2011 at 8:15 PM, Sergio Valcarcel <serte...@gmail.com> wrote:
Hi Morty,

I have tried with openjdk-6, openjdk-7, java-sun-6 and java-sun-7. And all of them throws the exception with udp-sender and crashes with udp-sink.
If I simulate only one udp-sender, it throws the exception after 5 seconds but them it allows to run. :-!? If I try the same with many of those nodes and I try to run after the first exception it throws the some more exception a few times and then crashes.

Cyril, in the log says:
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.0-b17 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x4576c7]  frame::sender(RegisterMap*) const+0x237
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again

Then... below... I can find:
Stack: [0x00007f6142976000,0x00007f6142a77000],  sp=0x00007f6142a75230,  free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x4576c7]  frame::sender(RegisterMap*) const+0x237
V  [libjvm.so+0x7770e1]  OptoRuntime::handle_exception_C(JavaThread*)+0xd1

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
C  [mtype281.cooja+0x1c9c1]  radio_read+0xa5

[error occurred during error reporting (printing Java stack), id 0xb]


So, when I go to the objdumed file I find:
000000000001c9c1 <radio_send>:
/*---------------------------------------------------------------------------*/
static int
radio_send(const void *payload, unsigned short payload_len)
{
   1c9c1:       55                      push   %rbp
   1c9c2:       48 89 e5                mov    %rsp,%rbp
   1c9c5:       48 83 ec 20             sub    $0x20,%rsp
   1c9c9:       48 89 7d e8             mov    %rdi,-0x18(%rbp)
   1c9cd:       89 f0                   mov    %esi,%eax
   1c9cf:       66 89 45 e4             mov    %ax,-0x1c(%rbp)

Does it mean anything for you?


Thanks!
Sergio

PS> let me know if you want me to send you the log and objdumped files.

Sergio Valcarcel

unread,
Oct 26, 2011, 2:46:27 PM10/26/11
to Contiki developer mailing list
Hi Morty

I have tried with openjdk-6, openjdk-7, java-sun-6 and java-sun-7. And all of them throws the exception with udp-sender and crashes with udp-sink.

Thanks!
Sergio 

PS> I had the idea of attaching the log and dumped files and SourceForge has rejected the mail for being too big, so I am sending this mail a few times because it stills send me notifications of rejected. 


2011/10/26 Moritz Struebe <Moritz....@informatik.uni-erlangen.de>

cyril auburtin

unread,
Oct 26, 2011, 3:40:02 PM10/26/11
to Contiki developer mailing list
you have a 64bit pc?
probably why you have problems where I don't (ubuntu 32-bit), or instant-contiki (32 bit also)

Ilias Rinis

unread,
Nov 8, 2011, 9:39:09 AM11/8/11
to Contiki developer mailing list
Hello all,

after managing finally to make Contiki motes work with RPL, I have
been trying to run the rpl-collect example, but unsuccessfully so
far... The problem is that while everything is running properly,
messages sent to the sink are not always delivered, and thus the test
fails. As an example, in the end the script out put looks like this
for some nodes:

Node 5 received: _1__1_1111 hops:_1__1_1111

I have tried various configurations of the network stack, but none
seems to work properly. For example:
Network sicslowpan
Framer 802154
RDC contikimac
MAC csma
Cooja radio

I have tried changing all of these to null drivers or even cxmac, but
with no success; every different configuration has a different effect
on how many messages are successfully delivered, but even this is not
stable per configuration.

Has anybody found a proper configuration to use with contiki motes?
What is the best match for Cooja radio? With sky motes and cc2420
radio, the above configuration works perfectly...This is on a clean
version of Contiki, but with the necessary configuration changes in
order to run RPL, as mentioned here in the same post.

> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Contiki-developers mailing list
> Contiki-d...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/contiki-developers
>
>

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1

Sergio Valcarcel

unread,
Nov 8, 2011, 10:07:15 AM11/8/11
to Contiki developer mailing list
Hello Cyril,

I may have not noticed. But after applying your patch to a 32bit Instant Contiki the RPL collect example works fine. We have not tested thoroughly but it seems to deliver all the packets. As we are just debugging the application we content with a small network of 4 nodes and a two hops path.

Which parameters you are using (num of nodes, length of path, num of packets, period, etc.) could influence packet lost?
I think we can not probably help quite much since we blindly used the patch and workaround you discovered, but if we can do something just let us know.

Cheers!
Sergio

Ilias Rinis

unread,
Nov 8, 2011, 10:17:25 AM11/8/11
to Contiki developer mailing list
Hello Sergio,

thanks for your answer! (although I am not Cyril, but still :) )

For this test I am using the simulation found under
contiki/tools/cooja/contiki_tests but a bit transformed for contiki
mote types. This example consists of 25 motes, the sink waits to
receive 10 packets from each node, and the longest path consists of 3
hops.

I have not been using Cyril's patch though, but since you suggest this
I will try...However, I studied it and my configuration looks
similar...Thanks a lot for your feedback!

Cheers!
Ilias

cyril auburtin

unread,
Nov 8, 2011, 10:50:01 AM11/8/11
to Contiki developer mailing list
I have used default RPL parameters
but concerning packet lost, I think you can change this in simulation vizualizer, right-click, change transmission range, or change tx ratio


Sergio Valcarcel

unread,
Nov 8, 2011, 2:41:37 PM11/8/11
to Contiki developer mailing list
Hello,

I was mixed up with my mail inbox, and I read Cyril in the top of the mail. Sorry both!

Very welcome! Cyril's patch works very well for us, indeed it has only crashed when we had problems in the C code (e.g. typical error pointers, etc.).

Thanks again Cyril!!!
Best regards,
Sergio
Reply all
Reply to author
Forward
0 new messages