*** empty log message ***

This commit is contained in:
dak664 2009-07-23 16:13:48 +00:00
parent 7af93463b5
commit c1b7375a5a
14 changed files with 190 additions and 93 deletions

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: cfs-eeprom.c,v 1.10 2009/02/27 14:50:35 nvt-se Exp $
* $Id: cfs-eeprom.c,v 1.11 2009/07/23 16:13:48 dak664 Exp $
*/
#include "cfs/cfs.h"
@ -97,7 +97,7 @@ int
cfs_write(int f, const void *buf, unsigned int len)
{
if(f == 1) {
eeprom_write(CFS_EEPROM_OFFSET + file.fileptr, buf, len);
eeprom_write(CFS_EEPROM_OFFSET + file.fileptr, (unsigned char *)buf, len);
file.fileptr += len;
return len;
} else {

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: psock.c,v 1.8 2009/04/28 13:52:04 adamdunkels Exp $
* $Id: psock.c,v 1.9 2009/07/23 16:13:48 dak664 Exp $
*/
#include <stdio.h>
@ -225,6 +225,7 @@ PT_THREAD(psock_generator_send(CC_REGISTER_ARG struct psock *s,
s->state = STATE_DATA_SENT;
/* Wait until all data is sent and acknowledged. */
// if (!s->sendlen) break; //useful debugging aid
PT_YIELD_UNTIL(&s->psockpt, uip_acked() || uip_rexmit());
} while(!uip_acked());

View file

@ -1,4 +1,4 @@
# $Id: Makefile.avr,v 1.14 2009/07/08 15:26:17 dak664 Exp $
# $Id: Makefile.avr,v 1.15 2009/07/23 16:13:48 dak664 Exp $
### Check if we are running under Windows
@ -12,19 +12,102 @@ endif
.SUFFIXES:
### Optimization setting, OPTI=0 for easier debugging!
OPTI=s
### Optimization setting. $make OPTI=0 for easier debugging of changed source file(s)
ifndef OPTI
OPTI=s
endif
### Define the CPU directory
### Define the CPU directory of the AVR port
CONTIKI_CPU=$(CONTIKI)/cpu/avr
### Define the source files we have in the AVR port
AVR = leds-arch.c leds.c clock.c random.c
### These directories will be searched for the specified source files
### TARGETLIBS are platform-specific routines in the contiki library path
CONTIKI_CPU_DIRS = . dev
AVR = clock.c mtarch.c eeprom.c flash.c rs232.c leds-arch.c
ELFLOADER = elfloader.c elfloader-avr.c symtab-avr.c
TARGETLIBS = clock.c flash.c mtarch.c
TARGETLIBS = random.c leds.c
CONTIKI_TARGET_SOURCEFILES += ${AVR} $(SENSORS) \
ifdef USB
### Add the directories for the USB stick and remove the default rs232 driver
override RF230BB = 0
CONTIKI_CPU_DIRS += dev/usb dev/usb/serial dev/usb/rndis dev/usb/storage
CONTIKI_TARGET_SOURCEFILES += $(USB)
AVR = clock.c mtarch.c eeprom.c flash.c leds-arch.c
endif
### The RF230 "bare bones" driver uses the core MAC layer.
### It does NOT work with the Jackdaw USB stick.
### Define RF230BB in the base makefile, or use $make RF230BB=1 ...
ifeq ($(RF230BB),1)
#ifdef RF230BB
CFLAGS += -DRF230BB
#Source for AT86RF230 barebones driver using the contiki core MAC
include $(CONTIKI)/cpu/avr/radio/rf230/Makefile.rf230
else
# Source for AT86RF230
include $(CONTIKI)/cpu/avr/radio/rf230/Makefile.rf230
#Source for Atmel/Cisco 802.15.4'ish MAC
include $(CONTIKI)/cpu/avr/radio/mac/Makefile.mac
#Source for IEEE 802.15.4 manager interface
include $(CONTIKI)/cpu/avr/radio/ieee-manager/Makefile.ieee-manager
endif
#For a coffee file system, the application makefile can define COFFEE_FILES=n
#to select the type and COFFEE_ADDRESS=0xaaaaaaaa as the starting byte address.
#If only one is define the other will use the (Raven webserver 1284p) defaults
#of a static file system in program flash starting at 0x10000 (word address=0x8000)
#For program flash the starting address is rounded down to a page boundary in cfs-coffee-arch.h
#It should be rounded down here too if someone can figure out how :)
ifdef COFFEE_ADDRESS #if address is passed force definition of COFFEE_FILES
ifndef COFFEE_FILES #use program flash for static file system if not specified
COFFEE_FILES=3
endif
endif
ifdef COFFEE_FILES #if files are defined force definition of COFFEE_ADDRESS
ifndef COFFEE_ADDRESS
ifeq ($(COFFEE_FILES), 1) #1=eeprom static
COFFEE_ADDRESS=DEFAULT
else ifeq ($(COFFEE_FILES), 2) #2=eeprom dynamic
COFFEE_ADDRESS=DEFAULT
else ifeq ($(COFFEE_FILES), 3) #3=program flash static
COFFEE_ADDRESS=0x14000
else ifeq ($(COFFEE_FILES), 4) #4=program flash dynamic
COFFEE_ADDRESS=0x10000
else
print "Unsupported coffee file type!"
endif
endif
COFFEE_ADDRESS1 = $(shell echo $$(( $(COFFEE_ADDRESS) + 1 )))
CONTIKI_TARGET_SOURCEFILES += cfs-coffee.c cfs-coffee-arch.c watchdog.c
CFLAGS += -DCOFFEE_FILES=$(COFFEE_FILES) -DCOFFEE_ADDRESS=$(COFFEE_ADDRESS)
ifneq ($(COFFEE_ADDRESS), DEFAULT)
LDFLAGS+= -Wl,--section-start=.coffeefiles=$(COFFEE_ADDRESS)
endif
#If $make invokation passed starting address use phony target to force synchronization of source to .coffeefiles section
#Warning: recompilation will not be forced if the starting address is then dropped, with dire consequences:
# -->Source that uses COFFEE_FILES and read macros for conditional compilation will be left hanging!
# -->Object modules that used .coffeesection will overlap the .data section.
# -->$make clean is safest.
#ifeq ($(origin COFFEE_ADDRESS), command line)
# ifeq ($(COFFEE_FILES), 2) #safest to force recompilation even if eeprom address is changed, might have been switched from flash
.PHONY : coffee
coffee:
$(OBJECTDIR)/cfs-coffee-arch.o : coffee #cfs-coffee-arch uses COFFEE_FILES, COFFEE_ADDRESS
$(OBJECTDIR)/contiki-raven-main.o : coffee #Raven Webserver uses COFFEE_FILES
$(OBJECTDIR)/httpd-fs.o : coffee #this file contains httpd-fsdata.c which has the .coffeesection data
$(OBJECTDIR)/httpd.c.o : coffee #uses defines to read from file system
$(OBJECTDIR)/httpd-cgi.o : coffee #uses defines to read from file system
$(OBJECTDIR)/cfs-coffee.o : coffee #core routine requires recompilation
#endif
#endif
endif
CONTIKI_TARGET_SOURCEFILES += $(AVR) $(SENSORS) \
$(SYSAPPS) $(ELFLOADER) \
$(TARGETLIBS)
@ -38,40 +121,23 @@ AS = avr-as
AR = avr-ar
OBJCOPY = avr-objcopy
STRIP = avr-strip
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \
CFLAGSNO = -Wall -mmcu=$(MCU) -gdwarf-2 \
-I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \
-I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \
-Wall -mmcu=$(MCU) -gdwarf-2 $(CONTIKI_PLAT_DEFS)
$(CONTIKI_PLAT_DEFS)
CFLAGS += $(CFLAGSNO) -O$(OPTI)
BOOTLOADER_START = 0x1FC00
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \
-Wl,--section-start=.bootloader=$(BOOTLOADER_START)
ifndef BOOTLOADER_START
BOOTLOADER_START = 0x1FC00
endif
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \
-Wl,--section-start=.bootloader=$(BOOTLOADER_START)
### Setup directory search path for source files
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)}
ifdef RF230BB
### The RF230 "bare bones" driver uses the core MAC layer.
### It does NOT work with the Jackdaw USB stick.
### Define RF230BB in the base makefile, or use $make RF230BB=1 ...
### Note $make clean and $make clean RF230BB=1 use different directory paths!
CFLAGS +=-DRF230BB
vpath %.c $(PROJECTDIRS) $(CONTIKI)/cpu/avr/dev \
$(CONTIKI_CPU) $(CONTIKI)/cpu/avr/radio/rf230bb \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT)
else
vpath %.c $(PROJECTDIRS) $(CONTIKI)/cpu/avr/dev $(CONTIKI)/cpu/avr/dev/usb \
$(CONTIKI)/cpu/avr/dev/usb/rndis $(CONTIKI)/cpu/avr/dev/usb/serial \
$(CONTIKI)/cpu/avr/dev/usb/storage \
$(CONTIKI_CPU) $(CONTIKI)/cpu/avr/radio/rf230 $(CONTIKI)/cpu/avr/radio/mac \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT)
endif
### Compilation rules
$(OBJECTDIR)/%.o: %.c

