@@ -50,6 +50,10 @@ sub workspace_file_name {
50
50
return $_ [0]-> get_modified_workspace_name(' default' , ' .gpj' );
51
51
}
52
52
53
+ sub is_absolute_path {
54
+ my $path = shift ;
55
+ return ($path =~ / ^\/ .+/ || $path =~ / ^[a-zA-Z]:.+/ );
56
+ }
53
57
54
58
sub pre_workspace {
55
59
my ($self , $fh ) = @_ ;
@@ -60,7 +64,9 @@ sub pre_workspace {
60
64
if (defined $$prjs [0]) {
61
65
my $fh = new FileHandle();
62
66
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 )) {
64
70
while (<$fh >) {
65
71
if (/ ^#primaryTarget=(.+)$ / ) {
66
72
$tgt = $1 ;
@@ -71,51 +77,82 @@ sub pre_workspace {
71
77
}
72
78
}
73
79
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
+
74
86
# # Print out the preliminary information
75
87
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 " ,
76
97
" primaryTarget=$tgt$crlf " ,
98
+ " customization=\$ {__OS_DIR}\\ target\\ integrity.bod$crlf " ,
77
99
" [Project]$crlf " ,
78
- " \t --one_instantiation_per_object$crlf " ,
100
+ " \t -gcc$crlf " ,
101
+ " \t --c++11$crlf " ,
79
102
" \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 " ,
81
106
" \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 " ;
84
110
}
85
111
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.
87
120
sub create_integrity_project {
88
121
my ($self , $int_proj , $project , $type , $target ) = @_ ;
89
122
my $outdir = $self -> get_outdir();
90
123
my $crlf = $self -> crlf();
91
124
my $fh = new FileHandle();
92
125
my $int_file = $int_proj ;
93
126
$int_file =~ s /\. gpj$/ .int/ ;
127
+ my $int_file_base = $self -> mpc_basename($int_file );
128
+ my $project_base = $self -> mpc_basename($project );
94
129
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 " )) {
96
132
# # First print out the project file
97
133
print $fh " #!gbuild$crlf " ,
98
134
" \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 " ;
101
137
foreach my $bsp (@integ_bsps ) {
102
138
print $fh " $bsp$crlf " ;
103
139
}
104
140
close ($fh );
105
141
106
142
# # 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 " )) {
108
145
print $fh " Kernel$crlf " ,
109
146
" \t Filename\t\t\t DynamicDownload$crlf " ,
110
147
" EndKernel$crlf$crlf " ,
111
148
" AddressSpace$crlf " ,
112
149
" \t Filename\t\t\t $target$crlf " ,
113
150
" \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 " ,
117
154
" \t Task Initial$crlf " ,
118
- " \t\t StackLength\t\t 0x8000 $crlf " ,
155
+ " \t\t StackLength\t\t 0xa000 $crlf " ,
119
156
" \t EndTask$crlf " ,
120
157
" EndAddressSpace$crlf " ;
121
158
close ($fh );
@@ -130,43 +167,39 @@ sub mix_settings {
130
167
my $mix = $project ;
131
168
my $outdir = $self -> get_outdir();
132
169
170
+ # If the project file path is already an absolute path, use it.
171
+ my $fullpath = is_absolute_path($project ) ? $project : " $outdir /$project " ;
172
+
133
173
# # Things that seem like they should be set in the project
134
174
# # actually have to be set in the controlling project file.
135
- if (open ($rh , " $outdir / $project " )) {
175
+ if (open ($rh , $fullpath )) {
136
176
my $crlf = $self -> crlf();
137
177
my $integrity_project = (index ($tgt , ' integrity' ) >= 0);
138
178
my ($int_proj , $int_type , $target );
139
179
140
180
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.
141
184
if (/ ^\s *(\[ (Program|Library|Subproject)\] )\s *$ / ) {
142
185
my $type = $1 ;
143
186
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]
149
192
}
150
- $mix .= " \t\t $type$crlf " .
151
- " \t -object_dir=" . $self -> mpc_dirname($project ) .
152
- ' /.obj' . $crlf ;
193
+ $mix .= " \t\t $type$crlf " ;
153
194
}
154
195
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 " ;
159
197
}
160
198
elsif ($integrity_project && / ^(.*\. bsp)\s / ) {
161
199
push (@integ_bsps , $1 );
162
200
}
163
201
else {
164
202
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
-
170
203
# # If this is an integrity project, we need to find out
171
204
# # what the output file will be for the integrate file.
172
205
if (defined $int_proj && / ^\s *\- o\s +(.*)\s $ / ) {
@@ -189,12 +222,10 @@ sub mix_settings {
189
222
sub write_comps {
190
223
my ($self , $fh ) = @_ ;
191
224
192
- # # Print out each projet
225
+ # # Print out each project
193
226
foreach my $project ($self -> sort_dependencies($self -> get_projects(), 0)) {
194
227
print $fh $self -> mix_settings($project );
195
228
}
196
229
}
197
230
198
-
199
-
200
231
1;
0 commit comments