* removed legacy projects folder and Jamfiles
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,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) <=< |