Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7a6f052626c539a163529704374eade2754f1e1b (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<!--http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd-->  
<html xmlns="http://www.w3.org/1999/xhtml"  
> 
<head><title>Setting up the Workspace for C Projects</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
<!-- xhtml,3,next,html --> 
<meta name="src" content="etrice-doc.tex" /> 
<meta name="date" content="2013-07-04 15:04:00" /> 
<link rel="stylesheet" type="text/css" href="etrice-doc.css" /> 
</head><body 
>
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a 
href="etrice-docse6.html" >next</a>] [<a 
href="etrice-docse4.html" >prev</a>] [<a 
href="etrice-docse4.html#tailetrice-docse4.html" >prev-tail</a>] [<a 
href="#tailetrice-docse5.html">tail</a>] [<a 
href="etrice-docch2.html#etrice-docse5.html" >up</a>] </p></div>
<h3 class="sectionHead"><span class="titlemark">2.3   </span> <a 
 id="x9-280002.3"></a>Setting up the Workspace for C Projects</h3>
<!--l. 3--><p class="noindent" >Before you can start with C, some preconditions must be fulfilled:
     </p><dl class="description"><dt class="description">
 </dt><dd 
class="description">A C compiler must be installed on your machine (all tests and tutorials are based on MinGW)
     </dd><dt class="description">
 </dt><dd 
class="description">The CDT-Eclipse plugin must be installed as the C development environment.</dd></dl>
<!--l. 10--><p class="noindent" >Once the CDT is installed, the C runtime and model library must be imported. (<span 
class="ec-lmsso-10">File-&#x003E;New-&#x003E;Project-&#x003E;</span><span 
class="ec-lmsso-10">e</span><span 
class="ec-lmsso-10">Trice</span>
select <span 
class="ec-lmsso-10">e</span><span 
class="ec-lmsso-10">Trice</span> <span 
class="ec-lmsso-10">C runtime </span>/ <span 
class="ec-lmsso-10">e</span><span 
class="ec-lmsso-10">Trice</span> <span 
class="ec-lmsso-10">C modellib</span>)
</p><!--l. 13--><p class="noindent" >The resulting workspace should look like this:
</p><!--l. 15--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC01.png" alt="PIC"  
 />
</p><!--l. 19--><p class="noindent" >
</p>
<h4 class="subsectionHead"><span class="titlemark">2.3.1   </span> <a 
 id="x9-290002.3.1"></a>Testing the environment</h4>
<!--l. 21--><p class="noindent" >To verify the C tool chain you should generate and run the Hello World example program of the CDT. Activate
the <span 
class="ec-lmsso-10">C/C++ </span>perspective.
</p><!--l. 24--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC03.png" alt="PIC"  
 />
</p><!--l. 27--><p class="noindent" >From the main menu select <span 
class="ec-lmsso-10">File-&#x003E;New-&#x003E;C Project</span>.
</p><!--l. 29--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC02.png" alt="PIC"  
 />
</p><!--l. 32--><p class="noindent" >Name the project. Select an <span 
class="ec-lmsso-10">Executable-&#x003E;Hello World ANSI C </span>as project type, <span 
class="ec-lmsso-10">MinGW GCC </span>as tool chain and
click <span 
class="ec-lmsso-10">Finish</span>.
</p><!--l. 35--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC04.png" alt="PIC"  
 />
</p><!--l. 38--><p class="noindent" >Select the new project and click the build button (or right click the project and select <span 
class="ec-lmsso-10">Build Project</span>)
</p><!--l. 41--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC05.png" alt="PIC"  
 />
</p><!--l. 44--><p class="noindent" >The binary should be generated. Run the binary as <span 
class="ec-lmsso-10">Local C/C++ Application</span>.
</p><!--l. 46--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC06.png" alt="PIC"  
 />
</p><!--l. 49--><p class="noindent" >Verify the output.
</p><!--l. 51--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC07.png" alt="PIC"  
 />
</p><!--l. 54--><p class="noindent" >Remember these steps. In the following Tutorials these steps will be referenced as <span 
class="ec-lmsso-10">build and run</span>.
                                                                                 
                                                                                 
</p><!--l. 57--><p class="noindent" >
</p>
<h4 class="subsectionHead"><span class="titlemark">2.3.2   </span> <a 
 id="x9-300002.3.2"></a>Building the C runtime system</h4>
<!--l. 59--><p class="noindent" >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 <span 
class="ec-lmsso-10">etRuntimeConfig.h </span>is located in
<span 
class="ec-lmsso-10">src/config</span>.
</p><!--l. 65--><p class="noindent" >After changing the configuration, the runtime must be built.
</p><!--l. 67--><p class="noindent" >Open the properties of the <span 
class="ec-lmsso-10">org.eclipse.runtime.c </span>project and select <span 
class="ec-lmsso-10">C/C++ Build-&#x003E;Settings-&#x003E;Tool Settings</span>
and select <span 
class="ec-lmsso-10">Includes</span>.
</p><!--l. 70--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC08.png" alt="PIC"  
 />
</p><!--l. 73--><p class="noindent" >Verify the include paths
</p>
     <ul class="itemize1">
     <li class="itemize"><span 
class="ec-lmsso-10">src/config</span>
     </li>
     <li class="itemize"><span 
class="ec-lmsso-10">src/common</span>
     </li>
     <li class="itemize"><span 
class="ec-lmsso-10">src/platforms/generic</span></li></ul>
<!--l. 81--><p class="noindent" >Within the Setting dialog select the tab <span 
class="ec-lmsso-10">Build Artefact </span>and select <span 
class="ec-lmsso-10">Static Library</span>
</p><!--l. 83--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC09.png" alt="PIC"  
 />
</p><!--l. 86--><p class="noindent" >Build the runtime by clicking
</p><!--l. 88--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC10.png" alt="PIC"  
 />
</p><!--l. 91--><p class="noindent" >The runtime library should be created.
</p><!--l. 93--><p class="noindent" ><img 
src="images/014-SetupWorkspaceC11.png" alt="PIC"  
 />
</p><!--l. 96--><p class="noindent" >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.
                                                                                 
                                                                                 
</p>
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a 
href="etrice-docse6.html" >next</a>] [<a 
href="etrice-docse4.html" >prev</a>] [<a 
href="etrice-docse4.html#tailetrice-docse4.html" >prev-tail</a>] [<a 
href="etrice-docse5.html" >front</a>] [<a 
href="etrice-docch2.html#etrice-docse5.html" >up</a>] </p></div>
<!--l. 1--><p class="noindent" ><a 
 id="tailetrice-docse5.html"></a> </p> 
</body></html> 

Back to the top