View file

@ -1,5 +1,2 @@
CONTIKI_CPU_DIRS += radio/ieee-manager
CONTIKI_TARGET_SOURCEFILES += ieee-15-4-manager.c
APPDIRS += $(CONTIKI)/cpu/avr/radio/ieee-manager

View file

@ -1,4 +1,3 @@
CONTIKI_CPU_DIRS += radio/mac
CONTIKI_TARGET_SOURCEFILES += mac.c sicslowmac.c
APPDIRS += $(CONTIKI)/cpu/avr/radio/mac

View file

@ -1,6 +1,2 @@
CONTIKI_CPU_DIRS += radio/rf230
CONTIKI_TARGET_SOURCEFILES += radio.c hal.c frame.c
# timer.c
APPDIRS += $(CONTIKI)/cpu/avr/radio/rf230

View file

@ -1,6 +1,2 @@
CONTIKI_CPU_DIRS += radio/rf230bb
CONTIKI_TARGET_SOURCEFILES += rf230bb.c halbb.c
# timer.c
APPDIRS += $(CONTIKI)/cpu/avr/radio/rf230bb

View file

@ -1,6 +1,6 @@
all:
make TARGET=avr-ravenusb -f Makefile.ravenusbstick ravenusbstick.elf
avr-objcopy -O ihex -R .eeprom -R .fuse ravenusbstick.elf ravenusbstick.hex
avr-objcopy -O ihex -R .signature -R .fuse -R .eeprom ravenusbstick.elf ravenusbstick.hex
avr-size -C --mcu=at90usb1287 ravenusbstick.elf
clean:

