Merge pull request #1293 from simonduq/pr/fix-warnings

Fix a number of compiler warnings and enable -Werror in Travis
This commit is contained in:
Simon Duquennoy 2015-11-10 08:49:11 +01:00
commit fbd78a7e3b
80 changed files with 201 additions and 146 deletions

View file

@ -48,15 +48,15 @@
struct powertrace_sniff_stats { struct powertrace_sniff_stats {
struct powertrace_sniff_stats *next; struct powertrace_sniff_stats *next;
uint32_t num_input, num_output; unsigned long num_input, num_output;
uint32_t input_txtime, input_rxtime; unsigned long input_txtime, input_rxtime;
uint32_t output_txtime, output_rxtime; unsigned long output_txtime, output_rxtime;
#if NETSTACK_CONF_WITH_IPV6 #if NETSTACK_CONF_WITH_IPV6
uint16_t proto; /* includes proto + possibly flags */ uint16_t proto; /* includes proto + possibly flags */
#endif #endif
uint16_t channel; uint16_t channel;
uint32_t last_input_txtime, last_input_rxtime; unsigned long last_input_txtime, last_input_rxtime;
uint32_t last_output_txtime, last_output_rxtime; unsigned long last_output_txtime, last_output_rxtime;
}; };
#define INPUT 1 #define INPUT 1
@ -72,17 +72,17 @@ PROCESS(powertrace_process, "Periodic power output");
void void
powertrace_print(char *str) powertrace_print(char *str)
{ {
static uint32_t last_cpu, last_lpm, last_transmit, last_listen; static unsigned long last_cpu, last_lpm, last_transmit, last_listen;
static uint32_t last_idle_transmit, last_idle_listen; static unsigned long last_idle_transmit, last_idle_listen;
uint32_t cpu, lpm, transmit, listen; unsigned long cpu, lpm, transmit, listen;
uint32_t all_cpu, all_lpm, all_transmit, all_listen; unsigned long all_cpu, all_lpm, all_transmit, all_listen;
uint32_t idle_transmit, idle_listen; unsigned long idle_transmit, idle_listen;
uint32_t all_idle_transmit, all_idle_listen; unsigned long all_idle_transmit, all_idle_listen;
static uint32_t seqno; static unsigned long seqno;
uint32_t time, all_time, radio, all_radio; unsigned long time, all_time, radio, all_radio;
struct powertrace_sniff_stats *s; struct powertrace_sniff_stats *s;
@ -287,13 +287,8 @@ output_sniffer(int mac_status)
static void static void
sniffprint(char *prefix, int seqno) sniffprint(char *prefix, int seqno)
{ {
const linkaddr_t *sender, *receiver, *esender, *ereceiver; const linkaddr_t *esender;
sender = packetbuf_addr(PACKETBUF_ADDR_SENDER);
receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
esender = packetbuf_addr(PACKETBUF_ADDR_ESENDER); esender = packetbuf_addr(PACKETBUF_ADDR_ESENDER);
ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER);
printf("%lu %s %d %u %d %d %d.%d %u %u\n", printf("%lu %s %d %u %d %d %d.%d %u %u\n",
clock_time(), clock_time(),

View file

@ -332,14 +332,10 @@ static void
parse_incoming_packet(const uint8_t *buf, int len) parse_incoming_packet(const uint8_t *buf, int len)
{ {
int numregs; int numregs;
int flags;
int i; int i;
int bufptr; int bufptr;
numregs = buf[MSG_NUMREGS_OFFSET]; numregs = buf[MSG_NUMREGS_OFFSET];
flags = buf[MSG_FLAGS_OFFSET];
/* printf("parse_incoming_packet Numregs %d flags %d\n", numregs, flags);*/
bufptr = MSG_ADDRS_OFFSET; bufptr = MSG_ADDRS_OFFSET;
for(i = 0; i < numregs; ++i) { for(i = 0; i < numregs; ++i) {

View file

@ -50,6 +50,7 @@
#define HAVE_ALLOCA 0 #define HAVE_ALLOCA 0
#else #else
#define HAVE_ALLOCA 1 #define HAVE_ALLOCA 1
#include <alloca.h>
#endif #endif
#define DEBUG 0 #define DEBUG 0

View file

@ -71,7 +71,7 @@ PROCESS_THREAD(shell_poke_process, ev, data)
PROCESS_EXIT(); PROCESS_EXIT();
} }
address = (uint8_t *)(int)shell_strtolong(args, &next); address = (uint8_t *)(uintptr_t)shell_strtolong(args, &next);
if(next == args) { if(next == args) {
shell_output_str(&poke_command, "usage 1", ""); shell_output_str(&poke_command, "usage 1", "");
PROCESS_EXIT(); PROCESS_EXIT();
@ -106,7 +106,7 @@ PROCESS_THREAD(shell_peek_process, ev, data)
PROCESS_EXIT(); PROCESS_EXIT();
} }
address = (uint8_t *)(int)shell_strtolong(args, &next); address = (uint8_t *)(uintptr_t)shell_strtolong(args, &next);
if(next == args) { if(next == args) {
shell_output_str(&peek_command, "usage 1", ""); shell_output_str(&peek_command, "usage 1", "");
PROCESS_EXIT(); PROCESS_EXIT();

View file

@ -128,8 +128,8 @@ memcpy_misaligned(void *dest, const void *source, int len)
int i; int i;
uint8_t *destptr; uint8_t *destptr;
const uint8_t *sourceptr; const uint8_t *sourceptr;
if(((int)dest & 1) == 1 || if(((uintptr_t)dest & 1) == 1 ||
((int)source & 1) == 1) { ((uintptr_t)source & 1) == 1) {
destptr = dest; destptr = dest;
sourceptr = source; sourceptr = source;
for(i = 0; i < len; ++i) { for(i = 0; i < len; ++i) {

View file

@ -129,7 +129,7 @@ PROCESS_THREAD(shell_netcmd_process, ev, data)
/* Terminate the string with a NUL character. */ /* Terminate the string with a NUL character. */
msg->netcmd[len] = 0; msg->netcmd[len] = 0;
msg->crc = crc16_data(msg->netcmd, len, 0); msg->crc = crc16_data((unsigned char *)msg->netcmd, len, 0);
printf("netcmd sending '%s'\n", msg->netcmd); printf("netcmd sending '%s'\n", msg->netcmd);
trickle_send(&trickle); trickle_send(&trickle);
} }
@ -157,7 +157,7 @@ recv_trickle(struct trickle_conn *c)
msg->netcmd[len] = 0; msg->netcmd[len] = 0;
memcpy(&crc, &msg->crc, sizeof(crc)); memcpy(&crc, &msg->crc, sizeof(crc));
if(crc == crc16_data(msg->netcmd, len, 0)) { if(crc == crc16_data((unsigned char *)msg->netcmd, len, 0)) {
/* Start the server process with the incoming command. */ /* Start the server process with the incoming command. */
process_start(&shell_netcmd_server_process, (void *)msg->netcmd); process_start(&shell_netcmd_server_process, (void *)msg->netcmd);
} }

View file

@ -133,7 +133,7 @@ PROCESS_THREAD(shell_sendcmd_process, ev, data)
/* Terminate the string with a NUL character. */ /* Terminate the string with a NUL character. */
msg->sendcmd[len] = 0; msg->sendcmd[len] = 0;
msg->crc = crc16_data(msg->sendcmd, len, 0); msg->crc = crc16_data((unsigned char *)msg->sendcmd, len, 0);
/* printf("sendcmd sending '%s'\n", msg->sendcmd);*/ /* printf("sendcmd sending '%s'\n", msg->sendcmd);*/
unicast_send(&uc, &addr); unicast_send(&uc, &addr);
@ -160,7 +160,7 @@ recv_uc(struct unicast_conn *c, const linkaddr_t *from)
msg->sendcmd[len] = 0; msg->sendcmd[len] = 0;
memcpy(&crc, &msg->crc, sizeof(crc)); memcpy(&crc, &msg->crc, sizeof(crc));
if(crc == crc16_data(msg->sendcmd, len, 0)) { if(crc == crc16_data((unsigned char *)msg->sendcmd, len, 0)) {
/* Start the server process with the incoming command. */ /* Start the server process with the incoming command. */
process_start(&shell_sendcmd_server_process, (void *)msg->sendcmd); process_start(&shell_sendcmd_server_process, (void *)msg->sendcmd);
} }

View file

@ -301,7 +301,7 @@ recv_collect(const linkaddr_t *originator, uint8_t seqno, uint8_t hops)
/* Copy the collect message header. */ /* Copy the collect message header. */
memcpy(&collect_msg, packetbuf_dataptr(), sizeof(collect_msg)); memcpy(&collect_msg, packetbuf_dataptr(), sizeof(collect_msg));
dataptr = ((struct collect_msg *)packetbuf_dataptr())->data; dataptr = (char *)((struct collect_msg *)packetbuf_dataptr())->data;
#if TIMESYNCH_CONF_ENABLED #if TIMESYNCH_CONF_ENABLED
latency = timesynch_time() - collect_msg.timestamp; latency = timesynch_time() - collect_msg.timestamp;
@ -321,7 +321,7 @@ recv_collect(const linkaddr_t *originator, uint8_t seqno, uint8_t hops)
if(packetbuf_datalen() >= COLLECT_MSG_HDRSIZE) { if(packetbuf_datalen() >= COLLECT_MSG_HDRSIZE) {
len = packetbuf_datalen() - COLLECT_MSG_HDRSIZE; len = packetbuf_datalen() - COLLECT_MSG_HDRSIZE;
if(collect_msg.crc == crc16_data(dataptr, len, 0)) { if(collect_msg.crc == crc16_data((unsigned char *)dataptr, len, 0)) {
msg.len = 5 + (packetbuf_datalen() - COLLECT_MSG_HDRSIZE) / 2; msg.len = 5 + (packetbuf_datalen() - COLLECT_MSG_HDRSIZE) / 2;
linkaddr_copy((linkaddr_t *)&msg.originator, originator); linkaddr_copy((linkaddr_t *)&msg.originator, originator);
msg.seqno = seqno; msg.seqno = seqno;

View file

@ -158,7 +158,6 @@ PROCESS_THREAD(shell_repeat_server_process, ev, data)
static char *command; static char *command;
static struct process *started_process; static struct process *started_process;
char command_copy[MAX_COMMANDLENGTH]; char command_copy[MAX_COMMANDLENGTH];
int ret;
if(ev == shell_event_input) { if(ev == shell_event_input) {
goto exit; goto exit;
@ -172,7 +171,7 @@ PROCESS_THREAD(shell_repeat_server_process, ev, data)
data == &shell_repeat_process); data == &shell_repeat_process);
{ {
strncpy(command_copy, command, MAX_COMMANDLENGTH); strncpy(command_copy, command, MAX_COMMANDLENGTH);
ret = shell_start_command(command_copy, (int)strlen(command_copy), shell_start_command(command_copy, (int)strlen(command_copy),
&repeat_command, &started_process); &repeat_command, &started_process);
if(started_process != NULL && if(started_process != NULL &&
@ -202,11 +201,10 @@ repeat_print_usage(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_repeat_process, ev, data) PROCESS_THREAD(shell_repeat_process, ev, data)
{ {
static int reps, period, period_left; static int reps, period;
static char command[MAX_COMMANDLENGTH]; static char command[MAX_COMMANDLENGTH];
static struct etimer etimer; static struct etimer etimer;
static int i; static int i;
static clock_time_t start_time;
const char *args, *next; const char *args, *next;
if(ev == shell_event_input) { if(ev == shell_event_input) {
@ -258,7 +256,6 @@ PROCESS_THREAD(shell_repeat_process, ev, data)
/* printf("repeats %d period %d command '%s'\n", /* printf("repeats %d period %d command '%s'\n",
reps, period, command);*/ reps, period, command);*/
start_time = clock_time();
etimer_set(&etimer, CLOCK_SECOND * period); etimer_set(&etimer, CLOCK_SECOND * period);
for(i = 0; reps == 0 || i < reps; ++i) { for(i = 0; reps == 0 || i < reps; ++i) {
@ -291,7 +288,6 @@ PROCESS_THREAD(shell_randwait_process, ev, data)
static struct etimer etimer; static struct etimer etimer;
static struct process *started_process; static struct process *started_process;
const char *args, *next; const char *args, *next;
int ret;
/* if(ev == shell_event_input) { /* if(ev == shell_event_input) {
struct shell_input *input; struct shell_input *input;
@ -339,7 +335,7 @@ PROCESS_THREAD(shell_randwait_process, ev, data)
/* printf("Starting '%s' child %p (%s)\n", command, randwait_command.child, */ /* printf("Starting '%s' child %p (%s)\n", command, randwait_command.child, */
/* randwait_command.child == NULL? "null": randwait_command.child->command); */ /* randwait_command.child == NULL? "null": randwait_command.child->command); */
ret = shell_start_command(command, (int)strlen(command), shell_start_command(command, (int)strlen(command),
randwait_command.child, &started_process); randwait_command.child, &started_process);
if(started_process != NULL && if(started_process != NULL &&

View file

@ -51,7 +51,7 @@
#define SHELL_VARS_RAM_END SHELL_VARS_CONF_RAM_END #define SHELL_VARS_RAM_END SHELL_VARS_CONF_RAM_END
#else /* SHELL_VARS_CONF_RAM_BEGIN */ #else /* SHELL_VARS_CONF_RAM_BEGIN */
#define SHELL_VARS_RAM_BEGIN 0 #define SHELL_VARS_RAM_BEGIN 0
#define SHELL_VARS_RAM_END (unsigned int)-1 #define SHELL_VARS_RAM_END (uintptr_t)-1
#endif /* SHELL_VARS_CONF_RAM_BEGIN */ #endif /* SHELL_VARS_CONF_RAM_BEGIN */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -77,8 +77,8 @@ PROCESS_THREAD(shell_vars_process, ev, data)
for(i = 0; i < symbols_nelts; ++i) { for(i = 0; i < symbols_nelts; ++i) {
if(symbols[i].name != NULL && if(symbols[i].name != NULL &&
(unsigned int)symbols[i].value >= SHELL_VARS_RAM_BEGIN && (uintptr_t)symbols[i].value >= SHELL_VARS_RAM_BEGIN &&
(unsigned int)symbols[i].value <= SHELL_VARS_RAM_END) { (uintptr_t)symbols[i].value <= SHELL_VARS_RAM_END) {
shell_output_str(&vars_command, (char *)symbols[i].name, ""); shell_output_str(&vars_command, (char *)symbols[i].name, "");
} }
} }

View file

@ -200,7 +200,7 @@ window_copy(int curptr, const char *data, unsigned char datalen)
len = windowend - windowstart; len = windowend - windowstart;
} }
strncpy(windowptr + windowstart, data, len); strncpy((char *)(windowptr + windowstart), data, len);
windowstart += len; windowstart += len;
return curptr + datalen; return curptr + datalen;
@ -217,7 +217,7 @@ senddata(void)
windowstart = s.getrequestptr; windowstart = s.getrequestptr;
curptr = 0; curptr = 0;
windowend = windowstart + uip_mss(); windowend = windowstart + uip_mss();
windowptr = (char *)uip_appdata - windowstart; windowptr = (unsigned char *)uip_appdata - windowstart;
curptr = window_copy(curptr, http_get, sizeof(http_get) - 1); curptr = window_copy(curptr, http_get, sizeof(http_get) - 1);
curptr = window_copy(curptr, s.file, (unsigned char)strlen(s.file)); curptr = window_copy(curptr, s.file, (unsigned char)strlen(s.file));

View file

@ -843,7 +843,9 @@ add_pagewidget(char *text, unsigned char size, char *attrib, unsigned char type,
void void
htmlparser_newline(void) htmlparser_newline(void)
{ {
#ifdef WITH_PETSCII
char *wptr; char *wptr;
#endif /* WITH_PETSCII */
if(++newlines > 2) { if(++newlines > 2) {
return; return;
@ -863,8 +865,10 @@ htmlparser_newline(void)
++y; ++y;
x = 0; x = 0;
#ifdef WITH_PETSCII
wptr = webpageptr - WWW_CONF_WEBPAGE_WIDTH; wptr = webpageptr - WWW_CONF_WEBPAGE_WIDTH;
petsciiconv_topetscii(wptr, WWW_CONF_WEBPAGE_WIDTH); petsciiconv_topetscii(wptr, WWW_CONF_WEBPAGE_WIDTH);
#endif /* WITH_PETSCII */
if(y == WWW_CONF_WEBPAGE_HEIGHT) { if(y == WWW_CONF_WEBPAGE_HEIGHT) {
loading = 0; loading = 0;

View file

@ -80,7 +80,7 @@ urlconv_tofilename(char *dest, char *source, unsigned char maxlen)
*dest = ISO_slash; *dest = ISO_slash;
strncpy(dest + 1, wwwroot, wwwrootlen); strncpy(dest + 1, wwwroot, wwwrootlen);
len = 0; len = 0;
from = source; to = dest + wwwrootlen; from = (unsigned char *)source; to = (unsigned char *)dest + wwwrootlen;
maxlen -= 2 + wwwrootlen; maxlen -= 2 + wwwrootlen;
do { do {
c = *(from++); c = *(from++);
@ -139,7 +139,7 @@ urlconv_tofilename(char *dest, char *source, unsigned char maxlen)
} }
} while(c); } while(c);
if(*to == ISO_slash && (len + sizeof(http_index_htm) - 3) < maxlen) { if(*to == ISO_slash && (len + sizeof(http_index_htm) - 3) < maxlen) {
strcpy(to, http_index_htm); // add index.htm strcpy((char *)to, http_index_htm); // add index.htm
} else { } else {
++to; ++to;
*to = 0; *to = 0;

View file

@ -155,14 +155,14 @@ ctk_filedialog_eventhandler(struct ctk_filedialog_state *s,
} }
return 1; return 1;
} else if(ev == ctk_signal_keypress) { } else if(ev == ctk_signal_keypress) {
if((ctk_arch_key_t)data == CH_CURS_UP) { if((char)(size_t)data == CH_CURS_UP) {
clearptr(); clearptr();
if(fileptr > 0) { if(fileptr > 0) {
--fileptr; --fileptr;
} }
showptr(); showptr();
return 1; return 1;
} else if((ctk_arch_key_t)data == CH_CURS_DOWN) { } else if((char)(size_t)data == CH_CURS_DOWN) {
clearptr(); clearptr();
if(fileptr < FILES_HEIGHT - 1) { if(fileptr < FILES_HEIGHT - 1) {
++fileptr; ++fileptr;

View file

@ -852,7 +852,9 @@ add_redrawwidget(struct ctk_widget *w)
static void static void
widget_redraw(struct ctk_widget *widget) widget_redraw(struct ctk_widget *widget)
{ {
#if CTK_CONF_WINDOWS
struct ctk_window *window; struct ctk_window *window;
#endif /* CTK_CONF_WINDOWS */
if(mode != CTK_MODE_NORMAL || widget == NULL) { if(mode != CTK_MODE_NORMAL || widget == NULL) {
return; return;
@ -870,8 +872,8 @@ widget_redraw(struct ctk_widget *widget)
if(menus.open == NULL) if(menus.open == NULL)
#endif /* CTK_CONF_MENUS */ #endif /* CTK_CONF_MENUS */
{ {
window = widget->window;
#if CTK_CONF_WINDOWS #if CTK_CONF_WINDOWS
window = widget->window;
if(window == dialog) { if(window == dialog) {
ctk_draw_widget(widget, CTK_FOCUS_DIALOG, 0, height); ctk_draw_widget(widget, CTK_FOCUS_DIALOG, 0, height);
} else if(dialog == NULL && } else if(dialog == NULL &&

View file

@ -83,7 +83,9 @@ static uip_ipaddr_t loc_fipaddr;
/* Pointers used in this file */ /* Pointers used in this file */
static uip_ds6_addr_t *locaddr; static uip_ds6_addr_t *locaddr;
static uip_ds6_maddr_t *locmaddr; static uip_ds6_maddr_t *locmaddr;
#if UIP_DS6_AADDR_NB
static uip_ds6_aaddr_t *locaaddr; static uip_ds6_aaddr_t *locaaddr;
#endif /* UIP_DS6_AADDR_NB */
static uip_ds6_prefix_t *locprefix; static uip_ds6_prefix_t *locprefix;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -458,6 +460,7 @@ uip_ds6_maddr_lookup(const uip_ipaddr_t *ipaddr)
uip_ds6_aaddr_t * uip_ds6_aaddr_t *
uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr) uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr)
{ {
#if UIP_DS6_AADDR_NB
if(uip_ds6_list_loop if(uip_ds6_list_loop
((uip_ds6_element_t *)uip_ds6_if.aaddr_list, UIP_DS6_AADDR_NB, ((uip_ds6_element_t *)uip_ds6_if.aaddr_list, UIP_DS6_AADDR_NB,
sizeof(uip_ds6_aaddr_t), ipaddr, 128, sizeof(uip_ds6_aaddr_t), ipaddr, 128,
@ -466,6 +469,7 @@ uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr)
uip_ipaddr_copy(&locaaddr->ipaddr, ipaddr); uip_ipaddr_copy(&locaaddr->ipaddr, ipaddr);
return locaaddr; return locaaddr;
} }
#endif /* UIP_DS6_AADDR_NB */
return NULL; return NULL;
} }
@ -483,11 +487,13 @@ uip_ds6_aaddr_rm(uip_ds6_aaddr_t *aaddr)
uip_ds6_aaddr_t * uip_ds6_aaddr_t *
uip_ds6_aaddr_lookup(uip_ipaddr_t *ipaddr) uip_ds6_aaddr_lookup(uip_ipaddr_t *ipaddr)
{ {
#if UIP_DS6_AADDR_NB
if(uip_ds6_list_loop((uip_ds6_element_t *)uip_ds6_if.aaddr_list, if(uip_ds6_list_loop((uip_ds6_element_t *)uip_ds6_if.aaddr_list,
UIP_DS6_AADDR_NB, sizeof(uip_ds6_aaddr_t), ipaddr, 128, UIP_DS6_AADDR_NB, sizeof(uip_ds6_aaddr_t), ipaddr, 128,
(uip_ds6_element_t **)&locaaddr) == FOUND) { (uip_ds6_element_t **)&locaaddr) == FOUND) {
return locaaddr; return locaaddr;
} }
#endif /* UIP_DS6_AADDR_NB */
return NULL; return NULL;
} }

View file

@ -216,9 +216,15 @@ typedef struct uip_ds6_netif {
uint32_t reachable_time; /* in msec */ uint32_t reachable_time; /* in msec */
uint32_t retrans_timer; /* in msec */ uint32_t retrans_timer; /* in msec */
uint8_t maxdadns; uint8_t maxdadns;
#if UIP_DS6_ADDR_NB
uip_ds6_addr_t addr_list[UIP_DS6_ADDR_NB]; uip_ds6_addr_t addr_list[UIP_DS6_ADDR_NB];
#endif /* UIP_DS6_ADDR_NB */
#if UIP_DS6_AADDR_NB
uip_ds6_aaddr_t aaddr_list[UIP_DS6_AADDR_NB]; uip_ds6_aaddr_t aaddr_list[UIP_DS6_AADDR_NB];
#endif /* UIP_DS6_AADDR_NB */
#if UIP_DS6_MADDR_NB
uip_ds6_maddr_t maddr_list[UIP_DS6_MADDR_NB]; uip_ds6_maddr_t maddr_list[UIP_DS6_MADDR_NB];
#endif /* UIP_DS6_MADDR_NB */
} uip_ds6_netif_t; } uip_ds6_netif_t;
/** \brief Generic type for a DS6, to use a common loop though all DS */ /** \brief Generic type for a DS6, to use a common loop though all DS */

View file

@ -288,7 +288,10 @@ struct uip_icmp6_conn uip_icmp6_conns;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* Functions */ /* Functions */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#if (!UIP_ARCH_ADD32 && UIP_TCP) #if UIP_TCP
#if UIP_ARCH_ADD32
void uip_add32(uint8_t *op32, uint16_t op16);
#else /* UIP_ARCH_ADD32 */
void void
uip_add32(uint8_t *op32, uint16_t op16) uip_add32(uint8_t *op32, uint16_t op16)
{ {
@ -315,8 +318,8 @@ uip_add32(uint8_t *op32, uint16_t op16)
} }
} }
} }
#endif /* UIP_ARCH_ADD32 */
#endif /* UIP_ARCH_ADD32 && UIP_TCP */ #endif /* UIP_TCP */
#if ! UIP_ARCH_CHKSUM #if ! UIP_ARCH_CHKSUM
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -55,7 +55,8 @@ anti_replay_set_counter(void)
{ {
frame802154_frame_counter_t reordered_counter; frame802154_frame_counter_t reordered_counter;
reordered_counter.u32 = LLSEC802154_HTONL(++counter); ++counter;
reordered_counter.u32 = LLSEC802154_HTONL(counter);
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1, reordered_counter.u16[0]); packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_0_1, reordered_counter.u16[0]);
packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3, reordered_counter.u16[1]); packetbuf_set_attr(PACKETBUF_ATTR_FRAME_COUNTER_BYTES_2_3, reordered_counter.u16[1]);

View file

@ -48,6 +48,7 @@
#if CONTIKI_TARGET_COOJA #if CONTIKI_TARGET_COOJA
#include "lib/simEnvChange.h" #include "lib/simEnvChange.h"
#include "sys/cooja_mt.h"
#endif /* CONTIKI_TARGET_COOJA */ #endif /* CONTIKI_TARGET_COOJA */
#define DEBUG 0 #define DEBUG 0

View file

@ -12,7 +12,6 @@
/* MCUSR is a deprecated name but older avr-libc versions may define it */ /* MCUSR is a deprecated name but older avr-libc versions may define it */
#if !defined (MCUCSR) #if !defined (MCUCSR)
# if defined (MCUSR) # if defined (MCUSR)
# warning *** MCUCSR not defined, using MCUSR instead ***
# define MCUCSR MCUSR # define MCUCSR MCUSR
# endif # endif
#endif #endif

View file

@ -237,6 +237,8 @@ typedef enum{
PROCESS(rf230_process, "RF230 driver"); PROCESS(rf230_process, "RF230 driver");
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int rf230_interrupt(void);
static int rf230_on(void); static int rf230_on(void);
static int rf230_off(void); static int rf230_off(void);

View file

@ -67,7 +67,6 @@
/* MCUSR is a deprecated name but older avr-libc versions may define it */ /* MCUSR is a deprecated name but older avr-libc versions may define it */
#if !defined (MCUCSR) #if !defined (MCUCSR)
# if defined (MCUSR) # if defined (MCUSR)
# warning *** MCUCSR not defined, using MCUSR instead ***
# define MCUCSR MCUSR # define MCUCSR MCUSR
# endif # endif
#endif #endif

View file

@ -22,6 +22,10 @@ LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch
OBJCOPY_FLAGS += -O binary --gap-fill 0xff OBJCOPY_FLAGS += -O binary --gap-fill 0xff
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb
ifdef WERROR
CFLAGS += -Werror
endif
### Are we building with code size optimisations? ### Are we building with code size optimisations?
ifeq ($(SMALL),1) ifeq ($(SMALL),1)
CFLAGS += -Os CFLAGS += -Os

View file

@ -41,6 +41,10 @@ LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch
OBJCOPY_FLAGS += -O binary --gap-fill 0xff OBJCOPY_FLAGS += -O binary --gap-fill 0xff
OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb
ifdef WERROR
CFLAGS += -Werror
endif
### Are we building with code size optimisations? ### Are we building with code size optimisations?
ifeq ($(SMALL),1) ifeq ($(SMALL),1)
CFLAGS += -Os CFLAGS += -Os

@ -1 +1 @@
Subproject commit 63ed52888467ea7d403b0c743852162395232c9e Subproject commit 6bdb6da3fa9682303799e5c3b1f755398e87fc99

@ -1 +1 @@
Subproject commit 0e82b18bf2c69fb0a40af4d2496db2a3dc721cec Subproject commit 0270b50ac750f8f3348a98f900a470e7a65ffce8

View file

@ -35,10 +35,17 @@ endif
CONTIKI_CPU_DIRS = $(CONTIKI_CPU_FAM_DIR) . dev CONTIKI_CPU_DIRS = $(CONTIKI_CPU_FAM_DIR) . dev
MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \ MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \
watchdog.c lpm.c mtarch.c rtimer-arch.c watchdog.c lpm.c rtimer-arch.c
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c ELFLOADER = elfloader.c elfloader-msp430.c symtab.c
ifndef CPU_HAS_MSP430X
# include mtarch.c only in the non-large memory model case, because
# the current implementation assumes 16-bit addresses (function pointers
# stored as "unsigned short").
MSP430 += mtarch.c
endif
ifeq ($(TARGET_MEMORY_MODEL),large) ifeq ($(TARGET_MEMORY_MODEL),large)
ELFLOADER = elfloader-msp430x.c symtab.c ELFLOADER = elfloader-msp430x.c symtab.c
endif endif

View file

@ -45,6 +45,8 @@ ISR(TIMERB1, cc2420_timerb1_interrupt)
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);
/* always read TBIV to clear IFG */ /* always read TBIV to clear IFG */
tbiv = TBIV; tbiv = TBIV;
/* read and discard tbiv to avoid "variable set but not used" warning */
(void)tbiv;
if(CC2420_SFD_IS_1) { if(CC2420_SFD_IS_1) {
cc2420_sfd_counter++; cc2420_sfd_counter++;
cc2420_sfd_start_time = TBCCR1; cc2420_sfd_start_time = TBCCR1;

View file

@ -44,6 +44,8 @@ ISR(TIMERB1, cc2520_timerb1_interrupt)
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);
/* always read TBIV to clear IFG */ /* always read TBIV to clear IFG */
tbiv = TBIV; tbiv = TBIV;
/* read and discard tbiv to avoid "variable set but not used" warning */
(void)tbiv;
if(CC2520_SFD_IS_1) { if(CC2520_SFD_IS_1) {
cc2520_sfd_counter++; cc2520_sfd_counter++;
cc2520_sfd_start_time = TBCCR1; cc2520_sfd_start_time = TBCCR1;

View file

@ -14,10 +14,10 @@ NM ?= nm
OBJCOPY ?= objcopy OBJCOPY ?= objcopy
STRIP ?= strip STRIP ?= strip
ifdef WERROR ifdef WERROR
CFLAGSWERROR=-Werror -pedantic -std=c99 -Werror CFLAGSWERROR=-Werror
endif endif
CFLAGSNO = -Wall -g -I/usr/local/include $(CFLAGSWERROR) CFLAGSNO = -Wall -g -I/usr/local/include $(CFLAGSWERROR)
CFLAGS += $(CFLAGSNO) -O CFLAGS += $(CFLAGSNO)
ifeq ($(HOST_OS),Darwin) ifeq ($(HOST_OS),Darwin)
AROPTS = -r AROPTS = -r

View file

@ -43,6 +43,8 @@
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/netstack.h" #include "net/netstack.h"
#include <stdlib.h>
#include <stdio.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>

View file

@ -93,8 +93,11 @@ static void
remove_route(void) remove_route(void)
{ {
char buf[1024]; char buf[1024];
int ret;
snprintf(buf, sizeof(buf), "route delete -net 172.18.0.0"); snprintf(buf, sizeof(buf), "route delete -net 172.18.0.0");
system(buf); ret = system(buf);
fprintf(stderr, "ret %d\n", ret);
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
} }
@ -103,6 +106,7 @@ void
tapdev_init(void) tapdev_init(void)
{ {
char buf[1024]; char buf[1024];
int ret;
fd = open(DEVTAP, O_RDWR); fd = open(DEVTAP, O_RDWR);
if(fd == -1) { if(fd == -1) {
@ -123,7 +127,8 @@ tapdev_init(void)
#endif /* Linux */ #endif /* Linux */
snprintf(buf, sizeof(buf), "ifconfig tap0 inet 172.18.0.1/16"); snprintf(buf, sizeof(buf), "ifconfig tap0 inet 172.18.0.1/16");
system(buf); ret = system(buf);
fprintf(stderr, "ret %d\n", ret);
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
#ifdef linux #ifdef linux
/* route add for linux */ /* route add for linux */
@ -133,7 +138,8 @@ tapdev_init(void)
snprintf(buf, sizeof(buf), "route add -net 172.18.0.0/16 -iface tap0"); snprintf(buf, sizeof(buf), "route add -net 172.18.0.0/16 -iface tap0");
#endif /* linux */ #endif /* linux */
system(buf); ret = system(buf);
fprintf(stderr, "ret %d\n", ret);
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
atexit(remove_route); atexit(remove_route);

View file

@ -331,7 +331,10 @@ tapdev_init(void)
*/ */
/* freebsd */ /* freebsd */
snprintf(buf, sizeof(buf), "ifconfig tap0 up"); snprintf(buf, sizeof(buf), "ifconfig tap0 up");
system(buf); if(system(buf) == -1) {
perror("tapdev: system: ifconfig");
return;
}
printf("%s\n", buf); printf("%s\n", buf);
/* */ /* */

View file

@ -127,7 +127,7 @@ else
STRIP = $(CROSS_COMPILE)strip STRIP = $(CROSS_COMPILE)strip
ifdef WERROR ifdef WERROR
CFLAGSWERROR ?= -Werror -pedantic -std=c99 -Werror CFLAGSWERROR ?= -Werror
endif endif
CFLAGSNO ?= -Wall -g $(CFLAGSWERROR) CFLAGSNO ?= -Wall -g $(CFLAGSWERROR)

View file

@ -102,12 +102,10 @@ ifeq ($(STM32W_CPUREV), CC)
LD-EXT=-stm32w108CC LD-EXT=-stm32w108CC
RAM_SIZE = 2*8192 RAM_SIZE = 2*8192
FLASH_SIZE = 2*128*1024 FLASH_SIZE = 2*128*1024
${warning "using stm32w108CC specific ld file"}
else ifeq ($(STM32W_CPUREV), xB) else ifeq ($(STM32W_CPUREV), xB)
LD-EXT=-stm32w108xB LD-EXT=-stm32w108xB
RAM_SIZE = 8192 RAM_SIZE = 8192
FLASH_SIZE = 128*1024 FLASH_SIZE = 128*1024
${warning "using stm32w108xB specific ld file"}
else else
${error "Bad STM32W_CPUREV value or no STM32W_CPUREV value specified. Cpu revision should be specified. Please read cpu/stm32w108/README.txt for more details."} ${error "Bad STM32W_CPUREV value or no STM32W_CPUREV value specified. Cpu revision should be specified. Please read cpu/stm32w108/README.txt for more details."}
endif endif

View file

@ -72,6 +72,7 @@
#if RDC_CONF_DEBUG_LED #if RDC_CONF_DEBUG_LED
#define LED_RDC RDC_CONF_DEBUG_LED #define LED_RDC RDC_CONF_DEBUG_LED
#undef LED_ACTIVITY
#define LED_ACTIVITY 1 #define LED_ACTIVITY 1
#else #else
#define LED_RDC 0 #define LED_RDC 0
@ -117,6 +118,7 @@
#endif /* LED_ACTIVITY */ #endif /* LED_ACTIVITY */
#if RDC_CONF_HARDWARE_CSMA #if RDC_CONF_HARDWARE_CSMA
#undef MAC_RETRIES
#define MAC_RETRIES 0 #define MAC_RETRIES 0
#endif /* RDC_CONF_HARDWARE_CSMA */ #endif /* RDC_CONF_HARDWARE_CSMA */
@ -169,6 +171,7 @@ const RadioTransmitConfig radioTransmitConfig = {
TRUE /* appendCrc; */ TRUE /* appendCrc; */
}; };
#undef MAC_RETRIES
#define MAC_RETRIES 0 #define MAC_RETRIES 0
/* /*

View file

@ -497,7 +497,7 @@ init_security(void)
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void
set_key(uint8_t *key) set_key(const uint8_t *key)
{ {
GET_LOCK(); GET_LOCK();
@ -655,17 +655,17 @@ cc2420_transmit(unsigned short payload_len)
#endif /* WITH_SEND_CCA */ #endif /* WITH_SEND_CCA */
for(i = LOOP_20_SYMBOLS; i > 0; i--) { for(i = LOOP_20_SYMBOLS; i > 0; i--) {
if(CC2420_SFD_IS_1) { if(CC2420_SFD_IS_1) {
#if PACKETBUF_WITH_PACKET_TYPE
{ {
rtimer_clock_t sfd_timestamp; rtimer_clock_t sfd_timestamp;
sfd_timestamp = cc2420_sfd_start_time; sfd_timestamp = cc2420_sfd_start_time;
#if PACKETBUF_WITH_PACKET_TYPE
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) {
/* Write timestamp to last two bytes of packet in TXFIFO. */ /* Write timestamp to last two bytes of packet in TXFIFO. */
write_ram((uint8_t *) &sfd_timestamp, CC2420RAM_TXFIFO + payload_len - 1, 2, WRITE_RAM_IN_ORDER); write_ram((uint8_t *) &sfd_timestamp, CC2420RAM_TXFIFO + payload_len - 1, 2, WRITE_RAM_IN_ORDER);
} }
#endif
} }
#endif /* PACKETBUF_WITH_PACKET_TYPE */
if(!(get_status() & BV(CC2420_TX_ACTIVE))) { if(!(get_status() & BV(CC2420_TX_ACTIVE))) {
/* SFD went high but we are not transmitting. This means that /* SFD went high but we are not transmitting. This means that

View file

@ -217,6 +217,8 @@ flushrx(void)
uint8_t dummy; uint8_t dummy;
CC2520_READ_FIFO_BYTE(dummy); CC2520_READ_FIFO_BYTE(dummy);
/* read and discard dummy to avoid "variable set but not used" warning */
(void)dummy;
CC2520_STROBE(CC2520_INS_SFLUSHRX); CC2520_STROBE(CC2520_INS_SFLUSHRX);
CC2520_STROBE(CC2520_INS_SFLUSHRX); CC2520_STROBE(CC2520_INS_SFLUSHRX);
} }
@ -435,17 +437,17 @@ cc2520_transmit(unsigned short payload_len)
#endif /* WITH_SEND_CCA */ #endif /* WITH_SEND_CCA */
for(i = LOOP_20_SYMBOLS; i > 0; i--) { for(i = LOOP_20_SYMBOLS; i > 0; i--) {
if(CC2520_SFD_IS_1) { if(CC2520_SFD_IS_1) {
#if PACKETBUF_WITH_PACKET_TYPE
{ {
rtimer_clock_t sfd_timestamp; rtimer_clock_t sfd_timestamp;
sfd_timestamp = cc2520_sfd_start_time; sfd_timestamp = cc2520_sfd_start_time;
#if PACKETBUF_WITH_PACKET_TYPE
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) {
/* Write timestamp to last two bytes of packet in TXFIFO. */ /* Write timestamp to last two bytes of packet in TXFIFO. */
CC2520_WRITE_RAM(&sfd_timestamp, CC2520RAM_TXFIFO + payload_len - 1, 2); CC2520_WRITE_RAM(&sfd_timestamp, CC2520RAM_TXFIFO + payload_len - 1, 2);
} }
#endif
} }
#endif /* PACKETBUF_WITH_PACKET_TYPE */
if(!(status() & BV(CC2520_TX_ACTIVE))) { if(!(status() & BV(CC2520_TX_ACTIVE))) {
/* SFD went high but we are not transmitting. This means that /* SFD went high but we are not transmitting. This means that

View file

@ -215,7 +215,6 @@ sht11_init(void)
This assumes the SDA/SCL pins passed in the -arch.h file are This assumes the SDA/SCL pins passed in the -arch.h file are
actually the same used for I2C operation, else comment out the following actually the same used for I2C operation, else comment out the following
*/ */
#warning SHT11: DISABLING I2C BUS
SHT11_PxSEL &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); SHT11_PxSEL &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL));
#if defined(__MSP430_HAS_MSP430X_CPU__) || defined(__MSP430_HAS_MSP430XV2_CPU__) #if defined(__MSP430_HAS_MSP430X_CPU__) || defined(__MSP430_HAS_MSP430XV2_CPU__)
SHT11_PxREN &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); SHT11_PxREN &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL));

View file

@ -40,6 +40,7 @@
#define CC2538_RF_CONF_SNIFFER 1 #define CC2538_RF_CONF_SNIFFER 1
#define CC2538_RF_CONF_AUTOACK 0 #define CC2538_RF_CONF_AUTOACK 0
#undef NETSTACK_CONF_RDC
#define NETSTACK_CONF_RDC stub_rdc_driver #define NETSTACK_CONF_RDC stub_rdc_driver
#define UART0_CONF_BAUD_RATE 460800 #define UART0_CONF_BAUD_RATE 460800

View file

@ -67,7 +67,7 @@ res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t prefer
coap_separate_accept(request, &request_metadata); coap_separate_accept(request, &request_metadata);
/* Need Time for calculation now */ /* Need Time for calculation now */
uint32_t i; unsigned i;
for(i = 0; i <= 4096; i++) { for(i = 0; i <= 4096; i++) {
printf("\r%4u\r", i); printf("\r%4u\r", i);
} }

View file

@ -38,6 +38,7 @@
#include "light-sensor.h" #include "light-sensor.h"
#include "ht-sensor.h" #include "ht-sensor.h"
#include "leds.h" #include "leds.h"
#include "leds-extension.h"
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(test_process, "Sensor test process"); PROCESS(test_process, "Sensor test process");

View file

@ -101,9 +101,10 @@ PROCESS_THREAD(unicast_test_process, ev, data)
} }
if(!runicast_is_transmitting(&runicast)) { if(!runicast_is_transmitting(&runicast)) {
linkaddr_t recv = { 0 };
static char buffer[100] = "hello"; static char buffer[100] = "hello";
linkaddr_t recv;
memset(&recv, 0, LINKADDR_SIZE);
packetbuf_copyfrom(buffer, sizeof(buffer)); packetbuf_copyfrom(buffer, sizeof(buffer));
recv.u8[0] = RX_ADDR1; recv.u8[0] = RX_ADDR1;
recv.u8[1] = RX_ADDR2; recv.u8[1] = RX_ADDR2;

View file

@ -28,6 +28,7 @@
*/ */
#include "contiki.h" #include "contiki.h"
#include "dev/slip.h"
#include "net/rpl/rpl.h" #include "net/rpl/rpl.h"
#include "tools/rpl-tools.h" #include "tools/rpl-tools.h"

View file

@ -79,8 +79,6 @@ static void
put_post_led_toggle_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_toggle_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
static int led_state = 0; static int led_state = 0;
const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
/* Given the way the LEDs are connected to the DIO ports, the LEDs are controlled via direct DIO access. */ /* Given the way the LEDs are connected to the DIO ports, the LEDs are controlled via direct DIO access. */

View file

@ -39,8 +39,10 @@
#include "light-sensor.h" #include "light-sensor.h"
#include "ht-sensor.h" #include "ht-sensor.h"
#include "dev/leds.h" #include "dev/leds.h"
#include "dev/leds-extension.h"
#include "sys/etimer.h" #include "sys/etimer.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
static void event_sensors_dr1175_handler(void); static void event_sensors_dr1175_handler(void);
static void get_sensors_dr1175_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset); static void get_sensors_dr1175_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
@ -247,13 +249,12 @@ static void
put_post_white_led_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_white_led_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content = NULL; const uint8_t *request_content = NULL;
int request_content_len;
int level; int level;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
level = atoi((const char *)request_content); level = atoi((const char *)request_content);
CLIP(level, 255) CLIP(level, 255)
leds_set_level(level, LEDS_WHITE); leds_set_level(level, LEDS_WHITE);
@ -272,7 +273,6 @@ static void
put_post_rgb_led_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_rgb_led_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content = NULL; const uint8_t *request_content = NULL;
int request_content_len;
char *pch; char *pch;
int RGB[] = { 0, 0, 0 }; int RGB[] = { 0, 0, 0 };
int index = 0; int index = 0;
@ -280,7 +280,7 @@ put_post_rgb_led_handler(void *request, void *response, uint8_t *buffer, uint16_
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
pch = strtok((char *)request_content, " "); pch = strtok((char *)request_content, " ");
while((pch != NULL) && (index != sizeof(RGB) / sizeof(int))) { while((pch != NULL) && (index != sizeof(RGB) / sizeof(int))) {
/* Convert token to int */ /* Convert token to int */
@ -308,11 +308,10 @@ static void
put_post_led_d3_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d3_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_GP0); SET_LED(LEDS_GP0);
} }
} }
@ -329,11 +328,10 @@ static void
put_post_led_d6_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d6_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_GP1); SET_LED(LEDS_GP1);
} }
} }

View file

@ -39,6 +39,7 @@
#include "button-sensor.h" #include "button-sensor.h"
#include "pot-sensor.h" #include "pot-sensor.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
static char content[REST_MAX_CHUNK_SIZE]; static char content[REST_MAX_CHUNK_SIZE];
static int content_len = 0; static int content_len = 0;
@ -238,11 +239,10 @@ static void
put_post_led_d1_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d1_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_GREEN) SET_LED(LEDS_GREEN)
} }
} }
@ -256,11 +256,10 @@ static void
put_post_led_d2_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d2_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_BLUE) SET_LED(LEDS_BLUE)
} }
} }
@ -274,11 +273,10 @@ static void
put_post_led_d3_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d3_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_RED) SET_LED(LEDS_RED)
} }
} }
@ -292,11 +290,10 @@ static void
put_post_led_d3_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d3_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_GP0); SET_LED(LEDS_GP0);
} }
} }
@ -310,11 +307,10 @@ static void
put_post_led_d6_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_d6_1174_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
SET_LED(LEDS_GP1); SET_LED(LEDS_GP1);
} }
} }
@ -328,11 +324,10 @@ static void
put_post_led_all_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset) put_post_led_all_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{ {
const uint8_t *request_content; const uint8_t *request_content;
int request_content_len;
unsigned int accept = -1; unsigned int accept = -1;
REST.get_header_accept(request, &accept); REST.get_header_accept(request, &accept);
if(accept == -1 || accept == REST.type.TEXT_PLAIN) { if(accept == -1 || accept == REST.type.TEXT_PLAIN) {
request_content_len = REST.get_request_payload(request, &request_content); REST.get_request_payload(request, &request_content);
if(atoi((const char *)request_content) != 0) { if(atoi((const char *)request_content) != 0) {
leds_on(LEDS_ALL); leds_on(LEDS_ALL);
} else { } else {

View file

@ -89,7 +89,7 @@ read_chunk(struct rucb_conn *c, int offset, char *to, int maxsize)
bytecount += size; bytecount += size;
if(bytecount == FILESIZE) { if(bytecount == FILESIZE) {
printf("Completion time %lu / %u\n", (unsigned long)clock_time() - start_time, CLOCK_SECOND); printf("Completion time %lu / %u\n", (unsigned long)clock_time() - start_time, (unsigned int)CLOCK_SECOND);
print_stats(); print_stats();
} }

View file

@ -83,9 +83,8 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag,
} }
if(datalen > 0) { if(datalen > 0) {
int ret;
cfs_seek(fd, offset, CFS_SEEK_SET); cfs_seek(fd, offset, CFS_SEEK_SET);
ret = cfs_write(fd, data, datalen); cfs_write(fd, data, datalen);
} }
cfs_close(fd); cfs_close(fd);

View file

@ -82,9 +82,8 @@ write_chunk(struct rudolph2_conn *c, int offset, int flag,
} }
if(datalen > 0) { if(datalen > 0) {
int ret;
cfs_seek(fd, offset, CFS_SEEK_SET); cfs_seek(fd, offset, CFS_SEEK_SET);
ret = cfs_write(fd, data, datalen); cfs_write(fd, data, datalen);
printf("+++ rudolph2 offset %d, length %d\n", offset, datalen); printf("+++ rudolph2 offset %d, length %d\n", offset, datalen);
} }

View file

@ -40,8 +40,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <io.h>
#include <signal.h>
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(sky_shell_process, "Sky Contiki shell w. webserver"); PROCESS(sky_shell_process, "Sky Contiki shell w. webserver");

View file

@ -57,7 +57,7 @@ PROCESS_THREAD(test_sht25_process, ev, data)
temperature = sht25.value(SHT25_VAL_TEMP); temperature = sht25.value(SHT25_VAL_TEMP);
printf("Temperature %d.%d ºC\n", temperature / 100, temperature % 100); printf("Temperature %d.%d ºC\n", temperature / 100, temperature % 100);
humidity = sht25.value(SHT25_VAL_HUM); humidity = sht25.value(SHT25_VAL_HUM);
printf("Humidity %d.%d %RH\n", humidity / 100, humidity % 100); printf("Humidity %d.%d %%RH\n", humidity / 100, humidity % 100);
} }
PROCESS_END(); PROCESS_END();
} }

View file

@ -527,6 +527,7 @@ extern uip_ds6_netif_t uip_ds6_if;
PRINTF("\n"); PRINTF("\n");
} }
} }
j = 1;
PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS); PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS);
for(nbr = nbr_table_head(ds6_neighbors); for(nbr = nbr_table_head(ds6_neighbors);
nbr != NULL; nbr != NULL;

View file

@ -29,6 +29,7 @@
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
*/ */
#include <stdio.h>
#include <string.h> #include <string.h>
#include "lib/simEnvChange.h" #include "lib/simEnvChange.h"
#include "cfs/cfs.h" #include "cfs/cfs.h"

View file

@ -28,6 +28,7 @@
* *
*/ */
#include <string.h>
#include "dev/eeprom.h" #include "dev/eeprom.h"
#include "lib/simEnvChange.h" #include "lib/simEnvChange.h"

View file

@ -46,6 +46,7 @@ char simSerialReceivingFlag;
static int (* input_handler)(unsigned char) = NULL; static int (* input_handler)(unsigned char) = NULL;
void simlog_char(char c);
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/
void rs232_init(void) { } void rs232_init(void) { }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/

View file

@ -45,7 +45,11 @@
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
uint8_t uint8_t
#if NETSTACK_CONF_WITH_IPV6
uip_driver_send(const uip_lladdr_t *addr)
#else
uip_driver_send(void) uip_driver_send(void)
#endif
{ {
packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len);

View file

@ -41,7 +41,11 @@
#include "net/netstack.h" #include "net/netstack.h"
#if NETSTACK_CONF_WITH_IPV6
uint8_t uip_driver_send(const uip_lladdr_t *);
#else
uint8_t uip_driver_send(void); uint8_t uip_driver_send(void);
#endif
extern const struct network_driver uip_driver; extern const struct network_driver uip_driver;

View file

@ -66,7 +66,9 @@ SENSORS(&button_sensor);
#endif #endif
static uint8_t serial_id[] = SERIAL_ID; static uint8_t serial_id[] = SERIAL_ID;
#if !NETSTACK_CONF_WITH_IPV6
static uint16_t node_id = 0x0102; static uint16_t node_id = 0x0102;
#endif /* !NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void

View file

@ -35,6 +35,7 @@
******************************************************************************/ ******************************************************************************/
#include "contiki-conf.h" #include "contiki-conf.h"
#include "core/sys/cc.h"
#include "hal_MSP-EXP430F5438.h" #include "hal_MSP-EXP430F5438.h"
#include "hal_lcd_fonts.h" #include "hal_lcd_fonts.h"
@ -116,8 +117,6 @@ void halLcdSendCommand(unsigned char Data[])
void halLcdInit(void) void halLcdInit(void)
{ {
volatile unsigned int i = 0;
LCD_CS_RST_OUT |= LCD_CS_PIN | LCD_RESET_PIN; LCD_CS_RST_OUT |= LCD_CS_PIN | LCD_RESET_PIN;
LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN; LCD_CS_RST_DIR |= LCD_CS_PIN | LCD_RESET_PIN;
@ -793,7 +792,7 @@ void halLcdPrint(char String[], unsigned char TextStyle)
while (String[i] != 0) // Stop on null character while (String[i] != 0) // Stop on null character
{ {
LookUpChar = fonts_lookup[String[i]]; LookUpChar = fonts_lookup[(unsigned char)String[i]];
for (j = 0; j < FONT_HEIGHT; j++) for (j = 0; j < FONT_HEIGHT; j++)
{ {

View file

@ -48,6 +48,17 @@ LDLIBS := $(subst MiniMac_JN516x, ,$(LDLIBS))
LDLIBS += JPT_$(JENNIC_CHIP) LDLIBS += JPT_$(JENNIC_CHIP)
endif endif
# Enable all warnings
CFLAGS += -Wall
# Disable warnings that result many false positives with the Contiki core
CFLAGS += -Wno-strict-aliasing
CFLAGS += -Wno-cast-align
# Warings as error
ifdef WERROR
CFLAGS += -Werror
endif
# Pass DEBUG as CFLAG # Pass DEBUG as CFLAG
ifeq ($(DEBUG),SW) ifeq ($(DEBUG),SW)
CFLAGS += -DDEBUG=1 CFLAGS += -DDEBUG=1
@ -64,9 +75,6 @@ SIZE:=$(CROSS_COMPILE)-size
OBJCOPY:=$(CROSS_COMPILE)-objcopy OBJCOPY:=$(CROSS_COMPILE)-objcopy
OBJDUMP:=$(CROSS_COMPILE)-objdump OBJDUMP:=$(CROSS_COMPILE)-objdump
CFLAGS := $(subst -Wcast-align,,$(CFLAGS))
CFLAGS := $(subst -Wall,,$(CFLAGS))
ARCH = ccm-star.c exceptions.c rtimer-arch.c slip_uart0.c clock.c micromac-radio.c \ ARCH = ccm-star.c exceptions.c rtimer-arch.c slip_uart0.c clock.c micromac-radio.c \
mtarch.c node-id.c watchdog.c log.c ringbufindex.c slip.c sprintf.c mtarch.c node-id.c watchdog.c log.c ringbufindex.c slip.c sprintf.c
# Default uart0 for printf and slip # Default uart0 for printf and slip

View file

@ -232,13 +232,13 @@ set_linkaddr(void)
{ {
int i; int i;
linkaddr_t addr; linkaddr_t addr;
memset(&addr, 0, sizeof(linkaddr_t)); memset(&addr, 0, LINKADDR_SIZE);
#if NETSTACK_CONF_WITH_IPV6 #if NETSTACK_CONF_WITH_IPV6
memcpy(addr.u8, node_mac, sizeof(addr.u8)); memcpy(addr.u8, node_mac, sizeof(addr.u8));
#else #else
if(node_id == 0) { if(node_id == 0) {
for(i = 0; i < sizeof(linkaddr_t); ++i) { for(i = 0; i < LINKADDR_SIZE; ++i) {
addr.u8[i] = node_mac[7 - i]; addr.u8[i] = node_mac[LINKADDR_SIZE - 1 - i];
} }
} else { } else {
addr.u8[0] = node_id & 0xff; addr.u8[0] = node_id & 0xff;

View file

@ -66,7 +66,6 @@
#endif /* JENNIC_CHIP_FAMILY */ #endif /* JENNIC_CHIP_FAMILY */
#if (defined EXCEPTION_VECTORS_LOCATION_RAM) #if (defined EXCEPTION_VECTORS_LOCATION_RAM)
#pragma "EXCEPTION_VECTORS_LOCATION_RAM"
/* RAM exception vectors are set up at run time */ /* RAM exception vectors are set up at run time */
/* Addresses of exception vectors in RAM */ /* Addresses of exception vectors in RAM */
#define BUS_ERROR *((volatile uint32 *)(0x4000000)) #define BUS_ERROR *((volatile uint32 *)(0x4000000))
@ -79,7 +78,6 @@
#define GENERIC *((volatile uint32 *)(0x400001c)) #define GENERIC *((volatile uint32 *)(0x400001c))
#define STACK_OVERFLOW *((volatile uint32 *)(0x4000020)) #define STACK_OVERFLOW *((volatile uint32 *)(0x4000020))
#elif (defined EXCEPTION_VECTORS_LOCATION_FLASH) #elif (defined EXCEPTION_VECTORS_LOCATION_FLASH)
#pragma "EXCEPTION_VECTORS_LOCATION_FLASH"
/* Flash exception vectors are set up at compile time */ /* Flash exception vectors are set up at compile time */
#else #else
#error Unknown exception vector location #error Unknown exception vector location

View file

@ -57,6 +57,8 @@
#include "JPT.h" #include "JPT.h"
#include "PeripheralRegs.h" #include "PeripheralRegs.h"
void vMMAC_SetChannelAndPower(uint8 u8Channel, int8 i8power);
/* This driver configures the radio in PHY mode and does address decoding /* This driver configures the radio in PHY mode and does address decoding
* and acknowledging in software. */ * and acknowledging in software. */
@ -864,8 +866,6 @@ set_send_on_cca(uint8_t enable)
static radio_result_t static radio_result_t
get_value(radio_param_t param, radio_value_t *value) get_value(radio_param_t param, radio_value_t *value)
{ {
int i, v;
if(!value) { if(!value) {
return RADIO_RESULT_INVALID_VALUE; return RADIO_RESULT_INVALID_VALUE;
} }
@ -926,8 +926,6 @@ get_value(radio_param_t param, radio_value_t *value)
static radio_result_t static radio_result_t
set_value(radio_param_t param, radio_value_t value) set_value(radio_param_t param, radio_value_t value)
{ {
int i;
switch(param) { switch(param) {
case RADIO_PARAM_POWER_MODE: case RADIO_PARAM_POWER_MODE:
if(value == RADIO_POWER_MODE_ON) { if(value == RADIO_POWER_MODE_ON) {

View file

@ -39,6 +39,7 @@
#include "sys/rtimer.h" #include "sys/rtimer.h"
#include "sys/clock.h" #include "sys/clock.h"
#include "sys/process.h"
#include <AppHardwareApi.h> #include <AppHardwareApi.h>
#include <PeripheralRegs.h> #include <PeripheralRegs.h>
#include "dev/watchdog.h" #include "dev/watchdog.h"

View file

@ -44,6 +44,7 @@
#include "contiki-conf.h" #include "contiki-conf.h"
#include "uart-driver.h" #include "uart-driver.h"
#include "sys/rtimer.h" #include "sys/rtimer.h"
#include "watchdog.h"
#include <math.h> #include <math.h>
#include <AppHardwareApi.h> #include <AppHardwareApi.h>
@ -79,7 +80,9 @@ extern volatile unsigned char xonxoff_state;
/*** Local Function Prototypes ***/ /*** Local Function Prototypes ***/
static void uart_driver_isr(uint32_t device_id, uint32_t item_bitmap); static void uart_driver_isr(uint32_t device_id, uint32_t item_bitmap);
#if !UART_XONXOFF_FLOW_CTRL
static int16_t uart_driver_get_tx_fifo_available_space(uint8_t uart_dev); static int16_t uart_driver_get_tx_fifo_available_space(uint8_t uart_dev);
#endif /* !UART_XONXOFF_FLOW_CTRL */
static void uart_driver_set_baudrate(uint8_t uart_dev, uint8_t br); static void uart_driver_set_baudrate(uint8_t uart_dev, uint8_t br);
static void uart_driver_set_high_baudrate(uint8_t uart_dev, uint32_t baud_rate); static void uart_driver_set_high_baudrate(uint8_t uart_dev, uint32_t baud_rate);
@ -352,12 +355,14 @@ uart_driver_rx_handler(uint8_t uart_dev)
/*** Local Functions ***/ /*** Local Functions ***/
/****************************************************************************/ /****************************************************************************/
#if !UART_XONXOFF_FLOW_CTRL
/* Returns the free space in tx fifo, i.e., how many characters we can put */ /* Returns the free space in tx fifo, i.e., how many characters we can put */
static int16_t static int16_t
uart_driver_get_tx_fifo_available_space(uint8_t uart_dev) uart_driver_get_tx_fifo_available_space(uint8_t uart_dev)
{ {
return tx_fifo_size[uart_dev] - u16AHI_UartReadTxFifoLevel(uart_dev); return tx_fifo_size[uart_dev] - u16AHI_UartReadTxFifoLevel(uart_dev);
} }
#endif /* !UART_XONXOFF_FLOW_CTRL */
/* Initializes the specified UART with auto-selection of /* Initializes the specified UART with auto-selection of
baudrate tuning method */ baudrate tuning method */
static void static void
@ -459,7 +464,7 @@ uart_driver_set_high_baudrate(uint8_t uart_dev, uint32_t baud_rate)
DBG_vPrintf(DEBUG_UART_BUFFERED, "Config uart=%d, baud=%d\n", uart_dev, DBG_vPrintf(DEBUG_UART_BUFFERED, "Config uart=%d, baud=%d\n", uart_dev,
baud_rate); baud_rate);
while(abs(i32BaudError) > (int32)(baud_rate >> 4)) { /* 6.25% (100/16) error */ while(ABS(i32BaudError) > (int32)(baud_rate >> 4)) { /* 6.25% (100/16) error */
if(--u8ClocksPerBit < 3) { if(--u8ClocksPerBit < 3) {
DBG_vPrintf(DEBUG_UART_BUFFERED, DBG_vPrintf(DEBUG_UART_BUFFERED,
"Could not calculate UART settings for target baud!"); "Could not calculate UART settings for target baud!");

View file

@ -43,6 +43,7 @@
#include <PeripheralRegs.h> #include <PeripheralRegs.h>
#include "contiki-conf.h" #include "contiki-conf.h"
#include "uart-driver.h"
#define UART_DEFAULT_RX_BUFFER_SIZE 2047 #define UART_DEFAULT_RX_BUFFER_SIZE 2047
#if UART_XONXOFF_FLOW_CTRL #if UART_XONXOFF_FLOW_CTRL

View file

@ -227,7 +227,7 @@ int
puts(const char *s) puts(const char *s)
{ {
char c; char c;
while(c = *s++) { while((c = *s++) != '\0') {
putchar(c); putchar(c);
} }
putchar('\n'); putchar('\n');

View file

@ -76,18 +76,8 @@
#include "net/ipv6/uip-ds6.h" #include "net/ipv6/uip-ds6.h"
#endif /* NETSTACK_CONF_WITH_IPV6 */ #endif /* NETSTACK_CONF_WITH_IPV6 */
#define DEBUG 1 #define DEBUG DEBUG_PRINT
#if DEBUG #include "net/ip/uip-debug.h"
#include <stdio.h>
#define PRINTF(...) printf(__VA_ARGS__)
#define PRINT6ADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
#define PRINTLLADDR(lladdr) PRINTF(" %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ",lladdr.u8[0], lladdr.u8[1], lladdr.u8[2], lladdr.u8[3],lladdr.u8[4], lladdr.u8[5], lladdr.u8[6], lladdr.u8[7])
#else
#define PRINTF(...)
#define PRINT6ADDR(addr)
#define PRINTLLADDR(addr)
#endif
#if NETSTACK_CONF_WITH_IPV6 #if NETSTACK_CONF_WITH_IPV6
PROCINIT(&tcpip_process, &sensors_process); PROCINIT(&tcpip_process, &sensors_process);
@ -183,13 +173,13 @@ main(void)
set_rime_addr(); set_rime_addr();
printf("%s %s, channel check rate %lu Hz\n", printf("%s %s, channel check rate %d Hz\n",
NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_MAC.name, NETSTACK_RDC.name,
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
NETSTACK_RDC.channel_check_interval())); NETSTACK_RDC.channel_check_interval()));
printf("802.15.4 PAN ID 0x%x, EUI-%d:", printf("802.15.4 PAN ID 0x%x, EUI-%d:",
IEEE802154_CONF_PANID, UIP_CONF_LL_802154?64:16); IEEE802154_CONF_PANID, UIP_CONF_LL_802154?64:16);
uip_debug_lladdr_print(&linkaddr_node_addr); uip_debug_lladdr_print((const uip_lladdr_t *)&linkaddr_node_addr);
printf(", radio channel %u\n", RF_CHANNEL); printf(", radio channel %u\n", RF_CHANNEL);
procinit_init(); procinit_init();

View file

@ -76,7 +76,6 @@ value(int type)
{ {
static uint16_t ADCvalue; static uint16_t ADCvalue;
static int16_t volts; static int16_t volts;
uint16_t scale=1;
halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE(halGetADCChannelFromGPIO(TEMPERATURE_SENSOR_GPIO),ADC_MUX_VREF2), ADC_CONVERSION_TIME_US_4096); halStartAdcConversion(ADC_USER_APP, ADC_REF_INT, ADC_SOURCE(halGetADCChannelFromGPIO(TEMPERATURE_SENSOR_GPIO),ADC_MUX_VREF2), ADC_CONVERSION_TIME_US_4096);

View file

@ -50,6 +50,7 @@
#include "net/netstack.h" #include "net/netstack.h"
#include "net/mac/frame802154.h" #include "net/mac/frame802154.h"
#include "net/linkaddr.h" #include "net/linkaddr.h"
#include "net/queuebuf.h"
#include "dev/ds2401.h" #include "dev/ds2401.h"
#include "sys/node-id.h" #include "sys/node-id.h"

View file

@ -33,6 +33,7 @@
#include "contiki-conf.h" #include "contiki-conf.h"
#include "sys/node-id.h" #include "sys/node-id.h"
#include "dev/eeprom.h"
unsigned short node_id = 0; unsigned short node_id = 0;

View file

@ -84,7 +84,9 @@ static int select_max = 0;
SENSORS(&pir_sensor, &vib_sensor, &button_sensor); SENSORS(&pir_sensor, &vib_sensor, &button_sensor);
static uint8_t serial_id[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}; static uint8_t serial_id[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};
#if !NETSTACK_CONF_WITH_IPV6
static uint16_t node_id = 0x0102; static uint16_t node_id = 0x0102;
#endif /* !NETSTACK_CONF_WITH_IPV6 */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int int
select_set_callback(int fd, const struct select_callback *callback) select_set_callback(int fd, const struct select_callback *callback)

View file

@ -44,6 +44,6 @@ void relay_enable(uint8_t pin);
void relay_on(); void relay_on();
void relay_off(); void relay_off();
int8_t relay_toogle(); int8_t relay_toggle();
#endif /* RELAY_PHIDGET_H_ */ #endif /* RELAY_PHIDGET_H_ */

View file

@ -92,7 +92,7 @@ set_global_address(void)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
uint8_t should_blink = 1; uint8_t should_blink = 1;
static void static void
route_callback(int event, uip_ipaddr_t *route, uip_ipaddr_t *ipaddr) route_callback(int event, uip_ipaddr_t *route, uip_ipaddr_t *ipaddr, int num_routes)
{ {
if(event == UIP_DS6_NOTIFICATION_DEFRT_ADD) { if(event == UIP_DS6_NOTIFICATION_DEFRT_ADD) {
should_blink = 0; should_blink = 0;
@ -105,11 +105,10 @@ PROCESS_THREAD(receiver_node_process, ev, data)
{ {
static struct etimer et; static struct etimer et;
static struct uip_ds6_notification n; static struct uip_ds6_notification n;
uip_ipaddr_t *ipaddr;
PROCESS_BEGIN(); PROCESS_BEGIN();
ipaddr = set_global_address(); set_global_address();
uip_ds6_notification_add(&n, route_callback); uip_ds6_notification_add(&n, route_callback);

View file

@ -2,5 +2,7 @@
#define RESOLV_CONF_SUPPORTS_MDNS 0 #define RESOLV_CONF_SUPPORTS_MDNS 0
#define COOJA_MTARCH_STACKSIZE 4096 #define COOJA_MTARCH_STACKSIZE 4096
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 3 #define UIP_CONF_MAX_ROUTES 3
#undef NBR_TABLE_CONF_MAX_NEIGHBORS
#define NBR_TABLE_CONF_MAX_NEIGHBORS 3 #define NBR_TABLE_CONF_MAX_NEIGHBORS 3

View file

@ -2,7 +2,9 @@
#define RESOLV_CONF_SUPPORTS_MDNS 0 #define RESOLV_CONF_SUPPORTS_MDNS 0
#define COOJA_MTARCH_STACKSIZE 4096 #define COOJA_MTARCH_STACKSIZE 4096
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 8 #define UIP_CONF_MAX_ROUTES 8
#undef NBR_TABLE_CONF_MAX_NEIGHBORS
#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 #define NBR_TABLE_CONF_MAX_NEIGHBORS 8
/*#define RPL_CONF_DEFAULT_LIFETIME_UNIT 10 /*#define RPL_CONF_DEFAULT_LIFETIME_UNIT 10

View file

@ -2,6 +2,7 @@
#include "contiki-net.h" #include "contiki-net.h"
#include "ip64.h" #include "ip64.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "net/rpl/rpl-dag-root.h"
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(router_node_process, "Router node"); PROCESS(router_node_process, "Router node");

View file

@ -41,7 +41,7 @@ define dooneexample
@echo Building example $(3): $(1) for target $(2) @echo Building example $(3): $(1) for target $(2)
@((cd $(EXAMPLESDIR)/$(1); \ @((cd $(EXAMPLESDIR)/$(1); \
export STM32W_CPUREV=CC; \ export STM32W_CPUREV=CC; \
make TARGET=$(2) clean && make TARGET=$(2)) > \ make TARGET=$(2) clean && make TARGET=$(2) WERROR=1) > \
$(3)-$(subst /,-,$(1))$(2).report 2>&1 && \ $(3)-$(subst /,-,$(1))$(2).report 2>&1 && \
(echo $(1) $(2): OK | tee $(3)-$(subst /,-,$(1))$(2).summary) || \ (echo $(1) $(2): OK | tee $(3)-$(subst /,-,$(1))$(2).summary) || \
(echo $(1) $(2): FAIL ಠ.ಠ | tee $(3)-$(subst /,-,$(1))$(2).summary ; \ (echo $(1) $(2): FAIL ಠ.ಠ | tee $(3)-$(subst /,-,$(1))$(2).summary ; \