Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki

This commit is contained in:
nvt 2012-02-17 16:59:47 +01:00
commit a2d2f0cb67
15 changed files with 138 additions and 100 deletions

View file

@ -1,3 +1,5 @@
# -*- makefile -*-
ifndef CONTIKI
${error CONTIKI not defined! You must specify where CONTIKI resides}
endif
@ -93,9 +95,9 @@ PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFI
ifdef APPS
APPDIRS += ${wildcard ${addprefix $(CONTIKI)/apps/, $(APPS)} \
${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \
${addprefix , $(APPS)}}
APPINCLUDES = ${foreach APP, $(APPS), ${wildcard \
${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \
${addprefix , $(APPS)}}
APPINCLUDES = ${foreach APP, $(APPS), ${wildcard ${foreach DIR, $(APPDIRS), $(DIR)/Makefile.$(APP)} \
$(CONTIKI)/apps/$(APP)/Makefile.$(APP) \
$(CONTIKI)/platform/$(TARGET)/apps/$(APP)/Makefile.$(APP) \
$(APP)/Makefile.$(APP)}}
@ -107,7 +109,7 @@ endif
### Include target makefile (TODO Unsafe?)
target_makefile := $(wildcard $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET))
target_makefile := $(wildcard ${realpath $(CONTIKI)}/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})
# Check if the target makefile exists, and create the object directory if necessary.
ifeq ($(strip $(target_makefile)),)
@ -116,7 +118,10 @@ else
ifeq (${wildcard $(OBJECTDIR)},)
DUMMY := ${shell mkdir $(OBJECTDIR)}
endif
include $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET)
ifneq (1, ${words $(target_makefile)})
${error More than one TARGET Makefile found: $(target_makefile)}
endif
include $(target_makefile)
endif
### Forward comma-separated list of arbitrary defines to the compiler
@ -126,13 +131,13 @@ CFLAGS += ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}}
### Setup directory search path for source and header files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix ${dir $(target_makefile)}, \
$(CONTIKI_TARGET_DIRS)}
CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
$(CONTIKI_CPU_DIRS)}
SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS)
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS) ${dir $(target_makefile)}
vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)

View file

