]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
added targets for tosthread support
authorklueska <klueska>
Thu, 12 Jun 2008 14:17:14 +0000 (14:17 +0000)
committerklueska <klueska>
Thu, 12 Jun 2008 14:17:14 +0000 (14:17 +0000)
support/make/cthreads.extra [new file with mode: 0644]
support/make/dynthreads.extra [new file with mode: 0644]
support/make/threads.extra [new file with mode: 0644]

diff --git a/support/make/cthreads.extra b/support/make/cthreads.extra
new file mode 100644 (file)
index 0000000..cb50e5f
--- /dev/null
@@ -0,0 +1,24 @@
+# Extra threads Makefile target to enable thread support for tinyos
+# Kevin Klues May 16th, 2008
+
+#Get all the normal include directories for a threads build
+$(call TOSMake_include,threads.extra)
+
+#Include directories required specifically for cthreads builds
+THREADS_CSYSTEM_DIR = $(TOS_THREADS_DIR)/csystem
+CFLAGS += -I$(THREADS_CSYSTEM_DIR)
+
+#Setup flag to pass to storage volume allocator to indicate threads are being used
+VOLUME_ALLOCATOR_FLAGS = -t
+
+#Set up extra c file to compile functions for thread manipulation
+#Also define the top level nesC component as the TinyOSEntryPointC component
+COMPONENT=$(THREADS_CSYSTEM_DIR)/TinyOSEntryPointC
+TOSTHREAD_MAIN_PATH=$(shell pwd)/$(TOSTHREAD_MAIN)
+ifdef TOSTHREAD_MAIN
+ifndef MAKE_DYNTHREADS
+  ifneq ($(wildcard $(TOSTHREAD_MAIN_PATH)), )
+    CFLAGS += -DMAIN_APP=\"$(TOSTHREAD_MAIN_PATH)\"
+  endif 
+endif
+endif
diff --git a/support/make/dynthreads.extra b/support/make/dynthreads.extra
new file mode 100644 (file)
index 0000000..e22a40d
--- /dev/null
@@ -0,0 +1,38 @@
+# Extra threads Makefile target to enable thread support for tinyos
+# Kevin Klues May 16th, 2008
+
+MAKE_DYNTHREADS =
+BUILD_DEPS = dynthreads_all
+
+#Get all the normal include directories for a cthreads build
+$(call TOSMake_include,cthreads.extra)
+
+#Stuff to build dynamically loadable binary
+DYNLOAD_CFILE = $(TOSTHREAD_MAIN_PATH)
+CFLAGS += -c
+PFLAGS += -x nesc
+
+BUILDDIR = build/$(PLATFORM)/dynthreads
+#DYNLOAD_BASENAME = $(shell basename $(DYNLOAD_CFILE) .c)
+DYNLOAD_BASENAME = main
+
+DYNLOAD_OBJFILE = $(BUILDDIR)/$(DYNLOAD_BASENAME).o
+DYNLOAD_BINFILE = $(BUILDDIR)/$(DYNLOAD_BASENAME).bin
+DYNLOAD_TOSFILE = $(BUILDDIR)/$(DYNLOAD_BASENAME).tos
+
+DYNLOAD_NCC_COMMAND = $(NCC) -o $(DYNLOAD_OBJFILE) $(PFLAGS) $(OPTFLAGS) $(CFLAGS) $(DYNLOAD_CFILE)
+DYNLOAD_OBJCOPY_COMMAND = $(OBJCOPY) --output-target=binary $(DYNLOAD_OBJFILE) $(DYNLOAD_BINFILE)
+DYNLOAD_GENTOS_COMMAND = tosthreads-dynamic-app $(DYNLOAD_OBJFILE) $(DYNLOAD_BINFILE) $(DYNLOAD_TOSFILE)
+
+dynthreads_build: dynthreads_builddir build_storage
+       @echo "    compiling $(DYNLOAD_CFILE) to a $(PLATFORM) dynamically loadable binary"
+       $(DYNLOAD_NCC_COMMAND)
+       $(DYNLOAD_OBJCOPY_COMMAND)
+       $(DYNLOAD_GENTOS_COMMAND)
+       
+dynthreads_all: dynthreads_build
+       @echo "            $(shell stat -F $(DYNLOAD_TOSFILE) | perl -lane 'print $$F[4];') bytes in BINARY"
+       @echo "    writing TOS image"
+
+dynthreads_builddir:
+       mkdir -p $(BUILDDIR)
diff --git a/support/make/threads.extra b/support/make/threads.extra
new file mode 100644 (file)
index 0000000..1c31653
--- /dev/null
@@ -0,0 +1,51 @@
+# Extra threads Makefile target to enable thread support for tinyos
+# Kevin Klues May 16th, 2008
+
+#Set up flag signifying threads are enabled 
+THREADS = THREADS
+PFLAGS += -D$(THREADS)
+TOS_THREADS_DIR ?= $(TOSDIR)/lib/tosthreads
+
+#Include directories required by all platforms and mcus
+CFLAGS += -I$(TOS_THREADS_DIR)/system
+CFLAGS += -I$(TOS_THREADS_DIR)/interfaces
+CFLAGS += -I$(TOS_THREADS_DIR)/types
+
+#Setup the thread scheduler for use by redefining the name of the task scheduler to use
+PFLAGS += -tosscheduler=TinyTaskSchedulerC,TinyTaskSchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask
+
+#Msp430 specific include directories on tested platforms
+THREADS_MSP430_DIR = $(TOS_THREADS_DIR)/chips/msp430
+THREADS_MSP430_INCLUDE_DIRS = -I$(THREADS_MSP430_DIR)
+THREADS_MSP430_INCLUDE_DIRS += -I$(THREADS_MSP430_DIR)/adc12
+
+#Atm128 specific include directories on tested platforms
+THREADS_ATM128_DIR = $(TOS_THREADS_DIR)/chips/atm128
+THREADS_ATM128_INCLUDE_DIRS = -I$(THREADS_ATM128_DIR)
+
+#Atm1281 specific include directories on tested platforms
+THREADS_ATM1281_DIR = $(TOS_THREADS_DIR)/chips/atm1281
+THREADS_ATM1281_INCLUDE_DIRS = -I$(THREADS_ATM1281_DIR)
+
+#Telos specific include directories
+THREADS_TELOS_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/telosa
+
+#Mica2 specific include directories
+THREADS_MICA2_INCLUDE_DIRS = -I$(TOS_THREADS_DIR)/platforms/mica2/chips/cc1000
+
+#Add CFLAGS for supported platforms
+ifneq ($(filter telos telosa telosb tmote,$(MAKECMDGOALS)),) 
+  CFLAGS += $(THREADS_MSP430_INCLUDE_DIRS)
+  CFLAGS += $(THREADS_TELOS_INCLUDE_DIRS)
+endif
+ifneq ($(filter mica2,$(MAKECMDGOALS)),) 
+  CFLAGS += $(THREADS_ATM128_INCLUDE_DIRS)
+  CFLAGS += $(THREADS_MICA2_INCLUDE_DIRS)
+endif
+ifneq ($(filter micaz,$(MAKECMDGOALS)),) 
+  CFLAGS += $(THREADS_ATM128_INCLUDE_DIRS)
+endif
+ifneq ($(filter iris,$(MAKECMDGOALS)),) 
+  CFLAGS += $(THREADS_ATM1281_INCLUDE_DIRS)
+  CFLAGS += $(THREADS_ATM128_INCLUDE_DIRS)
+endif