View file

@ -1,9 +1,18 @@
all:
ifndef WEBDIR
OUTFILE=webserver6
else
OUTFILE=webserver6-$(WEBDIR)
endif
all:
make -f Makefile.webserver TARGET=avr-raven webserver6.elf
avr-objcopy -O ihex -R .eeprom -R .fuse -R .signature webserver6.elf webserver6.hex
avr-size -C --mcu=atmega1284p webserver6.elf
#can't just rename, webserver6 may be open in debugger
@if [ $(OUTFILE) != "webserver6" ]; then cp webserver6.elf $(OUTFILE).elf;fi
avr-objcopy -O ihex -R .eeprom -R .fuse -R .signature $(OUTFILE).elf $(OUTFILE).hex
avr-size -C --mcu=atmega1284p $(OUTFILE).elf
clean:
make -f Makefile.webserver TARGET=avr-raven clean
rm ../../platform/avr-raven/apps/raven-webserver/httpd-fsdata.c
rm symbols.c symbols.h webserver6.elf webserver6.hex
rm -rf obj_avr-raven

View file

@ -4,7 +4,10 @@ all: webserver6
APPS=raven-webserver raven-lcd-interface
TARGET=avr-raven
UIP_CONF_IPV6=1
#RF230BB=1 //Use radio driver that communicates with the core MAC layer. Still Experimental!
#RF230BB=1 //Use radio driver that communicates with the core MAC layer. Still Experimental!
#COFFEE_FILES=1 //Use coffee file system in EEPROM
#COFFEE_FILES=2 //Use coffee file system in program flash
#COFFEE_ADDRESS=0xnnnn //Override default coffee file system starting address
CONTIKI = ../..

