<
From version < 3.1 >
edited by aas2
on 2017/08/02 21:12
To version < 6.1 >
edited by aas2
on 2017/10/16 13:33
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -83,12 +83,372 @@
83 83  
84 84  The new project builder is configured using a domain specific language, namely KiBuild. Corresponding to the actions that are performed during the build, its configuration consists of //model compilers//, //simulation compilers// and //template processors//. A template processor is either a //simple template processor//, //wrapper code template processor// or //simulation template processor//.
85 85  
86 +When writing the configuration, use code completion to see available attributes for the entities. The following table describes the available attributes.
87 +
88 +(% class="relative-table wrapped" style="width: 99.937%;" %)
89 +|=(((
90 +**Attribute**
91 +)))|=(((
92 +Domain
93 +)))|=(% colspan="1" %)(% colspan="1" %)
94 +(((
95 +Default Value
96 +)))|=(((
97 +Description
98 +)))
99 +|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
100 +(((
101 +**KiCo Model Compiler**
102 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
103 +(((
104 +\\
105 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
106 +(((
107 +\\
108 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
109 +(((
110 +\\
111 +)))
112 +|(% colspan="1" %)(% colspan="1" %)
113 +(((
114 +outputFolder
115 +)))|(% colspan="1" %)(% colspan="1" %)
116 +(((
117 +String
118 +)))|(% colspan="1" %)(% colspan="1" %)
119 +(((
120 +kieler-gen
121 +)))|(% colspan="1" %)(% colspan="1" %)
122 +(((
123 +{{{The folder in which compilation output is saved}}}
124 +)))
125 +|(% colspan="1" %)(% colspan="1" %)
126 +(((
127 +whitelist
128 +)))|(% colspan="1" %)(% colspan="1" %)
129 +(((
130 +String, Regular expression
131 +)))|(% colspan="1" %)(% colspan="1" %)
132 +(((
133 +-
134 +)))|(% colspan="1" %)(% colspan="1" %)
135 +(((
136 +Only model files that have a location matching this regular expression are compiled. Thus to compile only a specific model, one can use the expression "ModelName.sctx"
137 +)))
138 +|(% colspan="1" %)(% colspan="1" %)
139 +(((
140 +blacklist
141 +)))|(% colspan="1" %)(% colspan="1" %)
142 +(((
143 +String, Regular expression
144 +)))|(% colspan="1" %)(% colspan="1" %)
145 +(((
146 +-
147 +)))|(% colspan="1" %)(% colspan="1" %)
148 +(((
149 +Model files that have a location matching this regular expression are exluded from the build. Thus to exclued all models and skip compilation, one can use ".*", which matches everything.
150 +)))
151 +|(% colspan="1" %)(% colspan="1" %)
152 +(((
153 +outputFileExtension
154 +)))|(% colspan="1" %)(% colspan="1" %)
155 +(((
156 +String
157 +)))|(% colspan="1" %)(% colspan="1" %)
158 +(((
159 +c
160 +)))|(% colspan="1" %)(% colspan="1" %)
161 +(((
162 +Compiled models are saved with using this file extension. Thus this attribute should match the code format that is generated by KiCo at the end of the compilation.
163 +)))
164 +|(% colspan="1" %)(% colspan="1" %)
165 +(((
166 +outputTemplate
167 +)))|(% colspan="1" %)(% colspan="1" %)
168 +(((
169 +String, Project relative file path
170 +)))|(% colspan="1" %)(% colspan="1" %)
171 +(((
172 +-
173 +)))|(% colspan="1" %)(% colspan="1" %)
174 +(((
175 +An optional template to add surrounding code to KiCo generated output for every compiled file. In the template the placeholder **${kico_code}** can be used an will be replaced with the compiled code.
176 +)))
177 +|(% colspan="1" %)(% colspan="1" %)
178 +(((
179 +compileChain
180 +)))|(% colspan="1" %)(% colspan="1" %)
181 +(((
182 +(% class="content-wrapper" %)
183 +(((
184 +String, Id of a pre-defined compilation system or processor id or a project relative file path to a kico file
185 +
186 +Can also be a list of the above to compile models in several steps
187 +
188 +Can also be a map to define the compilation of different model types
189 +
190 +{{code}}
191 +compileChain {
192 + sctx: de.cau.cs.kieler.sccharts.netlist.simple
193 + strl: de.cau.cs.kieler.esterel.netlist.simple
194 +}
195 +{{/code}}
196 +
197 +\\
198 +
199 +\\
200 +)))
201 +)))|(% colspan="1" %)(% colspan="1" %)
202 +(((
203 +de.cau.cs.kieler.sccharts.netlist.simple
204 +)))|(% colspan="1" %)(% colspan="1" %)
205 +(((
206 +The compilation system that is used by KiCo to determine the compile chain.
207 +)))
208 +|(% colspan="1" %)(% colspan="1" %)
209 +(((
210 +communicateRegisterVariables
211 +)))|(% colspan="1" %)(% colspan="1" %)
212 +(((
213 +Boolean
214 +)))|(% colspan="1" %)(% colspan="1" %)
215 +(((
216 +true
217 +)))|(% colspan="1" %)(% colspan="1" %)
218 +(((
219 +Determines if the variables that save the internal state of a model should be communicated to the simulation generation. If set to false, stepping back and forth in the simulation history will not change the internal state of the model.
220 +)))
221 +|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
222 +(((
223 +**Simulation Compiler**
224 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
225 +(((
226 +\\
227 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
228 +(((
229 +\\
230 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
231 +(((
232 +\\
233 +)))
234 +|(% colspan="1" %)(% colspan="1" %)
235 +(((
236 +command
237 +)))|(% colspan="1" %)(% colspan="1" %)
238 +(((
239 +String
240 +)))|(% colspan="1" %)(% colspan="1" %)
241 +(((
242 +For C:
243 +
244 +"gcc -std=c99 -Werror=int-conversion -o \"./${outputFolder}/${executable_name}\""
245 +
246 +For Java:
247 +
248 +"jar cvfe \"../${outputFolder}/${executable_name}\""
249 +)))|(% colspan="1" %)(% colspan="1" %)
250 +(((
251 +The command that is called to compile simulation code to an executable.
252 +
253 +In case of the C simulation, the compiled file is added implicitly as additional parameter, to create an executable.
254 +
255 +In case of Java, all class files and the class file of the compiled model are added implicitly to create an executable JAR file.
256 +)))
257 +|(% colspan="1" %)(% colspan="1" %)
258 +(((
259 +outputFolder
260 +)))|(% colspan="1" %)(% colspan="1" %)
261 +(((
262 +String, Project relative folder path
263 +)))|(% colspan="1" %)(% colspan="1" %)
264 +(((
265 +kieler-gen/sim/bin
266 +)))|(% colspan="1" %)(% colspan="1" %)
267 +(((
268 +The folder in which compiled output will be saved.
269 +
270 +Note that it is possible to use a command that creates the compiled files in a different location. However the folder specified in this attribute is created before the command is executed and refreshed afterwards. This ensures that the folder exists and changes will be noticed in the Eclipse workspace.
271 +)))
272 +|(% colspan="1" %)(% colspan="1" %)
273 +(((
274 +libFolder
275 +)))|(% colspan="1" %)(% colspan="1" %)
276 +(((
277 +String, Project relative folder path
278 +)))|(% colspan="1" %)(% colspan="1" %)
279 +(((
280 +kieler-gen/sim/lib
281 +)))|(% colspan="1" %)(% colspan="1" %)
282 +(((
283 +The folder where additional files are saved before the command is run. These files can be linked into the simulation code, e.g., for JSON handling.
284 +)))
285 +|(% colspan="1" %)(% colspan="1" %)
286 +(((
287 +timeout
288 +)))|(% colspan="1" %)(% colspan="1" %)
289 +(((
290 +int
291 +)))|(% colspan="1" %)(% colspan="1" %)
292 +(((
293 +10
294 +)))|(% colspan="1" %)(% colspan="1" %)
295 +(((
296 +Time in seconds that is waited for the executed command to finish. If the command runs longer, it is assumed to be failed and aborted.
297 +)))
298 +|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
299 +(((
300 +**Template Processor**
301 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
302 +(((
303 +\\
304 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
305 +(((
306 +\\
307 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
308 +(((
309 +\\
310 +)))
311 +|(% colspan="1" %)(% colspan="1" %)
312 +(((
313 +file
314 +)))|(% colspan="1" %)(% colspan="1" %)
315 +(((
316 +String, Project relative file path
317 +)))|(% colspan="1" %)(% colspan="1" %)
318 +(((
319 +-
320 +)))|(% colspan="1" %)(% colspan="1" %)
321 +(((
322 +The template file that should be processed
323 +)))
324 +|(% colspan="1" %)(% colspan="1" %)
325 +(((
326 +target
327 +)))|(% colspan="1" %)(% colspan="1" %)
328 +(((
329 +String, Project relative file path
330 +)))|(% colspan="1" %)(% colspan="1" %)
331 +(((
332 +-
333 +)))|(% colspan="1" %)(% colspan="1" %)
334 +(((
335 +The file in which the output should be saved
336 +)))
337 +|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
338 +(((
339 +**Wrapper Code Template Processor**
340 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
341 +(((
342 +\\
343 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
344 +(((
345 +\\
346 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
347 +(((
348 +\\
349 +)))
350 +|(% colspan="1" %)(% colspan="1" %)
351 +(((
352 +modelFile
353 +)))|(% colspan="1" %)(% colspan="1" %)
354 +(((
355 +String, Project relative file path
356 +)))|(% colspan="1" %)(% colspan="1" %)
357 +(((
358 +-
359 +)))|(% colspan="1" %)(% colspan="1" %)
360 +(((
361 +The model file that is searched for annotations to determine the code snippets to be injected.
362 +)))
363 +|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
364 +(((
365 +**Simulation Code Template Processor**
366 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
367 +(((
368 +\\
369 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
370 +(((
371 +\\
372 +)))|(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)(% class="highlight-blue" colspan="1" data-highlight-colour="blue" %)
373 +(((
374 +\\
375 +)))
376 +|(% colspan="1" %)(% colspan="1" %)
377 +(((
378 +modelFile
379 +)))|(% colspan="1" %)(% colspan="1" %)
380 +(((
381 +String, Project relative file path
382 +)))|(% colspan="1" %)(% colspan="1" %)
383 +(((
384 +-
385 +)))|(% colspan="1" %)(% colspan="1" %)
386 +(((
387 +The model file that is searched for annotations to determine the code snippets to be injected
388 +)))
389 +|(% colspan="1" %)(% colspan="1" %)
390 +(((
391 +compiledModelFile
392 +)))|(% colspan="1" %)(% colspan="1" %)
393 +(((
394 +String, Absolute file system path
395 +)))|(% colspan="1" %)(% colspan="1" %)
396 +(((
397 +-
398 +)))|(% colspan="1" %)(% colspan="1" %)
399 +(((
400 +The absolute path of the compiled model file for which the simulation is created. This is used to replace the placeholder ${compiled_model_loc} in the simulation code template
401 +)))
402 +|(% colspan="1" %)(% colspan="1" %)
403 +(((
404 +variables
405 +)))|(% colspan="1" %)(% colspan="1" %)
406 +(((
407 +(% class="content-wrapper" %)
408 +(((
409 +Map, e.g.,
410 +
411 +{{code}}
412 +variables {
413 + input: myVar1
414 + output: {
415 + bool: myVar2
416 + int: myVar3[2][3]
417 + }
418 +}
419 +{{/code}}
420 +)))
421 +)))|(% colspan="1" %)(% colspan="1" %)
422 +(((
423 +-
424 +)))|(% colspan="1" %)(% colspan="1" %)
425 +(((
426 +Optional additional variables that should be communicated to the outside
427 +)))
428 +|(% colspan="1" %)(% colspan="1" %)
429 +(((
430 +interfaceTypes
431 +)))|(% colspan="1" %)(% colspan="1" %)
432 +(((
433 +String, List of Strings
434 +)))|(% colspan="1" %)(% colspan="1" %)
435 +(((
436 +-
437 +)))|(% colspan="1" %)(% colspan="1" %)
438 +(((
439 +The interface types that should be communicated in the simulation, e.g., input, output, internal
440 +)))
441 +
442 +\\
443 +
444 +Example for KiBuild files:
445 +
86 86  {{code title="Simple KiBuild Example" linenumbers="true"}}
87 87  // Compile models to C code
88 88  model compiler kico {
89 89   outputFolder: kieler-gen // The folder, in which the compilation output is saved
90 90   outputFileExtension: c // The file extension for compiled files
91 - compilationSystem: de.cau.cs.kieler.sccharts.netlist.simple // The system that determines the compile chain within the KIELER compiler
451 + compileChain: de.cau.cs.kieler.sccharts.netlist.simple // The system that determines the compile chain within the KIELER compiler
92 92  
93 93   // Generate C simulation for compiled models
94 94   process simulation template {
... ... @@ -96,15 +96,14 @@
96 96   }
97 97  }
98 98  
99 -// Compile C simulation via gcc
459 +// Compile simulation code
100 100  simulation compiler c {
101 101   libFolder: kieler-gen/sim/lib // Create additional libraries required for compilation in this folder
102 102   outputFolder: kieler-gen/sim/bin // Create the executables in this folder
103 - command: "gcc -std=c99 -o ./${outputFolder}/${executable_name}" // Use gcc to compile the code
463 + command: "gcc -std=c99 -o ./${outputFolder}/${executable_name} ${file_path} " // Use gcc to compile the code
104 104  }
105 105  
106 106  
107 -
108 108  {{/code}}
109 109  
110 110  {{code title="Complex KiBuild Example"}}
... ... @@ -113,7 +113,7 @@
113 113   outputFolder: kieler-gen
114 114   outputFileExtension: java
115 115   outputTemplate: assets/OutputTemplate.ftl
116 - compilationSystem: de.cau.cs.kieler.sccharts.netlist.simple
475 + compileChain: de.cau.cs.kieler.sccharts.netlist.simple
117 117   whitelist: "ModelA|ModelB" // Only compile models that match this regex
118 118  
119 119   // Generate C simulation for compiled models
... ... @@ -122,11 +122,12 @@
122 122   }
123 123  }
124 124  
125 -// Compile C simulation via gcc
484 +// Compile simulation code
126 126  simulation compiler java {
127 127   libFolder: kieler-gen/org/json
128 128   outputFolder: kieler-gen/sim/bin
129 - command: "jar cvfe ../${outputFolder}/${executable_name}"
488 + command: "javac -cp kieler-gen -d bin \"${file_path}\" "
489 + jarCommand: "jar cvfe \"./${outputFolder}/${executable_name}\" sim.code.${file_basename} -C bin . "
130 130  }
131 131  
132 132  // Process a simple template
... ... @@ -141,6 +141,17 @@
141 141   target: kieler-gen/Main.c
142 142   modelFile: MyModel.sctx
143 143  }
504 +
505 +// Process a template to generate a simulation for a model that has been compiled with some other framework
506 +process simulation template {
507 + file: assets/JavaSimulationForOtherModel.ftl
508 + target: kieler-gen/Sim_OtherModel.java
509 + variables: { // These variables should be communicated to the outside
510 + input: a,b,c
511 + output: x,y,z
512 + }
513 + interfaceTypes: input, output // Only communicate these interface types. In this case, internal variables are not communicated.
514 +}
144 144  {{/code}}
145 145  
146 146  \\
... ... @@ -147,11 +147,11 @@
147 147  
148 148  ----
149 149  
150 -== Prom Environments ==
521 +== Project Drafts ==
151 151  
152 -Environments are used to provide default settings for project creation. They are configured in the **preferences** (//Window //>// Preferences > KIELER SCCharts > Execution Environments//).
523 +Project drafts are used to provide default settings for project creation. They are configured in the **preferences** (//Window //>// Preferences > KIELER SCCharts > Project Drafts//).
153 153  
154 -An environment consists of
525 +An project draft consists of
155 155  
156 156  1. a unique **name**, which may not contain a comma
157 157  1. anĀ **associated** project wizard
... ... @@ -226,3 +226,15 @@
226 226  === [[image:attach:wrapper_code_generation_example.png]] ===
227 227  
228 228  ----
600 +
601 +== Problem Solving ==
602 +
603 +=== CDT Projects ===
604 +
605 +When working with the CDT, the folder that contains the simulation code has to be excluded from the CDT build, because this code is compiled using the compiler specified in the kibuild file, and every simulation file has an additional main function, which is not the use-case that a CDT project is made for. These files are self contained and do not interact with other files in the CDT project, thus they should not be built.
606 +
607 +[[image:attach:cdt_exlude_from_build.png]]
608 +
609 +\\
610 +
611 +----
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -31162488
1 +33259959
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/31162488/V2 Project Management
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/33259959/V2 Project Management