IBM Support

How to build a bootable VxWorks application with RoseRT (Method 1)

Troubleshooting


Problem

How to build a bootable VxWorks application with RoseRT (Method 1)

Resolving The Problem

QUESTION: How do I build VxWorks so that it boots and then runs my RoseRT application?

ANSWER:

1) Create a new platform with the TargetRTS for RoseRT. It is recommended doing it this way for any customization so out-of-the-box ports aren't broken when changes are made.
For example, name your target:

TORNADO2T.ppc-cygnus-2.7.2-960126_bootable

In order for this new target to be recognized you need to make the following changes :

- copy the directory $ROSERT_HOME/C++/TargetRTS/config/TORNADO2T.ppc-cygnus-2.7.2-960126 to $ROSERT_HOME/C++/TargetRTS/config/TORNADO2T.ppc-cygnus-2.7.2-960126_bootable

- create a directory ppc-cygnus-2.7.2-960126_bootable in $ROSERT_HOME/C++/TargetRTS/libset

- add a new file, bootlink.pl to $ROSERT_HOME/C++/TargetRTS/target/TORNADO2T, this file prelinks the application but does NOT do munching. Munching is done within Tornado when building the VxWorks executable. Below is an example of bootlink.pl.

################### beginning of bootlink.pl ######################
#! perl -w

# This script translates object file lists
# (identified by %file on the command line) to linker command files.
# This script does not build the construct/destructor tables - this is
# done as an extra step within the Tornado environment.
#
# Example usage:
# ===============
# perl bootlink.pl ARCH=386 -o TopCapsule \
# main.o RTSystem.o %OLIST user_obj.o -LX -lx ...
#
# The general algorithm:
# Translate each OLIST to OLIST.cmd
# ld<ARCH> -r -o TopCapsule main.o RTSystem.o -T OLIST.cmd user_obj.o -LX -lx

# Win9x command.com does not interact with perl according to win32 standard.
# We therefore need to call some functions in a non-standard way.
#
# This detects if the system is Win95 for that purpose.

sub mySystem
{
my( $OS, $ROSERT_HOST );

$OS = $ENV{'OS'} || '?';
$ROSERT_HOST = $ENV{'ROSERT_HOST'} || '?';

if( $ROSERT_HOST eq 'win32' && $OS !~ m{^Windows_NT$}i )
{
return system( join( ' ', @_ ) );
}
else
{
return system( @_ );
}
}

sub report_ges_error
{
my( $ERROR ) = @_;

print "description '$ERROR' severity 'error'\n";
print "result 'failure'\n";

exit 1;
}

$arch_pattern = 'ARCH=(386|68k|960|ppc|simpc|simso)';

sub show_usage
{
&report_ges_error( "Usage: $0 $arch_pattern options ... " );
}

&show_usage() unless $#ARGV >= 1;

if( $ARGV[0] =~ m{^$arch_pattern$} )
{
$arch = $1;
shift @ARGV;
}
else
{
&show_usage();
}

&report_ges_error( "WIND_BASE is not set" )
unless( $WIND_BASE = $ENV{'WIND_BASE'} );

&report_ges_error( "WIND_HOST_TYPE is not set" )
unless( $WIND_HOST_TYPE = $ENV{'WIND_HOST_TYPE'} );

# commands
$ld_cmd = "ld$arch";

# filenames
$output = 'a.out';

$status = 0; # assume all is well
$cmdfile = 'ld000'; # command filename pattern

# Translate all indirect object file lists (identified by %) into linker
# command files for use in the prelink step.

if( $arch eq 'ppc' )
{
@script_intro = ( '-T', "$WIND_BASE/host/$WIND_HOST_TYPE"
. '/powerpc-wrs-vxworks/lib/ldscripts/elf32ppc.xr' );
}
else
{
@script_intro = ();
}

