diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java
index 2eec8c5c91750f7aa0ae0cc6b1f8ab3b59f0a9f2..d74808110ba9a577a59ba6d8d527f6828ea086a9 100644
--- a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java
+++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/executable/RaspberryPIExecutable.java
@@ -36,7 +36,10 @@ import org.fortiss.af3.component.model.Port;
 import org.fortiss.af3.component.model.generator.ComponentProgram;
 import org.fortiss.af3.expression.model.DataDictionary;
 import org.fortiss.af3.expression.model.terms.IExpressionTerm;
+import org.fortiss.af3.generator.common.model.c.AF3GeneratorCommonLanguagesCFactory;
 import org.fortiss.af3.generator.common.model.c.CSourcePackage;
+import org.fortiss.af3.generator.common.model.source.AbstractUnit;
+import org.fortiss.af3.generator.common.model.source.ByteContentUnit;
 import org.fortiss.af3.generator.common.model.source.SourceUnit;
 import org.fortiss.af3.platform.language.executable.ExecutionUnitExecutableBase;
 import org.fortiss.af3.platform.model.ExecutionUnit;
@@ -59,6 +62,7 @@ public class RaspberryPIExecutable extends ExecutionUnitExecutableBase<Raspberry
 
 	private static final String SRC_LIB_SUB_PACKAGE_NAME = "src-lib";
 	private static final String INC_LIB_SUB_PACKAGE_NAME = "inc-lib";
+	private static final String LIB_SUB_PACKAGE_NAME = "lib";
 
 	/** Constructor. */
 	public RaspberryPIExecutable(RaspberryPi modelElement) {
@@ -77,6 +81,7 @@ public class RaspberryPIExecutable extends ExecutionUnitExecutableBase<Raspberry
 			addDataDictionaryCode(context, sourcePackage);
 			addLogicalComponentCode(deployedComponents, context, sourcePackage);
 			addEclipseCProjectFiles(sourcePackage, modelElement.getName());
+			addLibraryCode(sourcePackage);
 		} catch(Exception ex) {
 			error(AF3PlatformRaspberryActivator.getDefault(), ex.getMessage(), ex);
 			ex.printStackTrace();
@@ -84,6 +89,31 @@ public class RaspberryPIExecutable extends ExecutionUnitExecutableBase<Raspberry
 		return sourcePackage;
 	}
 