View file

@ -1,19 +1,9 @@
# The barebones radio driver uses the contiki core MAC layer instead
# of the original glue. Define it here or invoke with $make RF230BB=1.
# If the latter, $make clean RF230BB=1 is needed to clean the same directory path.
##RF230BB=1
ifdef RF230BB
CONTIKI_TARGET_DIRS = . rf230bb apps net loader
else
CONTIKI_TARGET_DIRS = . rf230 apps net loader
endif
CONTIKI_TARGET_DIRS = . apps net loader
CONTIKI_CORE=contiki-raven-main
CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o
CONTIKI_TARGET_SOURCEFILES += rs232.c cfs-eeprom.c eeprom.c random.c \
mmem.c contiki-raven-main.c contiki-raven-default-init-net.c
CONTIKI_TARGET_SOURCEFILES += contiki-raven-main.c contiki-raven-default-init-net.c
CONTIKIAVR=$(CONTIKI)/cpu/avr
CONTIKIBOARD=.
@ -37,17 +27,3 @@ AVRDUDE_OPTIONS=-V
include $(CONTIKIAVR)/Makefile.avr
ifdef RF230BB
# Source for AT86RF230 barebones driver using the contiki core MAC
include $(CONTIKI)/cpu/avr/radio/rf230bb/Makefile.rf230bb
else
# Source for AT86RF230
include $(CONTIKI)/cpu/avr/radio/rf230/Makefile.rf230
#Source for Atmel/Cisco 802.15.4'ish MAC
include $(CONTIKI)/cpu/avr/radio/mac/Makefile.mac
#Source for IEEE 802.15.4 manager interface
include $(CONTIKI)/cpu/avr/radio/ieee-manager/Makefile.ieee-manager
endif

View file

