Code generation in OSATE

From AadlWiki

Jump to: navigation, search

Contents

Using OSATE code generator with the OSATE Java Runtime (OJR)

Required Plug-In

To use the code generator, you will need


Using the Plug-In

First of all, instantiate your model. Once the model is instantiated, edit the project properties (right click on the project in the eclipse navigator and edit the properties). Then, go to the RAMSES menu, choose the instance model to use and select the OJR code generator as shown below.


Image:Ramses-prefs.PNG


Generate code

Once you have configured your project, you can select the instance (orange box in the following picture) and invoke the code generator (click on the button with the red rectangle below). If the code generation is successful, a directory called the generated-code will contain all the produced code (green rectangle in the picture).


Image:Ramses-button.PNG


Use generated code

The generated code can then be imported/copied into a java project within Eclipse. To do so, create a new Java Eclipse project and copy the generated code. Be careful, the generated code is in a package called generatedcode so you will have to keep the same naming convention. Also, the generated code uses the ojr runtime (generic functions called by the generated code) to manage its resources. So, you need also to checkout the ojr runtime within the same workspace. The OJR runtime can be found at https://github.com/osate/codegen under the org.osate.runtime package.


Also, you will need to write your own user code that will interact with the generated code.


Examples

Examples for code generation can be found on our github repository, under https://github.com/osate/examples/tree/master/codegen . They contain both the AADL model and the user code.


Bug Reports

Personal tools