diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusExecutable.java
index 1f555bbc01f08012e116589d1952836acf9c4007..6119881dc8ec4b802e20e0864960971598c273f3 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusExecutable.java
+++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/BusExecutable.java
@@ -49,8 +49,16 @@ public class BusExecutable extends TransmissionUnitExecutableBase<TransmissionUn
 	public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair,
 			Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent,
 			int deploymentID) {
-		// TODO Auto-generated method stub
+		checkTypesOfOutputPorts(euPortsPair);
 
 	}
 
+	/** Collects the information about type and bounds of all OutputPorts. */
+	public void checkTypesOfOutputPorts(Map<ExecutionUnit, List<Port>> portsToCheck) {
+
+		// TODO: Look at all ports, which are OutputPorts (instanceof OutputPort)
+		// save for each port the type (i.e.: int) and the upper+lower bounds
+		// create a simple string template for the output
+	}
+
 }
diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CANBusExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CANBusExecutable.java
index 411383e8b4846c9a3b2e2df867cbe57e0cb5ef46..a5faebdc135a9950dfe7893ea59ce6767bc9e799 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CANBusExecutable.java
+++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CANBusExecutable.java
@@ -17,8 +17,6 @@ $Id$
 +--------------------------------------------------------------------------*/
 package org.fortiss.af3.platform.raspberry.generator.executable;
 
-import static org.fortiss.af3.generator.common.utils.SourceModelElementFactory.createStaticContentSourceUnit;
-
 import java.util.List;
 import java.util.Map;
 
@@ -28,7 +26,6 @@ import org.fortiss.af3.generator.common.model.source.SourcePackage;
 import org.fortiss.af3.platform.language.executable.TransmissionUnitExecutableBase;
 import org.fortiss.af3.platform.model.ExecutionUnit;
 import org.fortiss.af3.platform.model.TransmissionUnit;
-import org.fortiss.af3.platform.raspberry.templates.RaspberryTemplateLoader;
 
 /**
  * 
@@ -52,24 +49,7 @@ public class CANBusExecutable extends TransmissionUnitExecutableBase<Transmissio
 	public void createAllFiles(SourcePackage pack, Map<ExecutionUnit, List<Port>> euPortsPair,
 			Map<ExecutionUnit, List<Component>> euComponentList, Component topComponent,
 			int deploymentID) {
-		createMakeFileUsingTemplate(pack, "test_targetName");
-		// createMakeMK(pack);
-		createMakeMKUsingTemplate(pack);
-
-	}
-
-	/*
-	 * More elegant way of creating files but not working right now. Problem with the special
-	 * characters (i.e. $) in MakeFileTemplate.stg
-	 */
-	private void createMakeFileUsingTemplate(SourcePackage pack, String exName) {
-		String content = RaspberryTemplateLoader.getMakeFileTemplate(exName).toString();
-		pack.addUnit(createStaticContentSourceUnit("Makefile", content, false));
-	}
-
-	private void createMakeMKUsingTemplate(SourcePackage pack) {
-		String content = RaspberryTemplateLoader.getMakeMkFileTemplate().toString();
-		pack.addUnit(createStaticContentSourceUnit("make.mk", content, false));
+		System.out.println("hello");
 	}
 
 }
diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CoreExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CoreExecutable.java
index d4dcdcba8b19c05b7d291da4e722a0b48f2e0276..7016414014797b91c00bd53ff04b0161a8abbff9 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CoreExecutable.java
+++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/CoreExecutable.java
@@ -36,6 +36,7 @@ import static org.fortiss.af3.generator.common.utils.CLanguageModelElementFacade
 import static org.fortiss.af3.generator.common.utils.CLanguageModelElementFactory.createCSourcePackage;
 import static org.fortiss.af3.generator.common.utils.CLanguageModelElementFactory.createConfigureFile;
 import static org.fortiss.af3.generator.common.utils.CLanguageModelElementFactory.createMakedefsFile;
+import static org.fortiss.af3.generator.common.utils.SourceModelElementFactory.createStaticContentSourceUnit;
 import static org.fortiss.tooling.kernel.utils.KernelModelElementUtils.getRootElement;
 import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
 import static org.fortiss.tooling.kernel.utils.TransformationUtils.createTransformedObjectFor;
@@ -59,8 +60,11 @@ import org.fortiss.af3.expression.model.terms.IExpressionTerm;
 import org.fortiss.af3.expression.model.terms.imperative.Assignment;
 import org.fortiss.af3.expression.model.terms.imperative.IStatementTerm;
 import org.fortiss.af3.expression.model.terms.imperative.StatementSequence;
+import org.fortiss.af3.expression.utils.ExpressionModelElementFactory;
 import org.fortiss.af3.generator.common.model.c.CImplementationFile;
 import org.fortiss.af3.generator.common.model.c.CSourcePackage;