@ -259,12 +259,16 @@ PT_THREAD(header(struct httpd_state *s, char *ptr))
#endif /* WEBSERVER_CONF_HEADER */
#if WEBSERVER_CONF_FILESTATS
static char *thisfilename; //todo move to s->ptr
/*---------------------------------------------------------------------------*/
static unsigned short
generate_file_stats(void *arg)
{
struct httpd_state *s = (struct httpd_state *)arg;
#if WEBSERVER_CONF_LOADTIME
static const char httpd_cgi_filestat1[] HTTPD_STRING_ATTR = "<p align=\"right\"><br><br><i>This page has been sent %u times (%1u.%u sec)</i></body></html>";
#else
static const char httpd_cgi_filestat1[] HTTPD_STRING_ATTR = "<p align=\"right\"><br><br><i>This page has been sent %u times</i></body></html>";
#endif
static const char httpd_cgi_filestat2[] HTTPD_STRING_ATTR = "<tr><td><a href=\"%s\">%s</a></td><td>%d</td>";
static const char httpd_cgi_filestat3[] HTTPD_STRING_ATTR = "%5u";
char tmp[20];
@ -272,11 +276,17 @@ generate_file_stats(void *arg)
u16_t i;
unsigned short numprinted;
/* Transfer arg from whichever flash that contains the html file to RAM */
httpd_fs_cpy(&tmp, (char *)arg, 20);
httpd_fs_cpy(&tmp, s->u.ptr, 20);
/* Count for this page, with common page footer */
if (tmp[0]=='.') {
numprinted=httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_filestat1, httpd_fs_open(thisfilename, 0));
#if WEBSERVER_CONF_LOADTIME
s->pagetime = clock_time() - s->pagetime;
numprinted=httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_filestat1, httpd_fs_open(s->filename, 0),
(unsigned int)s->pagetime/CLOCK_SECOND,(unsigned int)s->pagetime%CLOCK_SECOND);
#else
numprinted=httpd_snprintf((char *)uip_appdata, uip_mss(), httpd_cgi_filestat1, httpd_fs_open(s->filename, 0));
#endif
/* Count for all files */
/* Note buffer will overflow if there are too many files! */
@ -310,13 +320,10 @@ PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
{
PSOCK_BEGIN(&s->sout);
//printf("s->filename is %c%c%c%c%c%c",s->filename[0],s->filename[1],s->filename[2],s->filename[3],s->filename[4],s->filename[5]);
//printf("s->filename string is %s",s->filename);
thisfilename=&s->filename[0]; //temporary way to pass filename to generate_file_stats
// printf("thisfilename is %s",thisfilename); //minimal net wants this
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, (void *) ptr);
/* Pass string after cgi invocation to the generator */
s->u.ptr = ptr;
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, s);
PSOCK_END(&s->sout);
}
@ -632,12 +639,6 @@ uint8_t c;
h=h-days*24;
numprinted+=httpd_snprintf((char *)uip_appdata + numprinted, uip_mss() - numprinted, httpd_cgi_sensor3d, days,h,m,s);
}
/* TODO: some gcc's have a bug with %02d format that adds an extra char after the string terminator.
* Seen with arm-none-eabi-gcc.exe (Sourcery G++ Lite 2008q3-66) 4.3.2
* Quick cosmetic fix to strip that off: */
if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
#if 0
if (sleepseconds) {
@ -667,25 +668,14 @@ uint8_t c;
sl=energest_total_time[ENERGEST_TYPE_CPU].current/RTIMER_ARCH_SECOND;
h=(10000UL*sl)/seconds;p1=h/100;p2=h-p1*100;h=sl/3600;s=sl-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor4, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
sl=energest_total_time[ENERGEST_TYPE_TRANSMIT].current/RTIMER_ARCH_SECOND;
h=(10000UL*sl)/seconds;p1=h/100;p2=h-p1*100;h=sl/3600;s=sl-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor10, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
sl=energest_total_time[ENERGEST_TYPE_LISTEN].current/RTIMER_ARCH_SECOND;
h=(10000UL*sl)/seconds;p1=h/100;p2=h-p1*100;h=sl/3600;s=sl-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor11, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
}
#endif /* ENERGEST_CONF_ON */
@ -700,18 +690,12 @@ uint8_t c;
h=((10000UL*compower_idle_activity.transmit)/RTIMER_ARCH_SECOND)/seconds;
p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor31, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
s=compower_idle_activity.listen/RTIMER_ARCH_SECOND;
h=((10000UL*compower_idle_activity.listen)/RTIMER_ARCH_SECOND)/seconds;
p1=h/100;p2=h-p1*100;h=s/3600;s=s-h*3600;m=s/60;s=s-m*60;
numprinted+=httpd_snprintf((char *)uip_appdata+numprinted, uip_mss()-numprinted, httpd_cgi_sensor32, h,m,s,p1,p2);
if (*(char *)(uip_appdata + numprinted-4)==0) {numprinted-=4;}
else if (*(char *)(uip_appdata + numprinted-3)==0) {numprinted-=3;}
else if (*(char *)(uip_appdata + numprinted-2)==0) {numprinted-=2;}
else if (*(char *)(uip_appdata + numprinted-1)==0) {numprinted-=1;}
}
#endif

View file

