summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-07-11 04:28:01 (EDT)
committerThomas Schuetz2013-07-11 04:28:01 (EDT)
commit9bdee8894c460f5750e9a32cf59e65baecc262a1 (patch)
tree28cafe83f3a9032b78c71053eacec67426662ff8
parentf38735cdcbbe26845fa75f798907d99ed9124e96 (diff)
downloadorg.eclipse.etrice-9bdee8894c460f5750e9a32cf59e65baecc262a1.zip
org.eclipse.etrice-9bdee8894c460f5750e9a32cf59e65baecc262a1.tar.gz
org.eclipse.etrice-9bdee8894c460f5750e9a32cf59e65baecc262a1.tar.bz2
[doc] changed setup tutorials
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/013-setting-up-the-workspace-for-java.tex8
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/014-setting-up-the-workspace-for-C.tex124
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/020-tutorial-blinky.tex656
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/drafts/tutorial-c-runtime.tex44
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/etrice-doc.tex6
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/014-05-gen_SetupTestC.pngbin0 -> 40063 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/014-06-FinishedCodeGeneration.pngbin0 -> 15062 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/014-07-Compile.pngbin0 -> 51447 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/014-08-RunAsC-CPP-Application.pngbin0 -> 44657 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspace007.pngbin0 -> 36972 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspaceC005.pngbin0 -> 49497 bytes
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt8
12 files changed, 445 insertions, 401 deletions
diff --git a/plugins/org.eclipse.etrice.doc/doc/013-setting-up-the-workspace-for-java.tex b/plugins/org.eclipse.etrice.doc/doc/013-setting-up-the-workspace-for-java.tex
index fcdf8fc..9904916 100644
--- a/plugins/org.eclipse.etrice.doc/doc/013-setting-up-the-workspace-for-java.tex
+++ b/plugins/org.eclipse.etrice.doc/doc/013-setting-up-the-workspace-for-java.tex
@@ -15,17 +15,17 @@ After installation of eclipse and the \eTrice{} plug in, your workspace should l
\includegraphics[width=0.8\textwidth]{images/013-SetupWorkspace01.png}
% !images/013-SetupWorkspace01.png!
-\newpage
Just the \eTrice{} menu item is visible of the installed \eTrice{} plugins.
+\newpage
Select the menu \emph{File->New->Other}
\includegraphics[width=0.6\textwidth]{images/013-SetupWorkspace02.png}
% !images/013-SetupWorkspace02.png!
-Open the \eTrice{} tab and select \textit{\eTrice{} Java Runtime}
+Open the \emph{eTrice} tab and select \textit{eTrice Java Runtime}
-Press \textit{Next} and \textit{Finish} to install the Runtime into your workspace.
+Press \emph{Next} and \emph{Finish} to install the Runtime into your workspace.
\includegraphics[width=0.6\textwidth]{images/013-SetupWorkspace03.png}
% !images/013-SetupWorkspace03.png!
@@ -56,7 +56,7 @@ The successful generation ends with \emph{Info: -- finished code generation} in
% !images/013-SetupWorkspace051.png!
For each tutorial in the folder src-gen a java package is generated including a java file called
-\emph{SubSys<...>Runner.java} . To run the a generated application simply run this file as a java application.
+\emph{SubSys<...>Runner.java} . To run the generated application simply run this file as a java application.
Try this with the file \emph{src-gen/SetupTest\_Model/SubSysClass1Runner.java} :
\includegraphics[width=0.6\textwidth]{images/013-SetupWorkspace06.png}
diff --git a/plugins/org.eclipse.etrice.doc/doc/014-setting-up-the-workspace-for-C.tex b/plugins/org.eclipse.etrice.doc/doc/014-setting-up-the-workspace-for-C.tex
index 476ff61..355bdfe 100644
--- a/plugins/org.eclipse.etrice.doc/doc/014-setting-up-the-workspace-for-C.tex
+++ b/plugins/org.eclipse.etrice.doc/doc/014-setting-up-the-workspace-for-C.tex
@@ -1,100 +1,88 @@
\section{Setting up the Workspace for C Projects}
-
-Before you can start with C, some preconditions must be fulfilled:
+\textbf{Objectives for this tutorial:}
\begin{itemize}
-\item A C compiler must be installed on your machine. All tutorials are based on MinGW/GCC (Windows) and Posix/GCC (Linux), but currently only tested on Windows with MinGW/GCC
-\item The CDT-Eclipse plugin must be installed as the C development environment.
+ \item create all needed library projects (runtime.c and modellib.c)
+ \item create the tutorial project with the examples
+ \item create the project with a traffic light simulator
+ \item test the workspace setup by running one of the examples
\end{itemize}
-Once the CDT is installed, the C runtime and model library must be imported.
-(\textit{File->New->Project->\eTrice{}} select \textit{\eTrice{} C runtime} / \textit{\eTrice{} C modellib})
-
-The resulting workspace should look like this:
-
-\includegraphics{images/014-SetupWorkspaceC01.png}
-% !images/014-SetupWorkspaceC01.png!
+\subsection{Create Library, Tutorial and Simulator Projects}
+Before you can start with C, some preconditions must be fulfilled:
-\subsection{Testing the environment}
+\begin{itemize}
+\item A C compiler must be installed on your machine. All tutorials are based on MinGW/GCC (Windows) and Posix/GCC (Linux), but currently only tested on Windows with MinGW/GCC
+\item The CDT-Eclipse plugin must be installed as the C development environment.
+\end{itemize}
-To verify the C tool chain you should generate and run the Hello World example program of the CDT.
-Activate the \textit{C/C++} perspective.
+After installation of eclipse and the \eTrice{} plug in, your workspace should look like this:
-\includegraphics{images/014-SetupWorkspaceC03.png}
-% !images/014-SetupWorkspaceC03.png!
-
-From the main menu select \textit{File->New->C Project}.
-
-\includegraphics{images/014-SetupWorkspaceC02.png}
-% !images/014-SetupWorkspaceC02.png!
+\includegraphics[width=0.8\textwidth]{images/013-SetupWorkspace01.png}
+% !images/013-SetupWorkspace01.png!
-Name the project. Select an \textit{Executable->Hello World ANSI C} as project type, \textit{MinGW GCC} as
-tool chain and click \textit{Finish}.
-
-\includegraphics{images/014-SetupWorkspaceC04.png}
-% !images/014-SetupWorkspaceC04.png!
+Just the \eTrice{} menu item is visible of the installed \eTrice{} plugins.
-Select the new project and click the build button (or right click the project and select \textit{Build
-Project})
+\newpage
+Select the menu \emph{File->New->Other}
-\includegraphics{images/014-SetupWorkspaceC05.png}
-% !images/014-SetupWorkspaceC05.png!
+\includegraphics[width=0.6\textwidth]{images/013-SetupWorkspace02.png}
+% !images/013-SetupWorkspace02.png!
-The binary should be generated. Run the binary as \textit{Local C/C++ Application}.
+Open the \emph{eTrice} tab and select \textit{eTrice C Runtime}
-\includegraphics{images/014-SetupWorkspaceC06.png}
-% !images/014-SetupWorkspaceC06.png!
+Press \emph{Next} and \emph{Finish} to install the Runtime into your workspace.
-Verify the output.
+\includegraphics[width=0.6\textwidth]{images/014-SetupWorkspaceC005.png}
+% !images/014-SetupWorkspaceC005.png!
-\includegraphics{images/014-SetupWorkspaceC07.png}
-% !images/014-SetupWorkspaceC07.png!
+\newpage
+Do the same steps for \textit{eTrice C Modellib}, \textit{eTrice C Tutorials} and \textit{eTrice Trafficlight for Tutorials}. To avoid temporary
+error markers you should keep the proposed order of installation. The resulting workspace should look like
+this:
-Remember these steps. In the following Tutorials these steps will be referenced as \textit{build and run}.
+\includegraphics[width=0.5\textwidth]{images/014-SetupWorkspace007.png}
+% !images/014-SetupWorkspace007.png!
+\subsection{Perform Setup Test}
-\subsection{Building the C runtime system}
+To check the correct setup of your workspace we run a little testproject contained in the tutorial project.
-The C runtime system contains some basic functionalities to run the generated models. The so called
-runtime is common for all C projects. The requirements for several projects may differ depending on the
-functionality of the model or the resources of the different platforms. Therefore the runtime is
-configurable in terms of message queue size, frequency and memory alignment. The configuration file
-\textit{etRuntimeConfig.h} is located in \textit{src/config}.
+The tutorial models are available in the \emph{org.eclipse.etrice.tutorials.c} project. All tutorials are ready to generate and run without any changes. To test the code generator and the workspace setup simply run
+\emph{gen\_SetupTestC.launch} as \emph{gen\_SetupTestC}:
-After changing the configuration, the runtime must be built.
+\includegraphics[width=0.6\textwidth]{images/014-05-gen_SetupTestC.png}
+% !images/014-05-gen_SetupTestC.png!
-Open the properties of the \textit{org.eclipse.runtime.c} project and select \textit{C/C++
-Build->Settings->Tool Settings} and select \textit{Includes}.
+\newpage
+The successful generation ends with \emph{Info: -- finished code generation} in the Console.
-\includegraphics{images/014-SetupWorkspaceC08.png}
-% !images/014-SetupWorkspaceC08.png!
+\includegraphics[width=0.5\textwidth]{images/014-06-FinishedCodeGeneration.png}
+% !014-06-FinishedCodeGeneration.png!
-Verify the include paths
+For each tutorial in the folder src-gen a sub folder is generated which contains the generated code. The file \emph{<...>\_Runner.c} contains the main function. To run the generated application you first have to compile the project (with the hammer symbol in the C/C++ Perspective).
-\begin{itemize}
-\item \textit{src/config}
-\item \textit{src/common}
-\item \textit{src/platforms/generic}
-\end{itemize}
+\includegraphics[width=0.5\textwidth]{images/014-07-Compile.png}
+% !014-07-Compile.png!
-Within the Setting dialog select the tab \textit{Build Artefact} and select \textit{Static Library}
+If the compilitation does not succeed, make sure to clean and compile the projects \emph{org.eclipse.etrice.runtime.c} and \emph{org.eclipse.etrice.modellib.c} with the correct build configuration for your platform. Depending on the setup of your C compiler and CDT you might have to change the pre defined build configurations \emph{MinGWDebug} or \emph{PosixDebug}.
-\includegraphics{images/014-SetupWorkspaceC09.png}
-% !images/014-SetupWorkspaceC09.png!
+After the successful compilation you can run the application as \emph{Local C/C++ Application}.
-Build the runtime by clicking
+\includegraphics[width=0.7\textwidth]{images/014-08-RunAsC-CPP-Application.png}
+% !images/014-08-RunAsC-CPP-Application.png!
-\includegraphics{images/014-SetupWorkspaceC10.png}
-% !images/014-SetupWorkspaceC10.png!
+\newpage
+To stop the application type \emph{quit} in the console window. If your Console contains the lines
+\newline\emph{******************}
+\newline\emph{*** Setup OK ***}
+\newline\emph{******************}
+\newline your setup should be ok.
-The runtime library should be created.
+%TODO : update screenshot
+\includegraphics[width=0.6\textwidth]{images/013-SetupWorkspace07.png}
+% !images/013-SetupWorkspace07.png!
-\includegraphics{images/014-SetupWorkspaceC11.png}
-% !images/014-SetupWorkspaceC11.png!
+Now the workspace is set up and you can perform the tutorials or start with your work.
-For the tutorials one runtime library should be sufficient. For embedded projects it might be necessary to
-build project specific runtime libraries. In this case a separate project for the runtime should be
-created. Symbolic links to the sources might be used to avoid duplicate files. Just the configuration file
-must be duplicated. A specific library file must exist within the project. Such specific runtime libraries
-might be referenced from several applications.
diff --git a/plugins/org.eclipse.etrice.doc/doc/020-tutorial-blinky.tex b/plugins/org.eclipse.etrice.doc/doc/020-tutorial-blinky.tex
index 41a44c1..92a52c8 100644
--- a/plugins/org.eclipse.etrice.doc/doc/020-tutorial-blinky.tex
+++ b/plugins/org.eclipse.etrice.doc/doc/020-tutorial-blinky.tex
@@ -1,322 +1,334 @@
-\section{Tutorial Blinky (Java)}
-
-\subsection{Scope}
-
-This tutorial describes how to use the \textit{TimingService}, how to combine a generated model with
-manual code and how to model a hierarchical state machine. The idea of the tutorial is to switch a LED on
-and off. The behavior of the LED should be: blinking in a one second interval for 5 seconds, stop blinking
-for 5 seconds, blinking, stop,...
-For this exercise we will use a little GUI class that will be used in more sophisticated tutorials too.
-The GUI simulates a pedestrian traffic crossing. For now, just a simple LED simulation will be used from
-the GUI.
-
-After the exercise is created you must copy the GUI to your src directory (see below).
-
-The package contains four java classes which implements a small window with a 3-light traffic light which
-simulates the signals for the car traffic and a 2-light traffic light which simulates the pedestrian
-signals.
-
-The GUI looks like this:
-
-\includegraphics{images/020-Blinky08.png}
-% !images/020-Blinky08.png!
-
-Within this tutorial we will just toggle the yellow light.
-
-You will perform the following steps:
-
-\begin{enumerate}
-\item create a new model from scratch
-\item define a protocol
-\item create an actor structure
-\item create a hierarchical state machine
-\item use the predefined \textit{TimingService}
-\item combine manual code with generated code
-\item build and run the model
-\item open the message sequence chart
-\end{enumerate}
-
-\subsection{Create a new model from scratch}
-
-Remember the exercise \textit{HelloWorld}.
-Create a new \eTrice{} project and name it \textit{Blinky}.
-
-To use the GUI please copy the package \textit{org.eclipse.etrice.tutorials.PedLightGUI} from
-\textit{org.eclipse.etrice.tutorials/src} to your \emph{src} directory \textit{Blinky/src}. For this tutorial
-you must remove the error markers by editing the file \textit{PedestrianLightWndNoTcp.java}. Appropriate
-comments are provided to remove the error markers for this turorial.
-
-Open the \textit{Blinky.room} file and copy the following code into the file or use content assist to
-create the model.
-
-\begin{verbatim}
-RoomModel Blinky {
-
- LogicalSystem System_Blinky {
- SubSystemRef subsystem : SubSystem_Blinky
- }
-
- SubSystemClass SubSystem_Blinky {
- ActorRef application : BlinkyTop
- }
-
- ActorClass BlinkyTop {
- }
-}
-\end{verbatim}
-
-\subsection{Add two additional actor classes}
-
-Position the cursor outside any class definition and right click the mouse within the editor window. From
-the context menu select \textit{Content Assist}
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky02.png}
-% !images/020-Blinky02.png!
-
-Select \textit{ActorClass - actor class skeleton} and name it \textit{Blinky}.
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky01.png}
-% !images/020-Blinky01.png!
-
-Repeat the described procedure and name the new actor \textit{BlinkyController}.
-
-With Ctrl+Shift+F you can beautify the model code.
-
-Save the model and visit the outline view.
-
-\subsection{Create a new protocol}
-
-With the help of \textit{Content Assist} create a \textit{ProtocolClass} and name it
-\textit{BlinkyControlProtocol}.
-Inside the brackets use the \textit{Content Assist} (CTRL+Space) to create two incoming messages called
-\textit{start} and \textit{stop}.
-
-The resulting code should look like this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky03.png}
-% !images/020-Blinky03.png!
-
-With Ctrl-Shift+F or selecting \textit{Format} from the context menu you can format the text. Note that
-all elements are displayed in the outline view.
-
-\subsection{Import the Timing Service}
-
-Switching on and off the LED is timing controlled. The timing service is provided from the model library
-and must be imported before it can be used from the model.
-
-This is the first time you use an element from the modellib. Make sure that your Java Build Path has the
-appropriate entry to the modellib. Otherwise the jave code, which will be generated from the modellib, can
-not be referenced.
-(right click to \textit{Blinky} and select properties. Select the \textit{Java Build Path} tab)
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky16.png}
-% !images/020-Blinky16.png!
-
-After the build path is set up return to the model and navigate the cursor at the beginning of the model
-and import the timing service:
-
-\begin{small}
-\begin{verbatim}
-RoomModel Blinky {
-
- import room.basic.service.timing.* from
- "../../org.eclipse.etrice.modellib/models/TimingService.room"
-
- LogicalSystem System_Blinky {
- SubSystemRef subsystem: SubSystem\_Blinky
- }
-}
-...
-\end{verbatim}
-\end{small}
-
-Make sure that the path fits to your folder structure. The original tutorial code is different due to the
-folder structure.
-
-Now it can be used within the model. Right click to \textbf{SubSystem\_Blinky} within the outline view.
-Select \textit{Edit Structure}. The \textit{application} is already referenced in the subsystem. Drag and
-Drop an \textit{ActorRef} to the \textbf{SubSystem\_Blinky} and name it \textit{timingService}. From the
-actor class drop down list select \textit{room.basic.service.timing.ATimingService}. Draw a
-\textit{LayerConnection} from \textit{application} to each service provision point (SPP) of the
-\textit{timingService}. The resulting structure should look like this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky06.png}
-% !images/020-Blinky06.png!
-
-The current version of \eTrice{} does not provide a graphical element for a service access point (SAP).
-Therefore the SAPs to access the timing service must be added in the .room file. Open the
-\textit{Blinky.room} file and navigate to the \textit{Blinky} actor. Add the following line to the
-structure of the actor:
-
-\begin{verbatim}SAP timer: room.basic.service.timing.PTimeout \end{verbatim}
-
-Do the same thing for \textit{BlinkyController}.
-
-The resulting code should look like this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky07.png}
-% !images/020-Blinky07.png!
-
-
-\subsection{Finish the model structure}
-
-From the outline view right click to \textit{Blinky} and select \textit{Edit Structure}. Drag and Drop an
-\textit{Interface Port} to the boarder of the \textit{Blinky} actor. Note that an interface port is not
-possible inside the actor. Name the port \textit{ControlPort} and select \textit{BlinkyControlProtocol}
-from the drop down list. Uncheck \textit{Conjugated} and \textit{Is Relay Port}. Click \textit{ok}. The
-resulting structure should look like this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky04.png}
-% !images/020-Blinky04.png!
-
-Repeat the above steps for the \textit{BlinkyController}. Make the port \textit{Conjugated}
-
-Keep in mind that the protocol defines \textit{start} and \textit{stop} as incoming messages.
-\textit{Blinky} receives this messages and therefore \textit{Blinky}'s \textit{ControlPort} must be a
-regular port and \textit{BlinkyController}'s \textit{ControlPort} must be a conjugated port.
-
-
-From the outline view right click \textit{BlinkyTop} and select \textit{Edit Structure}.
-
-Drag and Drop an \textit{ActorRef} inside the \textit{BlinkyTop} actor. Name it \textit{blinky}. From the
-actor class drop down list select \textit{Blinky}. Do the same for \textit{controller}. Connect the ports
-via the binding tool. The resulting structure should look like this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky05.png}
-% !images/020-Blinky05.png!
-
-\subsection{Implement the Behavior}
-
-The application should switch on and off the LED for 5 seconds in a 1 second interval, then stop blinking
-for 5 seconds and start again. To implement this behavior we will implement two FSMs. One for the 1 second
-interval and one for the 5 second interval. The 1 second blinking should be implemented in
-\textit{Blinky}. The 5 second interval should be implemented in \textit{BlinkyController}. First implement
-the Controller.
-
-Right click to \textit{BlinkyController} and select \textit{Edit Behavior}.
-Drag and Drop the \textit{Initial Point} and two \textit{States} into the top state. Name the states
-\textit{on} and \textit{off}.
-Use the \textit{Transition} tool to draw transitions from \textit{init} to \textit{on} from \textit{on} to
-\textit{off} and from \textit{off} to \textit{on}.
-
-Open the transition dialog by double click the arrow to specify the trigger event and the action code of
-each transition. Note that the initial transition does not have a trigger event.
-
-The transition dialog should look like this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky09.png}
-% !{width=500px}images/020-Blinky09.png!
-
-The defined ports will be generated as a member attribute of the actor class from type of the attached
-protocol. So, to send e message you must state \textit{port.message(param);}. In this example
-\textit{ControlPort.start()} sends the \textit{start} message via the \textit{ControlPort} to the outside
-world. Assuming that \textit{Blinky} is connected to this port, the message will start the one second
-blinking FSM. It is the same thing with the \textit{timer}. The SAP is also a port and follows the same
-rules. So it is clear that \textit{timer.Start(5000);} will send the \textit{Start} message to the timing
-service. The timing service will send a \textit{timeoutTick} message back after 5000ms.
-
-Within each transition the timer will be restarted and the appropriate message will be sent via the
-\textit{ControlPort}.
-
-The resulting state machine should look like this:
-(Note that the arrows peak changes if the transition contains action code.)
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky10.png}
-% !images/020-Blinky10.png!
-
-Save the diagram and inspect the \textit{Blinky.room} file. The \textit{BlinkyController} should look like
-this:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky11.png}
-% !images/020-Blinky11.png!
-
-Now we will implement \textit{Blinky}. Due to the fact that \textit{Blinky} interacts with the GUI class a
-view things must to be done in the model file.
-
-Double click \textit{Blinky} in the outline view to navigate to \textit{Blinky} within the model file.
-Add the following code:
-(type it or simply copy it from the tutorial project)
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky12.png}
-% !images/020-Blinky12.png!
-
-\textit{usercode1} will be generated at the beginning of the file, outside the class definition.
-\textit{usercode2} will be generated within the class definition. The code imports the GUI class and
-instantiates the window class. Attributes for the carLights and pedLights will be declared to easily
-access the lights in the state machine.
-The Operation \textit{destroyUser()} is a predefined operation that will be called during shutdown of the
-application. Within this operation, cleanup of manual coded classes can be done.
-
-Now design the FSM of \textit{Blinky}. Remember, as the name suggested \textit{blinking} is a state in
-which the LED must be switched on and off. We will realize that by an hierarchical FSM in which the
-\textit{blinking} state has two sub states.
-
-Open the behavior diagram of \textit{Blinky} by right clicking the \textit{Blinky} actor in the outline
-view. Create two states named \textit{blinking} and \textit{off}. Right click to \textit{blinking} and
-create a subgraph.
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky13.png}
-% !images/020-Blinky13.png!
-
-Create the following state machine. The trigger events between \textit{on} and \textit{off} are the
-\textit{timeoutTick} from the \textit{timer} port.
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky14.png}
-% !images/020-Blinky14.png!
-
-Create entry code for both states by right clicking the state and select \textit{Edit State...}
-
-Entry code of \textit{on} is:
-
-\begin{verbatim}
-timer.Start(1000);
-carLights.setState(TrafficLight3.YELLOW);
-\end{verbatim}
-
-
-Entry code of \textit{off} is:
-
-\begin{verbatim}
-timer.Start(1000);
-carLights.setState(TrafficLight3.OFF);
-\end{verbatim}
-
-Navigate to the Top level state by double clicking the \textit{/blinking} state. Create the following
-state machine:
-
-\includegraphics[width=0.8\textwidth]{images/020-Blinky15.png}
-% !images/020-Blinky15.png!
-
-The trigger event from \textit{off} to \textit{blinking} is the \textit{start} event from the
-\textit{ControlPort}.The trigger event from \textit{blinking} to \textit{off} is the \textit{stop} event
-from the \textit{ControlPort}.
-Note: The transition from \textit{blinking} to \textit{off} is a so called group transition. This is a
-outgoing transition from a super state (state with sub states) without specifying the concrete leave state
-(state without sub states). An incoming transition to a super state is called history transition.
-
-Action code of the init transition is:
-
-\begin{verbatim}
-carLights = light.getCarLights();
-pedLights = light.getPedLights();
-carLights.setState(TrafficLight3.OFF);
-pedLights.setState(TrafficLight2.OFF);
-\end{verbatim}
-
-Action code from \textit{blinking} to \textit{off} is:
-
-\begin{verbatim}
-timer.Kill();
-carLights.setState(TrafficLight3.OFF);
-\end{verbatim}
-
-The model is complete now. You can run and debug the model as described in getting started. Have fun.
-
-The complete model can be found in /org.eclipse.etrice.tutorials/model/Blinky.
-
-\subsection{Summary}
-
-Run the model and take a look at the generated MSCs. Inspect the generated code to understand the runtime
-model of \eTrice{}. Within this tutorial you have learned how to create a hierarchical FSM with group
-transitions and history transitions and you have used entry code. You are now familiar with the basic
-features of \eTrice{}. The further tutorials will take this knowledge as a precondition.
+\section{Tutorial Blinky (Java)}
+
+\subsection{Scope}
+
+This tutorial describes how to use the \textit{TimingService}, how to combine a generated model with
+manual code and how to model a hierarchical state machine. The idea of the tutorial is to switch a LED on
+and off. The behavior of the LED should be: blinking in a one second interval for 5 seconds, stop blinking
+for 5 seconds, blinking, stop,...
+For this exercise we will use a little GUI class that will be used in more sophisticated tutorials too.
+The GUI simulates a pedestrian traffic crossing. For now, just a simple LED simulation will be used from
+the GUI.
+
+After the exercise is created you must copy the GUI to your src directory (see below).
+
+The package contains four java classes which implements a small window with a 3-light traffic light which
+simulates the signals for the car traffic and a 2-light traffic light which simulates the pedestrian
+signals.
+
+The GUI looks like this:
+
+\includegraphics{images/020-Blinky08.png}
+% !images/020-Blinky08.png!
+
+Within this tutorial we will just toggle the yellow light.
+
+You will perform the following steps:
+
+\begin{enumerate}
+\item create a new model from scratch
+\item define a protocol
+\item create an actor structure
+\item create a hierarchical state machine
+\item use the predefined \textit{TimingService}
+\item combine manual code with generated code
+\item build and run the model
+\item open the message sequence chart
+\end{enumerate}
+
+\subsection{Create a new model from scratch}
+
+Remember the exercise \textit{HelloWorld}.
+Create a new \eTrice{} project and name it \textit{Blinky}.
+
+To use the GUI please copy the package \textit{org.eclipse.etrice.tutorials.PedLightGUI} from
+\textit{org.eclipse.etrice.tutorials/src} to your \emph{src} directory \textit{Blinky/src}. For this tutorial
+you must remove the error markers by editing the file \textit{PedestrianLightWndNoTcp.java}. Appropriate
+comments are provided to remove the error markers for this turorial.
+
+Open the \textit{Blinky.room} file and copy the following code into the file or use content assist to
+create the model.
+
+\begin{verbatim}
+RoomModel Blinky {
+
+ LogicalSystem System_Blinky {
+ SubSystemRef subsystem : SubSystem_Blinky
+ }
+
+ SubSystemClass SubSystem_Blinky {
+ ActorRef application : BlinkyTop
+ }
+
+ ActorClass BlinkyTop {
+ }
+}
+\end{verbatim}
+
+\subsection{Add two additional actor classes}
+
+Position the cursor outside any class definition and right click the mouse within the editor window. From
+the context menu select \textit{Content Assist}
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky02.png}
+% !images/020-Blinky02.png!
+
+Select \textit{ActorClass - actor class skeleton} and name it \textit{Blinky}.
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky01.png}
+% !images/020-Blinky01.png!
+
+Repeat the described procedure and name the new actor \textit{BlinkyController}.
+
+With Ctrl+Shift+F you can beautify the model code.
+
+Save the model and visit the outline view.
+
+\subsection{Create a new protocol}
+
+With the help of \textit{Content Assist} create a \textit{ProtocolClass} and name it
+\textit{BlinkyControlProtocol}.
+Inside the brackets use the \textit{Content Assist} (CTRL+Space) to create two incoming messages called
+\textit{start} and \textit{stop}.
+
+The resulting code should look like this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky03.png}
+% !images/020-Blinky03.png!
+
+With Ctrl-Shift+F or selecting \textit{Format} from the context menu you can format the text. Note that
+all elements are displayed in the outline view.
+
+\subsection{Import the Timing Service}
+
+Switching on and off the LED is timing controlled. The timing service is provided from the model library
+and must be imported before it can be used from the model.
+
+This is the first time you use an element from the modellib. Make sure that your Java Build Path has the
+appropriate entry to the modellib. Otherwise the jave code, which will be generated from the modellib, can
+not be referenced.
+(right click to \textit{Blinky} and select properties. Select the \textit{Java Build Path} tab)
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky16.png}
+% !images/020-Blinky16.png!
+
+After the build path is set up return to the model and navigate the cursor at the beginning of the model
+and import the timing service:
+
+\begin{small}
+\begin{verbatim}
+RoomModel Blinky {
+
+ import room.basic.service.timing.* from
+ "../../org.eclipse.etrice.modellib/models/TimingService.room"
+
+ LogicalSystem System_Blinky {
+ SubSystemRef subsystem: SubSystem\_Blinky
+ }
+}
+...
+\end{verbatim}
+\end{small}
+
+Make sure that the path fits to your folder structure. The original tutorial code is different due to the
+folder structure.
+
+Now it can be used within the model. Right click to \textbf{SubSystem\_Blinky} within the outline view.
+Select \textit{Edit Structure}. The \textit{application} is already referenced in the subsystem. Drag and
+Drop an \textit{ActorRef} to the \textbf{SubSystem\_Blinky} and name it \textit{timingService}. From the
+actor class drop down list select \textit{room.basic.service.timing.ATimingService}. Draw a
+\textit{LayerConnection} from \textit{application} to each service provision point (SPP) of the
+\textit{timingService}. The resulting structure should look like this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky06.png}
+% !images/020-Blinky06.png!
+
+The current version of \eTrice{} does not provide a graphical element for a service access point (SAP).
+Therefore the SAPs to access the timing service must be added in the .room file. Open the
+\textit{Blinky.room} file and navigate to the \textit{Blinky} actor. Add the following line to the
+structure of the actor:
+
+\begin{verbatim}SAP timer: room.basic.service.timing.PTimeout \end{verbatim}
+
+Do the same thing for \textit{BlinkyController}.
+
+The resulting code should look like this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky07.png}
+% !images/020-Blinky07.png!
+
+
+\subsection{Finish the model structure}
+
+From the outline view right click to \textit{Blinky} and select \textit{Edit Structure}. Drag and Drop an
+\textit{Interface Port} to the boarder of the \textit{Blinky} actor. Note that an interface port is not
+possible inside the actor. Name the port \textit{ControlPort} and select \textit{BlinkyControlProtocol}
+from the drop down list. Uncheck \textit{Conjugated} and \textit{Is Relay Port}. Click \textit{ok}. The
+resulting structure should look like this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky04.png}
+% !images/020-Blinky04.png!
+
+Repeat the above steps for the \textit{BlinkyController}. Make the port \textit{Conjugated}
+
+Keep in mind that the protocol defines \textit{start} and \textit{stop} as incoming messages.
+\textit{Blinky} receives this messages and therefore \textit{Blinky}'s \textit{ControlPort} must be a
+regular port and \textit{BlinkyController}'s \textit{ControlPort} must be a conjugated port.
+
+
+From the outline view right click \textit{BlinkyTop} and select \textit{Edit Structure}.
+
+Drag and Drop an \textit{ActorRef} inside the \textit{BlinkyTop} actor. Name it \textit{blinky}. From the
+actor class drop down list select \textit{Blinky}. Do the same for \textit{controller}. Connect the ports
+via the binding tool. The resulting structure should look like this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky05.png}
+% !images/020-Blinky05.png!
+
+\subsection{Implement the Behavior}
+
+The application should switch on and off the LED for 5 seconds in a 1 second interval, then stop blinking
+for 5 seconds and start again. To implement this behavior we will implement two FSMs. One for the 1 second
+interval and one for the 5 second interval. The 1 second blinking should be implemented in
+\textit{Blinky}. The 5 second interval should be implemented in \textit{BlinkyController}. First implement
+the Controller.
+
+Right click to \textit{BlinkyController} and select \textit{Edit Behavior}.
+Drag and Drop the \textit{Initial Point} and two \textit{States} into the top state. Name the states
+\textit{on} and \textit{off}.
+Use the \textit{Transition} tool to draw transitions from \textit{init} to \textit{on} from \textit{on} to
+\textit{off} and from \textit{off} to \textit{on}.
+
+Open the transition dialog by double click the arrow to specify the trigger event and the action code of
+each transition. Note that the initial transition does not have a trigger event.
+
+The transition dialog should look like this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky09.png}
+% !{width=500px}images/020-Blinky09.png!
+
+The defined ports will be generated as a member attribute of the actor class from type of the attached
+protocol. So, to send e message you must state \textit{port.message(param);}. In this example
+\textit{ControlPort.start()} sends the \textit{start} message via the \textit{ControlPort} to the outside
+world. Assuming that \textit{Blinky} is connected to this port, the message will start the one second
+blinking FSM. It is the same thing with the \textit{timer}. The SAP is also a port and follows the same
+rules. So it is clear that \textit{timer.Start(5000);} will send the \textit{Start} message to the timing
+service. The timing service will send a \textit{timeoutTick} message back after 5000ms.
+
+Within each transition the timer will be restarted and the appropriate message will be sent via the
+\textit{ControlPort}.
+
+The resulting state machine should look like this:
+(Note that the arrows peak changes if the transition contains action code.)
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky10.png}
+% !images/020-Blinky10.png!
+
+Save the diagram and inspect the \textit{Blinky.room} file. The \textit{BlinkyController} should look like
+this:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky11.png}
+% !images/020-Blinky11.png!
+
+Now we will implement \textit{Blinky}. Due to the fact that \textit{Blinky} interacts with the GUI class a
+view things must to be done in the model file.
+
+Double click \textit{Blinky} in the outline view to navigate to \textit{Blinky} within the model file.
+Add the following code:
+(type it or simply copy it from the tutorial project)
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky12.png}
+% !images/020-Blinky12.png!
+
+\textit{usercode1} will be generated at the beginning of the file, outside the class definition.
+\textit{usercode2} will be generated within the class definition. The code imports the GUI class and
+instantiates the window class. Attributes for the carLights and pedLights will be declared to easily
+access the lights in the state machine.
+The Operation \textit{destroyUser()} is a predefined operation that will be called during shutdown of the
+application. Within this operation, cleanup of manual coded classes can be done.
+
+Now design the FSM of \textit{Blinky}. Remember, as the name suggested \textit{blinking} is a state in
+which the LED must be switched on and off. We will realize that by an hierarchical FSM in which the
+\textit{blinking} state has two sub states.
+
+Open the behavior diagram of \textit{Blinky} by right clicking the \textit{Blinky} actor in the outline
+view. Create two states named \textit{blinking} and \textit{off}. Right click to \textit{blinking} and
+create a subgraph.
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky13.png}
+% !images/020-Blinky13.png!
+
+Create the following state machine. The trigger events between \textit{on} and \textit{off} are the
+\textit{timeoutTick} from the \textit{timer} port.
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky14.png}
+% !images/020-Blinky14.png!
+
+Create entry code for both states by right clicking the state and select \textit{Edit State...}
+
+Entry code of \textit{on} is:
+
+\begin{verbatim}
+timer.Start(1000);
+carLights.setState(TrafficLight3.YELLOW);
+\end{verbatim}
+
+
+Entry code of \textit{off} is:
+
+\begin{verbatim}
+timer.Start(1000);
+carLights.setState(TrafficLight3.OFF);
+\end{verbatim}
+
+Navigate to the Top level state by double clicking the \textit{/blinking} state. Create the following
+state machine:
+
+\includegraphics[width=0.8\textwidth]{images/020-Blinky15.png}
+% !images/020-Blinky15.png!
+
+The trigger event from \textit{off} to \textit{blinking} is the \textit{start} event from the
+\textit{ControlPort}.The trigger event from \textit{blinking} to \textit{off} is the \textit{stop} event
+from the \textit{ControlPort}.
+Note: The transition from \textit{blinking} to \textit{off} is a so called group transition. This is a
+outgoing transition from a super state (state with sub states) without specifying the concrete leave state
+(state without sub states). An incoming transition to a super state is called history transition.
+
+Action code of the init transition is:
+
+\begin{verbatim}
+carLights = light.getCarLights();
+pedLights = light.getPedLights();
+carLights.setState(TrafficLight3.OFF);
+pedLights.setState(TrafficLight2.OFF);
+\end{verbatim}
+
+Action code from \textit{blinking} to \textit{off} is:
+
+\begin{verbatim}
+timer.Kill();
+carLights.setState(TrafficLight3.OFF);
+\end{verbatim}
+
+The model is complete now. You can run and debug the model as described in getting started. Have fun.
+
+The complete model can be found in /org.eclipse.etrice.tutorials/model/Blinky.
+
+\subsection{Summary}
+
+Run the model and take a look at the generated MSCs. Inspect the generated code to understand the runtime
+model of \eTrice{}. Within this tutorial you have learned how to create a hierarchical FSM with group
+transitions and history transitions and you have used entry code. You are now familiar with the basic
+features of \eTrice{}. The further tutorials will take this knowledge as a precondition.
+
+\begin{figure}[ht]
+\begin{minipage}[b]{0.45\linewidth}
+\centering
+Text1
+\end{minipage}
+\hspace{0.5cm}
+\begin{minipage}[b]{0.45\linewidth}
+\centering
+Text2
+\end{minipage}
+\end{figure} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.doc/doc/drafts/tutorial-c-runtime.tex b/plugins/org.eclipse.etrice.doc/doc/drafts/tutorial-c-runtime.tex
new file mode 100644
index 0000000..d4dcd35
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/drafts/tutorial-c-runtime.tex
@@ -0,0 +1,44 @@
+\subsection{Building the C runtime system}
+
+The C runtime system contains some basic functionalities to run the generated models. The so called
+runtime is common for all C projects. The requirements for several projects may differ depending on the
+functionality of the model or the resources of the different platforms. Therefore the runtime is
+configurable in terms of message queue size, frequency and memory alignment. The configuration file
+\textit{etRuntimeConfig.h} is located in \textit{src/config}.
+
+After changing the configuration, the runtime must be built.
+
+Open the properties of the \textit{org.eclipse.runtime.c} project and select \textit{C/C++
+Build->Settings->Tool Settings} and select \textit{Includes}.
+
+\includegraphics{images/014-SetupWorkspaceC08.png}
+% !images/014-SetupWorkspaceC08.png!
+
+Verify the include paths
+
+\begin{itemize}
+\item \textit{src/config}
+\item \textit{src/common}
+\item \textit{src/platforms/generic}
+\end{itemize}
+
+Within the Setting dialog select the tab \textit{Build Artefact} and select \textit{Static Library}
+
+\includegraphics{images/014-SetupWorkspaceC09.png}
+% !images/014-SetupWorkspaceC09.png!
+
+Build the runtime by clicking
+
+\includegraphics{images/014-SetupWorkspaceC10.png}
+% !images/014-SetupWorkspaceC10.png!
+
+The runtime library should be created.
+
+\includegraphics{images/014-SetupWorkspaceC11.png}
+% !images/014-SetupWorkspaceC11.png!
+
+For the tutorials one runtime library should be sufficient. For embedded projects it might be necessary to
+build project specific runtime libraries. In this case a separate project for the runtime should be
+created. Symbolic links to the sources might be used to avoid duplicate files. Just the configuration file
+must be duplicated. A specific library file must exist within the project. Such specific runtime libraries
+might be referenced from several applications.
diff --git a/plugins/org.eclipse.etrice.doc/doc/etrice-doc.tex b/plugins/org.eclipse.etrice.doc/doc/etrice-doc.tex
index 5a117f5..f2a5459 100644
--- a/plugins/org.eclipse.etrice.doc/doc/etrice-doc.tex
+++ b/plugins/org.eclipse.etrice.doc/doc/etrice-doc.tex
@@ -1,6 +1,6 @@
\documentclass[a4paper,oneside,10pt]{book}
\usepackage[english]{babel}
-\usepackage[portrait,a4paper,margin=3.0cm,headsep=5mm]{geometry}
+\usepackage[portrait,a4paper,margin=2.0cm,headsep=5mm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
@@ -61,9 +61,9 @@
%\input{012-working-with-tutorials}
\input{013-setting-up-the-workspace-for-java}
\input{014-setting-up-the-workspace-for-C}
-%\input{015-hello-world-java}
+\input{015-hello-world-java}
%\input{016-hello-world-c}
-%\input{020-tutorial-blinky}
+\input{020-tutorial-blinky}
%\input{025-tutorial-sending-data}
%\input{030-tutorial-ped-lights}
%\input{040-room-concepts}
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/014-05-gen_SetupTestC.png b/plugins/org.eclipse.etrice.doc/doc/images/014-05-gen_SetupTestC.png
new file mode 100644
index 0000000..ac70401
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/014-05-gen_SetupTestC.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/014-06-FinishedCodeGeneration.png b/plugins/org.eclipse.etrice.doc/doc/images/014-06-FinishedCodeGeneration.png
new file mode 100644
index 0000000..8b1cc05
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/014-06-FinishedCodeGeneration.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/014-07-Compile.png b/plugins/org.eclipse.etrice.doc/doc/images/014-07-Compile.png
new file mode 100644
index 0000000..c461fcd
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/014-07-Compile.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/014-08-RunAsC-CPP-Application.png b/plugins/org.eclipse.etrice.doc/doc/images/014-08-RunAsC-CPP-Application.png
new file mode 100644
index 0000000..661c08e
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/014-08-RunAsC-CPP-Application.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspace007.png b/plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspace007.png
new file mode 100644
index 0000000..37af1d8
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspace007.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspaceC005.png b/plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspaceC005.png
new file mode 100644
index 0000000..10195de
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/014-SetupWorkspaceC005.png
Binary files differ
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt
index c3b99d4..1dc2b35 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt
@@ -1,4 +1,4 @@
-This directory is an eTrice code generation target.
-It will be erased every time the generator is executed.
-
-DO NOT PLACE OTHER FILES HERE!
+This directory is an eTrice code generation target.
+It will be erased every time the generator is executed.
+
+DO NOT PLACE OTHER FILES HERE!