diff --git a/apps/powertrace/powertrace.c b/apps/powertrace/powertrace.c index 139d96af8..6d8f2936f 100644 --- a/apps/powertrace/powertrace.c +++ b/apps/powertrace/powertrace.c @@ -48,15 +48,15 @@ struct powertrace_sniff_stats { struct powertrace_sniff_stats *next; - uint32_t num_input, num_output; - uint32_t input_txtime, input_rxtime; - uint32_t output_txtime, output_rxtime; + unsigned long num_input, num_output; + unsigned long input_txtime, input_rxtime; + unsigned long output_txtime, output_rxtime; #if NETSTACK_CONF_WITH_IPV6 uint16_t proto; /* includes proto + possibly flags */ #endif uint16_t channel; - uint32_t last_input_txtime, last_input_rxtime; - uint32_t last_output_txtime, last_output_rxtime; + unsigned long last_input_txtime, last_input_rxtime; + unsigned long last_output_txtime, last_output_rxtime; }; #define INPUT 1 @@ -72,17 +72,17 @@ PROCESS(powertrace_process, "Periodic power output"); void powertrace_print(char *str) { - static uint32_t last_cpu, last_lpm, last_transmit, last_listen; - static uint32_t last_idle_transmit, last_idle_listen; + static unsigned long last_cpu, last_lpm, last_transmit, last_listen; + static unsigned long last_idle_transmit, last_idle_listen; - uint32_t cpu, lpm, transmit, listen; - uint32_t all_cpu, all_lpm, all_transmit, all_listen; - uint32_t idle_transmit, idle_listen; - uint32_t all_idle_transmit, all_idle_listen; + unsigned long cpu, lpm, transmit, listen; + unsigned long all_cpu, all_lpm, all_transmit, all_listen; + unsigned long idle_transmit, 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; @@ -287,13 +287,8 @@ output_sniffer(int mac_status) static void sniffprint(char *prefix, int seqno) { - const linkaddr_t *sender, *receiver, *esender, *ereceiver; - - sender = packetbuf_addr(PACKETBUF_ADDR_SENDER); - receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); + const linkaddr_t *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", clock_time(), diff --git a/apps/servreg-hack/servreg-hack.c b/apps/servreg-hack/servreg-hack.c index f93bf20c3..d7ccf7dac 100644 --- a/apps/servreg-hack/servreg-hack.c +++ b/apps/servreg-hack/servreg-hack.c @@ -332,14 +332,10 @@ static void parse_incoming_packet(const uint8_t *buf, int len) { int numregs; - int flags; int i; int bufptr; 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; for(i = 0; i < numregs; ++i) { diff --git a/apps/shell/shell-crc.c b/apps/shell/shell-crc.c index 315ca18e2..b3234577a 100644 --- a/apps/shell/shell-crc.c +++ b/apps/shell/shell-crc.c @@ -50,6 +50,7 @@ #define HAVE_ALLOCA 0 #else #define HAVE_ALLOCA 1 +#include #endif #define DEBUG 0 diff --git a/apps/shell/shell-memdebug.c b/apps/shell/shell-memdebug.c index 9c6be22a9..e25e5afae 100644 --- a/apps/shell/shell-memdebug.c +++ b/apps/shell/shell-memdebug.c @@ -71,7 +71,7 @@ PROCESS_THREAD(shell_poke_process, ev, data) PROCESS_EXIT(); } - address = (uint8_t *)(int)shell_strtolong(args, &next); + address = (uint8_t *)(uintptr_t)shell_strtolong(args, &next); if(next == args) { shell_output_str(&poke_command, "usage 1", ""); PROCESS_EXIT(); @@ -106,7 +106,7 @@ PROCESS_THREAD(shell_peek_process, ev, data) PROCESS_EXIT(); } - address = (uint8_t *)(int)shell_strtolong(args, &next); + address = (uint8_t *)(uintptr_t)shell_strtolong(args, &next); if(next == args) { shell_output_str(&peek_command, "usage 1", ""); PROCESS_EXIT(); diff --git a/apps/shell/shell-netperf.c b/apps/shell/shell-netperf.c index b4e35ed1a..5776945fc 100644 --- a/apps/shell/shell-netperf.c +++ b/apps/shell/shell-netperf.c @@ -128,8 +128,8 @@ memcpy_misaligned(void *dest, const void *source, int len) int i; uint8_t *destptr; const uint8_t *sourceptr; - if(((int)dest & 1) == 1 || - ((int)source & 1) == 1) { + if(((uintptr_t)dest & 1) == 1 || + ((uintptr_t)source & 1) == 1) { destptr = dest; sourceptr = source; for(i = 0; i < len; ++i) { diff --git a/apps/shell/shell-rime-netcmd.c b/apps/shell/shell-rime-netcmd.c index cadcd993a..87927065d 100644 --- a/apps/shell/shell-rime-netcmd.c +++ b/apps/shell/shell-rime-netcmd.c @@ -129,7 +129,7 @@ PROCESS_THREAD(shell_netcmd_process, ev, data) /* Terminate the string with a NUL character. */ 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); trickle_send(&trickle); } @@ -157,7 +157,7 @@ recv_trickle(struct trickle_conn *c) msg->netcmd[len] = 0; 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. */ process_start(&shell_netcmd_server_process, (void *)msg->netcmd); } diff --git a/apps/shell/shell-rime-sendcmd.c b/apps/shell/shell-rime-sendcmd.c index b3179c54b..5bbbc4aea 100644 --- a/apps/shell/shell-rime-sendcmd.c +++ b/apps/shell/shell-rime-sendcmd.c @@ -133,7 +133,7 @@ PROCESS_THREAD(shell_sendcmd_process, ev, data) /* Terminate the string with a NUL character. */ 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);*/ unicast_send(&uc, &addr); @@ -160,7 +160,7 @@ recv_uc(struct unicast_conn *c, const linkaddr_t *from) msg->sendcmd[len] = 0; 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. */ process_start(&shell_sendcmd_server_process, (void *)msg->sendcmd); } diff --git a/apps/shell/shell-rime.c b/apps/shell/shell-rime.c index 16061c58d..3e6184ff7 100644 --- a/apps/shell/shell-rime.c +++ b/apps/shell/shell-rime.c @@ -301,7 +301,7 @@ recv_collect(const linkaddr_t *originator, uint8_t seqno, uint8_t hops) /* Copy the collect message header. */ 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 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) { 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; linkaddr_copy((linkaddr_t *)&msg.originator, originator); msg.seqno = seqno; diff --git a/apps/shell/shell-time.c b/apps/shell/shell-time.c index fb2b7e7f1..6947df7ee 100644 --- a/apps/shell/shell-time.c +++ b/apps/shell/shell-time.c @@ -158,7 +158,6 @@ PROCESS_THREAD(shell_repeat_server_process, ev, data) static char *command; static struct process *started_process; char command_copy[MAX_COMMANDLENGTH]; - int ret; if(ev == shell_event_input) { goto exit; @@ -172,7 +171,7 @@ PROCESS_THREAD(shell_repeat_server_process, ev, data) data == &shell_repeat_process); { 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); if(started_process != NULL && @@ -202,11 +201,10 @@ repeat_print_usage(void) /*---------------------------------------------------------------------------*/ PROCESS_THREAD(shell_repeat_process, ev, data) { - static int reps, period, period_left; + static int reps, period; static char command[MAX_COMMANDLENGTH]; static struct etimer etimer; static int i; - static clock_time_t start_time; const char *args, *next; if(ev == shell_event_input) { @@ -258,7 +256,6 @@ PROCESS_THREAD(shell_repeat_process, ev, data) /* printf("repeats %d period %d command '%s'\n", reps, period, command);*/ - start_time = clock_time(); etimer_set(&etimer, CLOCK_SECOND * period); 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 process *started_process; const char *args, *next; - int ret; /* if(ev == shell_event_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, */ /* 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); if(started_process != NULL && diff --git a/apps/shell/shell-vars.c b/apps/shell/shell-vars.c index 42948f5aa..b28834f4a 100644 --- a/apps/shell/shell-vars.c +++ b/apps/shell/shell-vars.c @@ -51,7 +51,7 @@ #define SHELL_VARS_RAM_END SHELL_VARS_CONF_RAM_END #else /* SHELL_VARS_CONF_RAM_BEGIN */ #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 */ /*---------------------------------------------------------------------------*/ @@ -77,8 +77,8 @@ PROCESS_THREAD(shell_vars_process, ev, data) for(i = 0; i < symbols_nelts; ++i) { if(symbols[i].name != NULL && - (unsigned int)symbols[i].value >= SHELL_VARS_RAM_BEGIN && - (unsigned int)symbols[i].value <= SHELL_VARS_RAM_END) { + (uintptr_t)symbols[i].value >= SHELL_VARS_RAM_BEGIN && + (uintptr_t)symbols[i].value <= SHELL_VARS_RAM_END) { shell_output_str(&vars_command, (char *)symbols[i].name, ""); } } diff --git a/apps/webbrowser/webclient.c b/apps/webbrowser/webclient.c index f8f63d413..b4487ca26 100644 --- a/apps/webbrowser/webclient.c +++ b/apps/webbrowser/webclient.c @@ -200,7 +200,7 @@ window_copy(int curptr, const char *data, unsigned char datalen) len = windowend - windowstart; } - strncpy(windowptr + windowstart, data, len); + strncpy((char *)(windowptr + windowstart), data, len); windowstart += len; return curptr + datalen; @@ -217,7 +217,7 @@ senddata(void) windowstart = s.getrequestptr; curptr = 0; 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, s.file, (unsigned char)strlen(s.file)); diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 87fdd9078..0f1be0ee8 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -843,7 +843,9 @@ add_pagewidget(char *text, unsigned char size, char *attrib, unsigned char type, void htmlparser_newline(void) { +#ifdef WITH_PETSCII char *wptr; +#endif /* WITH_PETSCII */ if(++newlines > 2) { return; @@ -863,8 +865,10 @@ htmlparser_newline(void) ++y; x = 0; +#ifdef WITH_PETSCII wptr = webpageptr - WWW_CONF_WEBPAGE_WIDTH; petsciiconv_topetscii(wptr, WWW_CONF_WEBPAGE_WIDTH); +#endif /* WITH_PETSCII */ if(y == WWW_CONF_WEBPAGE_HEIGHT) { loading = 0; diff --git a/apps/webserver/urlconv.c b/apps/webserver/urlconv.c index 3d5e583df..d4f32f484 100644 --- a/apps/webserver/urlconv.c +++ b/apps/webserver/urlconv.c @@ -80,7 +80,7 @@ urlconv_tofilename(char *dest, char *source, unsigned char maxlen) *dest = ISO_slash; strncpy(dest + 1, wwwroot, wwwrootlen); len = 0; - from = source; to = dest + wwwrootlen; + from = (unsigned char *)source; to = (unsigned char *)dest + wwwrootlen; maxlen -= 2 + wwwrootlen; do { c = *(from++); @@ -139,7 +139,7 @@ urlconv_tofilename(char *dest, char *source, unsigned char maxlen) } } while(c); 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 { ++to; *to = 0; diff --git a/core/ctk/ctk-filedialog.c b/core/ctk/ctk-filedialog.c index 0bafcc4a8..ca4bf523e 100644 --- a/core/ctk/ctk-filedialog.c +++ b/core/ctk/ctk-filedialog.c @@ -155,14 +155,14 @@ ctk_filedialog_eventhandler(struct ctk_filedialog_state *s, } return 1; } else if(ev == ctk_signal_keypress) { - if((ctk_arch_key_t)data == CH_CURS_UP) { + if((char)(size_t)data == CH_CURS_UP) { clearptr(); if(fileptr > 0) { --fileptr; } showptr(); return 1; - } else if((ctk_arch_key_t)data == CH_CURS_DOWN) { + } else if((char)(size_t)data == CH_CURS_DOWN) { clearptr(); if(fileptr < FILES_HEIGHT - 1) { ++fileptr; diff --git a/core/ctk/ctk.c b/core/ctk/ctk.c index 56f962b4a..699cf0198 100644 --- a/core/ctk/ctk.c +++ b/core/ctk/ctk.c @@ -852,7 +852,9 @@ add_redrawwidget(struct ctk_widget *w) static void widget_redraw(struct ctk_widget *widget) { +#if CTK_CONF_WINDOWS struct ctk_window *window; +#endif /* CTK_CONF_WINDOWS */ if(mode != CTK_MODE_NORMAL || widget == NULL) { return; @@ -870,8 +872,8 @@ widget_redraw(struct ctk_widget *widget) if(menus.open == NULL) #endif /* CTK_CONF_MENUS */ { - window = widget->window; #if CTK_CONF_WINDOWS + window = widget->window; if(window == dialog) { ctk_draw_widget(widget, CTK_FOCUS_DIALOG, 0, height); } else if(dialog == NULL && diff --git a/core/net/ipv6/uip-ds6.c b/core/net/ipv6/uip-ds6.c index 2141ac2c1..148c8aa24 100644 --- a/core/net/ipv6/uip-ds6.c +++ b/core/net/ipv6/uip-ds6.c @@ -83,7 +83,9 @@ static uip_ipaddr_t loc_fipaddr; /* Pointers used in this file */ static uip_ds6_addr_t *locaddr; static uip_ds6_maddr_t *locmaddr; +#if UIP_DS6_AADDR_NB static uip_ds6_aaddr_t *locaaddr; +#endif /* UIP_DS6_AADDR_NB */ 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_add(uip_ipaddr_t *ipaddr) { +#if UIP_DS6_AADDR_NB 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, @@ -466,6 +469,7 @@ uip_ds6_aaddr_add(uip_ipaddr_t *ipaddr) uip_ipaddr_copy(&locaaddr->ipaddr, ipaddr); return locaaddr; } +#endif /* UIP_DS6_AADDR_NB */ return NULL; } @@ -483,11 +487,13 @@ uip_ds6_aaddr_rm(uip_ds6_aaddr_t *aaddr) uip_ds6_aaddr_t * 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, UIP_DS6_AADDR_NB, sizeof(uip_ds6_aaddr_t), ipaddr, 128, (uip_ds6_element_t **)&locaaddr) == FOUND) { return locaaddr; } +#endif /* UIP_DS6_AADDR_NB */ return NULL; } diff --git a/core/net/ipv6/uip-ds6.h b/core/net/ipv6/uip-ds6.h index 9c470a1db..b111d0f5b 100644 --- a/core/net/ipv6/uip-ds6.h +++ b/core/net/ipv6/uip-ds6.h @@ -216,9 +216,15 @@ typedef struct uip_ds6_netif { uint32_t reachable_time; /* in msec */ uint32_t retrans_timer; /* in msec */ uint8_t maxdadns; +#if 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]; +#endif /* UIP_DS6_AADDR_NB */ +#if UIP_DS6_MADDR_NB uip_ds6_maddr_t maddr_list[UIP_DS6_MADDR_NB]; +#endif /* UIP_DS6_MADDR_NB */ } uip_ds6_netif_t; /** \brief Generic type for a DS6, to use a common loop though all DS */ diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index 98edee6a5..63858017c 100644 --- a/core/net/ipv6/uip6.c +++ b/core/net/ipv6/uip6.c @@ -288,7 +288,10 @@ struct uip_icmp6_conn uip_icmp6_conns; /*---------------------------------------------------------------------------*/ /* 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 uip_add32(uint8_t *op32, uint16_t op16) { @@ -315,8 +318,8 @@ uip_add32(uint8_t *op32, uint16_t op16) } } } - -#endif /* UIP_ARCH_ADD32 && UIP_TCP */ +#endif /* UIP_ARCH_ADD32 */ +#endif /* UIP_TCP */ #if ! UIP_ARCH_CHKSUM /*---------------------------------------------------------------------------*/ diff --git a/core/net/llsec/anti-replay.c b/core/net/llsec/anti-replay.c index c56d90e0b..7c392bff7 100644 --- a/core/net/llsec/anti-replay.c +++ b/core/net/llsec/anti-replay.c @@ -55,7 +55,8 @@ anti_replay_set_counter(void) { 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_2_3, reordered_counter.u16[1]); diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 04baa90bd..5cec23a3d 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -48,6 +48,7 @@ #if CONTIKI_TARGET_COOJA #include "lib/simEnvChange.h" +#include "sys/cooja_mt.h" #endif /* CONTIKI_TARGET_COOJA */ #define DEBUG 0 diff --git a/cpu/avr/bootloader.c b/cpu/avr/bootloader.c index 20a174ed0..844dc20a1 100644 --- a/cpu/avr/bootloader.c +++ b/cpu/avr/bootloader.c @@ -12,7 +12,6 @@ /* MCUSR is a deprecated name but older avr-libc versions may define it */ #if !defined (MCUCSR) # if defined (MCUSR) -# warning *** MCUCSR not defined, using MCUSR instead *** # define MCUCSR MCUSR # endif #endif diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index c85608e09..d00a24d72 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -237,6 +237,8 @@ typedef enum{ PROCESS(rf230_process, "RF230 driver"); /*---------------------------------------------------------------------------*/ +int rf230_interrupt(void); + static int rf230_on(void); static int rf230_off(void); diff --git a/cpu/avr/watchdog.c b/cpu/avr/watchdog.c index e7aaee9bd..b37691e39 100644 --- a/cpu/avr/watchdog.c +++ b/cpu/avr/watchdog.c @@ -67,7 +67,6 @@ /* MCUSR is a deprecated name but older avr-libc versions may define it */ #if !defined (MCUCSR) # if defined (MCUSR) -# warning *** MCUCSR not defined, using MCUSR instead *** # define MCUCSR MCUSR # endif #endif diff --git a/cpu/cc2538/Makefile.cc2538 b/cpu/cc2538/Makefile.cc2538 index 2ace72f76..0d4d3c73f 100644 --- a/cpu/cc2538/Makefile.cc2538 +++ b/cpu/cc2538/Makefile.cc2538 @@ -22,6 +22,10 @@ LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch OBJCOPY_FLAGS += -O binary --gap-fill 0xff OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb +ifdef WERROR +CFLAGS += -Werror +endif + ### Are we building with code size optimisations? ifeq ($(SMALL),1) CFLAGS += -Os diff --git a/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx b/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx index 781f79b3f..f6ac275da 100644 --- a/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx +++ b/cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx @@ -41,6 +41,10 @@ LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch OBJCOPY_FLAGS += -O binary --gap-fill 0xff OBJDUMP_FLAGS += --disassemble --source --disassembler-options=force-thumb +ifdef WERROR +CFLAGS += -Werror +endif + ### Are we building with code size optimisations? ifeq ($(SMALL),1) CFLAGS += -Os diff --git a/cpu/cc26xx-cc13xx/lib/cc13xxware b/cpu/cc26xx-cc13xx/lib/cc13xxware index 63ed52888..6bdb6da3f 160000 --- a/cpu/cc26xx-cc13xx/lib/cc13xxware +++ b/cpu/cc26xx-cc13xx/lib/cc13xxware @@ -1 +1 @@ -Subproject commit 63ed52888467ea7d403b0c743852162395232c9e +Subproject commit 6bdb6da3fa9682303799e5c3b1f755398e87fc99 diff --git a/cpu/cc26xx-cc13xx/lib/cc26xxware b/cpu/cc26xx-cc13xx/lib/cc26xxware index 0e82b18bf..0270b50ac 160000 --- a/cpu/cc26xx-cc13xx/lib/cc26xxware +++ b/cpu/cc26xx-cc13xx/lib/cc26xxware @@ -1 +1 @@ -Subproject commit 0e82b18bf2c69fb0a40af4d2496db2a3dc721cec +Subproject commit 0270b50ac750f8f3348a98f900a470e7a65ffce8 diff --git a/cpu/msp430/Makefile.msp430 b/cpu/msp430/Makefile.msp430 index 81c71f51a..6d5370575 100644 --- a/cpu/msp430/Makefile.msp430 +++ b/cpu/msp430/Makefile.msp430 @@ -35,10 +35,17 @@ endif CONTIKI_CPU_DIRS = $(CONTIKI_CPU_FAM_DIR) . dev 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 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) ELFLOADER = elfloader-msp430x.c symtab.c endif diff --git a/cpu/msp430/cc2420-arch-sfd.c b/cpu/msp430/cc2420-arch-sfd.c index f7535b276..6cd7d2606 100644 --- a/cpu/msp430/cc2420-arch-sfd.c +++ b/cpu/msp430/cc2420-arch-sfd.c @@ -45,6 +45,8 @@ ISR(TIMERB1, cc2420_timerb1_interrupt) ENERGEST_ON(ENERGEST_TYPE_IRQ); /* always read TBIV to clear IFG */ tbiv = TBIV; + /* read and discard tbiv to avoid "variable set but not used" warning */ + (void)tbiv; if(CC2420_SFD_IS_1) { cc2420_sfd_counter++; cc2420_sfd_start_time = TBCCR1; diff --git a/cpu/msp430/cc2520-arch-sfd.c b/cpu/msp430/cc2520-arch-sfd.c index bafa11b1c..5e7bee813 100644 --- a/cpu/msp430/cc2520-arch-sfd.c +++ b/cpu/msp430/cc2520-arch-sfd.c @@ -44,6 +44,8 @@ ISR(TIMERB1, cc2520_timerb1_interrupt) ENERGEST_ON(ENERGEST_TYPE_IRQ); /* always read TBIV to clear IFG */ tbiv = TBIV; + /* read and discard tbiv to avoid "variable set but not used" warning */ + (void)tbiv; if(CC2520_SFD_IS_1) { cc2520_sfd_counter++; cc2520_sfd_start_time = TBCCR1; diff --git a/cpu/native/Makefile.native b/cpu/native/Makefile.native index ea7a2bc27..2adb48070 100644 --- a/cpu/native/Makefile.native +++ b/cpu/native/Makefile.native @@ -14,10 +14,10 @@ NM ?= nm OBJCOPY ?= objcopy STRIP ?= strip ifdef WERROR -CFLAGSWERROR=-Werror -pedantic -std=c99 -Werror +CFLAGSWERROR=-Werror endif CFLAGSNO = -Wall -g -I/usr/local/include $(CFLAGSWERROR) -CFLAGS += $(CFLAGSNO) -O +CFLAGS += $(CFLAGSNO) ifeq ($(HOST_OS),Darwin) AROPTS = -r diff --git a/cpu/native/net/linuxradio-drv.c b/cpu/native/net/linuxradio-drv.c index 785bd1d87..a2be32940 100644 --- a/cpu/native/net/linuxradio-drv.c +++ b/cpu/native/net/linuxradio-drv.c @@ -43,6 +43,8 @@ #include "net/packetbuf.h" #include "net/netstack.h" +#include +#include #include #include #include diff --git a/cpu/native/net/tapdev.c b/cpu/native/net/tapdev.c index e58b3c475..b60cd1946 100644 --- a/cpu/native/net/tapdev.c +++ b/cpu/native/net/tapdev.c @@ -93,8 +93,11 @@ static void remove_route(void) { char buf[1024]; + int ret; + 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); } @@ -103,7 +106,8 @@ void tapdev_init(void) { char buf[1024]; - + int ret; + fd = open(DEVTAP, O_RDWR); if(fd == -1) { perror("tapdev: tapdev_init: open"); @@ -123,7 +127,8 @@ tapdev_init(void) #endif /* Linux */ 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); #ifdef linux /* route add for linux */ @@ -132,8 +137,9 @@ tapdev_init(void) /* route add for freebsd */ snprintf(buf, sizeof(buf), "route add -net 172.18.0.0/16 -iface tap0"); #endif /* linux */ - - system(buf); + + ret = system(buf); + fprintf(stderr, "ret %d\n", ret); fprintf(stderr, "%s\n", buf); atexit(remove_route); diff --git a/cpu/native/net/tapdev6.c b/cpu/native/net/tapdev6.c index 8ff74e09c..d69ac290e 100644 --- a/cpu/native/net/tapdev6.c +++ b/cpu/native/net/tapdev6.c @@ -331,7 +331,10 @@ tapdev_init(void) */ /* freebsd */ snprintf(buf, sizeof(buf), "ifconfig tap0 up"); - system(buf); + if(system(buf) == -1) { + perror("tapdev: system: ifconfig"); + return; + } printf("%s\n", buf); /* */ diff --git a/cpu/rl78/Makefile.rl78 b/cpu/rl78/Makefile.rl78 index a20382b7f..d5b68af68 100755 --- a/cpu/rl78/Makefile.rl78 +++ b/cpu/rl78/Makefile.rl78 @@ -127,7 +127,7 @@ else STRIP = $(CROSS_COMPILE)strip ifdef WERROR - CFLAGSWERROR ?= -Werror -pedantic -std=c99 -Werror + CFLAGSWERROR ?= -Werror endif CFLAGSNO ?= -Wall -g $(CFLAGSWERROR) diff --git a/cpu/stm32w108/Makefile.stm32w108 b/cpu/stm32w108/Makefile.stm32w108 index dce0b1383..a51e0dbad 100644 --- a/cpu/stm32w108/Makefile.stm32w108 +++ b/cpu/stm32w108/Makefile.stm32w108 @@ -102,12 +102,10 @@ ifeq ($(STM32W_CPUREV), CC) LD-EXT=-stm32w108CC RAM_SIZE = 2*8192 FLASH_SIZE = 2*128*1024 - ${warning "using stm32w108CC specific ld file"} else ifeq ($(STM32W_CPUREV), xB) LD-EXT=-stm32w108xB RAM_SIZE = 8192 FLASH_SIZE = 128*1024 - ${warning "using stm32w108xB specific ld file"} 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."} endif diff --git a/cpu/stm32w108/dev/stm32w-radio.c b/cpu/stm32w108/dev/stm32w-radio.c index 4488b3a93..30bfa0ff2 100644 --- a/cpu/stm32w108/dev/stm32w-radio.c +++ b/cpu/stm32w108/dev/stm32w-radio.c @@ -72,6 +72,7 @@ #if RDC_CONF_DEBUG_LED #define LED_RDC RDC_CONF_DEBUG_LED +#undef LED_ACTIVITY #define LED_ACTIVITY 1 #else #define LED_RDC 0 @@ -117,6 +118,7 @@ #endif /* LED_ACTIVITY */ #if RDC_CONF_HARDWARE_CSMA +#undef MAC_RETRIES #define MAC_RETRIES 0 #endif /* RDC_CONF_HARDWARE_CSMA */ @@ -169,6 +171,7 @@ const RadioTransmitConfig radioTransmitConfig = { TRUE /* appendCrc; */ }; +#undef MAC_RETRIES #define MAC_RETRIES 0 /* diff --git a/dev/cc2420/cc2420.c b/dev/cc2420/cc2420.c index d455e02df..66a551250 100644 --- a/dev/cc2420/cc2420.c +++ b/dev/cc2420/cc2420.c @@ -497,7 +497,7 @@ init_security(void) } /*---------------------------------------------------------------------------*/ static void -set_key(uint8_t *key) +set_key(const uint8_t *key) { GET_LOCK(); @@ -655,17 +655,17 @@ cc2420_transmit(unsigned short payload_len) #endif /* WITH_SEND_CCA */ for(i = LOOP_20_SYMBOLS; i > 0; i--) { if(CC2420_SFD_IS_1) { +#if PACKETBUF_WITH_PACKET_TYPE { rtimer_clock_t sfd_timestamp; sfd_timestamp = cc2420_sfd_start_time; -#if PACKETBUF_WITH_PACKET_TYPE if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { /* 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); } -#endif } +#endif /* PACKETBUF_WITH_PACKET_TYPE */ if(!(get_status() & BV(CC2420_TX_ACTIVE))) { /* SFD went high but we are not transmitting. This means that diff --git a/dev/cc2520/cc2520.c b/dev/cc2520/cc2520.c index b6c0e43fa..e0dad1b6a 100644 --- a/dev/cc2520/cc2520.c +++ b/dev/cc2520/cc2520.c @@ -217,6 +217,8 @@ flushrx(void) uint8_t 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); } @@ -435,17 +437,17 @@ cc2520_transmit(unsigned short payload_len) #endif /* WITH_SEND_CCA */ for(i = LOOP_20_SYMBOLS; i > 0; i--) { if(CC2520_SFD_IS_1) { +#if PACKETBUF_WITH_PACKET_TYPE { rtimer_clock_t sfd_timestamp; sfd_timestamp = cc2520_sfd_start_time; -#if PACKETBUF_WITH_PACKET_TYPE if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP) { /* Write timestamp to last two bytes of packet in TXFIFO. */ CC2520_WRITE_RAM(&sfd_timestamp, CC2520RAM_TXFIFO + payload_len - 1, 2); } -#endif } +#endif /* PACKETBUF_WITH_PACKET_TYPE */ if(!(status() & BV(CC2520_TX_ACTIVE))) { /* SFD went high but we are not transmitting. This means that diff --git a/dev/sht11/sht11.c b/dev/sht11/sht11.c index f6780d0a0..670d10d91 100644 --- a/dev/sht11/sht11.c +++ b/dev/sht11/sht11.c @@ -215,7 +215,6 @@ sht11_init(void) 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 */ - #warning SHT11: DISABLING I2C BUS SHT11_PxSEL &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); #if defined(__MSP430_HAS_MSP430X_CPU__) || defined(__MSP430_HAS_MSP430XV2_CPU__) SHT11_PxREN &= ~(BV(SHT11_ARCH_SDA) | BV(SHT11_ARCH_SCL)); diff --git a/examples/cc2538dk/sniffer/project-conf.h b/examples/cc2538dk/sniffer/project-conf.h index fd70cd9c9..7e1ac0cd6 100644 --- a/examples/cc2538dk/sniffer/project-conf.h +++ b/examples/cc2538dk/sniffer/project-conf.h @@ -40,6 +40,7 @@ #define CC2538_RF_CONF_SNIFFER 1 #define CC2538_RF_CONF_AUTOACK 0 +#undef NETSTACK_CONF_RDC #define NETSTACK_CONF_RDC stub_rdc_driver #define UART0_CONF_BAUD_RATE 460800 diff --git a/examples/er-rest-example/resources/res-b1-sep-b2.c b/examples/er-rest-example/resources/res-b1-sep-b2.c index be4d8f943..7dcbdd0ca 100644 --- a/examples/er-rest-example/resources/res-b1-sep-b2.c +++ b/examples/er-rest-example/resources/res-b1-sep-b2.c @@ -67,9 +67,9 @@ res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t prefer coap_separate_accept(request, &request_metadata); /* Need Time for calculation now */ - uint32_t i; + unsigned i; for(i = 0; i <= 4096; i++) { - printf("\r% 4u\r", i); + printf("\r%4u\r", i); } printf("\n"); diff --git a/examples/jn516x/dr1175-sensors/node.c b/examples/jn516x/dr1175-sensors/node.c index bf1b4c89b..e30bfea3d 100644 --- a/examples/jn516x/dr1175-sensors/node.c +++ b/examples/jn516x/dr1175-sensors/node.c @@ -38,6 +38,7 @@ #include "light-sensor.h" #include "ht-sensor.h" #include "leds.h" +#include "leds-extension.h" /*---------------------------------------------------------------------------*/ PROCESS(test_process, "Sensor test process"); diff --git a/examples/jn516x/rime/node.c b/examples/jn516x/rime/node.c index 261fd61ad..dd8fd37b7 100644 --- a/examples/jn516x/rime/node.c +++ b/examples/jn516x/rime/node.c @@ -101,9 +101,10 @@ PROCESS_THREAD(unicast_test_process, ev, data) } if(!runicast_is_transmitting(&runicast)) { - linkaddr_t recv = { 0 }; static char buffer[100] = "hello"; + linkaddr_t recv; + memset(&recv, 0, LINKADDR_SIZE); packetbuf_copyfrom(buffer, sizeof(buffer)); recv.u8[0] = RX_ADDR1; recv.u8[1] = RX_ADDR2; diff --git a/examples/jn516x/rpl/border-router/border-router.c b/examples/jn516x/rpl/border-router/border-router.c index d36130607..a260aef3b 100644 --- a/examples/jn516x/rpl/border-router/border-router.c +++ b/examples/jn516x/rpl/border-router/border-router.c @@ -28,6 +28,7 @@ */ #include "contiki.h" +#include "dev/slip.h" #include "net/rpl/rpl.h" #include "tools/rpl-tools.h" diff --git a/examples/jn516x/rpl/coap-dongle-node/dongle-node.c b/examples/jn516x/rpl/coap-dongle-node/dongle-node.c index c49bc9e7c..ab5845dff 100644 --- a/examples/jn516x/rpl/coap-dongle-node/dongle-node.c +++ b/examples/jn516x/rpl/coap-dongle-node/dongle-node.c @@ -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) { static int led_state = 0; - const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; /* Given the way the LEDs are connected to the DIO ports, the LEDs are controlled via direct DIO access. */ diff --git a/examples/jn516x/rpl/coap-dr1175-node/dr1175-node.c b/examples/jn516x/rpl/coap-dr1175-node/dr1175-node.c index f6eba5f32..f377dc3b3 100644 --- a/examples/jn516x/rpl/coap-dr1175-node/dr1175-node.c +++ b/examples/jn516x/rpl/coap-dr1175-node/dr1175-node.c @@ -39,8 +39,10 @@ #include "light-sensor.h" #include "ht-sensor.h" #include "dev/leds.h" +#include "dev/leds-extension.h" #include "sys/etimer.h" #include +#include 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); @@ -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) { const uint8_t *request_content = NULL; - int request_content_len; int level; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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); CLIP(level, 255) 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) { const uint8_t *request_content = NULL; - int request_content_len; char *pch; int RGB[] = { 0, 0, 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; REST.get_header_accept(request, &accept); 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, " "); while((pch != NULL) && (index != sizeof(RGB) / sizeof(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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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); } } @@ -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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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); } } diff --git a/examples/jn516x/rpl/coap-dr1199-node/dr1199-node.c b/examples/jn516x/rpl/coap-dr1199-node/dr1199-node.c index 91921fed1..373922e58 100644 --- a/examples/jn516x/rpl/coap-dr1199-node/dr1199-node.c +++ b/examples/jn516x/rpl/coap-dr1199-node/dr1199-node.c @@ -39,6 +39,7 @@ #include "button-sensor.h" #include "pot-sensor.h" #include +#include static char content[REST_MAX_CHUNK_SIZE]; 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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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) } } @@ -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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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) } } @@ -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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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) } } @@ -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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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); } } @@ -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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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); } } @@ -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) { const uint8_t *request_content; - int request_content_len; unsigned int accept = -1; REST.get_header_accept(request, &accept); 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) { leds_on(LEDS_ALL); } else { diff --git a/examples/rime/example-rucb.c b/examples/rime/example-rucb.c index 7bf5d3b1d..e3d291c52 100644 --- a/examples/rime/example-rucb.c +++ b/examples/rime/example-rucb.c @@ -89,7 +89,7 @@ read_chunk(struct rucb_conn *c, int offset, char *to, int maxsize) bytecount += size; 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(); } diff --git a/examples/rime/example-rudolph1.c b/examples/rime/example-rudolph1.c index ebdf8a4cd..1dcf4b0af 100644 --- a/examples/rime/example-rudolph1.c +++ b/examples/rime/example-rudolph1.c @@ -83,9 +83,8 @@ write_chunk(struct rudolph1_conn *c, int offset, int flag, } if(datalen > 0) { - int ret; cfs_seek(fd, offset, CFS_SEEK_SET); - ret = cfs_write(fd, data, datalen); + cfs_write(fd, data, datalen); } cfs_close(fd); diff --git a/examples/rime/example-rudolph2.c b/examples/rime/example-rudolph2.c index 3b97d1857..fe9afd0dc 100644 --- a/examples/rime/example-rudolph2.c +++ b/examples/rime/example-rudolph2.c @@ -82,9 +82,8 @@ write_chunk(struct rudolph2_conn *c, int offset, int flag, } if(datalen > 0) { - int ret; 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); } diff --git a/examples/sky-shell-webserver/sky-shell-webserver.c b/examples/sky-shell-webserver/sky-shell-webserver.c index 57f85c368..f89e19ac1 100644 --- a/examples/sky-shell-webserver/sky-shell-webserver.c +++ b/examples/sky-shell-webserver/sky-shell-webserver.c @@ -40,8 +40,6 @@ #include #include -#include -#include /*---------------------------------------------------------------------------*/ PROCESS(sky_shell_process, "Sky Contiki shell w. webserver"); diff --git a/examples/z1/test-sht25.c b/examples/z1/test-sht25.c index 25d308f3b..6137e9753 100644 --- a/examples/z1/test-sht25.c +++ b/examples/z1/test-sht25.c @@ -57,7 +57,7 @@ PROCESS_THREAD(test_sht25_process, ev, data) temperature = sht25.value(SHT25_VAL_TEMP); printf("Temperature %d.%d ºC\n", temperature / 100, temperature % 100); 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(); } diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c index 14c34fb4b..723bd9436 100644 --- a/platform/avr-raven/contiki-raven-main.c +++ b/platform/avr-raven/contiki-raven-main.c @@ -527,6 +527,7 @@ extern uip_ds6_netif_t uip_ds6_if; PRINTF("\n"); } } + j = 1; PRINTF("\nNeighbors [%u max]\n",NBR_TABLE_MAX_NEIGHBORS); for(nbr = nbr_table_head(ds6_neighbors); nbr != NULL; diff --git a/platform/cooja/cfs/cfs-cooja.c b/platform/cooja/cfs/cfs-cooja.c index 40d1c3ceb..3150517b2 100644 --- a/platform/cooja/cfs/cfs-cooja.c +++ b/platform/cooja/cfs/cfs-cooja.c @@ -29,6 +29,7 @@ * This file is part of the Contiki operating system. * */ +#include #include #include "lib/simEnvChange.h" #include "cfs/cfs.h" diff --git a/platform/cooja/dev/eeprom.c b/platform/cooja/dev/eeprom.c index 8a40fa3d8..026c10f26 100644 --- a/platform/cooja/dev/eeprom.c +++ b/platform/cooja/dev/eeprom.c @@ -28,6 +28,7 @@ * */ +#include #include "dev/eeprom.h" #include "lib/simEnvChange.h" diff --git a/platform/cooja/dev/rs232.c b/platform/cooja/dev/rs232.c index 51ee5b6a9..08257b555 100644 --- a/platform/cooja/dev/rs232.c +++ b/platform/cooja/dev/rs232.c @@ -46,6 +46,7 @@ char simSerialReceivingFlag; static int (* input_handler)(unsigned char) = NULL; +void simlog_char(char c); /*-----------------------------------------------------------------------------------*/ void rs232_init(void) { } /*-----------------------------------------------------------------------------------*/ diff --git a/platform/cooja/net/uip-driver.c b/platform/cooja/net/uip-driver.c index 1b2fb5c4d..896550f93 100644 --- a/platform/cooja/net/uip-driver.c +++ b/platform/cooja/net/uip-driver.c @@ -45,7 +45,11 @@ /*--------------------------------------------------------------------*/ uint8_t +#if NETSTACK_CONF_WITH_IPV6 +uip_driver_send(const uip_lladdr_t *addr) +#else uip_driver_send(void) +#endif { packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); diff --git a/platform/cooja/net/uip-driver.h b/platform/cooja/net/uip-driver.h index 2a9c4b191..a711313b8 100644 --- a/platform/cooja/net/uip-driver.h +++ b/platform/cooja/net/uip-driver.h @@ -41,7 +41,11 @@ #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); +#endif extern const struct network_driver uip_driver; diff --git a/platform/eval-adf7xxxmb4z/contiki-main.c b/platform/eval-adf7xxxmb4z/contiki-main.c index 0a7d3f203..d34b7e63f 100644 --- a/platform/eval-adf7xxxmb4z/contiki-main.c +++ b/platform/eval-adf7xxxmb4z/contiki-main.c @@ -66,7 +66,9 @@ SENSORS(&button_sensor); #endif static uint8_t serial_id[] = SERIAL_ID; +#if !NETSTACK_CONF_WITH_IPV6 static uint16_t node_id = 0x0102; +#endif /* !NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ static void diff --git a/platform/exp5438/hal_lcd.c b/platform/exp5438/hal_lcd.c index 62b36b414..66be62de9 100644 --- a/platform/exp5438/hal_lcd.c +++ b/platform/exp5438/hal_lcd.c @@ -35,6 +35,7 @@ ******************************************************************************/ #include "contiki-conf.h" +#include "core/sys/cc.h" #include "hal_MSP-EXP430F5438.h" #include "hal_lcd_fonts.h" @@ -116,8 +117,6 @@ void halLcdSendCommand(unsigned char Data[]) void halLcdInit(void) { - volatile unsigned int i = 0; - LCD_CS_RST_OUT |= 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 { - LookUpChar = fonts_lookup[String[i]]; + LookUpChar = fonts_lookup[(unsigned char)String[i]]; for (j = 0; j < FONT_HEIGHT; j++) { diff --git a/platform/jn516x/Makefile.jn516x b/platform/jn516x/Makefile.jn516x index bce6adbd5..50f0a393d 100644 --- a/platform/jn516x/Makefile.jn516x +++ b/platform/jn516x/Makefile.jn516x @@ -48,6 +48,17 @@ LDLIBS := $(subst MiniMac_JN516x, ,$(LDLIBS)) LDLIBS += JPT_$(JENNIC_CHIP) 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 ifeq ($(DEBUG),SW) CFLAGS += -DDEBUG=1 @@ -64,9 +75,6 @@ SIZE:=$(CROSS_COMPILE)-size OBJCOPY:=$(CROSS_COMPILE)-objcopy 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 \ mtarch.c node-id.c watchdog.c log.c ringbufindex.c slip.c sprintf.c # Default uart0 for printf and slip diff --git a/platform/jn516x/contiki-jn516x-main.c b/platform/jn516x/contiki-jn516x-main.c index deda71b11..d7b463b12 100644 --- a/platform/jn516x/contiki-jn516x-main.c +++ b/platform/jn516x/contiki-jn516x-main.c @@ -232,13 +232,13 @@ set_linkaddr(void) { int i; linkaddr_t addr; - memset(&addr, 0, sizeof(linkaddr_t)); + memset(&addr, 0, LINKADDR_SIZE); #if NETSTACK_CONF_WITH_IPV6 memcpy(addr.u8, node_mac, sizeof(addr.u8)); #else if(node_id == 0) { - for(i = 0; i < sizeof(linkaddr_t); ++i) { - addr.u8[i] = node_mac[7 - i]; + for(i = 0; i < LINKADDR_SIZE; ++i) { + addr.u8[i] = node_mac[LINKADDR_SIZE - 1 - i]; } } else { addr.u8[0] = node_id & 0xff; diff --git a/platform/jn516x/dev/exceptions.c b/platform/jn516x/dev/exceptions.c index def4e2a73..10a3bf11b 100644 --- a/platform/jn516x/dev/exceptions.c +++ b/platform/jn516x/dev/exceptions.c @@ -66,7 +66,6 @@ #endif /* JENNIC_CHIP_FAMILY */ #if (defined EXCEPTION_VECTORS_LOCATION_RAM) -#pragma "EXCEPTION_VECTORS_LOCATION_RAM" /* RAM exception vectors are set up at run time */ /* Addresses of exception vectors in RAM */ #define BUS_ERROR *((volatile uint32 *)(0x4000000)) @@ -79,7 +78,6 @@ #define GENERIC *((volatile uint32 *)(0x400001c)) #define STACK_OVERFLOW *((volatile uint32 *)(0x4000020)) #elif (defined EXCEPTION_VECTORS_LOCATION_FLASH) -#pragma "EXCEPTION_VECTORS_LOCATION_FLASH" /* Flash exception vectors are set up at compile time */ #else #error Unknown exception vector location diff --git a/platform/jn516x/dev/micromac-radio.c b/platform/jn516x/dev/micromac-radio.c index 3d9d4026a..97e481eab 100644 --- a/platform/jn516x/dev/micromac-radio.c +++ b/platform/jn516x/dev/micromac-radio.c @@ -57,6 +57,8 @@ #include "JPT.h" #include "PeripheralRegs.h" +void vMMAC_SetChannelAndPower(uint8 u8Channel, int8 i8power); + /* This driver configures the radio in PHY mode and does address decoding * and acknowledging in software. */ @@ -864,8 +866,6 @@ set_send_on_cca(uint8_t enable) static radio_result_t get_value(radio_param_t param, radio_value_t *value) { - int i, v; - if(!value) { return RADIO_RESULT_INVALID_VALUE; } @@ -926,8 +926,6 @@ get_value(radio_param_t param, radio_value_t *value) static radio_result_t set_value(radio_param_t param, radio_value_t value) { - int i; - switch(param) { case RADIO_PARAM_POWER_MODE: if(value == RADIO_POWER_MODE_ON) { diff --git a/platform/jn516x/dev/rtimer-arch.c b/platform/jn516x/dev/rtimer-arch.c index f89b8a9a8..6c2e3ae8d 100644 --- a/platform/jn516x/dev/rtimer-arch.c +++ b/platform/jn516x/dev/rtimer-arch.c @@ -39,6 +39,7 @@ #include "sys/rtimer.h" #include "sys/clock.h" +#include "sys/process.h" #include #include #include "dev/watchdog.h" diff --git a/platform/jn516x/dev/uart-driver.c b/platform/jn516x/dev/uart-driver.c index 16edb7e00..922c067ab 100644 --- a/platform/jn516x/dev/uart-driver.c +++ b/platform/jn516x/dev/uart-driver.c @@ -44,6 +44,7 @@ #include "contiki-conf.h" #include "uart-driver.h" #include "sys/rtimer.h" +#include "watchdog.h" #include #include @@ -79,7 +80,9 @@ extern volatile unsigned char xonxoff_state; /*** Local Function Prototypes ***/ 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); +#endif /* !UART_XONXOFF_FLOW_CTRL */ 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); @@ -352,12 +355,14 @@ uart_driver_rx_handler(uint8_t uart_dev) /*** Local Functions ***/ /****************************************************************************/ +#if !UART_XONXOFF_FLOW_CTRL /* Returns the free space in tx fifo, i.e., how many characters we can put */ static int16_t uart_driver_get_tx_fifo_available_space(uint8_t 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 baudrate tuning method */ 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, 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) { DBG_vPrintf(DEBUG_UART_BUFFERED, "Could not calculate UART settings for target baud!"); diff --git a/platform/jn516x/dev/uart0.h b/platform/jn516x/dev/uart0.h index 293950c5b..6f93f7147 100644 --- a/platform/jn516x/dev/uart0.h +++ b/platform/jn516x/dev/uart0.h @@ -43,6 +43,7 @@ #include #include "contiki-conf.h" +#include "uart-driver.h" #define UART_DEFAULT_RX_BUFFER_SIZE 2047 #if UART_XONXOFF_FLOW_CTRL diff --git a/platform/jn516x/lib/sprintf.c b/platform/jn516x/lib/sprintf.c index 8dbfa10a0..500951e92 100644 --- a/platform/jn516x/lib/sprintf.c +++ b/platform/jn516x/lib/sprintf.c @@ -227,7 +227,7 @@ int puts(const char *s) { char c; - while(c = *s++) { + while((c = *s++) != '\0') { putchar(c); } putchar('\n'); diff --git a/platform/mbxxx/contiki-main.c b/platform/mbxxx/contiki-main.c index 8a6867d74..c383b0f61 100644 --- a/platform/mbxxx/contiki-main.c +++ b/platform/mbxxx/contiki-main.c @@ -76,18 +76,8 @@ #include "net/ipv6/uip-ds6.h" #endif /* NETSTACK_CONF_WITH_IPV6 */ -#define DEBUG 1 -#if DEBUG -#include -#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 - +#define DEBUG DEBUG_PRINT +#include "net/ip/uip-debug.h" #if NETSTACK_CONF_WITH_IPV6 PROCINIT(&tcpip_process, &sensors_process); @@ -183,13 +173,13 @@ main(void) 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, CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: NETSTACK_RDC.channel_check_interval())); printf("802.15.4 PAN ID 0x%x, EUI-%d:", 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); procinit_init(); diff --git a/platform/mbxxx/dev/temperature-sensor.c b/platform/mbxxx/dev/temperature-sensor.c index c4418c55a..520032cb4 100644 --- a/platform/mbxxx/dev/temperature-sensor.c +++ b/platform/mbxxx/dev/temperature-sensor.c @@ -76,7 +76,6 @@ value(int type) { static uint16_t ADCvalue; 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); diff --git a/platform/micaz/init-net.c b/platform/micaz/init-net.c index f4289f567..271b402c8 100644 --- a/platform/micaz/init-net.c +++ b/platform/micaz/init-net.c @@ -50,6 +50,7 @@ #include "net/netstack.h" #include "net/mac/frame802154.h" #include "net/linkaddr.h" +#include "net/queuebuf.h" #include "dev/ds2401.h" #include "sys/node-id.h" diff --git a/platform/micaz/node-id.c b/platform/micaz/node-id.c index 00f1ed13a..998dd1b0d 100644 --- a/platform/micaz/node-id.c +++ b/platform/micaz/node-id.c @@ -33,6 +33,7 @@ #include "contiki-conf.h" #include "sys/node-id.h" +#include "dev/eeprom.h" unsigned short node_id = 0; diff --git a/platform/native/contiki-main.c b/platform/native/contiki-main.c index 780dce7c6..9c4639b16 100644 --- a/platform/native/contiki-main.c +++ b/platform/native/contiki-main.c @@ -84,7 +84,9 @@ static int select_max = 0; SENSORS(&pir_sensor, &vib_sensor, &button_sensor); static uint8_t serial_id[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08}; +#if !NETSTACK_CONF_WITH_IPV6 static uint16_t node_id = 0x0102; +#endif /* !NETSTACK_CONF_WITH_IPV6 */ /*---------------------------------------------------------------------------*/ int select_set_callback(int fd, const struct select_callback *callback) diff --git a/platform/z1/dev/relay-phidget.h b/platform/z1/dev/relay-phidget.h index 1d9247cca..580151f58 100644 --- a/platform/z1/dev/relay-phidget.h +++ b/platform/z1/dev/relay-phidget.h @@ -44,6 +44,6 @@ void relay_enable(uint8_t pin); void relay_on(); void relay_off(); -int8_t relay_toogle(); +int8_t relay_toggle(); #endif /* RELAY_PHIDGET_H_ */ diff --git a/regression-tests/12-rpl/code/receiver-node.c b/regression-tests/12-rpl/code/receiver-node.c index 25e1e6758..4ba3cb148 100644 --- a/regression-tests/12-rpl/code/receiver-node.c +++ b/regression-tests/12-rpl/code/receiver-node.c @@ -92,7 +92,7 @@ set_global_address(void) /*---------------------------------------------------------------------------*/ uint8_t should_blink = 1; 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) { should_blink = 0; @@ -105,11 +105,10 @@ PROCESS_THREAD(receiver_node_process, ev, data) { static struct etimer et; static struct uip_ds6_notification n; - uip_ipaddr_t *ipaddr; PROCESS_BEGIN(); - ipaddr = set_global_address(); + set_global_address(); uip_ds6_notification_add(&n, route_callback); diff --git a/regression-tests/21-large-rpl/code/node/project-conf.h b/regression-tests/21-large-rpl/code/node/project-conf.h index c8cfeb645..21bf07a9b 100644 --- a/regression-tests/21-large-rpl/code/node/project-conf.h +++ b/regression-tests/21-large-rpl/code/node/project-conf.h @@ -2,5 +2,7 @@ #define RESOLV_CONF_SUPPORTS_MDNS 0 #define COOJA_MTARCH_STACKSIZE 4096 +#undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 3 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS #define NBR_TABLE_CONF_MAX_NEIGHBORS 3 diff --git a/regression-tests/21-large-rpl/code/router/project-conf.h b/regression-tests/21-large-rpl/code/router/project-conf.h index 2fa5e2977..eb0b0b1a7 100644 --- a/regression-tests/21-large-rpl/code/router/project-conf.h +++ b/regression-tests/21-large-rpl/code/router/project-conf.h @@ -2,7 +2,9 @@ #define RESOLV_CONF_SUPPORTS_MDNS 0 #define COOJA_MTARCH_STACKSIZE 4096 +#undef UIP_CONF_MAX_ROUTES #define UIP_CONF_MAX_ROUTES 8 +#undef NBR_TABLE_CONF_MAX_NEIGHBORS #define NBR_TABLE_CONF_MAX_NEIGHBORS 8 /*#define RPL_CONF_DEFAULT_LIFETIME_UNIT 10 diff --git a/regression-tests/21-large-rpl/code/router/router.c b/regression-tests/21-large-rpl/code/router/router.c index 391b5038b..844afdc1c 100644 --- a/regression-tests/21-large-rpl/code/router/router.c +++ b/regression-tests/21-large-rpl/code/router/router.c @@ -2,6 +2,7 @@ #include "contiki-net.h" #include "ip64.h" #include "net/netstack.h" +#include "net/rpl/rpl-dag-root.h" /*---------------------------------------------------------------------------*/ PROCESS(router_node_process, "Router node"); diff --git a/regression-tests/Makefile.compile-test b/regression-tests/Makefile.compile-test index 4ca4e3fd7..60eaf4279 100644 --- a/regression-tests/Makefile.compile-test +++ b/regression-tests/Makefile.compile-test @@ -41,7 +41,7 @@ define dooneexample @echo Building example $(3): $(1) for target $(2) @((cd $(EXAMPLESDIR)/$(1); \ 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 && \ (echo $(1) $(2): OK | tee $(3)-$(subst /,-,$(1))$(2).summary) || \ (echo $(1) $(2): FAIL ಠ.ಠ | tee $(3)-$(subst /,-,$(1))$(2).summary ; \