IBM Support

Using pSOS+ with Rose RealTime

Troubleshooting


Problem

Building IBM Rational Rose RealTime applications for the pSOS+ operating system requires more steps than is typical for other operating systems. This technote will help you get your Rose RealTime application running on a pSOS+ target.

Resolving The Problem

Note: This technical note assumes familiarity with pSOS+ and the development tools that form the pRISM+ development environment and is written specifically for the Diab 4.2b tool chain running on a Solaris host. All of the steps are applicable, with minor modification, to a Windows platform.

Setting up your Environment

The first step is to setup your environment for using pSOS+ and a compiler.

Environment vairables required by the pSOS+ development environment:

PSS_ROOT : points to the top level directory of your pSOS+ installation
PSS_BSP : points to the BSP directory for your target
PSS_HOST : type of host being used, in this case "sunos"
SNIFF_MAKE_CMD : make command for Sniff+ (set to snf_gnu)

Other environment variables will need to be set in order to use the entire set of tools, refer to the documentation that comes with the tools to see what needs to be set.

If this is the first time you have used this development environment you should develop and test some simple non-Rose RealTime applications before attempting to build and run Rose RealTime applications on the target hardware.

Building a pSOS+ TargetRTS

The Rose RealTime installation provides many pre-built TargetRTS libraries for different operating system, hardware and compiler combinations. If your particular configuration is not one of the pre-built libraries, or if you have customized your TargetRTS, then you will have to (re)build it.

Assuming you have set up your environment as discussed in the previous section, it is a simple matter to build the TargetRTS.

Note: The file $ROSERT_HOME/C++/TargetRTS/config/PSOS25T.ppc603-Diab-4.2b/setup.pl has definitions that are specific to Rose RealTime's internal development environment. If by default you have the necessary environment to build pSOS+ applications (as discussed in the previous section) then you should remove these environment variable settings in the setup.pl file. In the end your setup.pl file should only contain the following :

$preprocessor = "dplus -t PPC603EH -P";
$supported = 'Yes';

You can now build the TargetRTS libraries for the PSOS25T.ppc603-Diab-4.2b platform :

prompt% cd $ROSERT_HOME/C++/TargetRTS/src
prompt% make CONFIG=PSOS25T.ppc603-Diab-4.2b

If an error occurs during the dependency generation, be sure to remove the $ROSERT_HOME/C++/TargetRTS/build-PSOS25T.ppc603-Diab-4.2b directory before proceeding. This will force regeneration of dependencies the next time you build the TargetRTS. An error during dependency generation is probably due to incorrect path settings for the tool chain executables.

Building a pSOS+ Executable

Once your environment is setup and your TargetRTS is built, you can start the Rose RealTime toolset. It must be started from a shell with the correct settings for compiling and linking pSOS+ applications.

Create a component that uses the appropriate pSOS+ target and compile it.

When you compile a Rose RealTime model using the pSOS+ target you have not completely finished. The "link" step when using pSOS+ is actually an archive command which adds the model code into a library file. This file has the same name as the top capsule with a ".a" extension.

In order to build an executable from this point the pSOS+ RTOS and board support package must be compiled and linked with the Rose RealTime model library and the TargetRTS libraries. The simplest way to do this is to use a template makefile provided by the C++ example program provided with pSOS+. Check your pSOS+ documentation for information on the C++ examples that come with pSOS+.

Create a subdirectory in which to build your pSOS+ application. Try to use a directory that is independent of the working directory for your models. For example, a good place is a subdirectory in your home directory called ~/pSOS_builds/model_name. Copy the following files to this new directory :

$PSS_ROOT/apps/cxx/sys_conf.h
$PSS_ROOT/apps/cxx/drv_conf.c
$PSS_ROOT/apps/cxx/makefile

The makefile must be edited before you can build the executable. Make the following changes :

# add new make variable ROSERT_LIB_DIR and ROSERT_LIBS
ROSERT_LIB_DIR=$(ROSERT_HOME)/C++/TargetRTS/lib/PSOS25T.ppc603-Diab-4.2b
ROSERT_LIBS= -lObjecTime -lObjecTimeTypes

#add new make variable ROSERT_APP_LIB
ROSERT_APP_LIB= *** complete path and filename of ".a" produced by Rose RealTime (include full name including .a) ***

#change PSS_APPOBJS
PSS_APPOBJS=$(ROSERT_LIB_DIR)/main.o

