Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 0201eda2973c3787fbd42bc40a688b00492efc22 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
h1. Setting up the Workspace ( C )
 
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. 
(_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.
 Activate the _C/C++_ perspective. 
 
!images/032-SetupWorkspaceC03.png!
 
From the main menu select _File->New->C Project_.
 
!images/032-SetupWorkspaceC02.png!

Name the Project. Select an _Executable->Hello World ANSI C_ as Project type, _MinGW GCC_ as Tool chain and click _Finish_. 
 
!images/032-SetupWorkspaceC04.png! 

Select the new project and click the build button (or right click the project and select _Build Project_)

!images/032-SetupWorkspaceC05.png!

The binary should be generated. Run the binary as _Local C/C++ Application_

!images/032-SetupWorkspaceC06.png!

Verify the output.

!images/032-SetupWorkspaceC07.png!

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.     

Back to the top