Building and Running a Simple UML RT Model in Rational Software Architect RealTime Edition (RSARTE) In this tutorial you will learn how to use RSARTE for transforming a simple UML RT model into C++ code compiling generated C++ code into an executable running the generated executable The tutorial was written using RSA-RTE 8.0.3. All screen captures are from RSARTE installed on a Windows platform. Preparing You will use the HelloWorld sample model which is included as part of the RSARTE installation. To create an instance of this sample select: 1. File > New > Model Project 2. Type "HelloWorld" as the name of the project and press Next. Click the "UML Capsule Development" category and select "Sample UML Capsule C++ Model". Press Finish. 3. A new HelloWorld project now appears in the Project Explorer. It contains the sample model as well as a transformation configuration: The transformation configuration specifies how the UML model can be translated into C++ code, and how to build the generated code. The red error marker indicates that there is currently one or many errors in the transformation configuration. To see these errors, select the transformation configuration and open the Problems view: You get this error because you haven't yet specified a C++ project where to place the C++ files that get generated by this transformation. To do that, open the transformation configuration by double clicking on the error message in the Problems view. The transformation configuration editor will appear. Click on the Sources and Target tab and scroll down to the Target section: Use the buttons to either browse to an existing C++ project, or create a new one. However, you can also just type the name of a project and let it be automatically created when the transformation runs. Ensure that the checkbox Generate target projects from target configurations is checked, and type "HelloWorld_target" as the project name. Click on the Save button to save the transformation configuration. The Problems view should become empty, since a C++ project now has been set-up for the transformation configuration. Before you attempt to build the transformation configuration, you must ensure that a few settings in the Target Configuration tab have appropriate values. These are the settings which depend on your build environment, for example, the target platform and the build tools that you use for building generated C++ code into an executable. Which settings you need to modify in this step, and what values to set, depend on your build environment. Unfortunately it is beyond the scope of this tutorial to cover all supported build environments, so we will only describe the settings to use for two popular environments: 1. Using the minGW tools on the Microsoft Windows platform 2. Using the GNU tools on the SLED10 (SUSE Linux Enterprise Desktop) platform Target Configuration Setting Make_type Make command Target RTS configuration minGW on Windows Gnu_make mingw32-make NT40MinGwT.x86-MinGwgnu-3.4.5 GNU on Linux Gnu_make $defaultMakeCommand SLED10T.x86-gnu-4.1 Building the transformation configuration To build the transformation configuration to populate the C++ project that you created with the C++ files generated from the UML mode, click the Run Transform button in the transformation configuration editor: However, you will probably find it inconvenient to have to open the transformation configuration editor every time you want to generate code for your model. It is more convenient to use the Build Active Transformation command for which there is a toolbar button when working in the UML Development perspective: When you click this button, the transformation configuration that is set as active in the current project will be built. The active transformation configuration is the one that is marked by a green check mark: If you have many transformation configurations in your project, make sure to set the one you use the most as the active one. You do this by right-clicking on the transformation configuration in the Project Explorer and then select "Active Transformation Configuration". If you want to build a transformation configuration that is not set as active you can do so by clicking on the black triangle to the right of the "Build Active Transformation" button, and then select the transformation configuration to build from the menu that appears. When you build the transformation configuration some messages appear in the "UML Development" console: This shows that the transformation was completed successfully and that we now should expect to see some generated C++ files in our C++ target project. Expand the target project to verify this: By default Eclipse builds projects automatically, so by this time the C++ project has already been compiled. Since we have a binary under the Binaries folder we can conclude that C++ compilation and linking were successful. To get more information about what happened we can look in the "C-Build" console: If you didn't get an executable at this point, it is most likely because your transformation configuration or target project was not set-up appropriately according to your build environment. If this happens there may be valuable information in this console which can help you understand what is wrong. If you make a modification in the transformation configuration just save and build it again to update the C++ project and rebuild generated C++ files. Running Once you have got an executable the next step is to run it. To do so you may right-click on the target C++ project and select Run As > UML Capsule C/C++ Application This will create what Eclipse calls a launch configuration, which basically is something that holds the information required in order to launch the executable. Depending on your build environment some dialogs may appear before the executable is launched. With the example build environments described above you get a dialog that asks you to specify which debug configuration to use. On Windows use "MinGW gdb" and on Linux use "gdb/mi". Once your launch configuration has been created you can view (and if needed edit it) by opening the Eclipse launch configuration dialog: Run > Run Configurations... The default name of the launch configuration is the name of the executable to launch. In the launch configuration dialog you can give the launch configuration another name if you want to. The next time you run your C++ project Eclipse will not create a new launch configuration, but will instead reuse the one that was already created. When you have run your executable take a look in the Console view to see what was printed at standard output: The first lines here are standard messages which are printed by the run-time system. Finally we can see the "Hello World" printout which we expected from this sample model.