@ -1,6 +1,52 @@
raven-webserver_src = webserver-nogui.c httpd.c http-strings.c psock.c memb.c \
httpd-fs.c httpd-cgi.c
httpd-fs.c httpd-cgi.c
raven-webserver_dsc = webserver-dsc.c
#$(CONTIKI)/apps/webserver/http-strings.c: $(CONTIKI)/apps/webserver/http-strings
# cd $(CONTIKI)/apps/webserver/; $(CONTIKI)/tools/makestrings $<
#
#The default is fixed web content packed in program flash memory. Note the existing httpd-fs read
#code will only work for content in the first 64KB of program flash as the linked list addresses are
#only 16 bit and reads use pgm_read_byte_near.
#For COFFEE_FILES=1 Fixed web content in eeprom memory. Existing files can be rewritten but not extended
#For COFFEE_FILES=2 Initial web content in eeprom memory in a fully writeable coffee file system.
#For COFFEE_FILES=3 Fixed web content in program flash memory. Existing files can be rewritten but not extended
#For COFFEE_FILES=4 Initial webcontent in program flash memory in a fully writeable coffee file system.
#The default web content is in the /httpd-fs directory. Override with $make WEBDIR=another_directory
#If WEBDIR is then dropped from the command line the web content will NOT revert to the default unless
#unless one of the files in the default directory is changed. This means a .coffeesection may still
#be defined when COFFEE_FILES is dropped from the make, and a section overlap will occur during the link.
.PHONY : force
ifdef WEBDIR
FORCE=force
else
WEBDIR=$(CONTIKI)/platform/avr-raven/apps/raven-webserver/httpd-fs
endif
WEBCSOURCE=$(CONTIKI)/platform/avr-raven/apps/raven-webserver/
ifdef COFFEE_ADDRESS #for now force whenever present, could test for arg passed in make
FORCE=force
endif
$(WEBCSOURCE)httpd-fs.c: $(WEBCSOURCE)httpd-fsdata.c
$(WEBCSOURCE)httpd-fsdata.c : $(FORCE) $(WEBDIR)/*.*
ifeq ($(COFFEE_FILES), 1) #1=eeprom static
@echo Generating web content for static eeprom coffee file system
$(CONTIKI)/tools/makefsdata -C -A EEPROM -l -f 16 -d $(WEBDIR) -o $(WEBCSOURCE)httpd-fsdata.c
else ifeq ($(COFFEE_FILES), 2) #2=eeprom dynamic
@echo Generating web content for full eeprom coffee file system
$(CONTIKI)/tools/makefsdata -C -A EEPROM -f 20 -d $(WEBDIR) -o $(WEBCSOURCE)httpd-fsdata.c
else ifeq ($(COFFEE_FILES), 3) #3=program flash static
@echo Generating web content for static flash coffee file system
$(CONTIKI)/tools/makefsdata -C -A PROGMEM -l -f 16 -d $(WEBDIR) -o $(WEBCSOURCE)httpd-fsdata.c
else ifeq ($(COFFEE_FILES), 4) #4=program flash dynamic
@echo Generating initial web content for full flash coffee file system
$(CONTIKI)/tools/makefsdata -C -A PROGMEM -c -f 20 -d $(WEBDIR) -o $(WEBCSOURCE)httpd-fsdata.c
else
@echo Generating static web content
$(CONTIKI)/tools/makefsdata -A PROGMEM -l -d $(WEBDIR) -o $(WEBCSOURCE)httpd-fsdata.c
endif

View file

@ -1,4 +1,4 @@
CONTIKI_TARGET_DIRS = . rf230 apps net loader
CONTIKI_TARGET_DIRS = . apps net loader dev/usb dev/serial
CONTIKI_CORE=contiki-raven-main
CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.o
@ -51,11 +51,11 @@ AVRDUDE_OPTIONS=-V
include $(CONTIKIAVR)/Makefile.avr
# Source for AT86RF230
include $(CONTIKI)/cpu/avr/radio/rf230/Makefile.rf230
#include $(CONTIKI)/cpu/avr/radio/rf230/Makefile.rf230
# Source for Atmel/Cisco 802.15.4'ish MAC
include $(CONTIKI)/cpu/avr/radio/mac/Makefile.mac
#include $(CONTIKI)/cpu/avr/radio/mac/Makefile.mac
# Source for IEEE 802.15.4 manager interface
include $(CONTIKI)/cpu/avr/radio/ieee-manager/Makefile.ieee-manager
#include $(CONTIKI)/cpu/avr/radio/ieee-manager/Makefile.ieee-manager

View file

@ -158,8 +158,12 @@
#include <stdio.h>
#include <string.h>
//#define PRINTF printf
#define DEBUG 0
#if DEBUG
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
#else
#define PRINTF(...)
#endif
#define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN])
#define ETHBUF(x) ((struct uip_eth_hdr *)x)
@ -292,8 +296,12 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
//Some IP packets have link layer in them, need to change them around!
if (usbstick_mode.translate) {
#if DEBUG
uint8_t transReturn = mac_translateIPLinkLayer(ll_802154_type);
PRINTF("IPTranslation: returns %d\n", transReturn);
#else
mac_translateIPLinkLayer(ll_802154_type);
#endif
}
if (usbstick_mode.sendToRf){
@ -547,7 +555,6 @@ int8_t mac_translateIcmpLinkLayer(lltype_t target)
uint8_t mac_createSicslowpanLongAddr(uint8_t * ethernet, uip_lladdr_t * lowpan)
{
uint8_t index;
uint8_t i;
#if UIP_LLADDR_LEN == 8
//Special case - if the address is our address, we just copy over what we know to be
@ -592,7 +599,7 @@ uint8_t mac_createSicslowpanLongAddr(uint8_t * ethernet, uip_lladdr_t * lowpan)
lowpan->addr[7] = ethernet[5];
#else
uint8_t i;
for(i = 0; i < UIP_LLADDR_LEN; i++) {
lowpan->addr[i] = ethernet[i];
}
@ -610,7 +617,8 @@ uint8_t mac_createSicslowpanLongAddr(uint8_t * ethernet, uip_lladdr_t * lowpan)
uint8_t mac_createEthernetAddr(uint8_t * ethernet, uip_lladdr_t * lowpan)
{
uint8_t index = 0;
uint8_t i,j, match;
uint8_t i;
//uint8_t i,j, match;
#if UIP_LLADDR_LEN == 8