+	/** Adds the library code need by the deployment code generator. */
+	private void addLibraryCode(CSourcePackage sourcePackage) throws Exception {
+		CSourcePackage srcLib =
+				AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createCSourcePackage();
+		srcLib.setBaseLocation(SRC_LIB_SUB_PACKAGE_NAME);
+		sourcePackage.getSubPackages().add(srcLib);
+
+		CSourcePackage incLib =
+				AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createCSourcePackage();
+		incLib.setBaseLocation(INC_LIB_SUB_PACKAGE_NAME);
+		sourcePackage.getSubPackages().add(incLib);
+
+		CSourcePackage lib = AF3GeneratorCommonLanguagesCFactory.eINSTANCE.createCSourcePackage();
+		incLib.setBaseLocation(LIB_SUB_PACKAGE_NAME);
+		sourcePackage.getSubPackages().add(lib);
+		lib.addUnit(getStaticLibraryUnit("libbrick.a"));
+		// lib.addUnit(getStaticLibraryUnit("libaf3pihal.a"));
+	}
+
+	/** Creates a {@link ByteContentUnit} for the given static library. */
+	private AbstractUnit getStaticLibraryUnit(String libName) throws Exception {
+		return createByteContentUnitForPluginFile(AF3PlatformRaspberryActivator.PLUGIN_ID,
+				"code-gen-hal/lin", libName, false);
+	}
+
 	/** Adds auxiliary files for Eclipse C project. */
 	private void addEclipseCProjectFiles(CSourcePackage sourcePackage, String projectName) {
 		sourcePackage.addUnit(getEclipseProjectFile(projectName));
diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/templates/ConfigureFile.stg b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/templates/ConfigureFile.stg
new file mode 100644
index 0000000000000000000000000000000000000000..b218b7ba38ca4f759b42d56b5152129aef3853cb
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/templates/ConfigureFile.stg
@@ -0,0 +1,64 @@
+group ConfigureFile;
+
+ConfigureFile(binary) ::= <<
+#!/bin/sh
+
+# The application's name.
+APPL="$binary$";
+
+# The root path for this script.
+if [ -z "\$ROOT" ]; then ROOT="."; fi;
+
+# The include and source paths.
+IPATH=". inc-lib inc-gen inc";
+VPATH=". src-lib src-gen src";
+
+# The include file for common make definitions.
+MAKEDEFS="Makedefs";
+
+# The include file for the user make definitions.
+USERDEFS="Userdefs";
+
+# The object file rule prefix.
+PREFIX="\\\${BPATH}/\\\${APPL}.run: \\\${BPATH}/";
+
+# The file which stores the object file list.
+OLIST="Objects";
+
+# Search for source files in the known directories.
+echo "searching for source files ...";
+rm -f \$ROOT/\$OLIST;
+for V in \$VPATH; do if [ \$V != "." ]; then find \$ROOT/\$V -name "*.c" \>\> \$ROOT/\$OLIST; fi; done;
+
+# The absolute path of the Makefile.
+MF=\$ROOT/Makefile;
+
+# Generate the Makefile.
+echo "generating Makefile ...";
+rm -f \$ROOT/Makefile;
+echo "# NOTICE: this Makefile has been generated, so your"                                \>\> \$MF;
+echo "#         modifications may get lost. To rebuild this"                              \>\> \$MF;
+echo "#         file, run the './configure' script."                                      \>\> \$MF;
+echo ""                                                                                   \>\> \$MF;
+echo "# The application's name."                                                          \>\> \$MF;
+echo "APPL=\$APPL"                                                                         \>\> \$MF;
+echo ""                                                                                   \>\> \$MF;
+echo "# The include and source paths."                                                    \>\> \$MF;
+echo "IPATH=\$IPATH"                                                                       \>\> \$MF;
+echo "VPATH=\$VPATH"                                                                       \>\> \$MF;
+echo ""                                                                                   \>\> \$MF;
+echo "# Include the common make definitions."                                             \>\> \$MF;
+echo "include \$MAKEDEFS"                                                                  \>\> \$MF;
+echo ""                                                                                   \>\> \$MF;
+if [ -f \$ROOT/\$USERDEFS ]; then
+    echo "# Include the users make definitions."                                          \>\> \$MF;
+    echo "include \$USERDEFS"                                                              \>\> \$MF;
+    echo ""                                                                               \>\> \$MF;
+fi;
+echo "# The object file rules of this application." \>\> \$ROOT/Makefile;
+cat \$ROOT/\$OLIST | awk 'BEGIN {FS="/"}; {print \$NF}' | sed "s/.c\$/.o/g" \
+                 | awk 'BEGIN {OFS=""}; {print "'"\$PREFIX"'", \$0}' \>\> \$ROOT/Makefile;
+rm -f \$ROOT/\$OLIST;
+exit 0;
+
+>>
diff --git a/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/templates/MakedefsFile.stg b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/templates/MakedefsFile.stg
new file mode 100644
index 0000000000000000000000000000000000000000..8ac69bc8e6a25857dcd7651887393da2b28a86bf
--- /dev/null
+++ b/org.fortiss.af3.platform.raspberry/trunk/src/org/fortiss/af3/platform/raspberry/generator/templates/MakedefsFile.stg
@@ -0,0 +1,52 @@
+group MakedefsFile;
+
+MakedefsFile() ::= <<
+# The default application name.
+ifndef APPL
+    APPL=my_app
+endif
+
+# The default build path.
+ifndef BPATH
+    BPATH=build
+endif
+
+# The compiler.
+ifndef CROSSCC
+    CROSSCC=gcc
+endif
+
+# The linker.
+ifndef CROSSLD
+    CROSSLD=gcc
+endif
+
+# The flags which are passed to the compiler and the linker.
+CCFLAGS+=-std=c99 -Wall -pedantic -c \${patsubst %,-I%,\${subst :, ,\${IPATH}}}
+LDFLAGS+=-std=c99 -Wall -pedantic
+
+# The default rules, i.e. the entry point.
+all: \${BPATH}
+all: \${BPATH}/\${APPL}.run
+
+# The target to clean the build directory.
+clean:
+	@echo "cleaning up path '\${BPATH}' ..."
+	@rm -rf \${BPATH}
+
+# The rule for creating the build directory.
+\${BPATH}:
+	@echo "creating path '\${BPATH}' ..."
+	@mkdir \${BPATH}
+
+# The rule for building an object file from the corresponding C source file.
+\${BPATH}/%.o: %.c
+	@echo "compiling file '\${<}' ..."
+	@\${CROSSCC} \${CCFLAGS} -o \${@} \${<}
+
+# The rule for linking an application.
+\${BPATH}/%.run:
+	@echo "linking application '\${@}' ..."
+	@\${CROSSLD} \${LDFLAGS} -o \${@} \$(filter %.o %.a, \${^})
+
+>>