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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,6 +44,7 @@
#include "contiki-conf.h"
#include "uart-driver.h"
#include "sys/rtimer.h"
#include "watchdog.h"
#include <math.h>
#include <AppHardwareApi.h>
@ -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!");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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