From 66acf746129dab4ddeca8ad47f917e5ea558472f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Date: Tue, 2 Jun 2015 01:38:11 +0200 Subject: [PATCH] cc2538: examples: Fix build warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Toolchain used: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150303 (release) [ARM/embedded-4_9-branch revision 221220] Signed-off-by: Benoît Thébaudeau --- core/net/ip/resolv.c | 2 +- core/net/mac/contikimac/contikimac.c | 8 ++++++++ core/net/rime/collect-neighbor.c | 2 -- core/net/rime/collect.c | 4 ++++ cpu/cc2538/usb/usb-arch.c | 6 ++---- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/core/net/ip/resolv.c b/core/net/ip/resolv.c index 58bda004d..edf2a4815 100644 --- a/core/net/ip/resolv.c +++ b/core/net/ip/resolv.c @@ -394,7 +394,7 @@ dns_name_isequal(const unsigned char *queryptr, const char *name, return 0; } - if(tolower(*name++) != tolower(*queryptr++)) { + if(tolower((unsigned int)*name++) != tolower((unsigned int)*queryptr++)) { return 0; } } diff --git a/core/net/mac/contikimac/contikimac.c b/core/net/mac/contikimac/contikimac.c index 7aea60928..b7083e83d 100644 --- a/core/net/mac/contikimac/contikimac.c +++ b/core/net/mac/contikimac/contikimac.c @@ -488,7 +488,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, int is_receiver_awake) { rtimer_clock_t t0; +#if WITH_PHASE_OPTIMIZATION rtimer_clock_t encounter_time = 0; +#endif int strobes; uint8_t got_strobe_ack = 0; int len; @@ -660,7 +662,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, { rtimer_clock_t wt; +#if WITH_PHASE_OPTIMIZATION rtimer_clock_t txtime = RTIMER_NOW(); +#endif #if RDC_CONF_HARDWARE_ACK int ret = NETSTACK_RADIO.transmit(transmit_len); #else @@ -673,7 +677,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, if(ret == RADIO_TX_OK) { if(!is_broadcast) { got_strobe_ack = 1; +#if WITH_PHASE_OPTIMIZATION encounter_time = txtime; +#endif break; } } else if (ret == RADIO_TX_NOACK) { @@ -698,7 +704,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, len = NETSTACK_RADIO.read(ackbuf, ACK_LEN); if(len == ACK_LEN && seqno == ackbuf[ACK_LEN - 1]) { got_strobe_ack = 1; +#if WITH_PHASE_OPTIMIZATION encounter_time = txtime; +#endif break; } else { PRINTF("contikimac: collisions while sending\n"); diff --git a/core/net/rime/collect-neighbor.c b/core/net/rime/collect-neighbor.c index dae9289ea..b033d3e05 100644 --- a/core/net/rime/collect-neighbor.c +++ b/core/net/rime/collect-neighbor.c @@ -254,13 +254,11 @@ collect_neighbor_list_remove(struct collect_neighbor_list *neighbors_list, struct collect_neighbor * collect_neighbor_list_best(struct collect_neighbor_list *neighbors_list) { - int found; struct collect_neighbor *n, *best; uint16_t rtmetric; rtmetric = RTMETRIC_MAX; best = NULL; - found = 0; if(neighbors_list == NULL) { return NULL; diff --git a/core/net/rime/collect.c b/core/net/rime/collect.c index 325996246..cdd2557c3 100644 --- a/core/net/rime/collect.c +++ b/core/net/rime/collect.c @@ -950,14 +950,18 @@ node_packet_received(struct unicast_conn *c, const linkaddr_t *from) if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_DATA) { linkaddr_t ack_to; +#if DEBUG uint8_t packet_seqno; +#endif stats.datarecv++; /* Remember to whom we should send the ACK, since we reuse the packet buffer and its attributes when sending the ACK. */ linkaddr_copy(&ack_to, packetbuf_addr(PACKETBUF_ADDR_SENDER)); +#if DEBUG packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); +#endif /* If the queue is more than half filled, we add the CONGESTED flag to our outgoing acks. */ diff --git a/cpu/cc2538/usb/usb-arch.c b/cpu/cc2538/usb/usb-arch.c index c209d7778..ed771ce83 100644 --- a/cpu/cc2538/usb/usb-arch.c +++ b/cpu/cc2538/usb/usb-arch.c @@ -872,7 +872,7 @@ fill_buffers(usb_buffer *buffer, uint8_t hw_ep, unsigned int len, static uint8_t ep0_get_setup_pkt(void) { - uint8_t res; + uint8_t res = 0; usb_buffer *buffer = skip_buffers_until(usb_endpoints[0].buffer, USB_BUFFER_SETUP, USB_BUFFER_SETUP, &res); @@ -916,8 +916,6 @@ ep0_get_data_pkt(void) } if(buffer->flags & (USB_BUFFER_SETUP | USB_BUFFER_IN)) { - uint8_t temp; - buffer->flags |= USB_BUFFER_FAILED; buffer->flags &= ~USB_BUFFER_SUBMITTED; if(buffer->flags & USB_BUFFER_NOTIFY) { @@ -925,7 +923,7 @@ ep0_get_data_pkt(void) } /* Flush the fifo */ while(len--) { - temp = REG(USB_F0); + REG(USB_F0); } usb_endpoints[0].buffer = buffer->next; /* Force data stage end */