Move example to the top-level dir (rpl-border-router) and tidy-up webserver configuration

Previously, we were using the example's Makefile to configure whether we want a web server built into the BR. We had 3 options:

* No web server
* Internal web server
* External web server (from apps/)

The last option is no longer evailable. This commit removes support for this option and it also simplifies the situation: We now merely use a CPP macro to enable/disable the web server.
This commit is contained in:
George Oikonomou 2017-10-28 23:48:46 +01:00
parent a3c185132a
commit dd1f06fb01
12 changed files with 37 additions and 60 deletions

View File

@ -71,7 +71,7 @@ TMOTES HOWTO
2. Press reset button, get address, abort with Ctrl+C:
Line: "Tentative link-local IPv6 address fe80:0000:0000:0000:____:____:____:____"
cd ../ipv6/rpl-border-router/
cd ../rpl-border-router/
make TARGET=sky border-router.upload MOTE=1
make connect-router

View File

@ -25,9 +25,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>rplroot</identifier>
<description>Sky RPL Root</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.c</source>
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-border-router/border-router.c</source>
<commands EXPORT="discard">make border-router.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.sky</firmware>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-border-router/border-router.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -25,9 +25,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>rplroot</identifier>
<description>Sky RPL Root</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.c</source>
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-border-router/border-router.c</source>
<commands EXPORT="discard">make border-router.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.sky</firmware>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-border-router/border-router.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -25,9 +25,9 @@
org.contikios.cooja.mspmote.SkyMoteType
<identifier>rplroot</identifier>
<description>Sky RPL Root</description>
<source EXPORT="discard">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.c</source>
<source EXPORT="discard">[CONTIKI_DIR]/examples/rpl-border-router/border-router.c</source>
<commands EXPORT="discard">make border-router.sky TARGET=sky</commands>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/ipv6/rpl-border-router/border-router.sky</firmware>
<firmware EXPORT="copy">[CONTIKI_DIR]/examples/rpl-border-router/border-router.sky</firmware>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>

View File

@ -1,39 +0,0 @@
CONTIKI_PROJECT=border-router
all: $(CONTIKI_PROJECT)
CONTIKI=../../..
PROJECT_SOURCEFILES += slip-bridge.c
#Simple built-in webserver is the default.
#Override with make WITH_WEBSERVER=0 for no webserver.
#WITH_WEBSERVER=module-path will use the module if it can be found
#make clean before changing webservers!
#Note /apps/webserver contains a 2500 byte style sheet which is a severe test
#of the slip connection. Large MSS together with low baud rates without flow
#control will overrun the transmit buffer when the style sheet is requested.
WITH_WEBSERVER=1
ifeq ($(WITH_WEBSERVER),1)
CFLAGS += -DWEBSERVER=1
PROJECT_SOURCEFILES += httpd-simple.c
else ifneq ($(WITH_WEBSERVER), 0)
MODULES += $(WITH_WEBSERVER)
CFLAGS += -DWEBSERVER=2
endif
ifeq ($(PREFIX),)
PREFIX = fd00::1/64
endif
include $(CONTIKI)/Makefile.include
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
(cd $(CONTIKI)/tools && $(MAKE) tunslip6)
connect-router: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 $(PREFIX)
connect-router-cooja: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 $(PREFIX)

View File

@ -0,0 +1,21 @@
CONTIKI_PROJECT=border-router
all: $(CONTIKI_PROJECT)
CONTIKI=../..
PROJECT_SOURCEFILES += slip-bridge.c httpd-simple.c
ifeq ($(PREFIX),)
PREFIX = fd00::1/64
endif
include $(CONTIKI)/Makefile.include
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
(cd $(CONTIKI)/tools && $(MAKE) tunslip6)
connect-router: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 $(PREFIX)
connect-router-cooja: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 $(PREFIX)

View File

@ -65,14 +65,7 @@ static uint8_t prefix_set;
PROCESS(border_router_process, "Border router process");
#if WEBSERVER==0
/* No webserver */
AUTOSTART_PROCESSES(&border_router_process);
#elif WEBSERVER>1
/* Use an external webserver application */
#include "webserver-nogui.h"
AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process);
#else
#if BORDER_ROUTER_CONF_WEBSERVER
/* Use simple webserver with only one page for minimum footprint.
* Multiple connections can result in interleaved tcp segments since
* a single static buffer is used for all segments.
@ -346,12 +339,12 @@ PT_THREAD(generate_routes(struct httpd_state *s))
httpd_simple_script_t
httpd_simple_get_script(const char *name)
{
return generate_routes;
}
#endif /* WEBSERVER */
#else /* BORDER_ROUTER_CONF_WEBSERVER */
/* No webserver */
AUTOSTART_PROCESSES(&border_router_process);
#endif /* BORDER_ROUTER_CONF_WEBSERVER */
/*---------------------------------------------------------------------------*/
static void
print_local_addresses(void)

View File

@ -39,7 +39,9 @@
#define WEBSERVER_CONF_CFS_CONNS 2
#endif
#if WEBSERVER
#define BORDER_ROUTER_CONF_WEBSERVER 1
#if BORDER_ROUTER_CONF_WEBSERVER
#define UIP_CONF_TCP 1
#endif

View File

@ -12,7 +12,7 @@ platform-specific/cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=launchpad/cc1310 \
platform-specific/cc26xx/cc26xx-web-demo/srf06-cc26xx:BOARD=launchpad/cc1350 \
platform-specific/cc26xx/very-sleepy-demo/srf06-cc26xx \
hello-world/cc2538dk \
ipv6/rpl-border-router/cc2538dk \
rpl-border-router/cc2538dk \
ipv6/rpl-udp/cc2538dk \
coap-example/cc2538dk \
ipso-objects/cc2538dk \