From 9e94ba98030e90f8b757addca7dbb738527397ea Mon Sep 17 00:00:00 2001 From: dak664 Date: Fri, 12 Nov 2010 17:15:00 +0000 Subject: [PATCH] Allow non-ipv6 build, e.g. Hello World --- cpu/avr/Makefile.avr | 4 ++-- examples/hello-world/Makefile | 6 +++++ platform/avr-raven/contiki-conf.h | 20 +++++++++------- platform/avr-raven/contiki-raven-main.c | 4 +++- platform/avr-zigbit/contiki-avr-zigbit-main.c | 4 +++- platform/avr-zigbit/contiki-conf.h | 24 +++++++++---------- 6 files changed, 37 insertions(+), 25 deletions(-) diff --git a/cpu/avr/Makefile.avr b/cpu/avr/Makefile.avr index db201a8f0..e57bc3e34 100644 --- a/cpu/avr/Makefile.avr +++ b/cpu/avr/Makefile.avr @@ -1,4 +1,4 @@ -# $Id: Makefile.avr,v 1.25 2010/09/17 21:59:09 dak664 Exp $ +# $Id: Makefile.avr,v 1.26 2010/11/12 17:15:00 dak664 Exp $ ### Check if we are running under Windows @@ -133,7 +133,7 @@ $(OBJECTDIR)/%.o: %.c %.elf: %.co $(PROJECT_OBJECTFILES) contiki-$(TARGET).a symbols.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(filter-out %.a,$^) $(filter %.a,$^) $(LDLIBS) -### avr-size -C --mcu=$(MCU) $@ + avr-size -C --mcu=$(MCU) $@ %.hex: %.out $(OBJCOPY) $^ -O ihex $@ diff --git a/examples/hello-world/Makefile b/examples/hello-world/Makefile index 0a79167ae..63efcf852 100644 --- a/examples/hello-world/Makefile +++ b/examples/hello-world/Makefile @@ -1,5 +1,11 @@ +#Note to AVR Raven users: Output goes to UART1, not the LCD. To see it, +#make TARGET=avr-raven hello-world.elf +#Load the .elf in AVR Studio and connect a hapsim terminal to the 1284p simulation. + CONTIKI_PROJECT = hello-world all: $(CONTIKI_PROJECT) +#UIP_CONF_IPV6=1 + CONTIKI = ../.. include $(CONTIKI)/Makefile.include diff --git a/platform/avr-raven/contiki-conf.h b/platform/avr-raven/contiki-conf.h index 8ce1dd75b..4f41ec4e8 100644 --- a/platform/avr-raven/contiki-conf.h +++ b/platform/avr-raven/contiki-conf.h @@ -73,9 +73,18 @@ #define RIMEADDR_CONF_SIZE 8 +//define UIP_CONF_IPV6 1 //Let the makefile do this, allows hello-world to compile +#if UIP_CONF_IPV6 +#define UIP_CONF_ICMP6 1 +#define UIP_CONF_UDP 1 +#define UIP_CONF_TCP 1 +#define NETSTACK_CONF_NETWORK sicslowpan_driver #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 +#else +#define NETSTACK_CONF_NETWORK rime_driver +#endif -/* RF230BB must be used with low power protocols */ +/* The new NETSTACK interface requires RF230BB */ #if RF230BB #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 //for barebones driver, sicslowpan calls radio->read function #undef PACKETBUF_CONF_HDR_SIZE //RF230BB takes the packetbuf default for header size @@ -88,7 +97,7 @@ #if 1 /* Network setup */ /* No radio cycling */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver + #define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_RDC sicslowmac_driver #define NETSTACK_CONF_FRAMER framer_802154 @@ -103,7 +112,6 @@ #elif 0 /* Contiki-mac radio cycling */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver #define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_FRAMER framer_802154 @@ -113,7 +121,6 @@ #elif 0 /* cx-mac radio cycling */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver #define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_RDC cxmac_driver #define NETSTACK_CONF_FRAMER framer_802154 @@ -149,7 +156,6 @@ #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_FWCACHE_SIZE 0 -#define UIP_CONF_IPV6 1 #define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_QUEUE_PKT 1 #define UIP_CONF_IPV6_REASSEMBLY 0 @@ -157,12 +163,8 @@ #define UIP_CONF_ND6_MAX_PREFIXES 3 #define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define UIP_CONF_ICMP6 1 -#define UIP_CONF_UDP 1 #define UIP_CONF_UDP_CHECKSUMS 1 - -#define UIP_CONF_TCP 1 #define UIP_CONF_TCP_SPLIT 1 #if 0 /* RPL */ diff --git a/platform/avr-raven/contiki-raven-main.c b/platform/avr-raven/contiki-raven-main.c index ff9aac78b..21dc8f676 100644 --- a/platform/avr-raven/contiki-raven-main.c +++ b/platform/avr-raven/contiki-raven-main.c @@ -189,7 +189,9 @@ void initialize(void) memset(&addr, 0, sizeof(rimeaddr_t)); get_mac_from_eeprom(addr.u8); - memcpy(&uip_lladdr.addr, &addr.u8, 8); +#if UIP_CONF_IPV6 + memcpy(&uip_lladdr.addr, &addr.u8, 8); +#endif rf230_set_pan_addr( get_panid_from_eeprom(), get_panaddr_from_eeprom(), diff --git a/platform/avr-zigbit/contiki-avr-zigbit-main.c b/platform/avr-zigbit/contiki-avr-zigbit-main.c index 5c33e37f3..5f2c2ecd7 100644 --- a/platform/avr-zigbit/contiki-avr-zigbit-main.c +++ b/platform/avr-zigbit/contiki-avr-zigbit-main.c @@ -123,7 +123,9 @@ init_lowlevel(void) eeprom_read_block ((void *)&addr.u8, &mac_address, 8); AVR_LEAVE_CRITICAL_REGION(); - memcpy(&uip_lladdr.addr, &addr.u8, 8); +#if UIP_CONF_IPV6 + memcpy(&uip_lladdr.addr, &addr.u8, 8); +#endif rf230_set_pan_addr(IEEE802154_PANID, 0, (uint8_t *)&addr.u8); rf230_set_channel(24); diff --git a/platform/avr-zigbit/contiki-conf.h b/platform/avr-zigbit/contiki-conf.h index da38987e0..fb219cb97 100644 --- a/platform/avr-zigbit/contiki-conf.h +++ b/platform/avr-zigbit/contiki-conf.h @@ -73,7 +73,14 @@ #define RIMEADDR_CONF_SIZE 8 #define PACKETBUF_CONF_HDR_SIZE 0 -/* RF230BB must be used with low power protocols */ +//define UIP_CONF_IPV6 1 //Let the makefile do this, allows hello-world to compile +#if UIP_CONF_IPV6 +#define UIP_CONF_ICMP6 1 +#define UIP_CONF_UDP 1 +#define UIP_CONF_TCP 1 +#endif + +/* The new NETSTACK interface requires RF230BB */ #if RF230BB #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 //for barebones driver, sicslowpan calls radio->read function @@ -81,7 +88,11 @@ #define UIP_CONF_LLH_LEN 0 /* No radio cycling */ +#if UIP_CONF_IPV6 #define NETSTACK_CONF_NETWORK sicslowpan_driver +#else +#define NETSTACK_CONF_NETWORK rime_driver +#endif #define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_RDC sicslowmac_driver #define NETSTACK_CONF_FRAMER framer_802154 @@ -112,7 +123,6 @@ #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 #define SICSLOWPAN_CONF_FRAG 1 - #define UIP_CONF_LL_802154 1 #define UIP_CONF_MAX_CONNECTIONS 2 @@ -122,24 +132,14 @@ #define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_FWCACHE_SIZE 0 -#define UIP_CONF_IPV6 1 #define UIP_CONF_IPV6_CHECKS 1 - - #define UIP_CONF_IPV6_QUEUE_PKT 0 - - #define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_NETIF_MAX_ADDRESSES 3 #define UIP_CONF_ND6_MAX_PREFIXES 3 #define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define UIP_CONF_ICMP6 1 - -#define UIP_CONF_UDP 1 #define UIP_CONF_UDP_CHECKSUMS 1 - -#define UIP_CONF_TCP 1 #define UIP_CONF_TCP_SPLIT 1