Skip to content

Commit f36608c

Browse files
committed
Handle absolute path to project file
1 parent d158343 commit f36608c

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

modules/GHSWorkspaceCreator.pm

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,14 @@ sub pre_workspace {
110110
"\t-non_shared$crlf";
111111
}
112112

113-
# TODO(sonndinh): Looks like this only support [INTEGRITY Application] with
114-
# only one [Program] (i.e., executable) in the image. But this seems sufficient
115-
# for most cases. How does a [INTEGRITY Application] gpj file look with more
116-
# than one [Program]s and how does the corresponding .int file look?
113+
# Write a .int file processed by the Integrate tool to create a dynamic download image.
114+
# This file creates a single virtual AddressSpace with specific assumptions such as
115+
# the language being used is C++, the heap size, stack length of the Initial Task.
116+
# Specific application may need to update the generated .int file according to its needs.
117+
# For example, if the application requires working with a file system, use the MULTI IDE
118+
# GUI to add a file system module to the application; this will automatically update the
119+
# .int file. If the application requires more heap memory, manually update the HeapSize
120+
# line to increase the heap size.
117121
sub create_integrity_project {
118122
my($self, $int_proj, $project, $type, $target) = @_;
119123
my $outdir = $self->get_outdir();
@@ -141,8 +145,8 @@ sub create_integrity_project {
141145
"AddressSpace$crlf",
142146
"\tFilename\t\t\t$target$crlf",
143147
"\tLanguage\t\t\tC++$crlf",
144-
## sonndinh: Some ACE tests require a bigger heap memory size.
145-
## Default heap size is 64kB; increase to 2MB here.
148+
# Default heap size is 64kB.
149+
# Increase to 2MB here to cover more applications.
146150
"\tHeapSize\t\t\t0x200000$crlf",
147151
"\tTask Initial$crlf",
148152
"\t\tStackLength\t\t0x8000$crlf",
@@ -160,28 +164,32 @@ sub mix_settings {
160164
my $mix = $project;
161165
my $outdir = $self->get_outdir();
162166

167+
# If the project file path is already an absolute path, use it.
168+
my $fullpath;
169+
if ($project =~ /^\/.*/ || $project =~ /^[a-zA-Z]:.*/) {
170+
$fullpath = $project;
171+
} else {
172+
$fullpath = "$outdir/$project";
173+
}
174+
163175
## Things that seem like they should be set in the project
164176
## actually have to be set in the controlling project file.
165-
if (open($rh, "$outdir/$project")) {
177+
if (open($rh, $fullpath)) {
166178
my $crlf = $self->crlf();
167179
my $integrity_project = (index($tgt, 'integrity') >= 0);
168180
my($int_proj, $int_type, $target);
169181

170-
# (sonndinh): Go through the lines in this project's gpj file.
171-
# Each line may result in some changes added to the workspace gpj file.
172-
# The changes are returned in the $mix variable.
173-
# In case the project is an
174182
while(<$rh>) {
175-
# (sonndinh): Don't need to add compiler/linker options to the workspace file.
176-
# The gpj file for each individual project should have those already.
177-
# In the workspace file (the top-level project file), only need to list the child projects.
183+
# Don't need to add compiler/linker options to the workspace file.
184+
# The .gpj file for each individual project should have those already.
185+
# In the workspace file, only need to list the child projects.
178186
if (/^\s*(\[(Program|Library|Subproject)\])\s*$/) {
179187
my $type = $1;
180188
if ($integrity_project && $type eq '[Program]') {
181-
$int_proj = $project; #E.g., tests/ARGV_Test.gpj
182-
$int_proj =~ s/(\.gpj)$/_int$1/; #E.g., tests/ARGV_Test_int.gpj
189+
$int_proj = $project; #E.g., tests/MyTest.gpj
190+
$int_proj =~ s/(\.gpj)$/_int$1/; #E.g., tests/MyTest_int.gpj
183191
$int_type = $type; #E.g., [Program]
184-
$mix =~ s/(\.gpj)$/_int$1/; #E.g., tests/ARGV_Test_int.gpj
192+
$mix =~ s/(\.gpj)$/_int$1/; #E.g., tests/MyTest_int.gpj
185193
$type = $integrity; # [INTEGRITY Application]
186194
}
187195
$mix .= "\t\t$type$crlf";
@@ -228,22 +236,10 @@ sub mix_settings {
228236
sub write_comps {
229237
my($self, $fh) = @_;
230238

231-
#my $projects = $self->get_projects();
232-
#my @list = $self->sort_dependencies($projects);
233-
234-
#foreach (@list) {
235-
# print "$_\n";
236-
#}
237-
238-
# TODO(sonndinh): Looks like the individual project files are produced before this happens.
239-
# And this module relies on them to add contents to the workspace file (default.gpj in case of GHS).
240-
241239
## Print out each project
242240
foreach my $project ($self->sort_dependencies($self->get_projects(), 0)) {
243241
print $fh $self->mix_settings($project);
244242
}
245243
}
246244

247-
248-
249245
1;

0 commit comments

Comments
 (0)