RAMSES: Generate Code from an Example

 

Before to start…

Make sure you have installed OSATE and RAMSES (install procedure available on this page) as well as the targets you need to execute the generated code (install procedure available on this page).

Import one of our Examples

The RAMSES archive contains examples you can use to get familiar with RAMSES. To import them, follow these instructions:

  • in the AADL navigator, right click and select New… –> Example… (or in the File menu select New… –> Example…)
  • searh for RAMSES, and select the example(s) you want to import.

Configure your AADL/RAMSES project

You can configure your AADL/RAMSES project as follows: right-click on an AADL project and select “Properties”. Choose “RAMSES Configuration” on the left.

The RAMSES property page pops up; it should look like this. Refer to the RAMSES user manual for a description of this property page.

choix_posix

Generate code for a simple Linux example

In the next subsections, we explain how to generate code for a Linux target from the example named “RAMSES Sampled Communications Example for Linux”

Configure examples for Linux

Open the AADL model (sampled-communications-linux/model/sampled-communications.aadl). In the outline view, right-click on the system implementation “main.linux” and click on Launch RAMSES.

Launch_RAMSES

A configuration page pops up. Select Linux target:

choix_posix

The generation can take some time. At the end, you obtain a directory called “output/generated-code/linux“. Inside, you have your program “the_cpu/the_proc/the_proc“. Execute it by running the following command (from the output/generated-code/linux directory):

$ make run

You need to be root to execute some threads functions. You should obtain something like following in your terminal:

posix_result

Configure examples for nxtOSEK

Right-click on an AADL project and select “Properties”. Choose “RAMSES Configuration” on the left. Then, select the target “OSEK/NXT-nxtOSEK”. Below, click on the button “Choose the target platform path” and select the path where you installed nxtOSEK:

OSEK_example

Then you can go in “Outline” tab, right-click on “main.osek” and “Launch RAMSES” like previously for POSIX-Linux. You should obtain in your “generated-code” directory the following file : “the_cpu/the_proc/the_proc_OSEK.rxe”.

You can install and launch it on your nxt brick with this command using the deployment tool (see above):

sudo <PATH_TO_DEPLOYMENT_TOOLS>/NeXTTool /COM=usb -download=<PATH_TO_EXAMPLE>/the_cpu/the_proc/the_proc_OSEK.rxe

Launch the program on the brick. You should see variables which send and receive incrementing values.

Configure examples for nxtOSEK

Like previously, open the properties of the project and go in the RAMSE Configuration. Select the POK target, configure the path to your POK install directory. The POK install directory should contain a “misc/mk/config.mk” file, produced during the installation of POK. You can now execute the code generation by right-click on the “main.pok” system, and select “Launch RAMSES”.

After code generation, the generated code is compiled. If you need to re-compile it, open a terminal, go to the “generated-code” directory, and execute:

$ make

To execute the generated code, go to the generated-code directory and execute:

$ make run

You should obtain something similar to this in a new window:

pok_test