Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Papyrus-RT/User Guide/Compiling and running Papyrus for Real Time applications

< Papyrus-RT‎ | User Guide
Revision as of 12:27, 16 January 2017 by Eposse.gmail.com (Talk | contribs) (Added clarification)

This page describes how to compile and run applications from code generated with Papyrus-RT.

Preliminaries

This assumes that you have installed Papyrus-RT, and if you are not on Linux, you have followed the steps described in Vagrant Setup. In particular we assume that either your host OS is Linux or you have now a Linux VM.

If you are not on Linux, start up your vagrant Linux VM: go to the command-line and type the following (adapting the path to the location where you installed your Vagrant VM accordingly)

cd /Users/yourusername/vms/my_vm
vagrant up
vagrant ssh

At this point you should be running Linux.

If you have not already done so, install g++ and make. On Ubuntu, you can do these as follows:

sudo apt-get -y install g++ make


Setting up the UMLRTS_ROOT environment variable

To build applications from code generated with Papyrus-RT, the build must link the compiled code to the runtime system (RTS). During a build we must specify where the RTS is located so that it can be linked. We specify this location in a special environment variable called UMLRTS_ROOT.

1. Determine the location of the runtime system.

  • If your host OS is Windows or macOS and you followed the instructions from Vagrant Setup, then the RTS will be located at /home/vagrant/rts.
  • If your host OS is Linux, then:
- If you installed Papyrus-RT with the RCP, then the RTS is located in the plugins folder under the extracted Papyrus-RT. There should be a folder called
org.eclipse.papyrusrt.rts_<version>.<year><month><day><build>
and under this, there should be a subdirectory called umlrts. This is the folder that we are looking for. For example, the full path could be something like this:
/Users/yourusername/tools/PapyrusRT/plugins/org.eclipse.papyrusrt.rts_0.8.0.201701030512/umlrts
- If you installed Papyrus-RT using the Installer and selected the "bundle pool" option, then the plugin is found under ~/.p2/pool/plugins where ~ is your user's home directory. If you didn't select the "bundle pool" option, then it will be located within the plugins folder of the installation folder you selected, as described in the previous option.

2. Once you determined the location of the RTS, add the following line to your .bash_login file (located in your user home directory):

export UMLRTS_ROOT=<path-to-the-rts>
For example, if you are on Windows or macOS, and followed the Vagrant Setup instructions, then you can type the following in the console:
export UMLRTS_ROOT=/home/vagrant/rts >> .bash_login
(The >> .bash_login part will add the line without having to open an editor.)

3. Either execute the contents of .bash_login

source ~/.bash_login
or exit the ssh session and start a new one:
exit
vagrant ssh
or exit and reload the VM
exit
vagrant reload
vagrant ssh
or exit and restart the VM
exit
vagrant halt
vagrant up
vagrant ssh

If you added the setting of the UMLRTS_ROOT environment variable to your .bash_login, you will not need to export it every time that you login to your VM.

To make sure that you setup the UMLRTS_ROOT environment variable correctly, you can type the following in the console:

env | grep UMLRTS_ROOT

or

echo $UMLRTS_ROOT

and this should show the path to the RTS, if you set it up correctly.


Building the runtime system

Before you can link the RTS to your code, the RTS itself must be built once. Assuming that you have set the UMLRTS_ROOT environment variable as described in the previous session, do the following:

1. Go the the RTS folder:

cd $UMLRTS_ROOT

2. Do a cleanup:

make clean

3. Build:

make

Normally you need to do this only once. You may have to redo these steps if you update Papyrus-RT, but otherwise you won't need to repeat these.


Building your applications

Assuming that you have set the UMLRTS_ROOT environment variable and built the RTS as described in the previous sections, you can now build code generated with Papyrus-RT.

Suppose that in your modelling environment you created a Papyrus-RT project called MyProject and that you successfully generated code from it. Then, the generated code will be in a project called MyProject_CDTProject in the same workspace. So now you can do the following:

1. If you are on Linux, go to step 2. If you are on Windows or macOS start your vagrant Linux VM if you have not already done so:

cd /Users/yourusername/vms/my_mv
vagrant up
vagrant ssh

2. Navigate to the location of your workspace (if you are on Windows or macOS, you should have specified in the Vagrantfile the location of the workspace as a shared folder). For example

cd ws

3. Go into the generated CDT project's src folder:

cd MyProject_CDTProject/src

4. Build

make

If there are no compilation errors, this will create an executable file, which by default is called TopMain and which you can run by typing

./TopMain

If there are errors, first make sure that the UMLRTS_ROOT environment variable is correctly set as described above. Also make sure that you have built the RTS as described above. If you still get errors, note the error messages issued by g++, and in particular note the lines in the generated code and the errors. These will usually be errors in action code. After making necessary changes, you can try recompiling by running make again. Occasionally, some errors require that you run make clean before running make again.

Back to the top