#add following to PSS_COMPLIB - do not remove existing libraries already defined!
PSS_COMPLIB= $(ROSERT_APP_LIB) -L$(ROSERT_LIB_DIR) $(ROSERT_LIBS)
#
#if using Microtec tool chain then use the following definition for PSS_COMPLIB
#the linker only does a single pass so circular references must be resolved by the user
#PSS_COMPLIB= $(ROSERT_UPDATE_LIB) -L$(ROSERT_LIB_DIR) $(ROSERT_LIBS) $(ROSERT_UPDATE_LIB)
#
#remove target "demo.o" and all subsequent commands defined for demo.o target

The sys_conf.h file must be edited to enable features required by Rose RealTime. Make the following changes to the sys_conf.h file :

#define SC_PROBE_DEBUG YES /* pROBE+ (debug interface executive) */
#define SC_PHILE_PHILE YES /* pHILE+ (pHILE+ real-time file sys) */
#define SC_PNA YES /* pNA+ TCP/IP networking manager */
#define SD_LAN1 YES /* Disable the LAN interface */
#define KC_SYSSTK 0x8000 /* pSOS+ system stack size (bytes) */
#define KC_ROOTSSTK 0x8000 /* ROOT supervisor stack size */
#define KC_ROOTUSTK 0x8000 /* ROOT user stack size */
#define NC_NSOCKETS 20 /* Number of sockets in the system */
#define NC_NDESCS 20 /* # of socket descriptors/task */

To build the executable :

make all

Note: To build the executable on Windows NT you must use psosmake. This
is the only make compatible with the supplied pSOS makefile.

psosmake all <Windows NT only!>

The executable will be generated as three files, ram.map, ram.hex and ram.elf.
* ram.map contains the complete memory map of the executable
* ram.elf is the executable in ELF format, needed by SingleStep debugger
* ram.hex provides the Motorola S-records needed by the ppc-Bug DL command or with TFTP (Trivial File Transport Protocol)

Running a pSOS+ Executable (Diab/SDS toolchain)

There are three ways to download and execute a Rose RealTime application on a pSOS+ target.

The first is using the serial line and S-records. This is slow and error prone.

The second is using the SingleStep debugger. The debugger is connected to the target via an Ethernet connection and allows for quick download and then source-level debugging on the target. (Refer to the documentation for SingleStep on how to download an ELF file to the target.) Remember that by default all applications end up as ram.elf and ram.hex.

The third technique is to use TFTP to download the executable (ram.hex). In either case you must configure the target board to startup with pROBE+ which is the resident low-level debugger used with pSOS+. You can configure pROBE+ to startup and be ready in stand-alone mode, SingleStep debugger mode or TFTP boot mode. Since you now have a "standard" pSOS+ executable you should be able to follow the steps documented for SingleStep and/or pROBE+.

Target Observability and pSOS+

Enabling Target Observability (T.O.) in a Rose RealTime application requires command line arguments. You cannot use command line arguments with pSOS+ as you would with UNIX therefore you must compile them into the executable. This is done using the "Default Arguments" entry in the component specification. Add the following arguments :

-obslisten='port'

Where 'port' is the observability port number and must match that set in the process configuration for your target. Note that you must recompile the application if this value changes, i.e. rebuild the executable and download again.

Additional Notes


By default, a Rose RealTime application will assume that it is the root task in the system. Rose RealTime defines the root task, initializes the C++ run time, initializes the system timer (DEV_TIMER) and the serial line (DEV_SERIAL). You must modify the main.cc file in $ROSERT_HOME/C++/TargetRTS/src/target/PSOS2/MAIN in order to modify this behaviour.

If you already have a root task that does this same initialization then you can start the main thread for Rose RealTime from your own root task. The name of the main thread function for Rose RealTime is "main_thread_func". You can use the thread creation code from main.cc as an example. Your user-defined root task must initialize the C++ runtime, timer and serial line in order for Rose RealTime to function properly. If you modify main.cc you must rebuild the TargetRTS as described in the previous section "Building a pSOS+ TargetRTS".

All threads in Rose RealTime running on pSOS+ are created with the T_LOCAL and T_FPU flags set. In addition, each thread is started with the T_PREEMPT, T_TSLICE, T_NOASR and T_USER flags set. You will need to modify $ROSERT_HOME/C++/TargetRTS/src/target/PSOS2/RTThread/ct.cc
in order to change these settings. If you modify this file you must rebuild the TargetRTS as described in the previous section "Building a pSOS+ TargetRTS".

The Rose RealTime TargetRTS uses two event numbers for internal signaling. These are, by default, 1 and 2.







[{"Product":{"code":"SSSHKL","label":"Rational Rose RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"--","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"2002.05.00.305.000","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Historical Number

9354

Document Information

Modified date:
16 June 2018

UID

swg21133988