Unverified Commit e30423f6 authored by Simon Duquennoy's avatar Simon Duquennoy Committed by GitHub
Browse files

Merge branch 'develop' into contrib/gpio-hal

parents 48ffc8f6 fa921150
......@@ -41,6 +41,7 @@
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
......
......@@ -111,7 +111,12 @@
static const struct select_callback *select_callback[SELECT_MAX];
static int select_max = 0;
static uint8_t serial_id[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};
#ifdef PLATFORM_CONF_MAC_ADDR
static uint8_t mac_addr[] = PLATFORM_CONF_MAC_ADDR;
#else /* PLATFORM_CONF_MAC_ADDR */
static uint8_t mac_addr[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
#endif /* PLATFORM_CONF_MAC_ADDR */
#if !NETSTACK_CONF_WITH_IPV6
static uint16_t node_id = 0x0102;
#endif /* !NETSTACK_CONF_WITH_IPV6 */
......@@ -177,12 +182,12 @@ set_lladdr(void)
memset(&addr, 0, sizeof(linkaddr_t));
#if NETSTACK_CONF_WITH_IPV6
memcpy(addr.u8, serial_id, sizeof(addr.u8));
memcpy(addr.u8, mac_addr, sizeof(addr.u8));
#else
if(node_id == 0) {
int i;
for(i = 0; i < sizeof(linkaddr_t); ++i) {
addr.u8[i] = serial_id[7 - i];
addr.u8[i] = mac_addr[7 - i];
}
} else {
addr.u8[0] = node_id & 0xff;
......
......@@ -41,6 +41,7 @@
#define CONTIKI_CONF_H
#include <stdint.h>
#include <inttypes.h>
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
......
......@@ -50,6 +50,7 @@
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
......
......@@ -38,6 +38,7 @@
#define CONTIKI_CONF_H
#include <stdint.h>
#include <inttypes.h>
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
......
......@@ -47,6 +47,7 @@
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
/*---------------------------------------------------------------------------*/
/* Include Project Specific conf */
#ifdef PROJECT_CONF_PATH
......
......@@ -314,7 +314,7 @@ add_req_handler(const linkaddr_t *peer_addr,
sizeof(sixp_pkt_cell_options_t) +
sizeof(sixp_pkt_num_cells_t) +
sizeof(sf_plugtest_cell_t))) {
LOG_ERR("invalid Add Request length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Add Request length: %lu\n", (unsigned long)body_len);
}
assert(
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
......@@ -359,7 +359,7 @@ add_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
struct tsch_slotframe *slotframe;
if(body_len != 4) {
LOG_ERR("invalid Add Response length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Add Response length: %lu\n", (unsigned long)body_len);
return;
}
......@@ -399,7 +399,7 @@ delete_req_handler(const linkaddr_t *peer_addr,
sizeof(sixp_pkt_cell_options_t) +
sizeof(sixp_pkt_num_cells_t) +
sizeof(sf_plugtest_cell_t))) {
LOG_ERR("invalid Delete Request length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Delete Request length: %lu\n", (unsigned long)body_len);
}
assert(
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
......@@ -446,7 +446,7 @@ delete_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
uint16_t timeslot;
if(body_len != 4) {
LOG_ERR("invalid Delete Response length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Delete Response length: %lu\n", (unsigned long)body_len);
return;
}
......@@ -489,7 +489,7 @@ count_req_handler(const linkaddr_t *peer_addr,
assert(peer_addr != NULL && body != NULL);
if(body_len != (sizeof(sixp_pkt_metadata_t) +
sizeof(sixp_pkt_cell_options_t))) {
LOG_ERR("invalid Count Request length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Count Request length: %lu\n", (unsigned long)body_len);
}
assert(
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
......@@ -534,7 +534,7 @@ count_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
sixp_pkt_total_num_cells_t total_num_cells;
if(body_len != 2) {
LOG_ERR("invalid Count Response length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Count Response length: %lu\n", (unsigned long)body_len);
return;
}
......@@ -570,7 +570,7 @@ list_req_handler(const linkaddr_t *peer_addr,
sizeof(sixp_pkt_reserved_t) +
sizeof(sixp_pkt_offset_t) +
sizeof(sixp_pkt_max_num_cells_t))) {
LOG_ERR("invalid List Request length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid List Request length: %lu\n", (unsigned long)body_len);
}
assert(
......@@ -679,7 +679,7 @@ clear_req_handler(const linkaddr_t *peer_addr,
assert(peer_addr != NULL && body != NULL);
if(body_len != sizeof(sixp_pkt_metadata_t)) {
LOG_ERR("invalid Clear Request length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Clear Request length: %lu\n", (unsigned long)body_len);
}
if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL) {
......@@ -717,7 +717,7 @@ clear_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
}
if(body_len != 0) {
LOG_ERR("invalid Clear Response length: %u\n", (unsigned int)body_len);
LOG_ERR("invalid Clear Response length: %lu\n", (unsigned long)body_len);
return;
}
......
......@@ -82,7 +82,7 @@
/* Save some space to fit the limited RAM of the z1 */
#define UIP_CONF_TCP 0
#define QUEUEBUF_CONF_NUM 2
#define RPL_NS_CONF_LINK_NUM 2
#define NETSTACK_MAX_ROUTE_ENTRIES 2
#define NBR_TABLE_CONF_MAX_NEIGHBORS 2
#define UIP_CONF_ND6_SEND_NA 0
#define SICSLOWPAN_CONF_FRAG 0
......
......@@ -83,7 +83,7 @@ multicast_send(void)
PRINTF("Send to: ");
PRINT6ADDR(&mcast_conn->ripaddr);
PRINTF(" Remote Port %u,", uip_ntohs(mcast_conn->rport));
PRINTF(" (msg=0x%08lx)", (unsigned long)uip_ntohl(*((uint32_t *)buf)));
PRINTF(" (msg=0x%08"PRIx32")", uip_ntohl(*((uint32_t *)buf)));
PRINTF(" %lu bytes\n", (unsigned long)sizeof(id));
seq_id++;
......
......@@ -347,7 +347,7 @@ heapmem_alloc(size_t size)
chunk->line = line;
#endif
PRINTF("%s ptr %p size %u\n", __func__, GET_PTR(chunk), (unsigned)size);
PRINTF("%s ptr %p size %lu\n", __func__, GET_PTR(chunk), (unsigned long)size);
return GET_PTR(chunk);
}
......
......@@ -82,8 +82,7 @@ progress_request(coap_request_state_t *state) {
coap_serialize_message(request, state->transaction->message);
coap_send_transaction(state->transaction);
LOG_DBG("Requested #%lu (MID %u)\n", (unsigned long)state->block_num,
request->mid);
LOG_DBG("Requested #%"PRIu32" (MID %u)\n", state->block_num, request->mid);
}
}
......@@ -120,8 +119,7 @@ coap_request_callback(void *callback_data, coap_message_t *response)
/* this is only for counting BLOCK2 blocks.*/
++(state->block_num);
} else {
LOG_WARN("WRONG BLOCK %lu/%lu\n", (unsigned long)res_block,
(unsigned long)state->block_num);
LOG_WARN("WRONG BLOCK %"PRIu32"/%"PRIu32"\n", res_block, state->block_num);
++block_error;
}
......
......@@ -507,7 +507,7 @@ output_to_peer(struct dtls_context_t *ctx,
struct uip_udp_conn *udp_connection = dtls_get_app_data(ctx);
LOG_DBG("output_to DTLS peer [");
LOG_DBG_6ADDR(&session->ipaddr);
LOG_DBG_("]:%u %d bytes\n", uip_ntohs(session->port), (int)len);
LOG_DBG_("]:%u %ld bytes\n", uip_ntohs(session->port), (long)len);
uip_udp_packet_sendto(udp_connection, data, len,
&session->ipaddr, session->port);
return len;
......
......@@ -528,7 +528,7 @@ coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len)
case COAP_OPTION_MAX_AGE:
coap_pkt->max_age = coap_parse_int_option(current_option,
option_length);
LOG_DBG_("Max-Age [%lu]\n", (unsigned long)coap_pkt->max_age);
LOG_DBG_("Max-Age [%"PRIu32"]\n", coap_pkt->max_age);
break;
case COAP_OPTION_ETAG:
coap_pkt->etag_len = MIN(COAP_ETAG_LEN, option_length);
......@@ -638,7 +638,7 @@ coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len)
case COAP_OPTION_OBSERVE:
coap_pkt->observe = coap_parse_int_option(current_option,
option_length);
LOG_DBG_("Observe [%lu]\n", (unsigned long)coap_pkt->observe);
LOG_DBG_("Observe [%"PRId32"]\n", coap_pkt->observe);
break;
case COAP_OPTION_BLOCK2:
coap_pkt->block2_num = coap_parse_int_option(current_option,
......@@ -666,11 +666,11 @@ coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len)
break;
case COAP_OPTION_SIZE2:
coap_pkt->size2 = coap_parse_int_option(current_option, option_length);
LOG_DBG_("Size2 [%lu]\n", (unsigned long)coap_pkt->size2);
LOG_DBG_("Size2 [%"PRIu32"]\n", coap_pkt->size2);
break;
case COAP_OPTION_SIZE1:
coap_pkt->size1 = coap_parse_int_option(current_option, option_length);
LOG_DBG_("Size1 [%lu]\n", (unsigned long)coap_pkt->size1);
LOG_DBG_("Size1 [%"PRIu32"]\n", coap_pkt->size1);
break;
default:
LOG_DBG_("unknown (%u)\n", option_number);
......
......@@ -973,7 +973,7 @@ ra_input(void)
default:
LOG_DBG("Updating timer of prefix ");
LOG_DBG_6ADDR(&prefix->ipaddr);
LOG_DBG_(" new value %lu\n", (unsigned long)uip_ntohl(nd6_opt_prefix_info->validlt));
LOG_DBG_(" new value %"PRIu32"\n", uip_ntohl(nd6_opt_prefix_info->validlt));
stimer_set(&prefix->vlifetime,
uip_ntohl(nd6_opt_prefix_info->validlt));
prefix->isinfinite = 0;
......@@ -1034,7 +1034,7 @@ ra_input(void)
while(naddr-- > 0) {
LOG_DBG("nameserver: ");
LOG_DBG_6ADDR(ip);
LOG_DBG_(" lifetime: %lx\n", (unsigned long)uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
LOG_DBG_(" lifetime: %"PRIx32"\n", uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
uip_nameserver_update(ip, uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
ip++;
}
......
......@@ -118,7 +118,7 @@ tsch_log_process_pending(void)
if(log->rx.drift_used) {
printf(", dr %d", log->rx.drift);
}
printf(", edr %d\n", (int)log->rx.estimated_drift);
printf(", edr %d\n", log->rx.estimated_drift);
break;
case tsch_log_message:
printf("%s\n", log->message);
......
......@@ -29,7 +29,7 @@
* This file is part of the Contiki operating system.
*
*/
/**
* \addtogroup rpl-lite
* @{
......@@ -73,17 +73,6 @@
#define RPL_WITH_NON_STORING (RPL_MOP_DEFAULT == RPL_MOP_NON_STORING)
#endif /* RPL_CONF_WITH_NON_STORING */
/* The number of non-storing nodes, i.e. the maximum netwrok size at the root */
#ifdef RPL_NS_CONF_LINK_NUM
#define RPL_NS_LINK_NUM RPL_NS_CONF_LINK_NUM
#else /* RPL_NS_CONF_LINK_NUM */
#if RPL_WITH_NON_STORING
#define RPL_NS_LINK_NUM NETSTACK_MAX_ROUTE_ENTRIES
#else
#define RPL_NS_LINK_NUM 0
#endif
#endif /* RPL_NS_CONF_LINK_NUM */
/*
* The objective function (OF) used by a RPL root is configurable through
* the RPL_CONF_OF_OCP parameter. This is defined as the objective code
......
......@@ -767,7 +767,7 @@ perform_multi_resource_read_op(lwm2m_object_t *object,
/* Now we need to initialize the object writing for this new object */
len = ctx->writer->init_write(ctx);
ctx->outbuf->len += len;
LOG_DBG("INIT WRITE len:%d size:%d\n", len, (int) ctx->outbuf->size);
LOG_DBG("INIT WRITE len:%d size:%"PRIu16"\n", len, ctx->outbuf->size);
initialized = 1;
}
......@@ -1516,10 +1516,10 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response,
/* for debugging */
LOG_DBG("[");
LOG_DBG_COAP_STRING(url, url_len);
LOG_DBG_("] %s Format:%d ID:%d bsize:%u offset:%d\n",
LOG_DBG_("] %s Format:%d ID:%d bsize:%u offset:%"PRId32"\n",
get_method_as_string(coap_get_method_type(request)),
format, context.object_id, buffer_size,
offset != NULL ? ((int)*offset) : 0);
offset != NULL ? *offset : 0);
if(format == TEXT_PLAIN) {
/* a string */
const uint8_t *data;
......@@ -1573,8 +1573,8 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response,
if(success == LWM2M_STATUS_OK) {
/* Handle blockwise 1 */
if(coap_is_option(request, COAP_OPTION_BLOCK1)) {
LOG_DBG("Setting BLOCK 1 num:%d o2:%d o:%d\n", (int) bnum, (int) boffset,
(int) (offset != NULL ? *offset : 0));
LOG_DBG("Setting BLOCK 1 num:%"PRIu32" o2:%"PRIu32" o:%"PRId32"\n", bnum, boffset,
(offset != NULL ? *offset : 0));
coap_set_header_block1(response, bnum, 0, bsize);
}
......
......@@ -219,9 +219,9 @@ write_int(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen,
char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : "";
int len;
if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) {
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"v\":%" PRId32 "}", sep, ctx->resource_id, ctx->resource_instance_id, value);
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"v\":%"PRId32"}", sep, ctx->resource_id, ctx->resource_instance_id, value);
} else {
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"v\":%" PRId32 "}", sep, ctx->resource_id, value);
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"v\":%"PRId32"}", sep, ctx->resource_id, value);
}
if((len < 0) || (len >= outlen)) {
return 0;
......
......@@ -177,7 +177,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
/* Handle the writes */
switch(ctx->resource_id) {
case LWM2M_SECURITY_SERVER_URI_ID:
LOG_DBG("Writing security URI value: len: %d\n", (int)ctx->inbuf->size);
LOG_DBG("Writing security URI value: len: %"PRId16"\n", ctx->inbuf->size);
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->server_uri, LWM2M_SECURITY_URI_SIZE);
/* This is string... */
security->server_uri_len = ctx->last_value_len;
......@@ -204,7 +204,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->public_key, LWM2M_SECURITY_KEY_SIZE);
security->public_key_len = ctx->last_value_len;
LOG_DBG("Writing client PKI: len: %d '", (int)ctx->last_value_len);
LOG_DBG("Writing client PKI: len: %"PRIu16" '", ctx->last_value_len);
LOG_DBG_COAP_STRING((const char *)security->public_key,
ctx->last_value_len);
LOG_DBG_("'\n");
......@@ -213,7 +213,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->secret_key, LWM2M_SECURITY_KEY_SIZE);
security->secret_key_len = ctx->last_value_len;
LOG_DBG("Writing secret key: len: %d '", (int)ctx->last_value_len);
LOG_DBG("Writing secret key: len: %"PRIu16" '", ctx->last_value_len);
LOG_DBG_COAP_STRING((const char *)security->secret_key,
ctx->last_value_len);
LOG_DBG_("'\n");
......
......@@ -205,7 +205,7 @@ lwm2m_tlv_write_int32(uint8_t type, int16_t id, int32_t value, uint8_t *buffer,
int i;
int v;
int last_bit;
LOG_DBG("Exporting int32 %d %ld ", id, (long)value);
LOG_DBG("Exporting int32 %d %"PRId32" ", id, value);
v = value < 0 ? -1 : 0;
i = 0;
......@@ -252,9 +252,9 @@ lwm2m_tlv_write_float32(uint8_t type, int16_t id, int32_t value, int bits,
e++;
}
LOG_DBG("Sign: %d, Fraction: %06lx 0b", value < 0, (long)val);
LOG_DBG("Sign: %d, Fraction: %06"PRIx32" 0b", value < 0, val);
for(i = 0; i < 23; i++) {
LOG_DBG_("%d", (int)((val >> (22 - i)) & 1));
LOG_DBG_("%"PRId32"", ((val >> (22 - i)) & 1));
}
LOG_DBG_("\nExp:%d\n", e);
......@@ -292,9 +292,9 @@ lwm2m_tlv_float32_to_fix(const lwm2m_tlv_t *tlv, int32_t *value, int bits)
e = ((tlv->value[0] << 1) & 0xff) | (tlv->value[1] >> 7);
val = (((long)tlv->value[1] & 0x7f) << 16) | (tlv->value[2] << 8) | tlv->value[3];
LOG_DBG("Sign: %d, Fraction: %06lx 0b", val < 0, (long)val);
LOG_DBG("Sign: %d, Fraction: %06"PRIx32" 0b", val < 0, val);
for(i = 0; i < 23; i++) {
LOG_DBG_("%d", (int)((val >> (22 - i)) & 1));
LOG_DBG_("%"PRId32"", ((val >> (22 - i)) & 1));
}
LOG_DBG("\nExp:%d => %d\n", e, e - 127);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment