From 6ea744421b143b474f6206faf7ab8d5db974e6a4 Mon Sep 17 00:00:00 2001 From: Atis Elsts Date: Tue, 22 Apr 2014 14:35:01 +0200 Subject: [PATCH 1/3] Initialize the rtimer component on native platform's startup. Otherwise applications that use rtimers die when run as native code because of an unhandled signal. --- platform/native/contiki-main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/native/contiki-main.c b/platform/native/contiki-main.c index e0e2f2012..8183fd18b 100644 --- a/platform/native/contiki-main.c +++ b/platform/native/contiki-main.c @@ -190,6 +190,7 @@ main(int argc, char **argv) process_init(); process_start(&etimer_process, NULL); ctimer_init(); + rtimer_init(); #if WITH_GUI process_start(&ctk_process, NULL); From b9e15a598635151e60c75fc345771db79afaa2d1 Mon Sep 17 00:00:00 2001 From: Atis Elsts Date: Tue, 22 Apr 2014 14:38:08 +0200 Subject: [PATCH 2/3] Make native platform's main loop less noisy. --- platform/native/contiki-main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/native/contiki-main.c b/platform/native/contiki-main.c index 8183fd18b..63313f554 100644 --- a/platform/native/contiki-main.c +++ b/platform/native/contiki-main.c @@ -35,6 +35,7 @@ #include #include #include +#include #ifdef __CYGWIN__ #include "net/wpcap-drv.h" @@ -260,7 +261,9 @@ main(int argc, char **argv) retval = select(maxfd + 1, &fdr, &fdw, NULL, &tv); if(retval < 0) { - perror("select"); + if(errno != EINTR) { + perror("select"); + } } else if(retval > 0) { /* timeout => retval == 0 */ for(i = 0; i <= maxfd; i++) { From 9cbfede2b6ca3fa070e812241b267d68da1ee797 Mon Sep 17 00:00:00 2001 From: Atis Elsts Date: Tue, 22 Apr 2014 14:40:04 +0200 Subject: [PATCH 3/3] Explicitly initialize queue buffer in the main startup routine only if uIP is used. The Rime stack already does this on its own, and there is no need to do it twice. --- platform/native/contiki-main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/native/contiki-main.c b/platform/native/contiki-main.c index 63313f554..0202fef73 100644 --- a/platform/native/contiki-main.c +++ b/platform/native/contiki-main.c @@ -199,12 +199,12 @@ main(int argc, char **argv) set_rime_addr(); - queuebuf_init(); - netstack_init(); printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name); #if WITH_UIP6 + queuebuf_init(); + memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr)); process_start(&tcpip_process, NULL);