@ -432,6 +432,9 @@ PT_THREAD(handle_input(struct httpd_state *s))
#if WEBSERVER_CONF_LOG
webserver_log_file(&uip_conn->ripaddr, s->filename);
// webserver_log(httpd_query);
#endif
#if WEBSERVER_CONF_LOADTIME
s->pagetime = clock_time();
#endif
s->state = STATE_OUTPUT;
while(1) {

View file

@ -52,6 +52,8 @@
#ifndef WEBSERVER_CONF_NANO
#if CONTIKI_TARGET_SKY || CONTIKI_TARGET_STK500
#define WEBSERVER_CONF_NANO 1
#elif CONTIKI_TARGET_REDBEE_ECONOTAG || CONTIKI_TARGET_AVR_RAVEN || CONTIKI_TARGET_AVR_ATMEGA128RFA1
#define WEBSERVER_CONF_NANO 2
#else
#define WEBSERVER_CONF_NANO 3
#endif
@ -73,6 +75,7 @@
//#define WEBSERVER_CONF_HEADER_W3C 1 //Proper header
#define WEBSERVER_CONF_HEADER_MENU 1 //with links to other pages
//#define WEBSERVER_CONF_HEADER_ICON 1 //with favicon
#define WEBSERVER_CONF_LOADTIME 0 //show load time in filestats
#define WEBSERVER_CONF_FILESTATS 1
#define WEBSERVER_CONF_TCPSTATS 0
#define WEBSERVER_CONF_PROCESSES 0
@ -101,7 +104,47 @@ extern char httpd_query[WEBSERVER_CONF_PASSQUERY];
#elif WEBSERVER_CONF_NANO==2
/* webserver-mini having more content */
#error webserver-micro not implemented
#define WEBSERVER_CONF_CONNS 2
#define WEBSERVER_CONF_NAMESIZE 20
#define WEBSERVER_CONF_BUFSIZE 40
/* Allow include in .shtml pages, e.g. %!: /header.html */
#define WEBSERVER_CONF_INCLUDE 1
/* Allow cgi in .shtml pages, e.g. %! file-stats . */
#define WEBSERVER_CONF_CGI 1
/* MAX_SCRIPT_NAME_LENGTH should be at least the maximum file name length+2 for %!: includes */
#define MAX_SCRIPT_NAME_LENGTH WEBSERVER_CONF_NAMESIZE+2
/* Enable specific cgi's */
#define WEBSERVER_CONF_HEADER 1
//#define WEBSERVER_CONF_HEADER_W3C 1 //Proper header
#define WEBSERVER_CONF_HEADER_MENU 1 //with links to other pages
//#define WEBSERVER_CONF_HEADER_ICON 1 //with favicon
#define WEBSERVER_CONF_LOADTIME 1
#define WEBSERVER_CONF_FILESTATS 1
#define WEBSERVER_CONF_TCPSTATS 1
#define WEBSERVER_CONF_PROCESSES 1
#define WEBSERVER_CONF_ADDRESSES 1
#define WEBSERVER_CONF_NEIGHBORS 1
#define WEBSERVER_CONF_ROUTES 1
#define WEBSERVER_CONF_SENSORS 1
//#define WEBSERVER_CONF_TICTACTOE 1 //Needs passquery of at least 10 chars
#define WEBSERVER_CONF_AJAX 1
//#define WEBSERVER_CONF_PASSQUERY 10
#if WEBSERVER_CONF_PASSQUERY
extern char httpd_query[WEBSERVER_CONF_PASSQUERY];
#endif
/* Enable specific file types */
#define WEBSERVER_CONF_JPG 1
#define WEBSERVER_CONF_PNG 1
#define WEBSERVER_CONF_GIF 1
#define WEBSERVER_CONF_TXT 1
#define WEBSERVER_CONF_CSS 1
#define WEBSERVER_CONF_BIN 1
/* Log page accesses */
#define WEBSERVER_CONF_LOG 1
/* Include referrer in log */
#define WEBSERVER_CONF_REFERER 1
#elif WEBSERVER_CONF_NANO==3
/* webserver-mini having all content */
@ -119,6 +162,7 @@ extern char httpd_query[WEBSERVER_CONF_PASSQUERY];
//#define WEBSERVER_CONF_HEADER_W3C 1 //Proper header
#define WEBSERVER_CONF_HEADER_MENU 1 //with links to other pages
//#define WEBSERVER_CONF_HEADER_ICON 1 //with favicon
#define WEBSERVER_CONF_LOADTIME 1
#define WEBSERVER_CONF_FILESTATS 1
#define WEBSERVER_CONF_TCPSTATS 1
#define WEBSERVER_CONF_PROCESSES 1
@ -213,6 +257,9 @@ struct httpd_state {
char *scriptptr;
int scriptlen;
#endif
#if WEBSERVER_CONF_LOADTIME
clock_time_t pagetime;
#endif
#if WEBSERVER_CONF_CGI
union {
unsigned short count;

View file

@ -503,6 +503,7 @@ format_str_v(const StrFormatContext *ctxt, const char *format, va_list ap)
if ((flags & JUSTIFY_MASK) == JUSTIFY_RIGHT) {
if (flags & PAD_ZERO) {
precision_fill += field_fill;
field_fill = 0; /* Do not double count padding */
} else {
CHECKCB(fill_space(ctxt,field_fill));
}

View file

@ -58,7 +58,7 @@ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) -I$(CONTIKI_CPU)/loader \
-DWITH_ASCII -DMCK=$(MCK) \
-Werror $(ARCH_FLAGS) -g
CFLAGS += $(CFLAGSNO) -Os -DRUN_AS_SYSTEM -DROM_RUN -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -DTEXT_BASE=$(TEXT_BASE) -fno-builtin-printf -fno-builtin-sprintf
CFLAGS += $(CFLAGSNO) -Os -DRUN_AS_SYSTEM -DROM_RUN -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -DTEXT_BASE=$(TEXT_BASE) -fno-builtin-printf -fno-builtin-sprintf -MMD
LDFLAGS += -T $(LINKERSCRIPT) -nostartfiles -static -u_start -Wl,-Map=contiki-$(TARGET).map,-export-dynamic
AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) -gstabs
@ -74,9 +74,9 @@ CFLAGS += -I$(OBJECTDIR) -I$(CONTIKI_CPU)/board -DBOARD=$(TARGET)
$(OBJECTDIR)/board.h: $(OBJECTDIR)
ifneq (,$(findstring Windows,$(OS)))
${info Cygwin detected.}
ln -f $(CONTIKI_CPU)/board/$(TARGET).h $(OBJECTDIR)/board.h
ln -f $(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
else
ln -sf ../$(CONTIKI_CPU)/board/$(TARGET).h $(OBJECTDIR)/board.h
ln -sf ../$(CONTIKI_CPU)/board/board.h $(OBJECTDIR)/board.h
endif
@ -107,14 +107,10 @@ CUSTOM_RULE_C_TO_CO=yes
%_$(TARGET).bin: %.elf
$(OBJCOPY) -O binary $< $@
symbols.c:
cp ${CONTIKI}/tools/empty-symbols.c symbols.c
cp ${CONTIKI}/tools/empty-symbols.h symbols.h
%.$(TARGET): %_$(TARGET).bin
@
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP) $(OBJECTDIR)/symbols.o
%.elf: $(OBJECTDIR)/board.h %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a $(STARTUP)
$(CC) $(LDFLAGS) $(CFLAGS) -nostartfiles -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(filter %.a,$^)

View file

@ -1,20 +0,0 @@
# -*- makefile -*-
BOARDS := redbee-dev redbee-r1 redbee-usb redbee-econotag quahogcon freescale-ncb
OBJDIR := obj_$(BOARD)_board
CFLAGS += -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
$(OBJDIR):
ifndef BOARD
${warning BOARD not defined}
${warning echo "make BOARD=foo"}
${warning "boards: $(BOARDS)"}
${error you must define BOARD}
endif
@echo "setup object directory for dev board"
mkdir $(OBJDIR)
$(OBJDIR)/board.h: $(OBJDIR)
ln -sf ../$(MC1322X)/board/$(BOARD).h $(OBJDIR)/board.h

View file

@ -0,0 +1,8 @@
#ifndef BOARD
BOARD = redbee-econotag
#endif
#if BOARD == redbee-econotag
#include "redbee-econotag.h"
#endif

View file

@ -28,7 +28,6 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: wpcap-drv.c,v 1.7 2010/10/19 18:29:04 adamdunkels Exp $
*/
#include "contiki-net.h"
@ -86,7 +85,7 @@ pollhandler(void)
if(uip_len > 0) {
#if UIP_CONF_IPV6
if(BUF->type == uip_htons(UIP_ETHTYPE_IPV6)) {
printf("wpcap poll calls tcpip");
// printf("wpcap poll calls tcpip");
tcpip_input();
} else
#endif /* UIP_CONF_IPV6 */

View file

@ -167,6 +167,10 @@ static struct pcap *(* pcap_open_live)(char *, int, int, int, char *);
static int (* pcap_next_ex)(struct pcap *, struct pcap_pkthdr **, unsigned char **);
static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int);
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
#define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#ifdef UIP_FALLBACK_INTERFACE
static struct pcap *pfall;
struct in_addr addrfall;
@ -183,14 +187,9 @@ init(void)
/*---------------------------------------------------------------------------*/
u8_t wfall_send(uip_lladdr_t *lladdr);
#if FALLBACK_HAS_ETHERNET_HEADERS
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
#undef IPBUF
#define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[14])
static uip_ipaddr_t last_sender;
#else
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
#define IPBUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
#endif
static void
@ -375,6 +374,8 @@ init_pcap(struct in_addr addr)
}
#ifdef UIP_FALLBACK_INTERFACE
log_message("init_pcap: Opened as primary interface","");
#else
log_message("init_pcap: Opened as interface","");
#endif
// pcap_setdirection(PCAP_D_IN); //Not implemented in windows yet?
set_ethaddr(addr);

View file

@ -225,6 +225,7 @@ PROCESS_THREAD(border_router_process, ev, data)
rpl_dag_t *dag;
PROCESS_BEGIN();
prefix_set = 0;
PROCESS_PAUSE();
@ -233,6 +234,12 @@ PROCESS_THREAD(border_router_process, ev, data)
PRINTF("RPL-Border router started\n");
/* The border router runs with a 100% duty cycle in order to ensure high
packet reception rates.
Note if the MAC RDC is not turned off now, aggressive power management of the
cpu will interfere with establishing the SLIP connection */
NETSTACK_MAC.off(1);
/* Request prefix until it has been received */
while(!prefix_set) {
etimer_set(&et, CLOCK_SECOND);
@ -250,10 +257,6 @@ PROCESS_THREAD(border_router_process, ev, data)
print_local_addresses();
#endif
/* The border router runs with a 100% duty cycle in order to ensure high
packet reception rates. */
NETSTACK_MAC.off(1);
while(1) {
PROCESS_YIELD();
if (ev == sensors_event && data == &button_sensor) {

View file

@ -57,7 +57,7 @@ static uip_ipaddr_t last_sender;
static void
slip_input_callback(void)
{
PRINTF("SIN: %u\n", uip_len);
// PRINTF("SIN: %u\n", uip_len);
if(uip_buf[0] == '!') {
PRINTF("Got configuration message of type %c\n", uip_buf[1]);
uip_len = 0;
@ -113,7 +113,7 @@ output(void)
PRINT6ADDR(&UIP_IP_BUF->destipaddr);
PRINTF("\n");
} else {
PRINTF("SUT: %u\n", uip_len);
// PRINTF("SUT: %u\n", uip_len);
slip_send();
}
}

View file

@ -29,7 +29,6 @@
*
* This file is part of the Contiki OS
*
* $Id: contiki-main.c,v 1.25 2010/10/19 18:29:05 adamdunkels Exp $
*
*/
@ -222,6 +221,9 @@ main(void)
printf("RPL enabled\n");
#endif
procinit_init();
autostart_start(autostart_processes);
/* Set default IP addresses if not specified */
#if !UIP_CONF_IPV6
{
@ -274,7 +276,17 @@ main(void)
}
#endif /* !UIP_CONF_IPV6_RPL */
#if !RPL_BORDER_ROUTER /* Border router process prints addresses later */
#endif /* !UIP_CONF_IPV6 */
// procinit_init();
// autostart_start(autostart_processes);
/* Make standard output unbuffered. */
setvbuf(stdout, (char *)NULL, _IONBF, 0);
printf("\n*******%s online*******\n",CONTIKI_VERSION_STRING);
#if UIP_CONF_IPV6 && !RPL_BORDER_ROUTER /* Border router process prints addresses later */
{
uint8_t i;
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
@ -285,16 +297,7 @@ main(void)
}
}
}
#endif /* !RPL_BORDER_ROUTER */
#endif /* !UIP_CONF_IPV6 */
procinit_init();
autostart_start(autostart_processes);
/* Make standard output unbuffered. */
setvbuf(stdout, (char *)NULL, _IONBF, 0);
printf("\n*******%s online*******\n",CONTIKI_VERSION_STRING);
#endif
while(1) {
fd_set fds;

View file

@ -335,7 +335,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
if (t < lastExecute) {
throw new RuntimeException("Bad event ordering: " + lastExecute + " < " + t);
}
/* Execute MSPSim-based mote */
/* TODO Try-catch overhead */
try {
@ -345,6 +345,10 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
lastExecute = t;
} catch (EmulationException e) {
String stackTraceOutput = sendCLICommandAndPrint("stacktrace");
if (stackTraceOutput == null) {
stackTraceOutput = "";
}
stackTraceOutput = e.getMessage() + "\n\n" + stackTraceOutput;
throw (ContikiError)
new ContikiError(stackTraceOutput).initCause(e);
}

View file

@ -253,8 +253,8 @@ public class Simulation extends Observable implements Runnable {
this.setChanged();
this.notifyObservers(this);
TimeEvent nextEvent = null;
try {
TimeEvent nextEvent;
while (isRunning) {
/* Handle all poll requests */
@ -289,7 +289,11 @@ public class Simulation extends Observable implements Runnable {
/* Quit simulator if in test mode */
System.exit(1);
} else {
GUI.showErrorDialog(GUI.getTopParentContainer(), "Simulation error", e, false);
String title = "Simulation error";
if (nextEvent instanceof MoteTimeEvent) {
title += ": " + ((MoteTimeEvent)nextEvent).getMote();
}
GUI.showErrorDialog(GUI.getTopParentContainer(), title, e, false);
}
}
}