From: Mart Lubbers Date: Thu, 2 Feb 2017 15:12:10 +0000 (+0100) Subject: adapt to new iTasks layout X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=3c4bbb3cae00cb810107b39b99b8118e9e458a34;p=mTask.git adapt to new iTasks layout --- diff --git a/Makefile b/Makefile index 6ca4681..866a77f 100644 --- a/Makefile +++ b/Makefile @@ -2,21 +2,11 @@ CLEAN_HOME?=/opt/clean CLM:=clm override CLMFLAGS+=-dynamics -h 200M -nt -l -no-pie CLMLIBS:=\ - -I ./iTasks-SDK/Patches/Dynamics\ - -I ./iTasks-SDK/Patches/Generics\ - -I ./iTasks-SDK/Patches/StdEnv\ - -I ./iTasks-SDK/Patches/TCPIP\ - -I ./iTasks-SDK/Server\ - -I ./clean-platform/src/libraries/OS-Independent\ - -I ./clean-platform/src/libraries/OS-Independent/Deprecated/StdLib\ - -I ./clean-platform/src/libraries/OS-Posix\ - -I ./clean-platform/src/libraries/OS-Linux\ - -I ./clean-platform/src/libraries/OS-Linux-64\ - -I ./iTasks-SDK/Dependencies/graph_copy/linux64\ - -I ./iTasks-SDK/Dependencies/graph_copy/common\ - -I ./iTasks-SDK/Dependencies/SAPL\ - -I ./iTasks-SDK/Dependencies/clean-sapl/src\ - -I ./iTasks-SDK/Server/lib\ + -I $(CLEAN_HOME)/lib/Platform\ + -I $(CLEAN_HOME)/lib/Platform/Deprecated/StdLib\ + -I $(CLEAN_HOME)/lib/iTasks\ + -I $(CLEAN_HOME)/lib/GraphCopy\ + -I $(CLEAN_HOME)/lib/Sapl\ -I $(CLEAN_HOME)/lib/StdEnv\ -I $(CLEAN_HOME)/lib/Generics\ -I $(CLEAN_HOME)/lib/Dynamics\ diff --git a/README.md b/README.md index 3872733..941e4ce 100644 --- a/README.md +++ b/README.md @@ -12,32 +12,16 @@ The devices suitable for *mTasks* are not limited to embedded devices. In the *mTasks* are written in [clean][clean] and specifically using the [iTasks][itasks] library. -### Workings of an *mTask* system -*mTasks* are routines that are executed in a round robin fashion +### How to setup the iTask system +Get the latest iTask and run Make. Make sure to have `gcc-5`. -### Communication back to the server via shared data sources -When a shared data source is updated the *mTask* can publish this data back to -the server. This is usefull when for example a temperature reaches a certain -threshhold. How this communication will be done is yet to be researched. -**TODO** +### How to setup the interpreter +For the linux version install `gcc` and run `make -f Makefile.linux` in the +`./int` directory -### Usage -All programs can be built by running `make`. Note that you need the latest -`clm` version if you want to use the `Makefile` since hierarchical modules are -used. This version can be found [here][clm]. - -The following programs are available as of now: -- `mTaskExamples` - - This compiles a list of mTask examples to `C` code. - -- `mTaskMakeSymbols` - - This creates the `mTaskSymbols.h` header file - -- `mTaskInterpret` - - This compiles a subset of *mTasks* to bytecode. +For the STM version install `gcc-arm-none-eabi` and run `make` in the `./int` +directory. To flash the binary to the device install (a recent version of) +`openocd` and run `make flash` in the `./int` directory. ### Protocol The server can send task specifications to the microcontroller by sending: @@ -46,14 +30,9 @@ The server can send task specifications to the microcontroller by sending: Where n is a 16bit integer. -### Bytecode operations -The header file for the interpreter with the corresponding bytevalues can be -generated by running `mTaskMakeSymbols`. - ### Author(s) Initial work has been done by Pieter Koopman. Extensions have been made by Mart Lubbers. -[clm]: https://svn.cs.ru.nl/repos/clean-tools/trunk/clm [clean]: clean.cs.ru.nl [itasks]: clean.cs.ru.nl/ITasks diff --git a/int/Makefile b/int/Makefile index be9ee21..d0f5454 100644 --- a/int/Makefile +++ b/int/Makefile @@ -223,7 +223,7 @@ RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC include $(RULESPATH)/rules.mk flash: build/$(PROJECT).bin - sudo openocd \ + sudo `which openocd` \ -f interface/stlink-v2-1.cfg\ -c "transport select hla_swd"\ -f target/stm32f7x.cfg \ diff --git a/mTaskSimulation.dcl b/mTaskSimulation.dcl index 16ceee4..1669f23 100644 --- a/mTaskSimulation.dcl +++ b/mTaskSimulation.dcl @@ -3,10 +3,9 @@ definition module mTaskSimulation import iTasks.API.Core.Types import mTask -//:: Display a = Display a +:: Display a = Display a -//derive class iTask Display -//instance zero State` +derive class iTask Display eval :: (Main (Eval t p)) -> [String] | toString t :: State` = diff --git a/mTaskSimulation.icl b/mTaskSimulation.icl index d28a4fe..7c187f7 100644 --- a/mTaskSimulation.icl +++ b/mTaskSimulation.icl @@ -3,7 +3,7 @@ implementation module mTaskSimulation import iTasks import gdynamic, gCons, GenEq, StdMisc, StdArray import mTask -//derive class iTask Display +derive class iTask Display eval :: (Main (Eval t p)) -> [String] | toString t eval {main=(E f)} = [toString (fst (f Rd zero))] diff --git a/miTask.icl b/miTask.icl index 2757450..5436ffe 100644 --- a/miTask.icl +++ b/miTask.icl @@ -8,6 +8,7 @@ import mTask from Text import class Text(startsWith,concat,split,join), instance Text String +from Data.Func import $ import Data.Tuple import System.Directory @@ -82,7 +83,7 @@ mTaskTask = let (msgs, sdsShares) = makeMsgs 1000 bc in >>= \p->sendMsg (fst (makeMsgs 0 (bc2 p))) ch) ||- forever (enterChoice "Choose led to disable" [] [LED1, LED2, LED3] >>= \p->sendMsg (fst (makeMsgs 0 (bc3 p))) ch) - ||- viewSharedInformation "channels" [ViewWith lens] ch + ||- viewSharedInformation "channels" [ViewAs lens] ch ||- viewSharedInformation "messages" [] messageShare ||- viewSh sdsShares ch >>* [OnAction ActionFinish (always shutDown)] @@ -151,10 +152,10 @@ syncSerialChannel dev opts rw = Task eval # iworld = {iworld & world=world, resources=Just (TTYd tty)} = case addBackgroundTask 42 (BackgroundTask (serialDeviceBackgroundTask rw)) iworld of (Error e, iworld) = (ExceptionResult (exception "h"), iworld) - (Ok _, iworld) = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=True} NoRep (TCBasic taskId ts JSONNull False), iworld) + (Ok _, iworld) = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=True} NoChange (TCBasic taskId ts JSONNull False), iworld) eval _ _ tree=:(TCBasic _ ts _ _) iworld - = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} NoRep tree, iworld) + = (ValueResult NoValue {TaskEvalInfo|lastEvent=ts,removedTasks=[],refreshSensitive=False} NoChange tree, iworld) eval event evalOpts tree=:(TCDestroy _) iworld=:{IWorld|resources,world} # (TTYd tty) = fromJust resources @@ -164,10 +165,10 @@ syncSerialChannel dev opts rw = Task eval (Error e, iworld) = (ExceptionResult (exception "h"), iworld) (Ok _, iworld) = (DestroyedResult, iworld) -serialDeviceBackgroundTask :: (Shared ([MTaskMSGRecv],[MTaskMSGSend],Bool)) !*IWorld -> *IWorld +serialDeviceBackgroundTask :: (Shared ([MTaskMSGRecv],[MTaskMSGSend],Bool)) !*IWorld -> (MaybeError TaskException (), *IWorld) serialDeviceBackgroundTask rw iworld = case read rw iworld of - (Error e, iworld) = abort "share couldn't be read" + (Error e, iworld) = (Error $ exception "share couldn't be read", iworld) (Ok (r,s,ss), iworld) # (Just (TTYd tty)) = iworld.resources # tty = writet (map encode s) tty @@ -178,10 +179,10 @@ serialDeviceBackgroundTask rw iworld = ([decode l], tty) # iworld = {iworld & resources=Just (TTYd tty)} = case write (r++ml,[],False) rw iworld of - (Error e, iworld) = abort "share couldn't be written" + (Error e, iworld) = (Error $ exception "share couldn't be written", iworld) (Ok _, iworld) = case notify rw iworld of - (Error e, iworld) = abort "share couldn't be notified" - (Ok _, iworld) = iworld + (Error e, iworld) = (Error $ exception "share couldn't be notified", iworld) + (Ok _, iworld) = (Ok (), iworld) where writet :: [String] -> (*TTY -> *TTY) writet [] = id