Allow non-ipv6 build (hello world)

This commit is contained in:
dak664 2010-11-12 20:49:03 +00:00
parent 3e61990312
commit 72d49c20af
4 changed files with 46 additions and 34 deletions

View file

@ -152,6 +152,17 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
//#pragma mark UIP Settings //#pragma mark UIP Settings
/* ************************************************************************** */ /* ************************************************************************** */
//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
#define UIP_CONF_LL_802154 1 #define UIP_CONF_LL_802154 1
#define UIP_CONF_LLH_LEN 14 #define UIP_CONF_LLH_LEN 14
#define UIP_CONF_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN + 4 // +4 for vlan on macosx #define UIP_CONF_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN + 4 // +4 for vlan on macosx
@ -162,7 +173,6 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#define UIP_CONF_IP_FORWARD 0 #define UIP_CONF_IP_FORWARD 0
#define UIP_CONF_FWCACHE_SIZE 0 #define UIP_CONF_FWCACHE_SIZE 0
#define UIP_CONF_IPV6 1
#define UIP_CONF_IPV6_CHECKS 1 #define UIP_CONF_IPV6_CHECKS 1
#define UIP_CONF_IPV6_QUEUE_PKT 0 #define UIP_CONF_IPV6_QUEUE_PKT 0
#define UIP_CONF_IPV6_REASSEMBLY 0 #define UIP_CONF_IPV6_REASSEMBLY 0
@ -171,10 +181,8 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#define UIP_CONF_ND6_MAX_NEIGHBORS 4 #define UIP_CONF_ND6_MAX_NEIGHBORS 4
#define UIP_CONF_ND6_MAX_DEFROUTERS 2 #define UIP_CONF_ND6_MAX_DEFROUTERS 2
#define UIP_CONF_UDP 1
#define UIP_CONF_UDP_CHECKSUMS 1 #define UIP_CONF_UDP_CHECKSUMS 1
#define UIP_CONF_TCP 1
#define UIP_CONF_TCP_SPLIT 1 #define UIP_CONF_TCP_SPLIT 1
#define UIP_CONF_STATISTICS 1 #define UIP_CONF_STATISTICS 1
@ -230,7 +238,6 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#if 1 /* Network setup */ #if 1 /* Network setup */
/* No radio cycling */ /* No radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC sicslowmac_driver #define NETSTACK_CONF_RDC sicslowmac_driver
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
@ -244,7 +251,6 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#elif 0 #elif 0
/* Contiki-mac radio cycling */ /* Contiki-mac radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC contikimac_driver #define NETSTACK_CONF_RDC contikimac_driver
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
@ -254,7 +260,6 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#elif 1 #elif 1
/* cx-mac radio cycling */ /* cx-mac radio cycling */
#define NETSTACK_CONF_NETWORK sicslowpan_driver
#define NETSTACK_CONF_MAC nullmac_driver #define NETSTACK_CONF_MAC nullmac_driver
#define NETSTACK_CONF_RDC cxmac_driver #define NETSTACK_CONF_RDC cxmac_driver
#define NETSTACK_CONF_FRAMER framer_802154 #define NETSTACK_CONF_FRAMER framer_802154
@ -289,51 +294,42 @@ or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenu
#define UIP_CONF_ROUTER 1 #define UIP_CONF_ROUTER 1
#define RPL_CONF_STATS 0 #define RPL_CONF_STATS 0
#define PROCESS_CONF_NO_PROCESS_NAMES 0 #define PROCESS_CONF_NO_PROCESS_NAMES 0
#undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page //#undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page
#define UIP_CONF_TCP 1 //#define UIP_CONF_TCP 1
//#undef UIP_FALLBACK_INTERFACE //#undef UIP_FALLBACK_INTERFACE
#define UIP_FALLBACK_INTERFACE rpl_interface //#define UIP_FALLBACK_INTERFACE rpl_interface
#undef UIP_CONF_MAX_CONNECTIONS //#undef UIP_CONF_MAX_CONNECTIONS
#define UIP_CONF_MAX_CONNECTIONS 1 //#define UIP_CONF_MAX_CONNECTIONS 1
//#undef UIP_CONF_MAX_LISTENPORTS //#undef UIP_CONF_MAX_LISTENPORTS
//#define UIP_CONF_MAX_LISTENPORTS 10 //#define UIP_CONF_MAX_LISTENPORTS 10
//#define UIP_CONF_BUFFER_SIZE 256 //#define UIP_CONF_BUFFER_SIZE 256
#define UIP_CONF_TCP_MSS 512 //#define UIP_CONF_TCP_MSS 512
//#define UIP_CONF_ND6_SEND_RA 0 error in uip-nd6.c
#if 0 //too much RAM!
/* Handle 10 neighbors */
#define UIP_CONF_DS6_NBR_NBU 10 #define UIP_CONF_DS6_NBR_NBU 10
/* Handle 10 routes */
#define UIP_CONF_DS6_ROUTE_NBU 10 #define UIP_CONF_DS6_ROUTE_NBU 10
#define UIP_CONF_ND6_SEND_RA 0 #define UIP_CONF_ND6_SEND_RA 0
#define UIP_CONF_ND6_REACHABLE_TIME 600000 #define UIP_CONF_ND6_REACHABLE_TIME 600000
#define UIP_CONF_ND6_RETRANS_TIMER 10000 #define UIP_CONF_ND6_RETRANS_TIMER 10000
#undef UIP_CONF_IPV6_QUEUE_PKT
#define UIP_CONF_IPV6_QUEUE_PKT 1
//#define UIP_CONF_IPV6_CHECKS 1
#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_IP_FORWARD 0
#define UIP_CONF_BUFFER_SIZE 240
#define UIP_CONF_ICMP_DEST_UNREACH 1
#define UIP_CONF_DHCP_LIGHT
#undef UIP_CONF_LLH_LEN //#define UIP_CONF_BUFFER_SIZE 1300
#define UIP_CONF_LLH_LEN 0
#define UIP_CONF_ICMP_DEST_UNREACH 1
#define UIP_CONF_DHCP_LIGHT
//#define UIP_CONF_LLH_LEN 0
//#define UIP_CONF_RECEIVE_WINDOW 48 //#define UIP_CONF_RECEIVE_WINDOW 48
//#define UIP_CONF_TCP_MSS 48 //#define UIP_CONF_TCP_MSS 48
#undef UIP_CONF_UDP_CONNS
#define UIP_CONF_UDP_CONNS 12 #define UIP_CONF_UDP_CONNS 12
#undef UIP_CONF_FWCACHE_SIZE #undef UIP_CONF_FWCACHE_SIZE
#define UIP_CONF_FWCACHE_SIZE 30 #define UIP_CONF_FWCACHE_SIZE 30
#define UIP_CONF_BROADCAST 1 #define UIP_CONF_BROADCAST 1
#define UIP_ARCH_IPCHKSUM 1 //#define UIP_ARCH_IPCHKSUM 1
#define UIP_CONF_PINGADDRCONF 0 #define UIP_CONF_PINGADDRCONF 0
#define UIP_CONF_LOGGING 0 #define UIP_CONF_LOGGING 0
#endif
#endif /* UIP_CONF_IPV6_RPL */ #endif /* UIP_CONF_IPV6_RPL */
#endif /* RF230BB */ #endif /* RF230BB */