foreach $arg ( @ARGV )
{
if( $arg eq '-o' )
{
$lasto = 1;
}
elsif( $lasto )
{
$output = $arg;
@command = ( $ld_cmd, '-r', '-o', $output );
$lasto = 0;
}
elsif( $arg =~ m{^%(.*)$} )
{
$in = $1;
if( ! open( IN, "<$in" ) )
{
print STDERR "link.pl: Can't read '$in': $!\n";
$status = 1;
}
else
{
$out = "$cmdfile.cmd";
++$cmdfile;
if( ! open( OUT, ">$out" ) )
{
print STDERR "link.pl: Can't create '$out': $!\n";
$status = 1;
}
else
{
while( <IN> )
{
chomp;
print OUT "INPUT(", $_, ".o)\n";
}
close( OUT );

push @command, @script_intro, $out;
@script_intro = ();
push @tmpfiles, $out;
}
close( IN );
}
}
else
{
push @command, $arg;
}
}

# prelink everything

$status = &mySystem( @command ) if $status == 0;

# remove our temporary files

unlink( @tmpfiles );

exit $status if $status < 256;
exit $status / 256;

#################### end of bootlink.pl #######################


- modify libset.mk in $ROSERT_HOME/C++/TargetRTS/libset/ ppc-cygnus-2.7.2-960126_bootable to use this new script (bootlink.pl) instead of the default link.pl

- modify libset.mk - add -DRTinclude_new_h to the LIBSETCCFLAGS macro. If you do not add this and recompile the TargetRTS libraries, you may see the following error when you add the RoseRT module to the VxWorks project,
Warning: size of symbol `operator new(unsigned int, void *)' changed from 8 to 444 in new.o

Below is an example of libset.mk.

#################### beginning of libset.mk #######################

VENDOR = cygnus

AR_CMD = $(PERL) "$(RTS_HOME)/tools/ar.pl" -create=arppc,rc \
-ranlib=ranlibppc
CC = ccppc
LD = $(PERL) "$(RTS_HOME)/target/$(TARGET)/bootlink.pl" ARCH=ppc

LIBSETCCFLAGS = -DPRAGMA -DRTinclude_new_h -ansi -nostdinc -DCPU=PPC603
LIBSETCCEXTRA = -O4 -finline -finline-functions -Wall
SHLIBS =

ALL_OBJS_LIST = %$(ALL_OBJS_LISTFILE)

#################### end of libset.mk #######################

- rebuild the TargetRTS -

cd $ROSERT_HOME/C++/TargetRTS/src
make CONFIG=TORNADO2T.ppc-cygnus-2.7.2-960126_bootable

NOTE: If you get an error that the VxWorks header files cannot be found, add the include path (i.e. -IC:\Tornado\target\h ) to LIBSETCCFLAGS in the libset.mk


2) Create a new component in RoseRT and build the application. The new component should use the target created in step 1). It should show up in the list of targets available. Rebuild the new component.

3) Create a new project within Tornado to build a VxWorks bootable image. This method is easiest to implement because Tornado has existing projects to start from that build bootable images. We simply add the model built in step 2) as an extra module. Some notes :

- create a new build specification for RoseRT.
- in the properties dialog for the RoseRT build spec - press the Macros tab.
- edit the EXTRA_MODULES macro to include the full path to the VxWorks application built in step 2)
- edit the file usrAppInit.c : add a call to rtsMain( "arg1", "arg2", .... ); this is the hook to start your RoseRT application.
- start build. End result will be a file vxWorks. The output directory will be where the project is stored (not in the RoseRT component build directory.) This file can become the boot file for your target board.


4) To enable target observability on the bootable version and to provide arguments you must add command line arguments to usrAppInit.c as described in 3). A typical invocation of this would like :

usrAppInit.c :

rtsMain( "-obslisten=35555", ... );

The port to use for Target Observability in the component instance specification must match the port number assigned to the obslisten parameter..


5) Create target in deployment view. Be sure to set the correct IP address. Create component instance. Set port number as described in 4). Disable the "Attach Target at Startup" option. You must boot the target first and then "Attach Target" (right click on component instance).





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

Historical Number

13067

Document Information

Modified date:
16 June 2018

UID

swg21123664