-Change needed for ravenusb to build

-Reverts Makefile.include back to 1.57, then apply the needed change
This commit is contained in:
c_oflynn 2008-10-14 20:31:46 +00:00
parent 219846f408
commit d5865cb2b6
3 changed files with 127 additions and 18 deletions

View File

@ -1,5 +1,5 @@
ifndef CONTIKI
${error CONTIKI not defined! You must specify where CONTIKI resides!}
${error CONTIKI not defined! You must specify where CONTIKI resides}
endif
OBJECTDIR = obj_$(TARGET)
@ -8,11 +8,8 @@ CFLAGS += -DCONTIKI_TARGET=$(TARGET)
ifeq ($(TARGET),)
-include Makefile.target
ifeq ($(TARGET),)
ifeq ($(DEFAULT_TARGET),)
DEFAULT_TARGET=native
endif
${info TARGET not defined, using target '$(DEFAULT_TARGET)'}
TARGET=$(DEFAULT_TARGET)
${info TARGET not defined, using target 'native'}
TARGET=native
else
${info using saved target '$(TARGET)'}
endif
@ -47,20 +44,21 @@ endif
include $(CONTIKI)/core/net/rime/Makefile.rime
include $(CONTIKI)/core/net/mac/Makefile.mac
#include $(CONTIKI)/core/net/ipv6/Makefile.ipv6
SYSTEM = process.c procinit.c autostart.c elfloader.c profile.c timetable.c timetable-aggregate.c
THREADS = mt.c
LIBS = timer.c etimer.c random.c memb.c list.c energest.c print-stats.c rtimer.c stimer.c
ifndef UIP_CONF_IPV6
UIP = uip.c tcpip.c uip-split.c psock.c uip-udp-packet.c uip-over-mesh.c resolv.c hc.c tcpdump.c uiplib.c
else
UIP = uip6.c tcpip.c uip-split.c psock.c uip-udp-packet.c uip-over-mesh.c resolv.c hc.c tcpdump.c uiplib.c
endif
#rawpacket-udp.c
ifndef UIP_CONF_IPV6
NET = $(UIP) uaodv.c uaodv-rt.c
else
LIBS = memb.c timer.c list.c etimer.c energest.c rtimer.c stimer.c \
print-stats.c ifft.c crc16.c random.c
ifdef UIP_CONF_IPV6
UIP = uip6.c tcpip.c psock.c uip-udp-packet.c uip-split.c \
uip-over-mesh.c resolv.c hc.c tcpdump.c uiplib.c
NET = $(UIP) uip-icmp6.c uip-nd6.c uip-nd6-io.c uip-netif.c sicslowpan.c
endif
else # UIP_CONF_IPV6
UIP = uip.c uiplib.c resolv.c tcpip.c psock.c hc.c uip-split.c uip-fw.c \
uip-fw-drv.c uip_arp.c tcpdump.c uip-neighbor.c uip-udp-packet.c \
uip-over-mesh.c #rawpacket-udp.c
NET = $(UIP) uaodv.c uaodv-rt.c
endif # UIP_CONF_IPV6
CTK = ctk.c
CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c
@ -73,7 +71,7 @@ endif
CONTIKI_SOURCEFILES += $(CONTIKIFILES)
CONTIKIDIRS += ${addprefix $(CONTIKI)/core/,dev lib net net/mac net/rime sys \
cfs ctk lib/ctk loader net/sicslow_interop . }
cfs ctk lib/ctk loader . }
oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}

View File

@ -3,6 +3,7 @@ DEFAULT_TARGET=avr-ravenusb
CONTIKI_NO_NET=1
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

View File

@ -0,0 +1,110 @@
/* Various stub functions and uIP variables other code might need to
* compile. Allows you to save needing to compile all of uIP in just
* to get a few things */
#include "uip.h"
#include <string.h>
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
u8_t uip_buf[UIP_BUFSIZE + 2];
u16_t uip_len;
struct uip_stats uip_stat;
uip_lladdr_t uip_lladdr;
u8_t (* tcpip_output)(uip_lladdr_t *);
u16_t htons(u16_t val) { return HTONS(val);}
/********** UIP_NETIF.c **********/
void
uip_netif_addr_autoconf_set(uip_ipaddr_t *ipaddr, uip_lladdr_t *lladdr)
{
/* We consider only links with IEEE EUI-64 identifier or
IEEE 48-bit MAC addresses */
#if (UIP_LLADDR_LEN == 8)
memcpy(ipaddr->u8 + 8, lladdr, UIP_LLADDR_LEN);
ipaddr->u8[8] ^= 0x02;
#elif (UIP_LLADDR_LEN == 6)
memcpy(ipaddr->u8 + 8, lladdr, 3);
ipaddr->u8[11] = 0xff;
ipaddr->u8[12] = 0xfe;
memcpy(ipaddr->u8 + 13, lladdr + 3, 3);
ipaddr->u8[8] ^= 0x02;
#else
/*
UIP_LOG("CAN NOT BUIL INTERFACE IDENTIFIER");
UIP_LOG("THE STACK IS GOING TO SHUT DOWN");
UIP_LOG("THE HOST WILL BE UNREACHABLE");
*/
exit(-1);
#endif
}
/********** UIP.c ****************/
static u16_t
chksum(u16_t sum, const u8_t *data, u16_t len)
{
u16_t t;
const u8_t *dataptr;
const u8_t *last_byte;
dataptr = data;
last_byte = data + len - 1;
while(dataptr < last_byte) { /* At least two more bytes */
t = (dataptr[0] << 8) + dataptr[1];
sum += t;
if(sum < t) {
sum++; /* carry */
}
dataptr += 2;
}
if(dataptr == last_byte) {
t = (dataptr[0] << 8) + 0;
sum += t;
if(sum < t) {
sum++; /* carry */
}
}
/* Return sum in host byte order. */
return sum;
}
static u16_t
upper_layer_chksum(u8_t proto)
{
u16_t upper_layer_len;
u16_t sum;
upper_layer_len = (((u16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ;
/* First sum pseudoheader. */
/* IP protocol and length fields. This addition cannot carry. */
sum = upper_layer_len + proto;
/* Sum IP source and destination addresses. */
sum = chksum(sum, (u8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t));
/* Sum TCP header and data. */
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
upper_layer_len);
return (sum == 0) ? 0xffff : htons(sum);
}
/*---------------------------------------------------------------------------*/
u16_t
uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
}