View file

@ -368,7 +368,10 @@ static void initialize(void) {
//Fix MAC address //Fix MAC address
init_net(); init_net();
#if UIP_CONF_IPV6
memcpy(&uip_lladdr.addr, &tmp_addr.u8, 8); memcpy(&uip_lladdr.addr, &tmp_addr.u8, 8);
#endif
rf230_set_pan_addr( rf230_set_pan_addr(
get_panid_from_eeprom(), get_panid_from_eeprom(),
get_panaddr_from_eeprom(), get_panaddr_from_eeprom(),

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: httpd-simple-avr.c,v 1.3 2010/10/23 15:26:46 dak664 Exp $ * $Id: httpd-simple-avr.c,v 1.4 2010/11/12 20:49:03 dak664 Exp $
*/ */
/** /**
@ -244,8 +244,11 @@ ipaddr_add(const uip_ipaddr_t *addr)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
char TOP[] PROGMEM = "<html><head><title>ContikiRPL(Jackdaw)</title></head><body>\n"; char TOP[] PROGMEM = "<html><head><title>ContikiRPL(Jackdaw)</title></head><body>\n";
char BOTTOM[] PROGMEM = "</body></html>\n"; char BOTTOM[] PROGMEM = "</body></html>\n";
#if UIP_CONF_IPV6
extern uip_ds6_nbr_t uip_ds6_nbr_cache[]; extern uip_ds6_nbr_t uip_ds6_nbr_cache[];
extern uip_ds6_route_t uip_ds6_routing_table[]; extern uip_ds6_route_t uip_ds6_routing_table[];
#endif
static static
PT_THREAD(generate_routes(struct httpd_state *s)) PT_THREAD(generate_routes(struct httpd_state *s))
{ {
@ -256,6 +259,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
blen = 0; blen = 0;
ADD("<h2>Neighbors</h2>"); ADD("<h2>Neighbors</h2>");
#if UIP_CONF_IPV6
for(i = 0; i < UIP_DS6_NBR_NB; i++) { for(i = 0; i < UIP_DS6_NBR_NB; i++) {
if(uip_ds6_nbr_cache[i].isused) { if(uip_ds6_nbr_cache[i].isused) {
ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr); ipaddr_add(&uip_ds6_nbr_cache[i].ipaddr);
@ -266,10 +270,12 @@ PT_THREAD(generate_routes(struct httpd_state *s))
} }
} }
} }
#endif
ADD("<h2>Routes</h2>"); ADD("<h2>Routes</h2>");
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
blen = 0; blen = 0;
#if UIP_CONF_IPV6
for(i = 0; i < UIP_DS6_ROUTE_NB; i++) { for(i = 0; i < UIP_DS6_ROUTE_NB; i++) {
if(uip_ds6_routing_table[i].isused) { if(uip_ds6_routing_table[i].isused) {
ipaddr_add(&uip_ds6_routing_table[i].ipaddr); ipaddr_add(&uip_ds6_routing_table[i].ipaddr);
@ -284,6 +290,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
blen = 0; blen = 0;
} }
} }
#endif
if(blen > 0) { if(blen > 0) {
PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf);
blen = 0; blen = 0;
@ -293,6 +300,7 @@ PT_THREAD(generate_routes(struct httpd_state *s))
PSOCK_END(&s->sout); PSOCK_END(&s->sout);
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
httpd_simple_script_t httpd_simple_script_t
httpd_simple_get_script(const char *name) httpd_simple_get_script(const char *name)

View file

@ -425,8 +425,11 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
mac_translateIPLinkLayer(ll_802154_type); mac_translateIPLinkLayer(ll_802154_type);
#endif #endif
} }
#if UIP_CONF_IPV6 //allow non-ipv6 builds (Hello World)
tcpip_output(destAddrPtr); tcpip_output(destAddrPtr);
#else
tcpip_output();
#endif
#if !RF230BB #if !RF230BB
usb_eth_stat.txok++; usb_eth_stat.txok++;
#endif #endif
@ -664,7 +667,9 @@ int8_t mac_translateIcmpLinkLayer(lltype_t target)
//We broke ICMP checksum, be sure to fix that //We broke ICMP checksum, be sure to fix that
UIP_ICMP_BUF->icmpchksum = 0; UIP_ICMP_BUF->icmpchksum = 0;
#if UIP_CONF_IPV6 //allow non ipv6 builds
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum(); UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
#endif
//Finally set up next run in while loop //Finally set up next run in while loop
len -= 8 * UIP_ICMP_OPTS(icmp_opt_offset)->length; len -= 8 * UIP_ICMP_OPTS(icmp_opt_offset)->length;