* removed legacy projects folder and Jamfiles

dev/timer
Oleg Hahm 10 years ago
parent b834831818
commit d31ee82518

@ -1,74 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP ;
#
# Target directory: bin directory located in BUILD_ROOT
#
TARGET_DIR ?= [ FPath $(BUILD_ROOT) bin $(BOARD) $(PROJECT) ] ;
LOCATE_TARGET = $(TARGET_DIR) ;
ALL_LOCATE_TARGET = $(TARGET_DIR) ;
echo "Building project '$(PROJECT)' for '$(BOARD)' board." ;
#
# Buil utility targets
#
Help ? ; # display usage from manual
Help help ;
Help usage ;
Help targets ;
Cleanall cleanall ; # clean all binaries
#
# Main target
#
Main $(TARGET) ;
Depends all : $(TARGET:S=.hex) ; # always build a hex-file
LOCATE on $(TARGET) = bin ;
LOCATE on $(TARGET:S=.hex) = bin ;
#
# Utility targets
#
Doc doc ; # build the documentation
Flash flash : $(TARGET:S=.hex) ;
Reset reset ;
Terminal term ;
Test test : all ;
Debug debug : $(TARGET) ;
ListModules listmodules ;
ShowFlags showflags : $(TARGET) ;
SubInclude TOP sys ;
SubInclude TOP core ;
SubInclude TOP drivers ;
SubInclude TOP board ;
SubInclude TOP projects $(PROJECT) ;

@ -1,77 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
#
# Include build system functionality
#
include $(TOP)$(SLASH)Jamrules.common ;
#
# Setup ukleos build system configuration (default values for common options)
#
PROJECT = $(PROJECT:E=default) ;
BOARD = $(BOARD:E=msba2) ;
SUFFIX ?= "" ; # must be at least "" !!!
TARGET = "$(BOARD)-$(PROJECT)$(SUFFIX)$(SUFEXE)" ; # main target binary
OPENOCD_IF ?= olimex-jtag-tiny-a ;
TERMINAL ?= tools/pyterm/pyterm.py ;
if $(NT) || $(OS) = CYGWIN {
PORT = $(PORT:E=1) ;
} else {
PORT = $(PORT:E=/dev/ttyUSB0) ;
}
CCFLAGS += -DBOARD=BOARD_$(BOARD:U) ;
#CCFLAGS += -finstrument-functions -finstrument-functions-exclude-file-list=trace ;
#
# core source directories
HDRS += $(TOP) ;
HDRS += [ FPath $(TOP) core include ] ;
HDRS += [ FPath $(TOP) sys include ] [ FPath $(TOP) sys config ] [ FPath $(TOP) sys drivers include ] [ FPath $(TOP) sys drivers cc110x ] [ FPath $(TOP) sys drivers nanopan5375 ] ;
HDRS += [ FPath $(TOP) sys net ] ;
HDRS += [ FPath $(TOP) sys lib ] [ FPath $(TOP) sys lib fat include ] ;
HDRS += [ FPath $(TOP) sys lib gps ] [ FPath $(TOP) sys lib gps drivers ] [ FPath $(TOP) sys lib gps geo ] ;
HDRS += [ FPath $(TOP) sys net phy ] [ FPath $(TOP) sys net mm ] ;
# Include board files
include [ FPath $(TOP) board $(BOARD) Jamrules.$(BOARD) ] ;
# Include cpu files
include [ FPath $(TOP) cpu $(CPU) Jamrules.$(CPU) ] ;
#
# standard target source directories
HDRS += [ FPath $(TOP) board $(BOARD) include ] ;
HDRS += [ FPath $(TOP) cpu $(CPU) include ] ;
HDRS += [ FPath $(TOP) projects $(PROJECT) ] ;
# drivers
HDRS += [ FPath $(TOP) drivers include ] ;
HDRS += [ FPath $(TOP) drivers cc110x ] ;
HDRS += [ FPath $(TOP) drivers cc110x_ng include ] ;

