Install the Rational Test RealTime integration for Rhapsody
Installation involves these three steps:
- Create Rational Test RealTime menus in Rhapsody.
- Create a new Rational Test RealTime configuration in Rhapsody.
- Update the batch files for Rational Test RealTime.
Create Rational Test RealTime menus in Rhapsody
- Launch Rhapsody by opening the following example that is provided with the product:
C:\Program Files\Telelogic\Rhapsody 7.4\Samples\CSamples\pacemaker\pacemaker.rpy - In Rhapsody, click Tools > Customize. The Helpers window opens.
- Click the New button (
) to create a new customized menu called Test RealTime options.
In the Command field, type the following line: C:\Program Files\Rational\TestRealTime\bin\intel\win32\TestRTcl.exe- In Arguments, type:
TestRTRhap.opt - Select Show in Tools menu, as shown in Figure 1, and then click Apply.
Figure 1. New Test RealTime options menu
- Click the New button (
) to create a new customized menu called Test RealTime Results. - In Command, type the following line:
C:\Program Files\Rational\TestRealTime\bin\intel\win32\studioreport.exe - In Arguments, type:
*/*/attolccReport.xtp - Select Show in Tools menu, as shown in Figure 2, and then click Apply.
Figure 2. New Test RealTime Results menu
- Click the New button (
) to create a new customized menu called Test RealTime Clean. - In Command, type the following line:
C:\Program Files\Rational\TestRealTime\bin\intel\win32\studioreport.exe - In Arguments, type:
-clean */*/attolccReport.xtp - Select Show in the Tools menu, as shown in Figure 3, and then click Apply.
Figure 3. New Test RealTime Clean menu
- Click the New button (
) to create a new customized menu called Test RealTime Clean All - In Command, type the following line:
C:\Program Files\Rational\TestRealTime\bin\intel\win32\studioreport.exe - In Arguments, type: -cleanAll */*/attolccReport.xtp
- Select Show in the Tools menu, as shown in Figure 4, and then click OK.
Figure 4. NewTest RealTime CleanAll menu
Create a new Rational Test RealTime configuration in Rhapsody
- In the Rhapsody project tree, right-click
<<Executable>> EXE, as shown in Figure 5, and then click Set as Active.
Figure 5. Rhapsody project tree in the Entire Model View
- To create a new configuration, copy the existing
Hostconfiguration and rename the copyHost_Coverage. - Create a copy of the Host configuration in the Configurations node. The new
configuration is automatically named
Host_copy, as shown in Figure 6.
Figure 6. Copy of Host
- Right-click
Host_copy, as shown in Figure 7, and click Set as Active.
Figure 7. Host_copy
- Double click the
Host_copyconfiguration and rename itHost_Coverage.
Figure 8. Rename the Host copy
- Click the Settings tab and, in the Environment drop-down list, select the appropriate compiler, as shown in Figure 9.
Figure 9. Select a compiler Click to enlarge
- Ensure that Instrumentation Mode is set to Animation, as shown in Figure 10.
Figure 10. Set Instrumentation Mode
- Click the Properties tab and select View Common > All, as shown in Figure 11.
Figure 11. Select All
- Expand the
C_CGproperties and select the build environment. - Change the InvokeMake property from
msmake.battomsmakeRTRT.bat, as shown in Figure 12 (orCygwinMake.battoCygwinMakeRTRT.bat, as appropriate in your environment).
Figure 12. Change the property name
- Click OK.
Update the "Make batch file" for Rational Test RealTime
This section describes how to update the "Make batch file" for compiling with Cygwin (a Linux®-like environment for Windows) or Microsoft® Visual Studio® Version 6.
- For Cygwin: Update the
CygwinMake.batfile - For Microsoft Visual Studio V6: Update the
msMake.batfile
Update the CygwinMakeRTRT.bat file
- Copy and rename the following file:
<RhapsodyInstallDir>\Share\etc\CygwinMake.batinto:<RhapsodyInstallDir>\Share\etc\CygwinMakeRTRT.bat - Edit the
CygwinMakeRTRT.batfile and make the following changes: Set the environment variable ATLTGT to the selected build environment: setATLTGT=%TESTRTDIR%\targets\cpcgnuAdd the following code:set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl -env_OMROOT=<RhapsodyInstallDir> -env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\Program Files\Telelogic\Rhapsody74\Share"Add this line of code at the end of the make line:CC="attolcc %RT_OPT% -- gcc" LINK_CMD="attolcc %RT_OPT% -- g++"
Listing 1 shows what the CygwinMakeRTRT.bat file should look like:
Listing 1. Sample CygwinMakeRTRT.bat file
@echo off PATH=c:\cygwin\bin;%PATH% if "%2"=="" set target=all if "%2"=="build" set target=all if "%2"=="rebuild" set target=clean all if "%2"=="clean" set target=clean set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl -env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\ Progra~1\Telelogic\Rhapsody74\Share" echo Setting environment for Cygwin echo "make.exe" make -s %target% -f %1 CC="attolcc %RT_OPT% -- gcc" LINK_CMD="attolcc %RT_OPT% -- g++" |
Update the msmakeRTRT.bat file
- Copy and rename the following file:
<RhapsodyInstallDir>\Share\etc\msmake.bat
into:
<RhapsodyInstallDir>\Share\etc\msmakeRTRT.bat - Edit the
msmakeRTRT.batfile to perform the following changes:- Add the following line:
set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl -env_OMROOT=<RhapsodyInstallDir> -env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\Program Files\Telelogic\Rhapsody74\Share" - Add the followings line at the end of the make line:
CC="attolcc %RT_OPT% -- cl" LINK_CMD="attolcc %RT_OPT% -- link"
- Add the following line:
- Edit the
Vcvars32.batfile to set the environment variable ATLTGT to the selected build environment:set ATLTGT=%TESTRTDIR%\targets\cvisual6
Listing 2 shows what the msmakeRTRT.bat file should look like.
Listing 2. Sample msmakeMakeRTRT.bat file
@echo off if "%2"=="" set target=all if "%2"=="build" set target=all if "%2"=="rebuild" set target=clean all if "%2"=="clean" set target=clean rem ensure that the following bolded code is on one line set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl -env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\ Progra~1\Telelogic\Rhapsody74\Share" set MAKEFLAGS= call "C:\Program Files\Telelogic\Rhapsody 7.4\Share\etc\Vcvars32.bat" x86 echo ''nmake.exe rem ensure that the following bolded code is on one line nmake /nologo /S /F %1 %target% %3 %4 %5 %6 CC="attolcc %RT_OPT% -- cl" LINK_CMD="attolcc %RT_OPT% -- link" |
Listing 3 shows what the Vcvars32.bat file should look like.
Listing 3. Sample Vcvars32.bat file
@echo off rem rem Root of Visual Developer Studio Common files. .... set VcOsDir= set VSCommonDir= rem ATLTGT for TestRealTime set ATLTGT=%TESTRTDIR%\targets\cvisual6 |
An example of instrumentation in Rhapsody with Microsoft Visual Studio V6
Edit the Host_Coverage configuration
- Open the Host_Coverage configuration and, on the Settings pane, and select Microsoft.
- Ensure that the following options are set, as shown in Figure 13.
- Instrumentation mode is set to Automation;
- Environment is set to Microsoft
- Build is set to Debug
- Instrumentation mode is set to Automation;
Figure 13. Verify the Host_Coverage settings
- On the Properties tab, select View all,
- In C_CG, under Microsoft®, change the InvokeMake setting from msmake.bat to msmakeRTRT.bat, as shown in Figure 14.
Figure 14. Properties
- Click OK.
Enable Rational Test RealTime instrumentation
- From the Rhapsody project, select Tools > Test RealTime options, as shown in Figure 15.
Figure 15. Open tools
- Click Enable, as shown in Figure 16.
Figure 16. Enable button
- If necessary, you can change the settings. For example, in Other Options add
-verbose, as shown in Figure 17.
Figure 17. Specify options
- Click Apply, and then OK.
Add a Rational Test RealTime dump point to the model
Rational Test RealTime is designed for embedded and real-time systems, which are often designed to never stop. In this case, runtime analysis results are evaluated in the target memory endlessly, until you decide to dump them back to the host machine.
Therefore, you must add a dump command in one of the Pacemaker transitions. You can do this:
- From the Packages tree.
- From the PaceMaker state chart.
Add a dump command from the Packages tree
- Click Enable.
- Select the dump command in the Packages tree (Figure 18).
Figure 18. Select "from On"
- On the General tab, in the action code (Action field), add the following statement, as shown in Figure 19.
#pragma attol insert _ATCPQ_DUMP(1); printf("TestRT results dumped!\n");
Figure 19. Specify transition action
Add a dump command from the PaceMaker state chart
- Select and double-click the evOFF transition, as shown in Figure 20.
Figure 20. The evOFF transition
- On the General tab, in the Action code, add the following statement, as shown in Figure 21.
#pragma attol insert _ATCPQ_DUMP(1); printf("TestRT results dumped!\n");
Figure 21. Specify transition action
- Click OK.
- To generate the code, select Code > Generate > Ctrl-F7 and click Yes, as shown in Figure 22.
Figure 22. Create Host_Coverage directory
- To build the generated code, select Code > Build > Build EXE.exe (F7), as shown in Figure 23.
Figure 23. Build the code
Note: only components with the modified configuration will be instrumented.
When the build is complete, the Build tab displays a Build Done status, as shown in Figure 24.
Figure 24. Build Messages
Run the instrumented application
- Click the Exclamation (!) button, as shown in Figure 25.
Figure 25. Exclamation button
- Click on following icon, as shown in Figure 26.
Figure 26. Click the Run button
- Select Tools > Animated State chart, as shown in Figure 27.
Figure 27. Select Animated State chart
- Select the Pacemaker[0] instance, as shown in Figure 28, and then click OK.
Figure 28. Choose the instance
The state chart opens in the default OFF state, as shown in Figure 29.
Figure 29. State chart in OFF state
- You can interact with the system under test. Click the Event Generator button, as shown in Figure 30.
Figure 30. Click Event Generator
- Click Select and select the Pacemaker[0] instance. In the Event list, select an event, as shown in Figure 31.
Figure 31. Select an event
- Click OK.
View Rational Test RealTime results
- Open the Coverage results on the Rational Test RealTime GUI. Click the Stop button to stop the execution, as shown in Figure 32.
Figure 32. Click Stop
- In Rhapsody, select Tools > Test RealTime Results. This opens Rational Test RealTime with the results, as shown in Figure 33.
Figure 33. Code Coverage [attoIccReport]
Add instrumentation to the Rhapsody framework for memory profiling
The memory profiling report can show many memory leaks. This is because the Rhapsody framework performs memory allocations that are not visible at the application level. To work around this, you must include the Rhapsody framework in the instrumentation.
- Make a copy of the original
msbuild.makfile located inC:\Program Files\Telelogic\Rhapsody74\Share\LangC - For Microsoft makefiles, you build instrumented libraries with standard libraries. To do this, duplicate the line that makes the libraries (not the .dll): once to clean existing intermediate files generated by the previous build, and a second time to build the same libraries with Rational Test RealTime instrumentation and a Rational Test RealTime prefix:
Listing 4 shows an example before modifications for the .axf libraries.
Listing 4. Code before modification
oxflibs : cd oxf $(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET) $(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET) $(MAKE) -f msoxf.mak CFG="distrib_oxf" $(BUILD_TARGET) $(MAKE) -f msoxf.mak CFG="distrib_oxfinst" $(BUILD_TARGET) cd .. |
Listing 5 shows the same example after modifications.
Listing 5. Code with duplicated lines
oxflibs : cd oxf $(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET) $(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET) LIB_PREFIX=RTMS clean $(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET) LIB_PREFIX=RTMS CPP="Attolcc -memprolib --no_sys_include -noTDP -- cl" $(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET) $(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET) LIB_PREFIX=RTMS clean $(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET) LIB_PREFIX=RTMS CPP="Attolcc -memprolib --no_sys_include -noTDP -- cl" etc ... cd .. |
- Rebuild the libraries of the Rhapsody framework with the appropriate memory profiling tracking: click Code > Build Framework, as shown in Figure 34.
Figure 34. Rebuild the libraries
After the framework instrumentation and build process is over (which takes approximately 5 minutes), rebuild the Pacemaker EXE file to integrate the new instrumented libraries of the framework into the final executable code.
Generate more runtime analysis results
- In Rhapsody, select Tools > Test RealTime Options.
- Select the Runtime Trace, Memory, or Performance Profiling tools that you want to enable, as shown in Figure 35.
Figure 35. Select tools to enable
- Click OK and click Code > Rebuild to rebuild your component, as shown in Figure 36.
Figure 36. Rebuild
- Run the instrumented application one more time to view the results in the animated state chart. Do not forget to shoot the event evOFF which permits to fire the transition that contains the dump command).
- In Rhapsody, select Tools > Test RealTime Results to display the corresponding reports in Rational Test RealTime, as shown in Figure 37.
Figure 37. View results
Click to enlarge
Summary of what you have learned
First, to install the Rational Test RealTime integration for Rhapsody, you completed these steps:
- Created Rational Test RealTime menus in Rhapsody
- Created a new configuration
- Updated the make batch files
Next, you enabled and used an example of Rational Test RealTime instrumentation in Rhapsody with Microsoft Visual Studio V6. You completed these tasks:
- Edited the Host_Coverage configuration
- Enabled Rational Test RealTime instrumentation
- Added a Rational Test RealTime dump point to the model
- Generated and built code
- Ran the instrumented application
- Viewed Rational Test RealTime results
- Added instrumentation to the Rhapsody Framework for memory profiling
- Generated more runtime analysis results
See Resources for further information.
Learn
-
Find out more about IBM Rational Test RealTime for articles on the concepts behind effective software development.
-
Explore the IBM Software Testing and Quality Management Solutions information center.
-
Learn more about the Rhapsody
software series
-
Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
-
Explore Rational computer-based, Web-based, and instructor-led online courses. Hone your skills and learn more about Rational tools with these courses, which range from introductory to advanced. The courses on this catalog are available for purchase through computer-based training or Web-based training. Additionally, some "Getting Started" courses are available free of charge.
-
Subscribe to the Rational Edge newsletter for articles on the concepts behind effective software development.
-
Subscribe to the IBM developerWorks newsletter, a weekly update on the best of developerWorks tutorials, articles, downloads, community activities, webcasts and events.
Get products and technologies
-
Download IBM Rational Test RealTime V7.5, a cross-platform automated testing solution for systems developers who are creating complex systems for embedded, real-time, and other cross-platform, distributed applications.
-
Try Rhapsody, which enables teams of engineers to develop real-time embedded applications in a collaborative environment, sharing and communicating design artifacts across disciplines.
-
Download trial versions of IBM Rational software.
- Download these IBM product evaluation versions and get your hands on application development tools and middleware products from
DB2®, Lotus®, Tivoli®, and WebSphere®.
Discuss
- Check out
developerWorks blogs and get involved in the developerWorks community.
Comments (Undergoing maintenance)





