Skip to content

Commit 35e8d37

Browse files
committed
Read Green Hills variables from environment
1 parent 4382624 commit 35e8d37

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

modules/GHSWorkspaceCreator.pm

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,37 @@ sub pre_workspace {
8181
# The first option requires setting environment variables.
8282
# The second option requires passing parameters to the -relative option.
8383

84+
## Try to read the INTEGRITY installation directory and BSP name from environment.
85+
## Default values are the installation directory on Windows and the BSP name
86+
## for the simulator for PowerPC architecture.
87+
my $ghs_os_dir = defined $ENV{GHS_OS_DIR} ? $ENV{GHS_OS_DIR} : 'C:\ghs\int1146';
88+
my $ghs_bsp_name = defined $ENV{GHS_BSP_NAME} ? $ENV{GHS_BSP_NAME} : "sim800";
89+
8490
## Print out the preliminary information
8591
print $fh "#!gbuild$crlf",
86-
"macro __OS_DIR=C:\ghs\int1146$crlf",
87-
"macro __BSP_NAME=sim800$crlf",
88-
'macro __BSP_DIR=${__OS_DIR}\${__BSP_NAME}$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",
8995
"macro ACE_ROOT=%expand_path(.)$crlf",
90-
'macro __BUILD_DIR=${ACE_ROOT}\build$crlf',
91-
'macro __LIBS_DIR_BASE=${__OS_DIR}\libs$crlf',
96+
"macro __BUILD_DIR=\${ACE_ROOT}\\build$crlf",
97+
"macro __LIBS_DIR_BASE=\${__OS_DIR}\\libs$crlf",
9298
"primaryTarget=$tgt$crlf",
93-
'customization=${__OS_DIR}\target\integrity.bod$crlf',
99+
"customization=\${__OS_DIR}\\target\\integrity.bod$crlf",
94100
"[Project]$crlf",
95-
#"\t-DACE_HAS_CPP14$crlf",
96101
"\t-gcc$crlf",
97102
"\t--c++14$crlf",
98103
"\t--libcxx$crlf",
99104
"\t:sourceDir=.$crlf",
100-
'\t:optionsFile=${__OS_DIR}\target\${__BSP_NAME}.opt$crlf',
101-
'\t-I${ACE_ROOT}$crlf',
105+
"\t:optionsFile=\${__OS_DIR}\\target\\\${__BSP_NAME}.opt$crlf",
106+
"\t-I\${ACE_ROOT}$crlf",
102107
"\t-language=cxx$crlf",
103108
"\t--new_style_casts$crlf",
104109
"\t-non_shared$crlf";
105110
}
106111

107112
# TODO(sonndinh): Looks like this only support [INTEGRITY Application] with
108113
# only one [Program] (i.e., executable) in the image. But this seems sufficient
109-
# for most cases.
110-
# How does a [INTEGRITY Application] gpj file look with more
114+
# for most cases. How does a [INTEGRITY Application] gpj file look with more
111115
# than one [Program]s and how does the corresponding .int file look?
112116
sub create_integrity_project {
113117
my($self, $int_proj, $project, $type, $target) = @_;
@@ -165,11 +169,11 @@ sub mix_settings {
165169
# (sonndinh): Go through the lines in this project's gpj file.
166170
# Each line may result in some changes added to the workspace gpj file.
167171
# The changes are returned in the $mix variable.
168-
# In case the project is an
172+
# In case the project is an
169173
while(<$rh>) {
170174
# (sonndinh): Don't need to add compiler/linker options to the workspace file.
171175
# The gpj file for each individual project should have those already.
172-
# In the workspace file (the top-level project file), only need to list the child projects.
176+
# In the workspace file (the top-level project file), only need to list the child projects.
173177
if (/^\s*(\[(Program|Library|Subproject)\])\s*$/) {
174178
my $type = $1;
175179
if ($integrity_project && $type eq '[Program]') {

templates/ghs.mpd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[Program]
55
-o <%if(exeout)%><%reltop_exeout%><%else%><%reltop%><%endif%>/<%exename%><%if(use_exe_modifier)%><%lib_modifier%><%endif%><%exe_ext%>
66
<%if(need_staticflags)%>
7-
{optional} -non_shared
7+
-non_shared
88
<%endif%>
99
<%else%>
1010
<%comment("TODO-sonndinh: If we put the sharedname branch before the staticname branch, MPC picks")%>

0 commit comments

Comments
 (0)