summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2012-09-09 14:19:23 (EDT)
committertjung2012-09-09 14:19:23 (EDT)
commit6c6eefb16f57f3ddb6fe5110e551559cfefbf282 (patch)
treeeb7876c1d695550981944c5e8ade59ef45eac95d
parent3361f9a848bb97b9a12957db2db7102b78a70e9e (diff)
downloadorg.eclipse.etrice-6c6eefb16f57f3ddb6fe5110e551559cfefbf282.zip
org.eclipse.etrice-6c6eefb16f57f3ddb6fe5110e551559cfefbf282.tar.gz
org.eclipse.etrice-6c6eefb16f57f3ddb6fe5110e551559cfefbf282.tar.bz2
[doc] hello world finished
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/032-Setting-up-the-Workspace_C.textile37
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile73
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC08.pngbin0 -> 94115 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC09.pngbin0 -> 63816 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC10.pngbin0 -> 36926 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC11.pngbin0 -> 9619 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC06.pngbin0 -> 29058 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC07.pngbin0 -> 93328 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC08.pngbin0 -> 93240 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC09.pngbin0 -> 104815 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC10.pngbin0 -> 101554 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC11.pngbin0 -> 5669 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC12.pngbin0 -> 128401 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC13.pngbin0 -> 12663 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC14.pngbin0 -> 101442 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC15.pngbin0 -> 94359 bytes
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC16.pngbin0 -> 11914 bytes
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/.cproject2
19 files changed, 80 insertions, 34 deletions
diff --git a/plugins/org.eclipse.etrice.doc/doc/032-Setting-up-the-Workspace_C.textile b/plugins/org.eclipse.etrice.doc/doc/032-Setting-up-the-Workspace_C.textile
index eb31f8e..0201eda 100644
--- a/plugins/org.eclipse.etrice.doc/doc/032-Setting-up-the-Workspace_C.textile
+++ b/plugins/org.eclipse.etrice.doc/doc/032-Setting-up-the-Workspace_C.textile
@@ -5,13 +5,15 @@ Before you can start with C, some preconditions must be fulfilled:
- A C compiler must be installed on your machine (all tests and tutorials are based on MinGW)
- The CDT-Eclipse plug in must be installed as the C development environment.
-Once the CDT is installed, the C runtime and model library must be imported.
+Once the CDT is installed, the C runtime and model library must be imported.
+(_File->New->Project->eTrice_ select _eTrice C runtime_ / _eTrice C modellib_)
The resulting workspace should look like this:
!images/032-SetupWorkspaceC01.png!
+
h2. Testing the environment
To verify the C tool chain you should generate and run the Hello World example program of the CDT.
@@ -39,4 +41,35 @@ Verify the output.
!images/032-SetupWorkspaceC07.png!
-Remember these steps. In the following Tutorials these steps will be referenced as _build and run_.
+Remember these steps. In the following Tutorials these steps will be referenced as _build and run_.
+
+
+h2. 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 _etRuntimeConfig.h_ is located in _src/config_.
+
+After changing the configuration, the runtime must be built.
+
+Open the properties of the _org.eclipse.runtime.c_ project and select _C/C++ Build->Settins->Tool Settings_ and select _Includes_.
+
+!images/032-SetupWorkspaceC08.png!
+
+Verify the include paths
+
+_src/config_
+_src/common_
+_src/platforms/generic_
+
+Within the Setting dialog select the tab _Build Artefact_ and select _Static Library_
+
+!images/032-SetupWorkspaceC09.png!
+
+Build the runtime by clicking
+
+!images/032-SetupWorkspaceC10.png!
+
+The runtime library should be created.
+
+!images/032-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/034-getting-started_C.textile b/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile
index 2fe6ef6..35e55b5 100644
--- a/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile
+++ b/plugins/org.eclipse.etrice.doc/doc/034-getting-started_C.textile
@@ -8,6 +8,7 @@ You will perform the following steps:
# create a new model from scratch for C
# create structure and behavior similar to Java
# create a launch configuration for the C code generator
+# setup the C environment
# generate the source code
# run the model
@@ -37,7 +38,7 @@ Add the model file to the folder. Right click on the new folder. Select _New->fi
!images/034-HelloWorldC03.png!
-Due to the file ending _.room_ the tool will ask you to add the Xtext nature. Answer with _Yes_.
+Due to the file ending _.room_, the tool will ask you to add the Xtext nature. Answer with _Yes_.
!images/034-HelloWorldC04.png!
@@ -54,8 +55,9 @@ Creating the model is not the focus of this tutorial. Therefore copy and paste t
Recognize the C specific parts:
- Import CTypes instead of JavaTypes
- The action code contains C instead of Java. Later versions will contain a common action language, but for the moment the action language is target specific.
+- The application must be shutdown on model level (see also _etRuntimeConfig.h_)
-ToDo: shutdown must be not depend on the subsystem.
+ToDo: shutdown must not depend on the subsystem.
bc..
RoomModel HelloWorldCModel {
@@ -70,8 +72,8 @@ RoomModel HelloWorldCModel {
Transition init: initial -> state0 { }
State state0 {
entry {
- "printf(\"HelloETrice !\\n\");"
- "HelloETriceSubSysClass_shutdown();//exit(0);"
+ "printf(\"HelloWorldC !\\n\");"
+ "HelloWorldCSubSysClass_shutdown();//exit(0);"
"\t\t\t\t\t\t"
}
}
@@ -81,58 +83,67 @@ RoomModel HelloWorldCModel {
}
bq.
-h2. Create a launch configuration to start the C codegenerator
+h2. Create a launch configuration to start the C code generator
-h2. Generate the code
+Other than in Java a launch configuration for the C code generator must be created.
-h2. Setup the include path
+From the _Run_ menu select _Run Configurations_
-h2. Run the model
+!images/034-HelloWorldC06.png!
-h2. Summary
+Within the dialog select _eTrice C Generator_ and click the _New_ button to create a new launch configuration.
+!images/034-HelloWorldC07.png!
-We will implement the Hello World code on the initial transition of the _HelloWorldTop_ actor. Therefore open the state machine editor by right clicking the _HelloWorldTop_ actor in the outline view and select _Edit Behavior_.
+A new configuration should be created. Name it _gen_HelloWorldC_ and add the model via one of the _add_ buttons.
-!images/015-HelloWorld03.png!
+!images/034-HelloWorldC08.png!
-The state machine editor will be opened. Drag and drop an _Initial Point_ from the tool box to the diagram into the top level state. Drag and drop a _State_ from the tool box to the diagram. Confirm the dialogue with _ok_. Select the _Transition_ in the tool box and draw the transition from the _Initial Point_ to the State. Open the transition dialogue by double clicking the transition arrow and fill in the action code.
+In the _Refresh_ tab select _The entire workspace_
-bc. System.out.println("Hello World !");
-
-The result should look like this:
+!images/034-HelloWorldC09.png!
-!images/015-HelloWorld04.png!
+In the _Common_ tab select _Shared file_ and add the _HelloWorldC_ project via the _Browse_ button.
-Save the diagram and inspect the model file. Note that the textual representation was created after saving the diagram.
+!images/034-HelloWorldC10.png!
-!images/015-HelloWorld05.png!
+Apply your changes. The new configuration should now exist in your workspace.
+!images/034-HelloWorldC11.png!
-h2. Build and run the model
-Now the model is finished and source code can be generated. The project wizard has created a launch configuration that is responsible for generating the source code. From _HelloWorld/_ right click *gen_HelloWorld.launch* and run it as gen_HelloWorld. All model files in the model directory will be generated.
+h2. Generate the code
-!images/015-HelloWorld06.png!
+Now you can generate the code as you know it from Java. Right click to the launch configuration and run it as _gen_HelloWorldC_.
-The code will be generated to the src-gen directory. The main function will be contained in *SubSystem_HelloWorldRunner.java*. Select this file and run it as Java application.
+!images/034-HelloWorldC12.png!
-!images/015-HelloWorld07.png!
+The code should be generated.
+!images/034-HelloWorldC13.png!
-The Hello World application starts and the string will be printed on the console window. To stop the application the user must type _quit_ in the console window.
+h2. Setup the include path
-!images/015-HelloWorld08.png!
+Before you can build the application you must setup the include path for the runtime system. Right click the project and select _Properties_. Add the include path as described in _setting up the workspace_.
-h2. Open the Message Sequence Chart
+!images/034-HelloWorldC14.png!
-During runtime the application produced a MSC and wrote it to a file. Open HelloWorld/tmp/log/SubSystem_HelloWorld_Async.seq using Trace2UML (it is open source and can be obtained from http://trace2uml.tigris.org/). You should see something like this:
+Add the runtime library.
-!images/015-HelloWorld09.png!
+!images/034-HelloWorldC15.png!
+Recognize the name of the library ("org.eclipse.etrice.runtime.c"). The library file on your disk is "liborg.eclipse.etrice.runtime.c.a".
+
+h2. Build and run the model
+
+Now you can build the application. Click the build button to build the application.
+Run the application as _Local C/C++ Application_.
+Verify the output.
+
+!images/034-HelloWorldC16.png!
h2. Summary
-Now you have generated your first eTrice model from scratch. You can switch between diagram editor and model (.room file) and you can see what will be generated during editing and saving the diagram files.
-You should take a look at the generated source files to understand how the state machine is generated and the life cycle of the application. The next tutorials will deal with more complex hierarchies in structure and behavior.
-
+You are now familiar with all necessary steps to create, build and run an eTrice C model from scratch. You are able to create a launch configuration to start the code generator and to perform all necessary settings to compile and link the application.
+
+The next tutorial provides an exercise to get more familiar with these working steps. \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC08.png b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC08.png
new file mode 100644
index 0000000..5168c87
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC08.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC09.png b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC09.png
new file mode 100644
index 0000000..45dc897
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC09.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC10.png b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC10.png
new file mode 100644
index 0000000..cc8c721
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC10.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC11.png b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC11.png
new file mode 100644
index 0000000..f3a8bd2
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/032-SetupWorkspaceC11.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC06.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC06.png
new file mode 100644
index 0000000..6adf37a
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC06.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC07.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC07.png
new file mode 100644
index 0000000..d64c323
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC07.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC08.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC08.png
new file mode 100644
index 0000000..14867cb
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC08.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC09.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC09.png
new file mode 100644
index 0000000..73fbeeb
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC09.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC10.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC10.png
new file mode 100644
index 0000000..ec764ef
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC10.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC11.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC11.png
new file mode 100644
index 0000000..8bca1b9
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC11.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC12.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC12.png
new file mode 100644
index 0000000..f66f9de
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC12.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC13.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC13.png
new file mode 100644
index 0000000..372c940
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC13.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC14.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC14.png
new file mode 100644
index 0000000..d4c5cb5
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC14.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC15.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC15.png
new file mode 100644
index 0000000..806e796
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC15.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC16.png b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC16.png
new file mode 100644
index 0000000..71e7674
--- /dev/null
+++ b/plugins/org.eclipse.etrice.doc/doc/images/034-HelloWorldC16.png
Binary files differ
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
index bca34cb..77eba5f 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/SubSystemClassGen.java
@@ -265,7 +265,7 @@ public class SubSystemClassGen {
_builder.newLine();
_builder.append("#include \"platform/etTimer.h\"");
_builder.newLine();
- _builder.append("#include \"etGlobalFlags.h\"");
+ _builder.append("#include \"etRuntimeConfig.h\"");
_builder.newLine();
_builder.newLine();
DetailCode _userCode3 = ssc.getUserCode3();
diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject
index b7b2924..becaa71 100644
--- a/runtime/org.eclipse.etrice.runtime.c/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.c/.cproject
@@ -43,6 +43,7 @@
<option id="gnu.c.compiler.option.include.paths.790097072" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/generic}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/config}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/common}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.361048721" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
@@ -123,4 +124,5 @@
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
+ <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>