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

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

View File

@ -48,15 +48,15 @@
struct powertrace_sniff_stats {
struct powertrace_sniff_stats *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(),

View File

@ -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) {

View File

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

View File

@ -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();

View File

@ -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) {

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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 &&

View File

@ -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, "");
}
}

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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 &&

View File

@ -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;
}

View File

@ -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 */

View File

@ -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
/*---------------------------------------------------------------------------*/

View File

@ -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]);

View File

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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

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

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

View File

@ -35,10 +35,17 @@ endif
CONTIKI_CPU_DIRS = $(CONTIKI_CPU_FAM_DIR) . dev
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

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

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

View File

@ -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);

View File

@ -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);
/* */

View File

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

View File

@ -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

View File

@ -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
/*

View File

@ -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

View File

@ -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

View File

@ -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));

View File

@ -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

View File

@ -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");

View File

@ -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");

View File

@ -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;

View File

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

View File

@ -79,8 +79,6 @@ static void
put_post_led_toggle_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
{
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. */

View File

@ -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 <stdio.h>
#include <stdlib.h>
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);
}
}

View File

@ -39,6 +39,7 @@
#include "button-sensor.h"
#include "pot-sensor.h"
#include <stdio.h>
#include <stdlib.h>
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 {

View File

@ -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();
}

View File

@ -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);

View File

@ -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);
}

View File

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

2
exam