@@ -50,6 +50,10 @@ sub workspace_file_name {
5050 return $_ [0]-> get_modified_workspace_name(' default' , ' .gpj' );
5151}
5252
53+ sub is_absolute_path {
54+ my $path = shift ;
55+ return ($path =~ / ^\/ .+/ || $path =~ / ^[a-zA-Z]:.+/ );
56+ }
5357
5458sub pre_workspace {
5559 my ($self , $fh ) = @_ ;
@@ -60,7 +64,9 @@ sub pre_workspace {
6064 if (defined $$prjs [0]) {
6165 my $fh = new FileHandle();
6266 my $outdir = $self -> get_outdir();
63- if (open ($fh , " $outdir /$$prjs [0]" )) {
67+ my $fullpath = is_absolute_path($$prjs [0]) ? $$prjs [0] : " $outdir /$$prjs [0]" ;
68+
69+ if (open ($fh , $fullpath )) {
6470 while (<$fh >) {
6571 if (/ ^#primaryTarget=(.+)$ / ) {
6672 $tgt = $1 ;
@@ -71,51 +77,82 @@ sub pre_workspace {
7177 }
7278 }
7379
80+ # # Try to read the INTEGRITY installation directory and BSP name from environment.
81+ # # Default values are the installation directory on Windows and the BSP name
82+ # # for the simulator for PowerPC architecture.
83+ my $ghs_os_dir = defined $ENV {GHS_OS_DIR } ? $ENV {GHS_OS_DIR } : ' C:\ghs\int1146' ;
84+ my $ghs_bsp_name = defined $ENV {GHS_BSP_NAME } ? $ENV {GHS_BSP_NAME } : " sim800" ;
85+
7486 # # Print out the preliminary information
7587 print $fh " #!gbuild$crlf " ,
88+ " import ACE_ROOT$crlf " ,
89+ " import TAO_ROOT$crlf " ,
90+ ' defineConfig(Debug dbg "")' , $crlf ,
91+ ' defineConfig(Release rel "")' , $crlf ,
92+ " macro __OS_DIR=$ghs_os_dir$crlf " ,
93+ " macro __BSP_NAME=$ghs_bsp_name$crlf " ,
94+ " macro __BSP_DIR=\$ {__OS_DIR}\\\$ {__BSP_NAME}$crlf " ,
95+ " macro __BUILD_DIR=\$ {ACE_ROOT}\\ build$crlf " ,
96+ " macro __LIBS_DIR_BASE=\$ {__OS_DIR}\\ libs$crlf " ,
7697 " primaryTarget=$tgt$crlf " ,
98+ " customization=\$ {__OS_DIR}\\ target\\ integrity.bod$crlf " ,
7799 " [Project]$crlf " ,
78- " \t --one_instantiation_per_object$crlf " ,
100+ " \t -gcc$crlf " ,
101+ " \t --c++11$crlf " ,
79102 " \t :sourceDir=.$crlf " ,
80- " \t --std$crlf " ,
103+ " \t :optionsFile=\$ {__OS_DIR}\\ target\\\$ {__BSP_NAME}.opt$crlf " ,
104+ " \t -I\$ {ACE_ROOT}$crlf " ,
105+ " \t -I\$ {TAO_ROOT}$crlf " ,
81106 " \t -language=cxx$crlf " ,
82- " \t --long_long$crlf " ,
83- " \t --new_style_casts$crlf " ;
107+ " \t --new_style_casts$crlf " ,
108+ " \t -non_shared$crlf " ,
109+ " \t {config(dbg)}-G$crlf " ;
84110}
85111
86-
112+ # Write a .int file processed by the Integrate tool to create a dynamic download image.
113+ # This file creates a single virtual AddressSpace with specific assumptions such as
114+ # the language being used is C++, the heap size, stack length of the Initial Task.
115+ # Specific application may need to update the generated .int file according to its needs.
116+ # For example, if the application requires working with a file system, use the MULTI IDE
117+ # GUI to add a file system module to the application; this will automatically update the
118+ # .int file. If the application requires more heap memory, manually update the HeapSize
119+ # line to increase the heap size.
87120sub create_integrity_project {
88121 my ($self , $int_proj , $project , $type , $target ) = @_ ;
89122 my $outdir = $self -> get_outdir();
90123 my $crlf = $self -> crlf();
91124 my $fh = new FileHandle();
92125 my $int_file = $int_proj ;
93126 $int_file =~ s /\. gpj$/ .int/ ;
127+ my $int_file_base = $self -> mpc_basename($int_file );
128+ my $project_base = $self -> mpc_basename($project );
94129
95- if (open ($fh , " >$outdir /$int_proj " )) {
130+ my $int_proj_path = is_absolute_path($int_proj ) ? $int_proj : " $outdir /$int_proj " ;
131+ if (open ($fh , " >$int_proj_path " )) {
96132 # # First print out the project file
97133 print $fh " #!gbuild$crlf " ,
98134 " \t $integrity$crlf " ,
99- " $project \t\t $type$crlf " ,
100- " $int_file $crlf " ;
135+ " $project_base \t\t $type$crlf " ,
136+ " $int_file_base $crlf " ;
101137 foreach my $bsp (@integ_bsps ) {
102138 print $fh " $bsp$crlf " ;
103139 }
104140 close ($fh );
105141
106142 # # Next create the integration file
107- if (open ($fh , " >$outdir /$int_file " )) {
143+ my $int_path = is_absolute_path($int_file ) ? $int_file : " $outdir /$int_file " ;
144+ if (open ($fh , " >$int_path " )) {
108145 print $fh " Kernel$crlf " ,
109146 " \t Filename\t\t\t DynamicDownload$crlf " ,
110147 " EndKernel$crlf$crlf " ,
111148 " AddressSpace$crlf " ,
112149 " \t Filename\t\t\t $target$crlf " ,
113150 " \t Language\t\t\t C++$crlf " ,
114- " \t Library \t\t\t\t libINTEGRITY.so $crlf " ,
115- " \t Library \t\t\t\t libc.so $crlf " ,
116- " \t Library \t\t\t\t libscxx_e.so $crlf " ,
151+ # Default heap size is 64kB.
152+ # Increase to 2MB here to cover more applications.
153+ " \t HeapSize \t\t\t 0x200000 $crlf " ,
117154 " \t Task Initial$crlf " ,
118- " \t\t StackLength\t\t 0x8000 $crlf " ,
155+ " \t\t StackLength\t\t 0xa000 $crlf " ,
119156 " \t EndTask$crlf " ,
120157 " EndAddressSpace$crlf " ;
121158 close ($fh );
@@ -130,43 +167,39 @@ sub mix_settings {
130167 my $mix = $project ;
131168 my $outdir = $self -> get_outdir();
132169
170+ # If the project file path is already an absolute path, use it.
171+ my $fullpath = is_absolute_path($project ) ? $project : " $outdir /$project " ;
172+
133173 # # Things that seem like they should be set in the project
134174 # # actually have to be set in the controlling project file.
135- if (open ($rh , " $outdir / $project " )) {
175+ if (open ($rh , $fullpath )) {
136176 my $crlf = $self -> crlf();
137177 my $integrity_project = (index ($tgt , ' integrity' ) >= 0);
138178 my ($int_proj , $int_type , $target );
139179
140180 while (<$rh >) {
181+ # Don't need to add compiler/linker options to the workspace file.
182+ # The .gpj file for each individual project should have those already.
183+ # In the workspace file, only need to list the child projects.
141184 if (/ ^\s *(\[ (Program|Library|Subproject)\] )\s *$ / ) {
142185 my $type = $1 ;
143186 if ($integrity_project && $type eq ' [Program]' ) {
144- $int_proj = $project ;
145- $int_proj =~ s / (\. gpj)$/ _int$1 / ;
146- $int_type = $type ;
147- $mix =~ s / (\. gpj)$/ _int$1 / ;
148- $type = $integrity ;
187+ $int_proj = $project ; # E.g., tests/MyTest.gpj
188+ $int_proj =~ s / (\. gpj)$/ _int$1 / ; # E.g., tests/MyTest_int.gpj
189+ $int_type = $type ; # E.g., [Program]
190+ $mix =~ s / (\. gpj)$/ _int$1 / ; # E.g., tests/MyTest_int.gpj
191+ $type = $integrity ; # [INTEGRITY Application]
149192 }
150- $mix .= " \t\t $type$crlf " .
151- " \t -object_dir=" . $self -> mpc_dirname($project ) .
152- ' /.obj' . $crlf ;
193+ $mix .= " \t\t $type$crlf " ;
153194 }
154195 elsif (/ ^\s *(\[ Shared Object\] )\s *$ / ) {
155- $mix .= " \t\t $1 $crlf " .
156- " \t -pic$crlf " .
157- " \t -object_dir=" . $self -> mpc_dirname($project ) .
158- ' /.shobj' . $crlf ;
196+ $mix .= " \t\t $1 $crlf " ;
159197 }
160198 elsif ($integrity_project && / ^(.*\. bsp)\s / ) {
161199 push (@integ_bsps , $1 );
162200 }
163201 else {
164202 if (/ ^\s *\- ((\w )\w *)/ ) {
165- # # Save the required options into the mixed project string
166- if (defined $directives {$2 } || defined $directives {$1 }) {
167- $mix .= $_ ;
168- }
169-
170203 # # If this is an integrity project, we need to find out
171204 # # what the output file will be for the integrate file.
172205 if (defined $int_proj && / ^\s *\- o\s +(.*)\s $ / ) {
@@ -189,12 +222,10 @@ sub mix_settings {
189222sub write_comps {
190223 my ($self , $fh ) = @_ ;
191224
192- # # Print out each projet
225+ # # Print out each project
193226 foreach my $project ($self -> sort_dependencies($self -> get_projects(), 0)) {
194227 print $fh $self -> mix_settings($project );
195228 }
196229}
197230
198-
199-
2002311;
0 commit comments