@ -1,360 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
#
# OS specifics
#
if $(NT) {
SLASH = \\ ;
POSIXSHELL = sh ;
NULLDEV = NUL ;
CAT = type ;
NOARSCAN = true ;
# redefine build rules for gcc on NT
SUFOBJ = .o ;
SUFLIB = .a ;
actions As
{
$(AS) $(ASFLAGS) $(ASHDRS) -o $(<) $(>)
}
actions Cc
{
$(CC) -c -o $(<) $(CCFLAGS) -D$(MODULE_DEFINES) $(CCDEFS) $(CCHDRS) $(>)
}
rule FDefines { return -D$(<) ; }
rule FIncludes { return -I$(<) ; }
} else {
NULLDEV = /dev/null ;
CAT = cat ;
RM = rm -rf ;
# use english language output for gcc
actions Cc
{
LANG=C $(CC) -c -o $(<) $(CCFLAGS) -D$(MODULE_DEFINES) $(CCDEFS) $(CCHDRS) $(>)
}
switch $(OS) {
case CYGWIN :
# archive scanning does not work on cygwin, so leave object files
NOARSCAN = true ;
}
}
#
# Plausbility checks and defaults
#
SUFEXE = .elf ;
#
# Rules and Actions
#
#
# Concatenates path-segments into a OS specific path string
# Usage: PATH = [ FPath path-segments ] ;
rule FPath
{
return $(<:J=$(SLASH)) ;
}
#
# Generate object archive
actions updated together piecemeal Archive
{
$(AR) $(ARFLAGS) $(<) $(>)
}
#
# Link target
rule Link
{
# add map file
Clean clean : $(<:S=.map) ;
# generation of hex file
Hexfile $(<:S=.hex) : $(<) ;
}
actions Link bind NEEDLIBS
{
echo "Old firmware size:"
$(TOOLCHAIN)size $(<) 2> $(NULLDEV) || echo " No old binary for size comparison..."
$(LINK) $(LINKFLAGS) -o $(<) $(UNDEFS) $(>) -Wl,--start-group $(NEEDLIBS) $(LINKLIBS) -lm -Wl,--end-group -Wl,-Map=$(<:S=.map) || $(RM) -f $(<) $(<:S=.map) $(<:S=.hex)
echo "New firmware size:"
$(TOOLCHAIN)size $(<)
}
#
# Clean binaries
actions piecemeal together existing Clean
{
# remove all jam targets
$(RM) $(>)
}
#
# Clean binaries regardless of project and board
rule Cleanall { }
actions Cleanall
{
echo "> Cleaning binaries"
$(RM) bin$(SLASH)*
# make -C $(TOP)$(SLASH)doc clean
}
#
# Display usage text from manual
rule Help { }
actions Help
{
$(CAT) $(TOP)$(SLASH)doc$(SLASH)src$(SLASH)manual$(SLASH)examples$(SLASH)jam-usage.txt
}
#
# Compile documentation
rule Doc { }
actions Doc
{
make -C $(TOP)$(SLASH)doc all
}
#
# Generate hex-file from binary
rule Hexfile
{
MakeLocate $(<) : $(LOCATE_TARGET) ;
Depends $(<) : $(>) ;
SEARCH on $(>) = $(LOCATE_TARGET) ;
Clean clean : $(<) ;
}
actions Hexfile
{
$(OBJCOPY) -O ihex $(>) $(<)
}
#
# Program binary to target device
rule Flash
{
Depends $(<) : $(>) ;
}
actions Flash
{
$(FLASHER) $(FLASHFLAGS) $(>)
}
#
# Run all tests for active project
rule Test
{
Depends $(<) : $(>) ;
}
actions Test
{
export PORT=$(PORT); for tst in projects/$(PROJECT)/tests/*; do $tst; done
}
# Reset connected sensor node
actions Reset
{
$(RESET) > /dev/null 2>&1
}
# run a terminal
#
actions Terminal
{
$(TERMINAL) $(TERMOPTS) $(PORT)
}
#
# Run debug server
rule Debug
{
Depends $(<) : $(>) ;
}
actions Debug
{
$(GDB) $(GDBFLAGS) $(>)
}
#
# Rules for convenient module building & dependency tracking
rule Module
{
local _m = $(<:S=$(SUFLIB)) ;
# echo Module Name: $(<) Files: $(>) Dependencies: $(3) ;
DEFINED_MODULES += $(_m) ;
ModuleFromObjects $(<) : $(>:S=$(SUFOBJ)) ;
ObjectsNoDep $(>) ;
ModuleDepends $(_m) : $(3) ;
if $(_m) in $(USE_MODULES) {
UseModule $(_m) ;
}
}
# Add a pre-built library as module
# Syntax: BinModule <Module Name = $(<)> ;
rule BinModule
{
local _m = $(<:S=$(SUFLIB)) ;
DEFINED_MODULES += $(_m) ;
BINARY_MODULES += $(_m) ;
ModuleDepends $(_m) : $(3) ;
if $(_m) in $(USE_MODULES) {
UseModule $(_m) ;
}
}
rule ModuleDepends
{
local _m = $(<:S=$(SUFLIB)) ;
local _d = $(>:S=$(SUFLIB)) ;
# for DEP in $(_d) {
Depends $(_m) : $(_d) ;
DEPENDS.$(_m) += $(_d) ;
# }
}
rule UseModule
{
local _m = $(<:S=$(SUFLIB)) ;
if $(_m) in $(BINARY_MODULES) {
local _l _s ;
_l = $(<:S=$(SUFLIB)) ; # name of the library file
_s = [ FGristFiles $(_l) ] ; # source
MakeLocate $(_l) : $(LOCATE_TARGET) ; # locate to bin directory
File $(TARGET_DIR)/$(_l) : $(_s) ;
}
# echo UseModule $(<) ;
if ! $(_m) in $(DEFINED_MODULES) {
# echo Module not defined yet. ;
USE_MODULES += $(_m) ;
} else {
LinkLibraries $(TARGET) : $(<) ;
local _mdefine = MODULE_$(_m:S=:U) ;
if ! $(_mdefine) in $(MODULE_DEFINES) {
MODULE_DEFINES += $(_mdefine) ;
}
# echo Dependencies of $(_m): $(DEPENDS.$(_m)) ;
for DEP in $(DEPENDS.$(_m)) {
UseModule $(DEP) ;
}
}
}
# (slightly modified version of LibraryFromObjects)
rule ModuleFromObjects
{
local _i _l _s ;
# Add grist to file names
_s = [ FGristFiles $(>) ] ;
_l = $(<:S=$(SUFLIB)) ;
# Set LOCATE for the library and its contents. The bound
# value shows up as $(NEEDLIBS) on the Link actions.
# For compatibility, we only do this if the library doesn't
# already have a path.
if ! $(_l:D)
{
MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_TARGET) ;
}
if $(NOARSCAN)
{
# If we can't scan the library to timestamp its contents,
# we have to just make the library depend directly on the
# on-disk object files.
Depends $(_l) : $(_s) ;
}
else
{
# If we can scan the library, we make the library depend
# on its members and each member depend on the on-disk
# object file.
Depends $(_l) : $(_l)($(_s:BS)) ;
for _i in $(_s)
{
Depends $(_l)($(_i:BS)) : $(_i) ;
}
}
Clean clean : $(_l) ;
if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; }
Archive $(_l) : $(_s) ;
if $(RANLIB) { Ranlib $(_l) ; }
# If we can't scan the library, we have to leave the .o's around.
if ! ( $(NOARSCAN) || $(NOARUPDATE) ) { RmTemps $(_l) : $(_s) ; }
}
#
# Like Objects, but doesn't set dependencies on obj pѕeudotarget.
rule ObjectsNoDep
{
local _i ;
for _i in [ FGristFiles $(<) ]
{
Object $(_i:S=$(SUFOBJ)) : $(_i) ;
}
}
actions ListModules {
echo $(MODULE_DEFINES) | tr ' ' '\n' | sort
}
actions ShowFlags {
echo "CCFLAGS: "
echo $(CCFLAGS) $(CCDEFS) -D$(MODULE_DEFINES) | tr ' ' '\n ' | sort
echo "" | $(CC) -E -dD -
}

@ -1,37 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP core ;
Module core : kernel_init.c sched.c mutex.c msg.c thread.c : core_lib ;
Module core_lib : queue.c clist.c bitarithm.c cib.c lifo.c ;
Module hwtimer : hwtimer.c : hwtimer_cpu ;
Module oneway_malloc : oneway_malloc.c ;
UseModule core ;

@ -1,30 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP cpu ;
# cpu subdirs are included from board specific jamfiles

@ -1,45 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP cpu arm_common ;
Module arm_common : common.s bootloader.c VIC.c atomic.s arm_cpu.c iap.c ;
UseModule arm_common ;
Module profiling : profiling.c ;
if $(PROFILING) {
UseModule profiling ;
}
Module hwtimer_cpu : hwtimer_cpu.c ;
Objects syscalls.c ;
DEPENDS $(TARGET) : <cpu!$(CPU)>startup.o ;
DEPENDS $(TARGET) : <cpu!arm_common>syscalls.o ;
LINKFLAGS on $(TARGET) += $(LINKFLAGS) [ FPath $(TARGET_DIR) startup.o ] [ FPath $(TARGET_DIR) syscalls.o ] ;

@ -1,57 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# ==============================================================================
# generic arm definitions & targets
# ==============================================================================
HDRS += [ FPath $(TOP) cpu arm_common include ] ;
TOOLCHAIN = arm-elf- ;
#
# Toolchain setup
#
CC = $(TOOLCHAIN)gcc ;
LINK = $(CC) ;
OPTIM = -Os ;
CCFLAGS += -std=gnu99 -Wall -mcpu=arm7tdmi-s ;
LINKFLAGS = -mcpu=arm7tdmi-s -static -lgcc -nostartfiles -T [ FPath $(TOP) cpu $(CPU) linkerscript.x ] ;
if $(PROFILING) = 1 {
CCFLAGS += -g -finstrument-functions ;
}
AS = $(TOOLCHAIN)as ;
ASFLAGS += -mcpu=arm7tdmi-s --defsym $(CPU)=1 ;
AR = $(TOOLCHAIN)ar ;
ARFLAGS = -rc ;
OBJCOPY = $(TOOLCHAIN)objcopy ;

@ -1,35 +0,0 @@
# ******************************************************************************
# Copyright 2010, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP cpu cc430 ;
Module hwtimer_cpu : hwtimer_cc430.c : hwtimer_msp430 ;
Module rtc : cc430-rtc.c ;
Module gpioint : cc430-gpioint.c ;
Module adc : cc430-adc.c : hwtimer ;
SubInclude TOP cpu msp430-common ;

@ -1 +0,0 @@
include [ FPath $(TOP) cpu msp430-common Jamrules.msp430-common ] ;

@ -1,33 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
SubDir TOP cpu lpc214x ;
Library cpu.a : cpu.c ;
Objects startup.s ;
SubInclude TOP cpu arm_common ;

@ -1,41 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP cpu lpc2387 ;
Module cpu : cpu.c lpc2387-lpm.c lpc23xx-iap.c ;
UseModule cpu ;
Module rtc : lpc2387-rtc.c ;
Module gpioint : lpc2387-gpioint.c ;
Module adc : lpc2387-adc.c ;
Module mci : lpc2387-mci.c asmfunc.s : hwtimer ;
Objects startup.s ;
#SubInclude TOP cpu lpc2387 drivers ;
SubInclude TOP cpu arm_common ;

@ -1,31 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
HDRS += [ FPath $(TOP) cpu $(CPU) drivers include ] ;
HDRS += [ FPath $(TOP) cpu $(CPU) hal include ] ;
include [ FPath $(TOP) cpu arm_common Jamrules.arm_common ] ;

@ -1,38 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP cpu msp430-common ;
Module cpu : msp430-main.c cpu.c atomic.c irq.c ;
Module hwtimer_msp430 : hwtimer_cpu.c ;
UseModule cpu ;
UseModule oneway_malloc ;
Object startup.o : startup.c ;
DEPENDS $(TARGET) : startup.o ;

@ -1,39 +0,0 @@
#
## msp430 based MCU Jamrules file
#
echo "Building for board $(BOARD)." ;
echo "Building for MCU $(MCU)." ;
HDRS += $(TOP)/cpu/msp430-common/include $(TOP)/cpu/$(CPU)/include $(TOP)/board/$(BOARD)/drivers $(TOP)/board/$(BOARD)/include $(TOP)/include $(TOP)/core/include ;
TOOLCHAIN = msp430- ;
CC = msp430-gcc ;
LINK = msp430-gcc ;
OPTIM = -Os -gdwarf-2 ;
#OPTIM = -O0 -g ;
#OPTIM = -O2 ;
CCFLAGS += -std=gnu99 -Wall -mmcu=$(MCU) ;
LINKFLAGS = -mmcu=$(MCU) -lgcc $(TOP)/bin/$(BOARD)/$(PROJECT)/startup.o ;
AS = msp430-as ;
ASFLAGS += -mmcu=$(MCU) --defsym $(CPU)=1 --gdwarf-2 ;
AR = msp430-ar ;
ARFLAGS = -rc ;
GDB = msp430-gdb ;
GDBFLAGS = -x $(TOP)/board/$(BOARD)/tools/gdbscript ;
OBJCOPY = msp430-objcopy ;
FLASHER ?= echo ;
FLASHFLAGS ?= "No flasher defined." ;
RESET ?= $(FLASHER) $(FLASHFLAGS) reset ;
# overwrite flash action in order to support mspdebug
actions Flash
{
$(FLASHER) $(FLASHFLAGS) "prog $(>)"
}

@ -1,33 +0,0 @@
# ******************************************************************************
# Copyright 2010, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id$
SubDir TOP cpu msp430x16x ;
Module flashrom : flashrom.c ;
Module hwtimer_cpu : hwtimer_msp430.c : hwtimer_msp430 ;
SubInclude TOP cpu msp430-common ;

@ -1 +0,0 @@
include [ FPath $(TOP) cpu msp430-common Jamrules.msp430-common ] ;

@ -1,37 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id: Jamfile 832 2009-03-13 16:45:41Z kaspar $
SubDir TOP drivers ;
Module sht11 : sht11.c : hwtimer ;
Module ltc4150 : ltc4150.c : board_ltc4150 hwtimer ;
Module vti_ps : vti_ps.c : vti_ps_twi ;
SubInclude TOP drivers cc110x ;
SubInclude TOP drivers cc110x_ng ;

@ -1,35 +0,0 @@
# ******************************************************************************
# Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of FeuerWare.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id: Jamfile 832 2009-03-13 16:45:41Z kaspar $
SubDir TOP drivers cc110x ;
HDRS += $(TOP)/drivers/cc110x ;
Module cc110x : cc1100.c cc1100-csmaca-mac.c cc1100-defaultSettings.c
cc1100_phy.c cc1100_spi.c
: board_cc110x vtimer protocol_multiplex gpioint ;

@ -1,34 +0,0 @@
# ******************************************************************************
# Copyright 2010, Freie Universitaet Berlin (FUB). All rights reserved.
#
# These sources were developed at the Freie Universitaet Berlin, Computer
# Systems and Telematics group (http://cst.mi.fu-berlin.de).
# ------------------------------------------------------------------------------
# This file is part of µkleos.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# FeuerWare is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see http://www.gnu.org/licenses/ .
# ------------------------------------------------------------------------------
# For further information and questions please use the web site
# http://scatterweb.mi.fu-berlin.de
# and the mailinglist (subscription via web site)
# scatterweb@lists.spline.inf.fu-berlin.de
# ******************************************************************************
# $Id: Jamfile 832 2009-03-13 16:45:41Z kaspar $
SubDir TOP drivers cc110x_ng ;
HDRS += $(TOP)/drivers/cc110x_ng/include ;
Module cc110x_ng : cc110x.c cc110x-rx.c cc110x-tx.c cc110x-defaultSettings.c : hwtimer board_cc110x ;
Module cc110x_spi : cc110x_spi.c ;
Module cc110x_cc430 : cc110x_cc430.c ;

@ -1,5 +0,0 @@
SubDir TOP projects WEAtHeR ;
Module WEAtHeR : main.c weather_routing.c protocol_msg_gateway.c : ltc4150 cc110x gpioint vtimer shell shell_commands posix_io uart0 auto_init rtc ;
UseModule WEAtHeR ;

@ -1,347 +0,0 @@
/* stdlib includes */
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/* core includes */
#include <msg.h>
#include <thread.h>
#include <hwtimer.h>
#define ENABLE_DEBUG
#include <debug.h>
/* sensors and actors */
#include <board.h>
#include <sht11.h>
#include <ltc4150.h>
/* shell */
#include <shell.h>
#include <board_uart0.h>
#include <posix_io.h>
/* transceiver */
#include <cc1100.h>
/* real time clock */
#include <rtc.h>
#include <lpc2387-rtc.h>
/* application header */
#include "weather_routing.h"
#include "weather_protocol.h"
#include "protocol_msg_gateway.h"
#define SECOND (1000 * 1000)
#define MINUTE (60 * SECOND)
#define SENDING_INTERVAL (1 * SECOND)
#define SHELL_STACK_SIZE (2048)
#define PH_STACK_SIZE (2048)
/* size of weather data packet without hop list */
#define EMPTY_WDP_SIZE (sizeof(weather_data_pkt_t) - MAX_HOP_LIST)
/* default values */
#define DEFAULT_INTERVAL (5 * SECOND)
/* stack space for threads */
#define SHELL_STACK_SIZE (4048)
#define PH_STACK_SIZE (4048)
char shell_stack_buffer[SHELL_STACK_SIZE];
char ph_stack_buffer[PH_STACK_SIZE];
/* per default acting only as relay */
static uint8_t data_sink = 0;
static uint8_t data_src = 0;
static uint32_t sending_interval = DEFAULT_INTERVAL;
extern uint8_t gossip_probability;
/* function prototypes */
static void weather_send(char* unused);
static void weather_sink(char* unused);
static void set_interval(char* interval);
static void set_probability(char* prob);
static void print_cc1100_info(char* unused);
/* shell commands */
shell_t shell;
const shell_command_t sc[] = {
{"sender", "Enables node as data source.", weather_send},
{"sink", "Enables node as data sink.", weather_sink},
{"int", "Set the sending interval in seconds", set_interval},
{"prob", "Set the gossiping probability", set_probability},
{"cc1100", "Show state, statistics and config of cc1100", print_cc1100_info},
{NULL, NULL, NULL}};
static void shell_runner(void) {
shell_init(&shell, sc, uart0_readc, uart0_putc);
posix_open(uart0_handler_pid, 0);
shell_run(&shell);
}
static void weather_send(char* unused) {
if (data_src) {
data_src = 0;
puts("Disabling data source mode.");
}
else {
data_src = 1;
puts("Enabling data source mode.");
}
}
static void weather_sink(char* unused) {
if (data_sink) {
data_sink = 0;
puts("Disabling data sink mode.");
}
else {
data_sink = 1;
puts("Enabling data sink mode.");
}
}
static void set_interval(char* interval) {
uint16_t a;
a = atoi(interval+4);
if (strlen(interval) > 4) {
printf("[WEAtHeR] Set interval to %u\n ", a);
sending_interval = a * SECOND;
}
else {
printf("[WEAtHeR] Current interval is %lu\n ", (sending_interval / SECOND));
}
}
static void set_probability(char* prob) {
uint16_t a;
a = atoi(prob+4);
if (strlen(prob) > 4) {
printf("[WEAtHeR] Set probability to %hu\n ", a);
gossip_probability = a;
}
else {
printf("[WEAtHeR] Current probability is %hu\n ", gossip_probability);
}
}
static void print_cc1100_info(char* unused) {
puts("==================================================");
cc1100_print_statistic();
puts("--------------------------------------------------");
cc1100_print_config();
puts("==================================================");
}
/* packet handling */
static void handle_packet(void* msg, int msg_size, packet_info_t* packet_info) {
weather_packet_header_t *header = (weather_packet_header_t*) msg;
/* packet origins at current node, just ignore it */
if (header->src == cc1100_get_address()) {
return;
}
DEBUG("\n\t Pkt received from phy: %u (%u bytes)\n"
"\t -> SEQ: %u | TYPE: %u | SRC: %hu \n\n",
packet_info->phy_src,
msg_size,
header->seq_nr,
header->type,
header->src
);
/* while not acting as sink and packet contains data, route the packet */
if (!data_sink) {
if (header->type == WEATHER_DATA) {
weather_data_pkt_t* wdp = (weather_data_pkt_t*) msg;
DEBUG("$0;%hu;%hu;%04lX;%04X;%.2f;%.2f;%.2f;%.2f\n",
header->src,
0,
wdp->timestamp,
0,
wdp->temperature,
wdp->relhum,
wdp->relhum_temp,
wdp->energy);
DEBUG("Not for me, routing, baby!\n");
route_packet(msg, msg_size);
}
return;
}
/* if current node acts as sink, handle packet */
switch (header->type) {
case WEATHER_HELLO: {
if (msg_size < sizeof(weather_hello_pkt_t)) {
puts("Bad hello packet received.");
} else {
puts("Hello packet received - no handler implemented");
}
break;
}
case WEATHER_CHAT: {
puts("\n*================================================================================*");
printf("\tCHAT MESSAGE from %hu: %s\n\n", packet_info->phy_src, ((weather_chat_pkt_t*) msg)->mesg);
puts("*================================================================================*\n");
break;
}
case WEATHER_DATA: {
weather_data_pkt_t* wdp = (weather_data_pkt_t*) msg;
uint8_t i;
time_t local_time = rtc_time(NULL);
/* <node_id_source>;<node_id_sink>;<timestamp_source>;<timestamp_sink>;<temperature>;<humidity_relative>;<humitidy_absolut>;<energy_counter> */
printf("$1;%hu;%u;%04lX;%04lX;%.2f;%.2f;%.2f;%.2f;",
header->src,
cc1100_get_address(),
wdp->timestamp,
local_time,
wdp->temperature,
wdp->relhum,
wdp->relhum_temp,
wdp->energy);
for (i = 0; i < wdp->hop_counter; i++) {
printf("%03u-", wdp->hops[i]);
}
puts("");
break;
}
default: {
printf("Unknown packet type \"%i\" received.\n", header->type);
}
}
}
/* endless loop for packet handling */
static void protocol_handler_thread(void) {
msg_t m;
puts("Protocol handler thread started.");
while(1) {
msg_receive(&m);
packet_t packet;
int pos = m.content.value;
packet = packet_buffer[pos];
handle_packet(packet.payload, packet.msg_size, &(packet.packet_info));
DEBUG("Packet handler done\n");
}
}
int main(void) {
weather_data_pkt_t wdp;
sht11_val_t sht11_val;
/* initialize variables */
uint8_t success = 0;
int sending_state = 0;
gossip_probability = FLOODING_PROB;
/* fill some fields of the packet */
wdp.header.seq_nr = 0;
wdp.header.type = WEATHER_DATA;
wdp.hop_counter = 1;
/* set initial channel */
cc1100_set_channel(10);
/* boot screen */
puts("");
puts("WEAtHeR: Wireless Energy-Aware mulTi-Hop sEnsor Reading.");
puts("");
printf("Sending interval: %lu\n", sending_interval / SECOND);
/* start shell */
thread_create(shell_stack_buffer, SHELL_STACK_SIZE, PRIORITY_MAIN-1, CREATE_STACKTEST, shell_runner, "shell");
/* initialize message gateway */
init_protocol_msg_gateway();
/* create thread for radio packet handling */
int pid = thread_create(ph_stack_buffer, PH_STACK_SIZE, PRIORITY_MAIN-2, CREATE_STACKTEST, protocol_handler_thread, "protocol_handler");
set_protocol_handler_thread(pid);
/* start coulomb counter and RTC */
ltc4150_start();
rtc_enable();
/* loop forever */
while (1) {
DEBUG("Measurement in progress...\n");
#ifndef ENABLE_DEBUG
success = sht11_read_sensor(&sht11_val, HUMIDITY|TEMPERATURE);
#else
success = 1;
sht11_val.temperature = 1;
sht11_val.relhum = 2;
sht11_val.relhum_temp = 3;
#endif
DEBUG("...done.\n");
if (data_src) {
wdp.header.src = cc1100_get_address();
DEBUG("Src filled\n");
wdp.timestamp = rtc_time(NULL);
DEBUG("Timestamp filled\n");
wdp.energy = ltc4150_get_total_mAh();
DEBUG("Energy filled\n");
if (!success) {
printf("error;error;error\n");
}
else {
wdp.temperature = sht11_val.temperature;
wdp.relhum = sht11_val.relhum;
wdp.relhum_temp = sht11_val.relhum_temp;
wdp.hops[0] = cc1100_get_address();
DEBUG("Ready for sending\n");
/* send packet with one entry in hop list */
sending_state = cc1100_send_csmaca(0, WEATHER_PROTOCOL_NR, 0, (char*)&wdp, (EMPTY_WDP_SIZE + 1));
if (sending_state > 0) {
DEBUG("Sending %lu bytes.\n", (EMPTY_WDP_SIZE + 1));
wdp.header.seq_nr++;
}
else {
printf("Error on sending packet with code %i!\n", sending_state);
}
}
LED_GREEN_TOGGLE;
}
else {
LED_RED_TOGGLE;
}
if (!success) {
printf("error;error;error\n");
}
else {
#ifdef ENABLE_DEBUG
puts("==================================================");
cc1100_print_statistic();
puts("--------------------------------------------------");
cc1100_print_config();
puts("==================================================");
#endif
printf("$0;%hu;%hu;%04lX;%04X;%.2f;%.2f;%.2f;%.2f\n",
cc1100_get_address(),
0,
rtc_time(NULL),
0,
sht11_val.temperature,
sht11_val.relhum,
sht11_val.relhum_temp,
ltc4150_get_total_mAh());
}
hwtimer_wait(sending_interval);
}
puts("Something went wrong.");
}

@ -1,58 +0,0 @@
#include <stdint.h>
#include <stdio.h>
#include <radio/radio.h>
#include <radio/types.h>
#include <string.h>
#include <msg.h>
#include <cc1100.h>
#include <board.h>
#include "protocol_msg_gateway.h"
#include "weather_protocol.h"
#define NUM_PROTOCOL_HANDLER_PIDS 8
static uint16_t protocol_handler_pid;
static int packet_buffer_next = 0;
packet_t packet_buffer[PACKET_BUFFER_SIZE];
static void protocol_msg_gateway(void* payload, int msg_size, packet_info_t* packet_info) {
msg_t m;
if (!cc1100_get_address()) {
puts("No address configured, not processing incoming packet");
return;
}
if (protocol_handler_pid <= 0) {
puts("protocol_handler(): received packet without protocol handler. msg dropped.");
return;
}
int mypos = packet_buffer_next++;
if (packet_buffer_next == PACKET_BUFFER_SIZE) packet_buffer_next = 0;
packet_t *p = &(packet_buffer[mypos]);
p->packet_info = *packet_info;
p->msg_size = msg_size;
memcpy(p->payload, payload, msg_size);
m.type = 0;
m.content.value = mypos;
int success = msg_send_int(&m, protocol_handler_pid);
if (! success) {
/* should set timer to retry. Dropping pkt for now. */
puts("protocol_handler(): msg dropped.");
}
}
void init_protocol_msg_gateway() {
puts("Init protocol msg gateway");
cc1100_set_packet_handler(WEATHER_PROTOCOL_NR, protocol_msg_gateway);
}
int set_protocol_handler_thread(int pid) {
protocol_handler_pid = pid;
return 0;
}

@ -1,18 +0,0 @@
#ifndef __PROTOCOL_MSG_GATEWAY_H
#define __PROTOCOL_MSG_GATEWAY_H
#define PACKET_BUFFER_SIZE 32
#define MAXIMUM_PAYLOAD_SIZE 64
typedef struct {
packet_info_t packet_info;
unsigned int msg_size;
char payload[MAXIMUM_PAYLOAD_SIZE];
} packet_t;
void init_protocol_msg_gateway();
int set_protocol_handler_thread(int pid);
extern packet_t packet_buffer[PACKET_BUFFER_SIZE];
#endif /* __PROTOCOL_MSG_GATEWAY_H */

@ -1,13 +0,0 @@
#!/usr/bin/expect
set timeout 5
spawn pseudoterm $env(PORT)
expect {
"Hello World!" {}
timeout { exit 1 }
}
puts "\nTest successful!\n"

@ -1,43 +0,0 @@
#ifndef WEATHER_PROTOCOL_H_
#define WEATHER_PROTOCOL_H_
#include <stdint.h>
#include <radio/radio.h>
#define WEATHER_PROTOCOL_NR 6
#define MAX_HOP_LIST (11)
typedef enum {
WEATHER_HELLO,
WEATHER_CHAT,
WEATHER_DATA
} packet_types;
typedef struct {
uint16_t seq_nr;
uint8_t src;
uint8_t type;
} weather_packet_header_t;
typedef struct __attribute__ ((packed)) {
weather_packet_header_t header;
} weather_hello_pkt_t;
typedef struct {
weather_packet_header_t header;
uint8_t len;
char mesg[40];
} weather_chat_pkt_t;
typedef struct __attribute__ ((packed)) {
weather_packet_header_t header;
time_t timestamp;
double temperature;
double relhum;
double relhum_temp;
double energy;
uint8_t hop_counter;
uint8_t hops[MAX_HOP_LIST];
} weather_data_pkt_t;
#endif

@ -1,77 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <cc1100.h>
#include "weather_protocol.h"
#include "weather_routing.h"
#define ENABLE_DEBUG
#include <debug.h>
uint8_t gossip_probability;
static source_timestamp_t sources[MAX_SOURCES];
static uint8_t update_sources(uint8_t id, time_t timestamp) {
uint8_t i;
DEBUG("updating sources list\n");
for (i = 0; i < MAX_SOURCES; i++) {
/* source id found */
if (sources[i].id == id) {
DEBUG("source already known, comparing timestamps: %04lX : %04lX\n", sources[i].timestamp, timestamp);
/* more current timestamp received, updating */
if (sources[i].timestamp < timestamp) {
sources[i].timestamp = timestamp;
return 1;
}
/* timestamp too old, discard this packet */
else {
puts("Timestamp too old, not routing");
return 0;
}
}
/* source id not yet stored creating new entry */
else if (!sources[i].id) {
puts("got to know a new source");
sources[i].id = id;
sources[i].timestamp = timestamp;
return 1;
}
}
puts("No more sources could be stored!");
return 0;
}
void route_packet(void* msg, int msg_size) {
weather_packet_header_t *header = (weather_packet_header_t*) msg;
weather_data_pkt_t* wdp = NULL;
int state = 0;
if (header->type == WEATHER_DATA) {
wdp = (weather_data_pkt_t*) msg;
if (!update_sources(wdp->header.src, wdp->timestamp)) {
return;
}
}
if ((100.0 * rand()/(double) RAND_MAX) <=<