From c8ec08732cb780e63dd38a490bc7bd0e3e00d091 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 10:53:21 +0200 Subject: [PATCH 01/62] Fix broken printf in examples/er-rest-example/resource/res-b1-sep-b2.c --- examples/er-rest-example/resources/res-b1-sep-b2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..06390da62 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; + int i; for(i = 0; i <= 4096; i++) { - printf("\r% 4u\r", i); + printf("\r%4u\r", i); } printf("\n"); From e3303c7e994184fed389df33c5e63e2c22dab723 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 10:57:43 +0200 Subject: [PATCH 02/62] Added missing undef in examples/cc2528dk/sinffer/project-conf.h --- examples/cc2538dk/sniffer/project-conf.h | 1 + 1 file changed, 1 insertion(+) 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 From d6f63e1746cd2f13ddacb0a9ecb580557b2d0580 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 11:05:54 +0200 Subject: [PATCH 03/62] uip6.c: declare uip_add32 symbol if UIP_ARCH_ADD32 is set --- core/net/ipv6/uip6.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/net/ipv6/uip6.c b/core/net/ipv6/uip6.c index 8778dcb82..e79238dcd 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 /*---------------------------------------------------------------------------*/ From cb4003eb52d290acbfafe854926a2c09a194a991 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 11:09:22 +0200 Subject: [PATCH 04/62] Removed compiler warning from sht11.c --- dev/sht11/sht11.c | 1 - 1 file changed, 1 deletion(-) 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)); From 6594cd1bbac49bc927e4254a7d09125499cb62e8 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 11:10:46 +0200 Subject: [PATCH 05/62] cc2420: fix function prototype of set_key --- dev/cc2420/cc2420.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/cc2420/cc2420.c b/dev/cc2420/cc2420.c index d455e02df..7c7c97461 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(); From e5d5cf7018dc8695491baa9cdcd42c4220520f45 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 11:13:06 +0200 Subject: [PATCH 06/62] cc2420: do not declare sfd_timestamp if not used --- dev/cc2420/cc2420.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/cc2420/cc2420.c b/dev/cc2420/cc2420.c index 7c7c97461..66a551250 100644 --- a/dev/cc2420/cc2420.c +++ b/dev/cc2420/cc2420.c @@ -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 From 560d6af97b1c6793ff8a9271372730df23ddb223 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 11:36:05 +0200 Subject: [PATCH 07/62] msp430x: do not compile mtarch, which currently assumes 16-bit function pointers --- cpu/msp430/Makefile.msp430 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 From 01984f07c2bd29cbd2488b29388dbd065ff0fdf3 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 11:59:38 +0200 Subject: [PATCH 08/62] cc2420 and cc2430: removed compiler warning on unused tbiv --- cpu/msp430/cc2420-arch-sfd.c | 1 + cpu/msp430/cc2520-arch-sfd.c | 1 + 2 files changed, 2 insertions(+) diff --git a/cpu/msp430/cc2420-arch-sfd.c b/cpu/msp430/cc2420-arch-sfd.c index f7535b276..a940b8cab 100644 --- a/cpu/msp430/cc2420-arch-sfd.c +++ b/cpu/msp430/cc2420-arch-sfd.c @@ -45,6 +45,7 @@ ISR(TIMERB1, cc2420_timerb1_interrupt) ENERGEST_ON(ENERGEST_TYPE_IRQ); /* always read TBIV to clear IFG */ tbiv = TBIV; + (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..852974b70 100644 --- a/cpu/msp430/cc2520-arch-sfd.c +++ b/cpu/msp430/cc2520-arch-sfd.c @@ -44,6 +44,7 @@ ISR(TIMERB1, cc2520_timerb1_interrupt) ENERGEST_ON(ENERGEST_TYPE_IRQ); /* always read TBIV to clear IFG */ tbiv = TBIV; + (void)tbiv; if(CC2520_SFD_IS_1) { cc2520_sfd_counter++; cc2520_sfd_start_time = TBCCR1; From 2c91ab6fade518c2860729c0587ff91855dc4012 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 12:00:02 +0200 Subject: [PATCH 09/62] linuxradio-drv.c: added missing include --- cpu/native/net/linuxradio-drv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cpu/native/net/linuxradio-drv.c b/cpu/native/net/linuxradio-drv.c index 785bd1d87..e9760d604 100644 --- a/cpu/native/net/linuxradio-drv.c +++ b/cpu/native/net/linuxradio-drv.c @@ -43,6 +43,7 @@ #include "net/packetbuf.h" #include "net/netstack.h" +#include #include #include #include From 0340567af86574957032511f745355013f0aea60 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 12:00:25 +0200 Subject: [PATCH 10/62] tapdev6.c: do not ignore return value of system() --- cpu/native/net/tapdev6.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); /* */ From 921a3c8a7b9a47415d5ef23164e9e895057af866 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 12:01:05 +0200 Subject: [PATCH 11/62] native platform: removed unused variable --- platform/native/contiki-main.c | 2 ++ 1 file changed, 2 insertions(+) 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) From cf97cfaff8f244482605c6deb0853bd6ab8967aa Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 12:04:12 +0200 Subject: [PATCH 12/62] cc2530: removed warning on unused variable --- dev/cc2520/cc2520.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/cc2520/cc2520.c b/dev/cc2520/cc2520.c index b6c0e43fa..b31302c43 100644 --- a/dev/cc2520/cc2520.c +++ b/dev/cc2520/cc2520.c @@ -217,6 +217,7 @@ flushrx(void) uint8_t dummy; CC2520_READ_FIFO_BYTE(dummy); + (void)dummy; CC2520_STROBE(CC2520_INS_SFLUSHRX); CC2520_STROBE(CC2520_INS_SFLUSHRX); } From b7fb06052f6e13e44038dda0bd610e0eb4dfff76 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 12:05:03 +0200 Subject: [PATCH 13/62] cc2530: do not declare sfd_timestamp if not used --- dev/cc2520/cc2520.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/cc2520/cc2520.c b/dev/cc2520/cc2520.c index b31302c43..3b40c8879 100644 --- a/dev/cc2520/cc2520.c +++ b/dev/cc2520/cc2520.c @@ -436,17 +436,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 From 061c7d15c45296fc9d5906901a951696b501fc31 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 12:08:44 +0200 Subject: [PATCH 14/62] Powertrace: removed unused variables --- apps/powertrace/powertrace.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/powertrace/powertrace.c b/apps/powertrace/powertrace.c index 139d96af8..81b469bbf 100644 --- a/apps/powertrace/powertrace.c +++ b/apps/powertrace/powertrace.c @@ -287,12 +287,15 @@ output_sniffer(int mac_status) static void sniffprint(char *prefix, int seqno) { - const linkaddr_t *sender, *receiver, *esender, *ereceiver; + /* const linkaddr_t *sender; */ + /* const linkaddr_t *receiver; */ + const linkaddr_t *esender; + /* const linkaddr_t *ereceiver; */ - sender = packetbuf_addr(PACKETBUF_ADDR_SENDER); - receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); + /* sender = packetbuf_addr(PACKETBUF_ADDR_SENDER); */ + /* receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); */ esender = packetbuf_addr(PACKETBUF_ADDR_ESENDER); - ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER); + /* ereceiver = packetbuf_addr(PACKETBUF_ADDR_ERECEIVER); */ printf("%lu %s %d %u %d %d %d.%d %u %u\n", From 16dd3af1e6d7111d48ab4046618242e892a0ba91 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:19:35 +0200 Subject: [PATCH 15/62] mbxxx temperature-sensor: remove unused variable --- platform/mbxxx/dev/temperature-sensor.c | 1 - 1 file changed, 1 deletion(-) 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); From fcd0302d02183559ec40949434b8dae0cbae49f0 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:26:40 +0200 Subject: [PATCH 16/62] mbxxx contiki-main.c: include uip-debug, as uip_debug_lladdr_print is used in main --- platform/mbxxx/contiki-main.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/platform/mbxxx/contiki-main.c b/platform/mbxxx/contiki-main.c index 8a6867d74..9c7c3308d 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); @@ -189,7 +179,7 @@ main(void) 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(); From 200786392293aacb238640ad26c975e4f949ad63 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:26:52 +0200 Subject: [PATCH 17/62] mbxxx: fix printf format --- platform/mbxxx/contiki-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mbxxx/contiki-main.c b/platform/mbxxx/contiki-main.c index 9c7c3308d..c383b0f61 100644 --- a/platform/mbxxx/contiki-main.c +++ b/platform/mbxxx/contiki-main.c @@ -173,7 +173,7 @@ 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())); From ccfdf80ff2c90b0878e0661a588b7cb2db447d97 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:28:53 +0200 Subject: [PATCH 18/62] Removed mbxxx warning messages on the current ld file in use --- cpu/stm32w108/Makefile.stm32w108 | 2 -- 1 file changed, 2 deletions(-) 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 From a2b1934f038ac479597898e49372bd1e9409c883 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:30:19 +0200 Subject: [PATCH 19/62] mbxxx: added missing undefs --- cpu/stm32w108/dev/stm32w-radio.c | 3 +++ 1 file changed, 3 insertions(+) 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 /* From c796ab418fac3f16e808f39772437e3ed8f98188 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 20 Oct 2015 09:38:25 +0200 Subject: [PATCH 20/62] exp5438: added missing include --- platform/exp5438/hal_lcd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/exp5438/hal_lcd.c b/platform/exp5438/hal_lcd.c index 62b36b414..65aac2563 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" From 1957ecd94a16e02209793bb9f147d10ac3f555fc Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 20 Oct 2015 09:41:07 +0200 Subject: [PATCH 21/62] exp5438: removed unused vairable --- platform/exp5438/hal_lcd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform/exp5438/hal_lcd.c b/platform/exp5438/hal_lcd.c index 65aac2563..6445b8fed 100644 --- a/platform/exp5438/hal_lcd.c +++ b/platform/exp5438/hal_lcd.c @@ -117,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; From 45af3adab489498db283eef128045f2828d09b27 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 20 Oct 2015 09:42:03 +0200 Subject: [PATCH 22/62] exp5438: do not use char as array index --- platform/exp5438/hal_lcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/exp5438/hal_lcd.c b/platform/exp5438/hal_lcd.c index 6445b8fed..66be62de9 100644 --- a/platform/exp5438/hal_lcd.c +++ b/platform/exp5438/hal_lcd.c @@ -792,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++) { From 2533265d3038c3cdfcc46b239f9f3ea8852549e5 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:39:26 +0200 Subject: [PATCH 23/62] eval-adf7xxxmb4z: declare node_id only when needed --- platform/eval-adf7xxxmb4z/contiki-main.c | 2 ++ 1 file changed, 2 insertions(+) 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 From 7328ee51ef1955bb692cb182bff5faaa62db140b Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 15:40:36 +0200 Subject: [PATCH 24/62] micaz: added missing include --- platform/micaz/init-net.c | 1 + 1 file changed, 1 insertion(+) 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" From 5dd6261feffc6ebda52679b57d85c5023284a170 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 16:09:13 +0200 Subject: [PATCH 25/62] Nullrdc: added missing include for cooja nodes --- core/net/mac/nullrdc.c | 1 + 1 file changed, 1 insertion(+) 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 From 43adbbf6f9093794e883f4d447eff69747f2a2a5 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 16:09:35 +0200 Subject: [PATCH 26/62] Target cooja: added missing includes --- platform/cooja/cfs/cfs-cooja.c | 1 + platform/cooja/dev/eeprom.c | 1 + 2 files changed, 2 insertions(+) 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" From b0f21747e1af5c124f39efe07c11de8928877790 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 16:09:53 +0200 Subject: [PATCH 27/62] Target cooja: added missing declaration of simlog_char --- platform/cooja/dev/rs232.c | 1 + 1 file changed, 1 insertion(+) 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) { } /*-----------------------------------------------------------------------------------*/ From 5ac4c2c867a18fcf671ae46928a50a26be7d0763 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 16:10:23 +0200 Subject: [PATCH 28/62] Target cooja: fixed funciton prototype of uip_driver_send --- platform/cooja/net/uip-driver.c | 4 ++++ platform/cooja/net/uip-driver.h | 4 ++++ 2 files changed, 8 insertions(+) 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; From 4805a9bbe66b07f82a76628e016c3875206764c2 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 16:10:46 +0200 Subject: [PATCH 29/62] Regression test: fixed function prototype of route_callback --- regression-tests/12-rpl/code/receiver-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression-tests/12-rpl/code/receiver-node.c b/regression-tests/12-rpl/code/receiver-node.c index 25e1e6758..98cd59b99 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; From 2c514d5d46495b1fd3d1b3c3b19dea6e83ec676f Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 16:10:58 +0200 Subject: [PATCH 30/62] Regression test: remove unused variable --- regression-tests/12-rpl/code/receiver-node.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/regression-tests/12-rpl/code/receiver-node.c b/regression-tests/12-rpl/code/receiver-node.c index 98cd59b99..4ba3cb148 100644 --- a/regression-tests/12-rpl/code/receiver-node.c +++ b/regression-tests/12-rpl/code/receiver-node.c @@ -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); From 9d7cfa8f780e5190b33f2a82baee740133032332 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 1 Oct 2015 17:08:44 +0200 Subject: [PATCH 31/62] Regression test 21: added missing undefs and include --- regression-tests/21-large-rpl/code/node/project-conf.h | 2 ++ regression-tests/21-large-rpl/code/router/project-conf.h | 2 ++ regression-tests/21-large-rpl/code/router/router.c | 1 + 3 files changed, 5 insertions(+) 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"); From aec8af25c066c10b65ba2cff3af02ef45518e06b Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 5 Oct 2015 12:07:49 +0200 Subject: [PATCH 32/62] jn516x: added WERROR --- platform/jn516x/Makefile.jn516x | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/jn516x/Makefile.jn516x b/platform/jn516x/Makefile.jn516x index bce6adbd5..b3dce252a 100644 --- a/platform/jn516x/Makefile.jn516x +++ b/platform/jn516x/Makefile.jn516x @@ -48,6 +48,11 @@ LDLIBS := $(subst MiniMac_JN516x, ,$(LDLIBS)) LDLIBS += JPT_$(JENNIC_CHIP) endif +# Warings as error +ifdef WERROR +CFLAGS += -Werror +endif + # Pass DEBUG as CFLAG ifeq ($(DEBUG),SW) CFLAGS += -DDEBUG=1 From 12a185f3944a3ba62867af8121a76736ca9254c5 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sat, 26 Sep 2015 11:19:22 +0200 Subject: [PATCH 33/62] Added the WERROR=1 flag to the CC2538 and CC26xx CPUs --- cpu/cc2538/Makefile.cc2538 | 4 ++++ cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cpu/cc2538/Makefile.cc2538 b/cpu/cc2538/Makefile.cc2538 index 29795111c..c53a68773 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 From 8a6ae7c65179867e377f54239014ead25592970a Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sat, 26 Sep 2015 11:18:54 +0200 Subject: [PATCH 34/62] Build examples with the WERROR=1 flag passed to make, to ensure that we have a clean non-warning build for all examples on platforms that support the WERROR=1 flag --- regression-tests/Makefile.compile-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ; \ From 1ed9a20fdb71f9113be7d14c8c4812eb52a7cc22 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:30:57 +0200 Subject: [PATCH 35/62] Use unsigned long instead of uint32_t to avoid compiler warnings with the printfs --- apps/powertrace/powertrace.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/powertrace/powertrace.c b/apps/powertrace/powertrace.c index 81b469bbf..131eb1deb 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; From 51233a7f88477be6b2de3d8c96baefffd3dce14d Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:31:08 +0200 Subject: [PATCH 36/62] Fix compiler warnings --- apps/servreg-hack/servreg-hack.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/servreg-hack/servreg-hack.c b/apps/servreg-hack/servreg-hack.c index f93bf20c3..9e60ddf24 100644 --- a/apps/servreg-hack/servreg-hack.c +++ b/apps/servreg-hack/servreg-hack.c @@ -332,12 +332,12 @@ static void parse_incoming_packet(const uint8_t *buf, int len) { int numregs; - int flags; + /*int flags;*/ int i; int bufptr; numregs = buf[MSG_NUMREGS_OFFSET]; - flags = buf[MSG_FLAGS_OFFSET]; + /*flags = buf[MSG_FLAGS_OFFSET];*/ /* printf("parse_incoming_packet Numregs %d flags %d\n", numregs, flags);*/ From 5e1ce413af18bc533abc8bcd44d896a6990b2fa1 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:31:17 +0200 Subject: [PATCH 37/62] Fix compiler warnings --- apps/shell/shell-crc.c | 1 + 1 file changed, 1 insertion(+) 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 From c0de05f9a8d68ea802bdffda1f128acec066e3c3 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:31:28 +0200 Subject: [PATCH 38/62] Fix compiler warnings --- apps/shell/shell-rime-netcmd.c | 4 ++-- apps/shell/shell-rime-sendcmd.c | 4 ++-- apps/shell/shell-rime.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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; From 08c6a69fe86a96b75b2cf9edc16e1b5588f26474 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:31:43 +0200 Subject: [PATCH 39/62] Fix compiler warnings --- apps/shell/shell-time.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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 && From c262eafe97915dfc901f7cecace6e8305a529871 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:31:57 +0200 Subject: [PATCH 40/62] Fix compiler warnings --- apps/webbrowser/webclient.c | 4 ++-- apps/webbrowser/www.c | 1 + apps/webserver/urlconv.c | 4 ++-- core/ctk/ctk-filedialog.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/webbrowser/webclient.c b/apps/webbrowser/webclient.c index 5d2ce0254..a6e6a6582 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 70af0332b..11ed1384a 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -864,6 +864,7 @@ htmlparser_newline(void) wptr = webpageptr - WWW_CONF_WEBPAGE_WIDTH; petsciiconv_topetscii(wptr, WWW_CONF_WEBPAGE_WIDTH); + (void)wptr; 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..f8626eab9 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((unsigned long)data == CH_CURS_UP) { clearptr(); if(fileptr > 0) { --fileptr; } showptr(); return 1; - } else if((ctk_arch_key_t)data == CH_CURS_DOWN) { + } else if((unsigned long)data == CH_CURS_DOWN) { clearptr(); if(fileptr < FILES_HEIGHT - 1) { ++fileptr; From 2d203cc71317fd86d7a0e6ea038b9fbda1db2820 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:32:05 +0200 Subject: [PATCH 41/62] Fix compiler warnings --- core/ctk/ctk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/ctk/ctk.c b/core/ctk/ctk.c index 5da963b19..b3c1198f9 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 && From 01996eb62ac92fe44603440f5167a1f95f95e8d6 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:32:12 +0200 Subject: [PATCH 42/62] Fix compiler warnings --- core/net/ipv6/uip-ds6.c | 6 ++++++ core/net/ipv6/uip-ds6.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/core/net/ipv6/uip-ds6.c b/core/net/ipv6/uip-ds6.c index ff2ccd1db..99d882e98 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 */ From 06dfce6d46c281724689ac66758cbc85dd2c59b0 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:33:08 +0200 Subject: [PATCH 43/62] The -pedantic and -stdc flags trigger a few too many warnings --- cpu/native/Makefile.native | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From 4cab313b8cd08b36bf620600eeec2e4bdedacde7 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:33:27 +0200 Subject: [PATCH 44/62] Fix compiler warnings --- cpu/native/net/linuxradio-drv.c | 1 + cpu/native/net/tapdev.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cpu/native/net/linuxradio-drv.c b/cpu/native/net/linuxradio-drv.c index e9760d604..a2be32940 100644 --- a/cpu/native/net/linuxradio-drv.c +++ b/cpu/native/net/linuxradio-drv.c @@ -43,6 +43,7 @@ #include "net/packetbuf.h" #include "net/netstack.h" +#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); From 24b1eb4031b4460289496c4fbb8d331b85e29333 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:33:37 +0200 Subject: [PATCH 45/62] The -pedantic and -stdc flags trigger a few too many warnings --- cpu/rl78/Makefile.rl78 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From afe3612c0ce699ba44c446717ce900e8f80e05b2 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:33:47 +0200 Subject: [PATCH 46/62] Fix compiler warnings --- examples/rime/example-rucb.c | 2 +- examples/rime/example-rudolph1.c | 3 +-- examples/rime/example-rudolph2.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) 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); } From 9b6377ecdc42e2a945682270293ca7ea72d5e384 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:33:54 +0200 Subject: [PATCH 47/62] Fix compiler warnings --- examples/sky-shell-webserver/sky-shell-webserver.c | 2 -- examples/z1/test-sht25.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) 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(); } From c1ed924c6757f71ddfcb727e3ed02e04f85ba828 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:34:07 +0200 Subject: [PATCH 48/62] Spell fix in function name --- platform/z1/dev/relay-phidget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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_ */ From bd54fe83f8578e277f8e7ea0f76d943202fc668f Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:46:22 +0200 Subject: [PATCH 49/62] Cast pointer to uintptr_t type to avoid compiler warnings --- apps/shell/shell-vars.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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, ""); } } From 160d792399ba5b4d1d2be07a8b8daa9d9f5ec4e1 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 22:53:23 +0200 Subject: [PATCH 50/62] Cast pointer to uintptr_t type to avoid compiler warnings --- apps/shell/shell-memdebug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); From 507309b0f5c78d2b43f348cc1c066566b388196c Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Sun, 4 Oct 2015 23:00:02 +0200 Subject: [PATCH 51/62] Cast pointer to uintptr_t type to avoid compiler warnings --- apps/shell/shell-netperf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) { From 2773a37857ad4226aa07902edea87a43d49e1b7b Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 5 Oct 2015 10:36:45 +0100 Subject: [PATCH 52/62] Update CCxxwares to our warning-free version --- cpu/cc26xx-cc13xx/lib/cc13xxware | 2 +- cpu/cc26xx-cc13xx/lib/cc26xxware | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From d48cf89e9bde9ec917b811ba4b6f3222747579c3 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 5 Oct 2015 12:46:12 +0200 Subject: [PATCH 53/62] Fixed compiler warnings for the AVR platforms --- cpu/avr/bootloader.c | 2 +- cpu/avr/radio/rf230bb/rf230bb.c | 2 ++ cpu/avr/watchdog.c | 2 +- platform/avr-raven/contiki-raven-main.c | 1 + platform/micaz/node-id.c | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cpu/avr/bootloader.c b/cpu/avr/bootloader.c index 20a174ed0..e41ac8cf8 100644 --- a/cpu/avr/bootloader.c +++ b/cpu/avr/bootloader.c @@ -12,7 +12,7 @@ /* 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 *** +/*# 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..2d4ec9270 100644 --- a/cpu/avr/watchdog.c +++ b/cpu/avr/watchdog.c @@ -67,7 +67,7 @@ /* 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 *** +/*# warning *** MCUCSR not defined, using MCUSR instead ****/ # define MCUCSR MCUSR # endif #endif 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/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; From 7d55e89563f8ab4599a1fa95a2923244a0758feb Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 5 Oct 2015 15:18:46 +0200 Subject: [PATCH 54/62] jn516x: enable -Wall --- platform/jn516x/Makefile.jn516x | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/jn516x/Makefile.jn516x b/platform/jn516x/Makefile.jn516x index b3dce252a..50f0a393d 100644 --- a/platform/jn516x/Makefile.jn516x +++ b/platform/jn516x/Makefile.jn516x @@ -48,6 +48,12 @@ 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 @@ -69,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 From 48ae0d2ba0ea1502d4a80647d63b9ad24f70755b Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 5 Oct 2015 15:19:27 +0200 Subject: [PATCH 55/62] anti-replay.c: fix undefined behavior on big-endian platforms --- core/net/llsec/anti-replay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]); From c13274c55020d1f0fc39923437f640037a531874 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 20 Oct 2015 09:45:00 +0200 Subject: [PATCH 56/62] jn516x platform: fix compiler warnings to enable -Wall -Werror compilation --- platform/jn516x/contiki-jn516x-main.c | 6 +++--- platform/jn516x/dev/exceptions.c | 2 -- platform/jn516x/dev/micromac-radio.c | 6 ++---- platform/jn516x/dev/rtimer-arch.c | 1 + platform/jn516x/dev/uart-driver.c | 7 ++++++- platform/jn516x/dev/uart0.h | 1 + platform/jn516x/lib/sprintf.c | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) 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 e5a58f0b5..b916927a2 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'); From 1634acf2c438a1fb7b26ba86d658655488a7c96a Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 20 Oct 2015 09:45:27 +0200 Subject: [PATCH 57/62] jn516x examples: fix compiler warnings to enable -Wall -Werror compilation --- examples/jn516x/dr1175-sensors/node.c | 1 + examples/jn516x/rime/node.c | 3 ++- .../jn516x/rpl/border-router/border-router.c | 1 + .../jn516x/rpl/coap-dongle-node/dongle-node.c | 2 -- .../jn516x/rpl/coap-dr1175-node/dr1175-node.c | 14 ++++++-------- .../jn516x/rpl/coap-dr1199-node/dr1199-node.c | 19 +++++++------------ 6 files changed, 17 insertions(+), 23 deletions(-) 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 { From f49b161795f5b604979b89283444ca55c7e15788 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 6 Oct 2015 15:39:29 +0200 Subject: [PATCH 58/62] Remove commented-out code --- apps/powertrace/powertrace.c | 8 -------- apps/servreg-hack/servreg-hack.c | 4 ---- cpu/avr/bootloader.c | 1 - cpu/avr/watchdog.c | 1 - 4 files changed, 14 deletions(-) diff --git a/apps/powertrace/powertrace.c b/apps/powertrace/powertrace.c index 131eb1deb..6d8f2936f 100644 --- a/apps/powertrace/powertrace.c +++ b/apps/powertrace/powertrace.c @@ -287,16 +287,8 @@ output_sniffer(int mac_status) static void sniffprint(char *prefix, int seqno) { - /* const linkaddr_t *sender; */ - /* const linkaddr_t *receiver; */ const linkaddr_t *esender; - /* const linkaddr_t *ereceiver; */ - - /* sender = packetbuf_addr(PACKETBUF_ADDR_SENDER); */ - /* receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER); */ 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 9e60ddf24..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/cpu/avr/bootloader.c b/cpu/avr/bootloader.c index e41ac8cf8..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/watchdog.c b/cpu/avr/watchdog.c index 2d4ec9270..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 From 343326abee596dac2eb378fd16b2ab26f6ce86ea Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 6 Oct 2015 15:42:18 +0200 Subject: [PATCH 59/62] www.c: added #ifdef WITH_PETSCII guards to avoid compiler warning on unused variable wptr --- apps/webbrowser/www.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/webbrowser/www.c b/apps/webbrowser/www.c index 11ed1384a..bc37ba9cf 100644 --- a/apps/webbrowser/www.c +++ b/apps/webbrowser/www.c @@ -842,7 +842,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; @@ -862,9 +864,10 @@ htmlparser_newline(void) ++y; x = 0; +#ifdef WITH_PETSCII wptr = webpageptr - WWW_CONF_WEBPAGE_WIDTH; petsciiconv_topetscii(wptr, WWW_CONF_WEBPAGE_WIDTH); - (void)wptr; +#endif /* WITH_PETSCII */ if(y == WWW_CONF_WEBPAGE_HEIGHT) { loading = 0; From ca8fe618e7411148edebae394fe2d1c54bee5134 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 6 Oct 2015 16:12:24 +0200 Subject: [PATCH 60/62] cc2420 and cc2430: add comment on why we discard tbiv --- cpu/msp430/cc2420-arch-sfd.c | 1 + cpu/msp430/cc2520-arch-sfd.c | 1 + dev/cc2520/cc2520.c | 1 + 3 files changed, 3 insertions(+) diff --git a/cpu/msp430/cc2420-arch-sfd.c b/cpu/msp430/cc2420-arch-sfd.c index a940b8cab..6cd7d2606 100644 --- a/cpu/msp430/cc2420-arch-sfd.c +++ b/cpu/msp430/cc2420-arch-sfd.c @@ -45,6 +45,7 @@ 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++; diff --git a/cpu/msp430/cc2520-arch-sfd.c b/cpu/msp430/cc2520-arch-sfd.c index 852974b70..5e7bee813 100644 --- a/cpu/msp430/cc2520-arch-sfd.c +++ b/cpu/msp430/cc2520-arch-sfd.c @@ -44,6 +44,7 @@ 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++; diff --git a/dev/cc2520/cc2520.c b/dev/cc2520/cc2520.c index 3b40c8879..e0dad1b6a 100644 --- a/dev/cc2520/cc2520.c +++ b/dev/cc2520/cc2520.c @@ -217,6 +217,7 @@ 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); From 8f954fbab56a4c5d0078e3f7c5b16afd990b9774 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Tue, 6 Oct 2015 16:15:17 +0200 Subject: [PATCH 61/62] res-b1-sep-b2.c: fix type of iterator --- examples/er-rest-example/resources/res-b1-sep-b2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 06390da62..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,7 +67,7 @@ res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t prefer coap_separate_accept(request, &request_metadata); /* Need Time for calculation now */ - int i; + unsigned i; for(i = 0; i <= 4096; i++) { printf("\r%4u\r", i); } From a29502ed0d28314533bfbbb380e7ed668e6e71c1 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Tue, 6 Oct 2015 16:25:42 +0200 Subject: [PATCH 62/62] Changed 'data' casting for 'ctk_signal_keypress'. In these cases data was set as `process_post_synch(window->owner, ctk_signal_keypress, (process_data_t)(size_t)c);` so it seems reasonable to cast "back" to `size_t`. Additionally the comparison can be limited to `char`. See i.e. calcc for reference: ``` if(ev == ctk_signal_keypress) { if((char)(size_t)data >= '0' && (char)(size_t)data <= '9') { ``` --- core/ctk/ctk-filedialog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/ctk/ctk-filedialog.c b/core/ctk/ctk-filedialog.c index f8626eab9..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((unsigned long)data == CH_CURS_UP) { + if((char)(size_t)data == CH_CURS_UP) { clearptr(); if(fileptr > 0) { --fileptr; } showptr(); return 1; - } else if((unsigned long)data == CH_CURS_DOWN) { + } else if((char)(size_t)data == CH_CURS_DOWN) { clearptr(); if(fileptr < FILES_HEIGHT - 1) { ++fileptr;