diff --git a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore index 317682960317ed2fc41387b1d55ef0d28cf33e49..66c2f48fd4f8b017135703cee5b48c7abe242f1a 100644 --- a/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore +++ b/org.fortiss.af3.platform.raspberry/trunk/model/raspberry.ecore @@ -19,7 +19,7 @@ </eAnnotations> </eOperations> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi3" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//GenericPlatformUnit platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement #//IBoardDomain"/> + <eClassifiers xsi:type="ecore:EClass" name="RaspberryPi3" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//GenericPlatformUnit platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement #//IBoardDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ExecutionUnit"/> <eClassifiers xsi:type="ecore:EClass" name="Sensor" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IBoardDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformIOResource"/> <eClassifiers xsi:type="ecore:EClass" name="Actuator" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Transmitter platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IBoardPlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IBoardDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformIOResource"/> <eClassifiers xsi:type="ecore:EClass" name="SensorIn" eSuperTypes="platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//Receiver platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IIpCorePlatformArchitectureElement platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//ICommunicationMaster #//IProcessorDomain platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformPort platform:/resource/org.fortiss.af3.platform/model/platform.ecore#//IPlatformIOResource"/> diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryFileGeneration.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryFileGeneration.java deleted file mode 100644 index be9b4b3666b7f30d5f87104284952541617a5d9f..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryFileGeneration.java +++ /dev/null @@ -1,51 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id: RaspberryMakefileGeneration.java 16640 2016-04-13 13:18:00Z zverlov $ -| | -| Copyright 2016 ForTISS GmbH | -| | -| Licensed under the Apache License, Version 2.0 (the "License"); | -| you may not use this file except in compliance with the License. | -| You may obtain a copy of the License at | -| | -| http://www.apache.org/licenses/LICENSE-2.0 | -| | -| Unless required by applicable law or agreed to in writing, software | -| distributed under the License is distributed on an "AS IS" BASIS, | -| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | -| See the License for the specific language governing permissions and | -| limitations under the License. | -+--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.generated.files; - -/** - * - * @author zverlov - * @author $Author: zverlov $ - * @version $Rev: 16640 $ - * @ConQAT.Rating RED Hash: - */ -public class RaspberryFileGeneration { - - /** Information relevant to the ports. */ - private String text; - - /** Contents of the PortsInfo. */ - private String content; - - /** Constructor. */ - public RaspberryFileGeneration(String specs) { - this.text = specs; - this.content = ""; - } - - /** Calls the methods that create the portSpecs. */ - - public void createInfofile() { - content += text; - } - - /** Return the current content of the portSpecs. */ - public String getContent() { - return this.content; - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryMakeMKGeneration.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryMakeMKGeneration.java deleted file mode 100644 index 0c8b68c4adc341b02eaa13b484fd585436fcd11d..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryMakeMKGeneration.java +++ /dev/null @@ -1,71 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id$ -| | -| Copyright 2016 ForTISS GmbH | -| | -| Licensed under the Apache License, Version 2.0 (the "License"); | -| you may not use this file except in compliance with the License. | -| You may obtain a copy of the License at | -| | -| http://www.apache.org/licenses/LICENSE-2.0 | -| | -| Unless required by applicable law or agreed to in writing, software | -| distributed under the License is distributed on an "AS IS" BASIS, | -| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | -| See the License for the specific language governing permissions and | -| limitations under the License. | -+--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.generated.files; - -import java.io.FileNotFoundException; -import java.io.UnsupportedEncodingException; - -/** - * - * @author zverlov - * @author $Author$ - * @version $Rev$ - * @ConQAT.Rating RED Hash: - */ -public class RaspberryMakeMKGeneration { - /** Contents of make.mk. */ - private String content; - - /** Constructor. */ - public RaspberryMakeMKGeneration() { - this.content = ""; - } - - /** Main methods for creation of make.mk. */ - /** - * public void createMakeMK(){ - * - * } - */ - - /** - * @throws FileNotFoundException - * @throws UnsupportedEncodingException - */ - public void createMakeMK() { - - /* - * FileInputStream fis = new FileInputStream("C:\\Users\\Khan\\Desktop\\make.txt"); - * InputStreamReader in = new InputStreamReader(fis, "US-ASCII");// UTF-8 - * - * content += in; - */ - content += - "test:\n @echo $(@D)\n @echo $(DEPS)\n @echo $(OBJECTS2)\n @echo Test\n @echo $(C_SRC)\n @echo Test\n @echo $(H_SRC)\n @echo Test\n @echo $(LIBRARY)\n"; - content += - "run: all\n @./$(TARGET)\n\nramdisk:\n sudo mkdir $(RAMDISK_DIR)\n sudo mount -t tmpfs -o size=512m tmpfs $(RAMDISK_DIR)\n\n\n.PHONY: test deploy all ramdisk "; - // FileOutputStream fos = new FileOutputStream("test.txt"); - // TODO: needs to be implemented - } - - /** Return content. */ - public String getContent() { - return this.content; - } - -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryMakefileGeneration.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryMakefileGeneration.java deleted file mode 100644 index c3e811d3752c2fdcd12a8393ba691f75cf3aaa9c..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generated/files/RaspberryMakefileGeneration.java +++ /dev/null @@ -1,63 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id$ -| | -| Copyright 2016 ForTISS GmbH | -| | -| Licensed under the Apache License, Version 2.0 (the "License"); | -| you may not use this file except in compliance with the License. | -| You may obtain a copy of the License at | -| | -| http://www.apache.org/licenses/LICENSE-2.0 | -| | -| Unless required by applicable law or agreed to in writing, software | -| distributed under the License is distributed on an "AS IS" BASIS, | -| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | -| See the License for the specific language governing permissions and | -| limitations under the License. | -+--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.generated.files; - -/** - * - * @author zverlov - * @author $Author$ - * @version $Rev$ - * @ConQAT.Rating RED Hash: - */ -public class RaspberryMakefileGeneration { - - /** The name of the executable. */ - private String binaryTargetName; - - /** Contents of the Makefile. */ - private String content; - - /** Constructor. */ - public RaspberryMakefileGeneration(String targetName) { - this.binaryTargetName = targetName; - this.content = ""; - } - - /** Calls the methods that create the Makefile. */ - public void createMakefile() { - // TODO: needs to be implemented - printFirstTwoLines(); - // .... - } - - /** This methods is only an example. */ - private void printFirstTwoLines() { - content += "SHELL := /bin/bash" + "\n\n"; - content += "TARGET = " + binaryTargetName + "\n\n"; - content += "C_SRC := $(wildcard *.c)\n"; - content += "CPP_SRC := $(wildcard *.cpp)\n"; - content += "H_SRC := $(wildcard *.h)\n"; - content += "H_SRC := $(wildcard *.h)\n"; - - } - - /** Return the current content of the Makefile. */ - public String getContent() { - return this.content; - } -} diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MainFileTemplate.stg b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MainFileTemplate.stg deleted file mode 100644 index 3b5eae63a79f807ac40d73802047d278a8219585..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MainFileTemplate.stg +++ /dev/null @@ -1,17 +0,0 @@ -group MainFileTemplate; - -MainFileTemplate() ::= << - -int main() -{ - initialize_system(); - while(1) - { - printf("Loop\n"); - run_system(); - sleep(1); - } - terminate_system(); -} - ->> \ No newline at end of file diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MakeFileTemplate.stg b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MakeFileTemplate.stg deleted file mode 100644 index dfd5b042b58691e6230056ccaaa59294d232f3b8..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MakeFileTemplate.stg +++ /dev/null @@ -1,110 +0,0 @@ -group MakeFileTemplate; - -MakeFileTemplate(binaryName) ::= << - -SHELL := /bin/bash - -TARGET = $binaryName$ - -C_SRC := \$(wildcard *.c) -CPP_SRC := \$(wildcard *.cpp) -H_SRC := \$(wildcard *.h) -LIBRARY := -INCLUDE_PATH := -I. -LIBRARY_PATH := -L. - -CC = gcc -CC_FLAGS = -Wall -O3 -Wno-unused-variable -CCXX = g++ -CCXX_FLAGS = -Wall -O3 -Wno-unused-variable - -LIBRARY := -lwiringPi -lwiringPiDev - -LD = ld -LD_FLAGS = - -#include makefile fragments in subdirectories if they exist --include ./*/make.mk - -OBJECTS = \$(patsubst %.c, %.o, \$(C_SRC)) -OBJECTS += \$(patsubst %.cpp, %.o, \$(CPP_SRC)) - -RAMDISK_DIR = /mnt/ramdisk -# make ramdisj target creates and mounts a tempfs drive -#OBJ_DIR = \$(RAMDISK_DIR)/objs -OBJ_DIR = objs - -OBJS = \$(addprefix \$(OBJ_DIR)/, \$(OBJECTS)) -DEPS = \$(patsubst %.o, %.o.d, \$(OBJS)) - - -all: \$(TARGET) silent - -#include all rules generated by gcc into the makefile --include \$(DEPS) - -#dummy target to that we don't get unnecessary mesages ( target is up to date & co) -silent: - @: - -\$(TARGET): \$(OBJS) - @echo Linking - @\$(CCXX) \$(LD_FLAGS) \$(LIBRARY_PATH) -o \$(TARGET) \$^ \$(LIBRARY) - -#create output directory if it doesn't exist -#generate dependency file for current file -# .o and .d are targets of the rule -# create blank targets for each source/header file. Used to update .d files when you delete a file -\$(OBJ_DIR)/%.o: %.c - @mkdir -p \$(@D) - @echo Building \$< - @\$(CC) \$(CC_FLAGS) \$(INCLUDE_PATH) \$(ARGS) -c \$< -o \$@ - @echo -n "\$@.d \$(@D)/" > \$@.d - @\$(CC) \$(CC_FLAGS) \$(INCLUDE_PATH) \$(ARGS) -MM \$< \>> \$@.d - @cp \$@.d \$<.tp - @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\\$\$//' -e '/^\$\$/ d' -e 's/\$\$/ :/' < \$<.tp \>> \$@.d - @rm -f \$<.tp - -\$(OBJ_DIR)/%.o: %.cpp - @mkdir -p \$(@D) - @echo Building \$< - @\$(CCXX) \$(CCXX_FLAGS) \$(INCLUDE_PATH) \$(ARGS) -c \$< -o \$@ - @echo -n "\$@.d \$(@D)/" > \$@.d - @\$(CCXX) \$(CCXX_FLAGS) \$(INCLUDE_PATH) \$(ARGS) -MM \$< \>> \$@.d - @cp \$@.d \$<.tp - @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\\$\$//' -e '/^\$\$/ d' -e 's/\$\$/ :/' < \$<.tp \>> \$@.d - @rm -f \$<.tp - -clean: - @echo Removing objects directory - @rm -rf \$(OBJ_DIR) - @echo Removing target - @rm -f \$(TARGET) - -#http://blog.jgc.org/2015/04/the-one-line-you-should-add-to-every.html -print-%: ; @echo \$*=\$(\$*) - - -test: - @echo \$(@D) - @echo \$(DEPS) - @echo \$(OBJECTS2) - @echo Test - @echo \$(C_SRC) - @echo Test - @echo \$(H_SRC) - @echo Test - @echo \$(LIBRARY) - -run: all - @./\$(TARGET) - -ramdisk: - sudo mkdir \$(RAMDISK_DIR) - sudo mount -t tmpfs -o size=512m tmpfs \$(RAMDISK_DIR) - - -.PHONY: test deploy all ramdisk - - ->> \ No newline at end of file diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MakeMkTemplate.stg b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MakeMkTemplate.stg deleted file mode 100644 index 568ca1451d8858709ceecf6191e19ffa413a0141..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/MakeMkTemplate.stg +++ /dev/null @@ -1,14 +0,0 @@ -group MakeMkTemplate; - -MakeMkTemplate() ::= << - -SELF_DIR = \$(dir \$(lastword \$(MAKEFILE_LIST))) -C_SRC += \$(wildcard \$(SELF_DIR)/*.c) -CPP_SRC += \$(wildcard \$(SELF_DIR)/*.cpp) -H_SRC += \$(wildcard \$(SELF_DIR)/*.h) -INCLUDE_PATH += \$ -I"\$(SELF_DIR)" -LIBRARY_PATH += #-L"\$(SELF_DIR)" -#include makefile fragments in subdirectories if they exist --include \$(SELF_DIR)/*/make.mk - ->> \ No newline at end of file diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/RaspberryTemplateLoader.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/RaspberryTemplateLoader.java deleted file mode 100644 index 3210853abca650135ae5a56e2c6e2a77451675f7..0000000000000000000000000000000000000000 --- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/templates/RaspberryTemplateLoader.java +++ /dev/null @@ -1,83 +0,0 @@ -/*--------------------------------------------------------------------------+ -$Id$ -| | -| Copyright 2016 ForTISS GmbH | -| | -| Licensed under the Apache License, Version 2.0 (the "License"); | -| you may not use this file except in compliance with the License. | -| You may obtain a copy of the License at | -| | -| http://www.apache.org/licenses/LICENSE-2.0 | -| | -| Unless required by applicable law or agreed to in writing, software | -| distributed under the License is distributed on an "AS IS" BASIS, | -| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | -| See the License for the specific language governing permissions and | -| limitations under the License. | -+--------------------------------------------------------------------------*/ -package org.fortiss.af3.platform.raspberry.templates; - -import static org.fortiss.af3.generator.common.AF3GeneratorCommonActivator.getDefault; -import static org.fortiss.tooling.kernel.utils.LoggingUtils.error; - -import java.io.IOException; -import java.io.InputStreamReader; - -import org.antlr.stringtemplate.StringTemplate; -import org.antlr.stringtemplate.StringTemplateGroup; -import org.antlr.stringtemplate.language.DefaultTemplateLexer; - -/** - * - * @author zverlov - * @author $Author$ - * @version $Rev$ - * @ConQAT.Rating RED Hash: - */ -public class RaspberryTemplateLoader { - /** - * @param contextClass - * @param stgName - * @return the string template group for a given context class and template group name - */ - public static StringTemplateGroup loadResourceSTG(Class<?> contextClass, String stgName) { - InputStreamReader in = - new InputStreamReader(contextClass.getResourceAsStream(stgName + - (stgName.contains(".") ? "" : ".stg"))); - StringTemplateGroup templates = new StringTemplateGroup(in, DefaultTemplateLexer.class); - try { - in.close(); - } catch(IOException e) { - error(getDefault(), "AF3 generator could not load stringtemplate " + stgName + ".", e); - } - return templates; - } - - /** Returns the Template of a Makefile for the Raspberry Platform. */ - public static StringTemplate getMakeFileTemplate(String binaryName) { - StringTemplate template = - loadResourceSTG(RaspberryTemplateLoader.class, "MakeFileTemplate").getInstanceOf( - "MakeFileTemplate"); - template.setAttribute("binaryName", binaryName); - return template; - } - - /** Returns the Template of make.mk file for the Raspberry Platform. */ - public static StringTemplate getMakeMkFileTemplate() { - StringTemplate template = - loadResourceSTG(RaspberryTemplateLoader.class, "MakeMkTemplate").getInstanceOf( - "MakeMkTemplate"); - return template; - } - /** - * @param string - * @return - */ - public static StringTemplate getMainFileTemplate(String headerFile) { - StringTemplate template = - loadResourceSTG(RaspberryTemplateLoader.class, "MainFileTemplate").getInstanceOf( - "MainFileTemplate"); - template.setAttribute("headerFile", headerFile); - return template; - } -}