+import org.fortiss.af3.generator.common.model.source.SourcePackage;
+import org.fortiss.af3.generator.common.model.source.StaticContentSourceUnit;
 import org.fortiss.af3.platform.AF3PlatformActivator;
 import org.fortiss.af3.platform.language.executable.ExecutableBase;
 import org.fortiss.af3.platform.language.executable.ExecutionUnitExecutableBase;
@@ -77,6 +81,7 @@ import org.fortiss.af3.platform.model.generic.GenericReceiver;
 import org.fortiss.af3.platform.model.generic.GenericTransceiver;
 import org.fortiss.af3.platform.model.generic.GenericTransmitter;
 import org.fortiss.af3.platform.raspberry.model.Core;
+import org.fortiss.af3.platform.raspberry.templates.RaspberryTemplateLoader;
 import org.fortiss.tooling.kernel.extension.data.ITransformationContext;
 import org.fortiss.tooling.kernel.extension.exception.TransformationFailedException;
 
@@ -148,7 +153,7 @@ public class CoreExecutable extends ExecutionUnitExecutableBase<Core, CSourcePac
 		ComponentProgram program = createComponentProgram("system", init, step);
 		program.getLocalFunctions().add(createTerminationFunction(usedUnits));
 		program.getLocalFunctions().add(createReadInputFunction(deployedPorts, usedTransceivers));
-
+		program.getLocalFunctions().add(createMainFunction());
 		// Fill the system program with the component sub-programs
 		try {
 			// deployed components
@@ -183,9 +188,25 @@ public class CoreExecutable extends ExecutionUnitExecutableBase<Core, CSourcePac
 
 		sourcePackage.getUnits().add(createConfigureFile(modelElement.getName()));
 		sourcePackage.getUnits().add(createMakedefsFile());
+		sourcePackage.getUnits().add(createMakeFileUsingTemplate(sourcePackage, "testName"));
+		sourcePackage.getSrcGenPackage().getUnits().add(createMakeMKUsingTemplate(sourcePackage));
+		sourcePackage.getSrcPackage().getUnits().add(createMakeMKUsingTemplate(sourcePackage));
+		sourcePackage.getIncPackage().getUnits().add(createMakeMKUsingTemplate(sourcePackage));
+		sourcePackage.getIncGenPackage().getUnits().add(createMakeMKUsingTemplate(sourcePackage));
+		sourcePackage.getUnits().add(createMakeMKUsingTemplate(sourcePackage));
 		return sourcePackage;
 	}
 
+	private StaticContentSourceUnit createMakeFileUsingTemplate(SourcePackage pack, String exName) {
+		String content = RaspberryTemplateLoader.getMakeFileTemplate(exName).toString();
+		return createStaticContentSourceUnit("Makefile", content, false);
+	}
+
+	private StaticContentSourceUnit createMakeMKUsingTemplate(SourcePackage pack) {
+		String content = RaspberryTemplateLoader.getMakeMkFileTemplate().toString();
+		return createStaticContentSourceUnit("make.mk", content, false);
+	}
+
 	/** Adds the platform connectors includes. */
 	private void fixSystemCImports(CImplementationFile system,
 			Set<PlatformConnectorUnit> usedUnits, Set<GenericTransceiver> usedTransceivers) {
@@ -297,6 +318,25 @@ public class CoreExecutable extends ExecutionUnitExecutableBase<Core, CSourcePac
 		}
 	}
 
+	/** Creates the main function. */
+	protected LocalFunction createMainFunction() {
+		List<IStatementTerm> body = new ArrayList<IStatementTerm>();
+		String content = "while(1) \n";
+		content += "{\n";
+		content += "printf(\"Loop\\n\"); \n";
+		content += "run_system(); \n";
+		content += "sleep(1); \n";
+		content += "} \n";
+
+		Assignment customAssignment =
+				assignment(ExpressionModelElementFactory.definedConst(content));
+		body.add(assignment(funcCall("initialize_system")));
+		body.add(customAssignment);
+		body.add(assignment(funcCall("terminate_system")));
+
+		return createLocalFunction("main", null, sequence(body));
+	}
+
 	/** Creates the read input function. */
 	protected LocalFunction createReadInputFunction(
 			List<Pair<PlatformConnectorUnit, Port>> deployedPorts,
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
index bbb5e3ec87e3c02e1a4c7d89e5e3c66b46ee21f1..3b5eae63a79f807ac40d73802047d278a8219585 100644
--- 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
@@ -1,15 +1,17 @@
 group MainFileTemplate;
 
-MainFileTemplate(headerFile) ::= <<
+MainFileTemplate() ::= <<
 
-#include "$headerFile$"
-
-int main(int argc, char *argv[]) {
-	initialize_ports();
+int main()
+{
 	initialize_system();
-	while (1) {
+	while(1)
+	{
+		printf("Loop\n");
 		run_system();
+		sleep(1);
 	}
+	terminate_system();
 }
 
 >>
\ No newline at end of file