Add feature of MACRO support in FDF file.
authorjlin16 <jlin16@7335b38e-4728-0410-8992-fb3ffe349368>
Sat, 29 Sep 2007 06:31:40 +0000 (06:31 +0000)
committerjlin16 <jlin16@7335b38e-4728-0410-8992-fb3ffe349368>
Sat, 29 Sep 2007 06:31:40 +0000 (06:31 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@788 7335b38e-4728-0410-8992-fb3ffe349368

17 files changed:
Source/Python/GenFds/AprioriSection.py
Source/Python/GenFds/CompressSection.py
Source/Python/GenFds/DataSection.py
Source/Python/GenFds/EfiSection.py
Source/Python/GenFds/FdfParser.py
Source/Python/GenFds/Ffs.py
Source/Python/GenFds/FfsFileStatement.py
Source/Python/GenFds/FfsInfStatement.py
Source/Python/GenFds/Fv.py
Source/Python/GenFds/FvImageSection.py
Source/Python/GenFds/GenFds.py
Source/Python/GenFds/GenFdsGlobalVariable.py
Source/Python/GenFds/GuidSection.py
Source/Python/GenFds/Region.py
Source/Python/GenFds/Section.py
Source/Python/GenFds/UiSection.py
Source/Python/GenFds/VerSection.py

index a4f170e..a801e2f 100755 (executable)
@@ -12,7 +12,7 @@ class AprioriSection (AprioriSectionClassObject):
         AprioriSectionClassObject.__init__(self)\r
         self.AprioriType = ""\r
         \r
-    def GenFfs (self, fvName):\r
+    def GenFfs (self, fvName, Dict = {}):\r
         DXE_GUID = "FC510EE7-FFDC-11D4-BD41-0080C73C8881"\r
         PEI_GUID = "1B45CC0A-156A-428A-AF62-49864DA0E6E6"\r
         Buffer = StringIO.StringIO('')\r
@@ -31,23 +31,47 @@ class AprioriSection (AprioriSectionClassObject):
                                     guid + fvName + '.Ffs')\r
                                    \r
         OutputAprFile = open(OutputAprFileName, 'w+b')\r
+        \r
+        Dict.update(self.DefineVarDict)\r
+        \r
         for ffs in self.FfsList :\r
             Guid = ""\r
             if isinstance(ffs, FfsFileStatement.FileStatements):\r
                 Guid = ffs.NameGuid\r
             else:\r
                 InfFileName = NormPath(ffs.InfFileName)\r
-                Inf = GenFdsGlobalVariable.WorkSpace.Build['IA32'].ModuleDatabase.get(InfFileName)\r
-                if Inf == None:\r
-                    Inf = GenFdsGlobalVariable.WorkSpace.Build['X64'].ModuleDatabase.get(InfFileName)\r
-                    if Inf == None:\r
-                        Inf = GenFdsGlobalVariable.WorkSpace.Build['IPF'].ModuleDatabase.get(InfFileName)\r
-                        if Inf == None:\r
-                            Inf = GenFdsGlobalVariable.WorkSpace.Build['EBC'].ModuleDatabase.get(InfFileName)\r
-                            if Inf == None:\r
-                                raise Exception ("This File :%s doesn't exist!", InfFileName)\r
+                Arch = ffs.GetCurrentArch()\r
+                \r
+                if Arch != None:\r
+                    Dict['$(ARCH)'] = Arch\r
+                InfFileName = GenFdsGlobalVariable.MacroExtend(InfFileName, Dict)\r
+#                Inf = GenFdsGlobalVariable.WorkSpace.Build['IA32'].ModuleDatabase.get(InfFileName)\r
+#                if Inf == None:\r
+#                    Inf = GenFdsGlobalVariable.WorkSpace.Build['X64'].ModuleDatabase.get(InfFileName)\r
+#                    if Inf == None:\r
+#                        Inf = GenFdsGlobalVariable.WorkSpace.Build['IPF'].ModuleDatabase.get(InfFileName)\r
+#                        if Inf == None:\r
+#                            Inf = GenFdsGlobalVariable.WorkSpace.Build['EBC'].ModuleDatabase.get(InfFileName)\r
+#                            if Inf == None:\r
+#                                raise Exception ("This File :%s doesn't exist!", InfFileName)\r
+                if Arch != None and InfFileName in GenFdsGlobalVariable.WorkSpace.Build[Arch].ModuleDatabase.keys():\r
+                    Inf = GenFdsGlobalVariable.WorkSpace.Build[Arch].ModuleDatabase[InfFileName]\r
+                    Guid = Inf.Guid\r
+        \r
+                elif InfFileName in GenFdsGlobalVariable.WorkSpace.InfDatabase.keys():\r
+                    Inf = GenFdsGlobalVariable.WorkSpace.InfDatabase[InfFileName]\r
+                    Guid = Inf.Module.Header.Guid\r
+                    \r
+                    self.BinFileList = Inf.Module.Binaries\r
+                    if self.BinFileList == []:\r
+                        raise Exception ("INF %s not found in build ARCH %s!" % (InfFileName, GenFdsGlobalVariable.ArchList))\r
+                        sys.exit(1)\r
+        \r
+                else:\r
+                    raise Exception ("INF %s not found in database!" % InfFileName)\r
+                    sys.exit(1)\r
             \r
-                Guid = Inf.Guid\r
+                \r
             GuidPart = Guid.split('-')\r
             Buffer.write(pack('I', long(GuidPart[0], 16)))\r
             Buffer.write(pack('H', int(GuidPart[1], 16)))\r
index 7b67d4b..9b94464 100755 (executable)
@@ -15,7 +15,7 @@ class CompressSection (CompressSectionClassObject) :
         CompressSectionClassObject.__init__(self)\r
         \r
 \r
-    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
         #\r
         # Generate all section\r
         #\r
@@ -28,7 +28,7 @@ class CompressSection (CompressSectionClassObject) :
         for Sect in self.SectionList:\r
             Index = Index + 1\r
             SecIndex = '%s.%d' %(SecNum, Index)\r
-            ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf)\r
+            ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList, FfsInf, Dict)\r
             if ReturnSectList != []:\r
                 for file in ReturnSectList:\r
                    SectFiles = SectFiles + \\r
index b293316..0bab537 100644 (file)
@@ -10,7 +10,7 @@ class DataSection (DataSectionClassObject):
     def __init__(self):\r
         DataSectionClassObject.__init__(self)\r
         \r
-    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsInf = None):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, keyStringList, FfsInf = None, Dict = {}):\r
         #\r
         # Prepare the parameter of GenSection\r
         #\r
@@ -20,6 +20,9 @@ class DataSection (DataSectionClassObject):
             self.SectFileName = FfsInf.__ExtendMarco__(self.SectFileName)\r
         else:\r
             self.SectFileName = GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.SectFileName)\r
+            \r
+        self.SectFileName = GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)\r
+        \r
         """Check Section file exist or not !"""\r
 \r
         if not os.path.exists(self.SectFileName):\r
@@ -31,10 +34,10 @@ class DataSection (DataSectionClassObject):
                        ' -o '         + \\r
                         TeFile        + \\r
                         ' '           + \\r
-                       GenFdsGlobalVariable.ExtendMarco(self.SectFileName)\r
+                       GenFdsGlobalVariable.MacroExtend(self.SectFileName, Dict)\r
             GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
             """Copy Map file to Ffs output"""\r
-            Filename = GenFdsGlobalVariable.ExtendMarco(self.SectFileName)\r
+            Filename = GenFdsGlobalVariable.MacroExtend(self.SectFileName)\r
             if Filename[(len(Filename)-4):] == '.efi':\r
                 MapFile = Filename.replace('.efi', '.map')\r
                 if os.path.exists(MapFile):\r
@@ -52,10 +55,10 @@ class DataSection (DataSectionClassObject):
                          ' -s '                                          + \\r
                          Section.Section.SectionType.get (self.SecType)  + \\r
                          ' '                                             + \\r
-                         GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.SectFileName)\r
+                         self.SectFileName\r
                          \r
         """Copy Map file to Ffs output"""\r
-        Filename = GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.SectFileName)\r
+        Filename = self.SectFileName\r
         if Filename[(len(Filename)-4):] == '.efi':\r
              MapFile = Filename.replace('.efi', '.map')\r
              if os.path.exists(MapFile):\r
index 1b26e4f..009a00c 100644 (file)
@@ -11,7 +11,7 @@ class EfiSection (EfiSectionClassObject):
     def __init__(self):\r
           EfiSectionClassObject.__init__(self)\r
 \r
-    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None) :\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}) :\r
         """Prepare the parameter of GenSection"""\r
         if FfsInf != None :\r
             InfFileName = FfsInf.InfFileName\r
@@ -33,12 +33,13 @@ class EfiSection (EfiSectionClassObject):
         """If the file name was pointed out, add it in FileList"""     \r
         FileList = []\r
         if Filename != None:\r
+            Filename = GenFdsGlobalVariable.MacroExtend(Filename, Dict)\r
             if not self.Optional:\r
                 FileList.append(Filename)\r
             elif os.path.exists(Filename):                 \r
                 FileList.append(Filename)\r
         else:\r
-            FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension)\r
+            FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict)\r
             if IsSect :\r
                 return FileList, self.Alignment\r
 \r
@@ -164,7 +165,7 @@ class EfiSection (EfiSectionClassObject):
                     Index = Index + 1\r
                     Num = '%s.%d' %(SecNum , Index)\r
                     OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
-                    File = GenFdsGlobalVariable.ExtendMarco(File)\r
+                    File = GenFdsGlobalVariable.MacroExtend(File, Dict)\r
                     if File[(len(File)-4):] == '.efi':\r
                         MapFile = File.replace('.efi', '.map')\r
                         if os.path.exists(MapFile):\r
@@ -179,7 +180,7 @@ class EfiSection (EfiSectionClassObject):
                                    ' -o '         + \\r
                                     TeFile        + \\r
                                     ' '           + \\r
-                                   GenFdsGlobalVariable.ExtendMarco(File)\r
+                                   GenFdsGlobalVariable.MacroExtend(File, Dict)\r
                         GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
                         File = TeFile\r
 \r
@@ -189,7 +190,7 @@ class EfiSection (EfiSectionClassObject):
                                          ' -s '                                          + \\r
                                          Section.Section.SectionType.get (SectionType)   + \\r
                                          ' '                                             + \\r
-                                         GenFdsGlobalVariable.ExtendMarco(File)\r
+                                         GenFdsGlobalVariable.MacroExtend(File)\r
                         \r
                     GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
                     OutputFileList.append(OutputFile)\r
index 3d88434..fbf6f21 100644 (file)
@@ -19,6 +19,7 @@ import RuleFileExtension
 import EfiSection\r
 import Vtf\r
 import ComponentStatement\r
+import GenFdsGlobalVariable\r
 \r
 import re\r
 import os\r
@@ -657,6 +658,7 @@ class FdfParser:
                 raise Warning("expected value At Line %d" % self.CurrentLineNumber)\r
 \r
             value = self.__Token\r
+            macro = '$(' + macro + ')'\r
             obj.DefineVarDict[macro] = value\r
             return True\r
         \r
@@ -897,12 +899,12 @@ class FdfParser:
 \r
         self.__GetFvAttributes( fv)\r
         \r
-        self.__GetAprioriSection( fv)\r
-        self.__GetAprioriSection( fv)\r
+        self.__GetAprioriSection( fv, fv.DefineVarDict.copy())\r
+        self.__GetAprioriSection( fv, fv.DefineVarDict.copy())\r
         \r
         while True:\r
-            isInf = self.__GetInfStatement( fv)\r
-            isFile = self.__GetFileStatement( fv)\r
+            isInf = self.__GetInfStatement( fv, MacroDict = fv.DefineVarDict.copy())\r
+            isFile = self.__GetFileStatement( fv, MacroDict = fv.DefineVarDict.copy())\r
             if not isInf and not isFile:\r
                 break\r
         \r
@@ -951,7 +953,7 @@ class FdfParser:
 \r
         return\r
 \r
-    def __GetAprioriSection(self, fv):\r
+    def __GetAprioriSection(self, fv, MacroDict = {}):\r
         \r
         if not self.__IsKeyword( "APRIORI"):\r
             return False\r
@@ -967,9 +969,10 @@ class FdfParser:
         aprSection.AprioriType = type\r
         \r
         self.__GetDefineStatements(aprSection)\r
+        MacroDict.update(aprSection.DefineVarDict)\r
         \r
         while True:\r
-            isInf = self.__GetInfStatement( aprSection)\r
+            isInf = self.__GetInfStatement( aprSection, MacroDict = MacroDict)\r
             isFile = self.__GetFileStatement( aprSection)\r
             if not isInf and not isFile:\r
                 break\r
@@ -980,7 +983,7 @@ class FdfParser:
         fv.AprioriSectionList.append(aprSection)\r
         return True\r
 \r
-    def __GetInfStatement(self, obj, ForCapsule = False):\r
+    def __GetInfStatement(self, obj, ForCapsule = False, MacroDict = {}):\r
 \r
         if not self.__IsKeyword( "INF"):\r
             return False\r
@@ -991,6 +994,10 @@ class FdfParser:
         if not self.__GetNextToken():\r
             raise Warning("expected INF file path At Line %d" % self.CurrentLineNumber)\r
         ffsInf.InfFileName = self.__Token\r
+        \r
+        if ffsInf.InfFileName.find('$') >= 0:\r
+            ffsInf.InfFileName = GenFdsGlobalVariable.GenFdsGlobalVariable.MacroExtend(ffsInf.InfFileName, MacroDict)\r
+            \r
         if not ffsInf.InfFileName in self.profile.InfList:\r
             self.profile.InfList.append(ffsInf.InfFileName)\r
         \r
@@ -1045,7 +1052,7 @@ class FdfParser:
                 \r
 \r
 \r
-    def __GetFileStatement(self, obj, ForCapsule = False):\r
+    def __GetFileStatement(self, obj, ForCapsule = False, MacroDict = {}):\r
 \r
         if not self.__IsKeyword( "FILE"):\r
             return False\r
@@ -1063,7 +1070,7 @@ class FdfParser:
             raise Warning("expected File GUID At Line %d" % self.CurrentLineNumber)\r
         ffsFile.NameGuid = self.__Token\r
     \r
-        self.__GetFilePart( ffsFile)\r
+        self.__GetFilePart( ffsFile, MacroDict.copy())\r
         \r
         if ForCapsule:\r
             capsuleFfs = CapsuleData.CapsuleFfs()\r
@@ -1074,7 +1081,7 @@ class FdfParser:
                 \r
         return True\r
         \r
-    def __GetFilePart(self, ffsFile):\r
+    def __GetFilePart(self, ffsFile, MacroDict = {}):\r
         \r
         self.__GetFileOpts( ffsFile)\r
         \r
@@ -1100,7 +1107,7 @@ class FdfParser:
             \r
         elif self.__Token in ("DEFINE", "APRIORI", "SECTION"):\r
             self.__UndoToken()\r
-            self.__GetSectionData( ffsFile)\r
+            self.__GetSectionData( ffsFile, MacroDict)\r
         else:\r
             ffsFile.FileName = self.__Token\r
         \r
@@ -1145,21 +1152,25 @@ class FdfParser:
             \r
         return False\r
     \r
-    def __GetSectionData(self, ffsFile):\r
+    def __GetSectionData(self, ffsFile, MacroDict = {}):\r
+        Dict = {}\r
+        Dict.update(MacroDict)\r
         \r
         self.__GetDefineStatements(ffsFile)\r
-        self.__GetAprioriSection(ffsFile)\r
-        self.__GetAprioriSection(ffsFile)\r
+        \r
+        Dict.update(ffsFile.DefineVarDict)\r
+        self.__GetAprioriSection(ffsFile, Dict.copy())\r
+        self.__GetAprioriSection(ffsFile, Dict.copy())\r
         \r
         while True:\r
-            isLeafSection = self.__GetLeafSection(ffsFile)\r
+            isLeafSection = self.__GetLeafSection(ffsFile, Dict)\r
             isEncapSection = self.__GetEncapsulationSec(ffsFile)\r
             if not isLeafSection and not isEncapSection:\r
                 break\r
 \r
            \r
     \r
-    def __GetLeafSection(self, obj):\r
+    def __GetLeafSection(self, obj, MacroDict = {}):\r
         \r
         oldPos = self.GetFileBufferPos()\r
         \r
@@ -1224,16 +1235,17 @@ class FdfParser:
                 fv = Fv.FV()\r
                 fv.UiFvName = fvName\r
                 self.__GetDefineStatements( fv)\r
+                MacroDict.update(fv.DefineVarDict)\r
                 self.__GetBlockStatement( fv)\r
                 self.__GetSetStatements( fv)\r
                 self.__GetFvAlignment( fv)\r
                 self.__GetFvAttributes( fv)\r
-                self.__GetAprioriSection( fv)\r
-                self.__GetAprioriSection( fv)\r
+                self.__GetAprioriSection( fv, MacroDict.copy())\r
+                self.__GetAprioriSection( fv, MacroDict.copy())\r
     \r
                 while True:\r
-                    isInf = self.__GetInfStatement( fv)\r
-                    isFile = self.__GetFileStatement( fv)\r
+                    isInf = self.__GetInfStatement( fv, MacroDict.copy())\r
+                    isFile = self.__GetFileStatement( fv, MacroDict.copy())\r
                     if not isInf and not isFile:\r
                         break\r
     \r
index c93901a..3fbf22d 100755 (executable)
@@ -43,5 +43,5 @@ class Ffs(FDClassObject):
     \r
     def __init__(self):\r
         FfsClassObject.__init__(self)\r
-    def GenFfs():\r
-        pass\r
+#    def GenFfs():\r
+#        pass\r
index 5ad1c87..12b8be8 100755 (executable)
@@ -10,11 +10,13 @@ class FileStatements (FileStatementsClassObject) :
     def __init__(self):\r
         FileStatementsClassObject.__init__(self)\r
         \r
-    def GenFfs(self):\r
+    def GenFfs(self, Dict = {}):\r
         OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)\r
         if not os.path.exists(OutputDir):\r
              os.makedirs(OutputDir)\r
 \r
+        Dict.update(self.DefineVarDict)\r
+        \r
         if self.FvName != None :\r
             Buffer = StringIO.StringIO('')\r
             if self.FvName.upper() not in GenFdsGlobalVariable.FdfParser.profile.FvDict.keys():\r
@@ -32,7 +34,8 @@ class FileStatements (FileStatementsClassObject) :
             SectionFiles = ' -i ' + FileName\r
         \r
         elif self.FileName != None:\r
-            SectionFiles = ' -i ' + GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.FileName)\r
+            self.FileName = GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.FileName)\r
+            SectionFiles = ' -i ' + GenFdsGlobalVariable.MacroExtend(self.FileName, Dict)\r
             \r
         else:\r
             SectionFiles = ''\r
@@ -40,7 +43,7 @@ class FileStatements (FileStatementsClassObject) :
             for section in self.SectionList :\r
                 Index = Index + 1\r
                 SecIndex = '%d' %Index\r
-                sectList, align = section.GenSection(OutputDir, self.NameGuid, SecIndex, self.KeyStringList)\r
+                sectList, align = section.GenSection(OutputDir, self.NameGuid, SecIndex, self.KeyStringList, None, Dict)\r
                 if sectList != []:\r
                     for sect in sectList:\r
                         SectionFiles = SectionFiles  + \\r
index b267b16..0a90b25 100644 (file)
@@ -15,15 +15,17 @@ from Common.String import *
 class FfsInfStatement(FfsInfStatementClassObject):\r
     def __init__(self):\r
         FfsInfStatementClassObject.__init__(self)\r
+        self.TargetOverrideList = []\r
 \r
-    def __infParse__(self):\r
-        self.CurrentArch = self.__GetCurrentArch__()\r
+    def __infParse__(self, Dict = {}):\r
+        self.CurrentArch = self.GetCurrentArch()\r
         #\r
         # Get the InfClass object\r
         #\r
 ##        for item in GenFdsGlobalVariable.WorkSpace.InfDatabase:\r
 ##            print item\r
         self.InfFileName = NormPath(self.InfFileName)\r
+        self.InfFileName = GenFdsGlobalVariable.MacroExtend(self.InfFileName, Dict)\r
         (self.SourceDir, InfName) = os.path.split(self.InfFileName)\r
         if self.CurrentArch != None and self.InfFileName in GenFdsGlobalVariable.WorkSpace.Build[self.CurrentArch].ModuleDatabase.keys():\r
             \r
@@ -70,7 +72,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         self.EfiOutputPath = self.__GetEFIOutPutPath__()\r
         GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)\r
                              \r
-    def GenFfs(self):\r
+    def GenFfs(self, Dict = {}):\r
         #\r
         # Parse Inf file get Module related information\r
         #\r
@@ -82,7 +84,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             self.InfFileName = self.InfFileName[1:]\r
         \r
  \r
-        self.__infParse__()\r
+        self.__infParse__(Dict)\r
         #\r
         # Get the rule of how to generate Ffs file\r
         #\r
@@ -107,23 +109,18 @@ class FfsInfStatement(FfsInfStatementClassObject):
             return FfsOutput\r
                 \r
     def __ExtendMarco__ (self, String):\r
-        MarcoDict = {\r
+        MacroDict = {\r
             '$(INF_OUTPUT)'  : self.EfiOutputPath,\r
             '$(MODULE_NAME)' : self.BaseName,\r
             '$(BUILD_NUMBER)': self.BuildNum,\r
             '$(INF_VERSION)' : self.VersionString,\r
-            '$(NAMED_GUID)'  : self.ModuleGuid,\r
-            '$(WORKSPACE)'   : GenFdsGlobalVariable.WorkSpaceDir\r
+            '$(NAMED_GUID)'  : self.ModuleGuid        \r
         }\r
-        if String == None :\r
-            return None\r
-        for Marco in MarcoDict.keys():\r
-            if String.find(Marco) >= 0 :\r
-                String = String.replace (Marco, MarcoDict[Marco])\r
+        String = GenFdsGlobalVariable.MacroExtend(String, MacroDict)\r
         return String\r
 \r
     def __GetRule__ (self) :\r
-        currentArchList = self.__GetCurrentArch__()\r
+        currentArchList = self.CurrentArch\r
         if currentArchList == None:\r
             currentArchList = ['common']\r
         \r
@@ -195,16 +192,23 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if dscArchList != []:\r
             curArchList = set (targetArchList) & set (dscArchList)\r
         GenFdsGlobalVariable.VerboseLogger ("Valid target architecture(s) is : " + " ".join(curArchList))\r
-        return curArchList\r
+        return list(curArchList)\r
     \r
-    def __GetCurrentArch__(self) :\r
+    def GetCurrentArch(self) :\r
         curArchList = self.__GetPlatformArchList__()\r
-        ArchList = curArchList\r
-        for Key in self.KeyStringList:\r
-            Target, Tag, Arch = Key.split('_')\r
-            ArchList = set (ArchList) & set(list(Arch))\r
+        ArchList = []\r
+        if self.KeyStringList != []:\r
+            for Key in self.KeyStringList:\r
+                Target, Tag, Arch = Key.split('_')\r
+                if Arch in curArchList:\r
+                    ArchList.append(Arch)\r
+                if Target not in self.TargetOverrideList:\r
+                    self.TargetOverrideList.append(Target)\r
+        else:\r
+            ArchList = curArchList\r
+                \r
         if len(ArchList) == 1:\r
-            Arch = list(ArchList)[0]\r
+            Arch = ArchList[0]\r
             return Arch\r
         elif len(ArchList) > 1:\r
 #            raise Exception("Module %s has too many build ARCH !" %self.InfFileName)\r
@@ -224,8 +228,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
         index = fileName.find('.')\r
         fileName = fileName[0:index]\r
         Arch = "NoneArch"\r
-        if self.__GetCurrentArch__() != None:\r
-            Arch = self.__GetCurrentArch__()\r
+        if self.CurrentArch != None:\r
+            Arch = self.CurrentArch\r
         \r
         OutputPath = os.path.join(GenFdsGlobalVariable.OuputDir,\r
                                   Arch ,\r
@@ -265,7 +269,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 #\r
                 # Call GenSection\r
                 #\r
-                GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gensection Failed!")\r
+                GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gen section Failed!")\r
                 OutputFileList.append(GenSecOutputFile)\r
         else:\r
             SecNum = '%d' %Index\r
@@ -282,7 +286,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             #\r
             # Call GenSection\r
             #\r
-            GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gensection Failed!")\r
+            GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gen section Failed!")\r
             OutputFileList.append(GenSecOutputFile)\r
 \r
         return OutputFile\r
index 3d5e83c..dea5fd5 100644 (file)
@@ -16,20 +16,24 @@ class FV (FvClassObject):
         self.BaseAddress = None\r
         self.InfFileName = None\r
         self.FvAddressFileName = None\r
-        \r
+\r
     #\r
     #  Generate Fv and add it to the Buffer\r
     #\r
-    def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None) :\r
-        self.__InitialInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)\r
+    def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}) :\r
+        \r
         if self.UiFvName.upper() in GenFds.FvBinDict.keys():\r
             return GenFds.FvBinDict[self.UiFvName.upper()]\r
+        \r
+        self.__InitialInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)\r
         #\r
         # First Process the Apriori section\r
         #\r
+        MacroDict.update(self.DefineVarDict)\r
+        \r
         GenFdsGlobalVariable.VerboseLogger('First generate Apriori file !')\r
         for aprSection in self.AprioriSectionList:\r
-            FileName = aprSection.GenFfs (self.UiFvName)\r
+            FileName = aprSection.GenFfs (self.UiFvName, MacroDict)\r
             # Add Apriori file name to Inf file\r
             self.FvInfFile.writelines("EFI_FILE_NAME = " + \\r
                                        FileName          + \\r
@@ -38,7 +42,7 @@ class FV (FvClassObject):
         # Process Modules in FfsList\r
         \r
         for FfsFile in self.FfsList :\r
-            FileName = FfsFile.GenFfs()\r
+            FileName = FfsFile.GenFfs(MacroDict)\r
             self.FvInfFile.writelines("EFI_FILE_NAME = " + \\r
                                        FileName          + \\r
                                        T_CHAR_LF)\r
index 43208aa..1123a31 100755 (executable)
@@ -10,7 +10,7 @@ class FvImageSection(FvImageSectionClassObject):
     def __init__(self):\r
         FvImageSectionClassObject.__init__(self)\r
         \r
-    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
         OutputFileList = []\r
         \r
         '''If Is FvBin '''\r
@@ -43,20 +43,20 @@ class FvImageSection(FvImageSectionClassObject):
             else:\r
                 raise Exception("FvImageSection Failed! %s NOT found in FDF" % self.FvName)\r
                                  \r
-            FvFileName = self.Fv.AddToBuffer(Buffer)\r
+        FvFileName = self.Fv.AddToBuffer(Buffer, MacroDict = Dict)\r
             \r
-            #\r
-            # Prepare the parameter of GenSection\r
-            #\r
-            OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
+        #\r
+        # Prepare the parameter of GenSection\r
+        #\r
+        OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
                      \r
-            GenSectionCmd = 'GenSec -o '                          + \\r
-                             OutputFile                           + \\r
-                             ' -s '                               + \\r
-                             'EFI_SECTION_FIRMWARE_VOLUME_IMAGE ' + \\r
-                             FvFileName\r
+        GenSectionCmd = 'GenSec -o '                          + \\r
+                         OutputFile                           + \\r
+                         ' -s '                               + \\r
+                         'EFI_SECTION_FIRMWARE_VOLUME_IMAGE ' + \\r
+                         FvFileName\r
                          \r
-            GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
-            OutputFileList.append(OutputFile)\r
+        GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
+        OutputFileList.append(OutputFile)\r
             \r
-            return OutputFileList, self.Alignment\r
+        return OutputFileList, self.Alignment\r
index 6e60719..7c870c3 100644 (file)
@@ -25,14 +25,14 @@ def main():
     ArchList = None\r
 \r
     if options.verbose != None:\r
-        EdkLogger.setLevel(EdkLogger.VERBOSE)\r
+        EdkLogger.SetLevel(EdkLogger.VERBOSE)\r
         GenFdsGlobalVariable.VerboseMode = True\r
     elif options.quiet != None:\r
-        EdkLogger.setLevel(EdkLogger.QUIET)\r
+        EdkLogger.SetLevel(EdkLogger.QUIET)\r
     elif options.debug != None:\r
-        EdkLogger.setLevel(options.debug)\r
+        EdkLogger.SetLevel(options.debug)\r
     else:\r
-        EdkLogger.setLevel(EdkLogger.INFO)\r
+        EdkLogger.SetLevel(EdkLogger.INFO)\r
         \r
     if (options.workspace == None):\r
         GenFdsGlobalVariable.InfLogger("ERROR: E0000: WORKSPACE not defined.\n  Please set the WORKSPACE environment variable to the location of the EDK II install directory.")\r
@@ -40,9 +40,15 @@ def main():
     else:\r
         workspace = options.workspace\r
         GenFdsGlobalVariable.WorkSpaceDir = workspace\r
+        if 'EDK_SOURCE' in os.environ.keys():\r
+            GenFdsGlobalVariable.EdkSourceDir = os.environ['EDK_SOURCE']\r
         if (options.debug):\r
             GenFdsGlobalVariable.VerboseLogger( "Using Workspace:", workspace)\r
 \r
+    Target = Common.TargetTxtClassObject.TargetTxtDict(GenFdsGlobalVariable.WorkSpaceDir)\r
+    GenFdsGlobalVariable.TargetName = Target.TargetTxtDictionary['TARGET'][0]\r
+    GenFdsGlobalVariable.ToolChainTag = Target.TargetTxtDictionary['TOOL_CHAIN_TAG'][0]\r
+\r
     if (options.filename):\r
         fdfFilename = options.filename\r
         fdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMarco(fdfFilename)\r
@@ -82,41 +88,14 @@ def main():
         else:\r
             raise Exception ("ActivePlatform doesn't exist!")\r
     else :\r
-        Target = Common.TargetTxtClassObject.TargetTxtDict(GenFdsGlobalVariable.WorkSpaceDir)\r
-        activePlatform = Target.TargetTxtDictionary[Common.DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM]\r
+        activePlatform = Target.TargetTxtDictionary['ACTIVE_PLATFORM']\r
 \r
     GenFdsGlobalVariable.ActivePlatform = NormPath(activePlatform)\r
         \r
-    if (options.outputDir):\r
-        outputDir = options.outputDir\r
-        outputDir = GenFdsGlobalVariable.ReplaceWorkspaceMarco(outputDir)\r
-    else:\r
-        #print "ERROR: E0001 - You must specify an Output directory"\r
-        GenFdsGlobalVariable.InfLogger("ERROR: E0001 - You must specify an Output directory")\r
-        sys.exit(1)\r
-\r
-    if outputDir[0:2] == '..':\r
-        outputDir = os.path.realpath(outputDir)\r
-        \r
-    if outputDir[1] != ':':\r
-        outputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, outputDir)\r
-\r
-    if not os.path.exists(outputDir):\r
-        GenFdsGlobalVariable.InfLogger ("ERROR: E1000: Directory %s not found" % (outputDir))\r
-        sys.exit(1)\r
-\r
     if (options.archList) :\r
         archList = options.archList.split(',')\r
     else:\r
-        Target = Common.TargetTxtClassObject.TargetTxtDict(GenFdsGlobalVariable.WorkSpaceDir)\r
         archList = Target.TargetTxtDictionary['TARGET_ARCH']\r
-        \r
-    """ Parse Fdf file """\r
-    fdfParser = FdfParser.FdfParser(fdfFilename)\r
-    fdfParser.ParseFile()\r
-    if fdfParser.CycleReferenceCheck():\r
-        GenFdsGlobalVariable.InfLogger ("ERROR: Cycle Reference Detected in FDF file")\r
-        sys.exit(1)\r
     \r
     if (options.uiFdName) :\r
         if options.uiFdName.upper() in fdfParser.profile.FdDict.keys():\r
@@ -135,6 +114,33 @@ def main():
     """call workspace build create database"""\r
     os.environ["WORKSPACE"] = workspace\r
     buildWorkSpace = Common.EdkIIWorkspaceBuild.WorkspaceBuild(GenFdsGlobalVariable.ActivePlatform, GenFdsGlobalVariable.WorkSpaceDir)\r
+        \r
+    outputDirFromDsc = buildWorkSpace.DscDatabase[GenFdsGlobalVariable.ActivePlatform].Defines.DefinesDictionary['OUTPUT_DIRECTORY'][0]\r
+    GenFdsGlobalVariable.OutputDirFromDsc = NormPath(outputDirFromDsc)\r
+    \r
+    if (options.outputDir):\r
+        outputDir = options.outputDir\r
+        outputDir = GenFdsGlobalVariable.ReplaceWorkspaceMarco(outputDir)\r
+    else:\r
+        outputDir = os.path.join(GenFdsGlobalVariable.OutputDirFromDsc, GenFdsGlobalVariable.TargetName + '_' + GenFdsGlobalVariable.ToolChainTag)        \r
+\r
+    if outputDir[0:2] == '..':\r
+        outputDir = os.path.realpath(outputDir)\r
+        \r
+    if outputDir[1] != ':':\r
+        outputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, outputDir)\r
+\r
+    if not os.path.exists(outputDir):\r
+        GenFdsGlobalVariable.InfLogger ("ERROR: E1000: Directory %s not found" % (outputDir))\r
+        sys.exit(1)\r
+\r
+    """ Parse Fdf file, has to place after build workspace as FDF may contain macros from DSC file """\r
+    fdfParser = FdfParser.FdfParser(fdfFilename)\r
+    fdfParser.ParseFile()\r
+    if fdfParser.CycleReferenceCheck():\r
+        GenFdsGlobalVariable.InfLogger ("ERROR: Cycle Reference Detected in FDF file")\r
+        sys.exit(1)\r
+        \r
     buildWorkSpace.GenBuildDatabase({}, fdfParser.profile.InfList)\r
     \r
     """Call GenFds"""\r
@@ -217,13 +223,13 @@ class GenFds :
                 Buffer.close()\r
                 return\r
         elif GenFds.OnlyGenerateThisFd == None:\r
-            for FvName in GenFdsGlobalVariable.FdfParser.profile.FvDict.keys():\r
-                    Buffer = StringIO.StringIO()\r
-                    fv = GenFdsGlobalVariable.FdfParser.profile.FvDict[FvName]\r
-                    # Get FV base Address\r
-                    fv.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(fv))\r
-                    Buffer.close()\r
-        \r
+            for FvName in GenFdsGlobalVariable.FdfParser.profile.FvDict.keys():          \r
+                Buffer = StringIO.StringIO()\r
+                fv = GenFdsGlobalVariable.FdfParser.profile.FvDict[FvName]\r
+                # Get FV base Address\r
+                fv.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(fv))\r
+                Buffer.close()\r
+    \r
         if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None:\r
             GenFdsGlobalVariable.VerboseLogger(" Gen Capsule !")\r
             for capsule in GenFdsGlobalVariable.FdfParser.profile.CapsuleList:\r
index 05ab7ed..f706cfc 100644 (file)
@@ -12,6 +12,10 @@ class GenFdsGlobalVariable:
     LibDir = ''\r
     WorkSpace = None\r
     WorkSpaceDir = ''\r
+    EdkSourceDir = ''\r
+    OutputDirFromDsc = ''\r
+    TargetName = ''\r
+    ToolChainTag = ''\r
     RuleDict = {}\r
     DefaultRule = None\r
     ArchList = None\r
@@ -21,8 +25,8 @@ class GenFdsGlobalVariable:
     SharpCounter = 0\r
     SharpNumberPerLine = 40\r
 \r
-    def ExtendMarco (String):\r
-        return String\r
+#    def ExtendMarco (String):\r
+#        return String\r
     \r
     def SetDir (OutputDir, FdfParser, WorkSpace, ArchList):\r
         GenFdsGlobalVariable.VerboseLogger( "GenFdsGlobalVariable.OuputDir :%s" %OutputDir)\r
@@ -79,28 +83,42 @@ class GenFdsGlobalVariable:
     def DebugLogger (Level, msg):\r
         EdkLogger.debug(Level, msg)\r
 \r
-    def MarcoExend (Str, MarcoDict):\r
+    def MacroExtend (Str, MacroDict = {}):\r
         if Str == None :\r
             return None\r
         \r
-        Dict = {'$(WORKSPACE)'   : GenFdsGlobalVariable.WorkSpaceDir}\r
-        if MarcoDict != None  and len (MarcoDict) != 0:\r
-            for marco in MarcoDict.keys():\r
-                key = '$(' + marco + ')'\r
-                Dict[key] = MarcoDict.get(marco)\r
+        Dict = {'$(WORKSPACE)'   : GenFdsGlobalVariable.WorkSpaceDir,\r
+                '$(EDK_SOURCE)'  : GenFdsGlobalVariable.EdkSourceDir,\r
+                '$(OUTPUT_DIRECTORY)': GenFdsGlobalVariable.OutputDirFromDsc,\r
+                '$(TARGET)' : GenFdsGlobalVariable.TargetName,\r
+                '$(TOOL_CHAIN_TAG)' : GenFdsGlobalVariable.ToolChainTag\r
+               }\r
+        if MacroDict != None  and len (MacroDict) != 0:\r
+#            for marco in MarcoDict.keys():\r
+#                key = '$(' + marco + ')'\r
+#                Dict[key] = MarcoDict.get(marco)\r
+            Dict.update(MacroDict)\r
 \r
         for key in Dict.keys():\r
             if Str.find(key) >= 0 :\r
                 Str = Str.replace (key, Dict[key])\r
+        \r
+        if Str.find('$(ARCH)') >= 0:\r
+            if len(GenFdsGlobalVariable.ArchList) == 1:\r
+                Str = Str.replace('$(ARCH)', GenFdsGlobalVariable.ArchList[0])\r
+            else:\r
+                GenFdsGlobalVariable.InfLogger ("No way to determine $(ARCH) for %s\n" % Str)\r
+                sys.exit(1)\r
+            \r
         return Str\r
 \r
 \r
     SetDir = staticmethod(SetDir)\r
-    ExtendMarco = staticmethod(ExtendMarco)\r
+#    ExtendMarco = staticmethod(ExtendMarco)\r
     SetDefaultRule = staticmethod(SetDefaultRule)\r
     ReplaceWorkspaceMarco = staticmethod(ReplaceWorkspaceMarco)\r
     CallExternalTool = staticmethod(CallExternalTool)\r
     VerboseLogger = staticmethod(VerboseLogger)\r
     InfLogger = staticmethod(InfLogger)\r
     DebugLogger = staticmethod(DebugLogger)\r
-    MarcoExend = staticmethod (MarcoExend)\r
+    MacroExtend = staticmethod (MacroExtend)\r
index 6b06239..19e3540 100755 (executable)
@@ -12,7 +12,7 @@ class GuidSection(GuidSectionClassObject) :
     def __init__(self):\r
         GuidSectionClassObject.__init__(self)\r
         \r
-    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
         #\r
         # Generate all section\r
         #\r
@@ -28,7 +28,7 @@ class GuidSection(GuidSectionClassObject) :
         for Sect in self.SectionList:\r
             Index = Index + 1\r
             SecIndex = '%s.%d' %(SecNum,Index)\r
-            ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList,FfsInf)\r
+            ReturnSectList, align = Sect.GenSection(OutputPath, ModuleName, SecIndex, KeyStringList,FfsInf, Dict)\r
             if ReturnSectList != []:\r
                 for file in ReturnSectList:\r
                     SectFile = SectFile + \\r
index 6675ed3..a7dcc29 100644 (file)
@@ -10,7 +10,7 @@ class region(RegionClassObject):
 \r
     """Add RegionData to Fd file"""\r
 \r
-    def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, FvBinDict, vtfDict = None, MarcoDict = None):\r
+    def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, FvBinDict, vtfDict = None, MacroDict = {}):\r
         Size = self.Size\r
         GenFdsGlobalVariable.InfLogger('Generate Region')\r
         GenFdsGlobalVariable.InfLogger("   Region Size = 0x%x" %Size)\r
@@ -30,7 +30,7 @@ class region(RegionClassObject):
             for RegionData in self.RegionDataList:\r
                 \r
                 if RegionData.endswith(".fv"):\r
-                    RegionData = GenFdsGlobalVariable.MarcoExend(RegionData, MarcoDict)\r
+                    RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
                     GenFdsGlobalVariable.InfLogger('   Region FV File Name = .fv : %s'%RegionData)\r
                     if RegionData[1] != ':' :\r
                         RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
@@ -79,7 +79,7 @@ class region(RegionClassObject):
         if self.RegionType == 'FILE':\r
             FvBuffer = StringIO.StringIO('')\r
             for RegionData in self.RegionDataList:\r
-                RegionData = GenFdsGlobalVariable.MarcoExend(RegionData, MarcoDict)\r
+                RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)\r
                 GenFdsGlobalVariable.InfLogger('   Region File Name = FILE: %s'%RegionData)\r
                 if RegionData[1] != ':' :\r
                     RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)\r
index 624b4c0..c4c1462 100755 (executable)
@@ -56,10 +56,10 @@ class Section (SectionClassObject):
     def __init__(self):\r
         SectionClassObject.__init__(self)\r
         \r
-    def GenSection(self, OutputPath, GuidName, SecNum, keyStringList, FfsInf = None):\r
+    def GenSection(self, OutputPath, GuidName, SecNum, keyStringList, FfsInf = None, Dict = {}):\r
         pass\r
 \r
-    def GetFileList(FfsInf, FileType, FileExtension):\r
+    def GetFileList(FfsInf, FileType, FileExtension, Dict = {}):\r
         if FileType in Section.SectFileType.keys() :\r
             IsSect = True\r
         else :\r
@@ -76,8 +76,9 @@ class Section (SectionClassObject):
         \r
         FileList = []\r
         for File in FfsInf.BinFileList :\r
-            if File.FileType == FileType:\r
-                FileList.append(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FfsInf.SourceDir, File.BinaryFile))\r
+            if File.FileType == FileType and FfsInf.CurrentArch in File.SupArchList:\r
+                if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList:\r
+                    FileList.append(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FfsInf.SourceDir, File.BinaryFile))\r
         \r
         if os.path.exists(FfsInf.EfiOutputPath):\r
             for file in os.listdir(FfsInf.EfiOutputPath):\r
@@ -85,5 +86,5 @@ class Section (SectionClassObject):
                 if Ext == suffix:\r
                    FileList.append(os.path.join(FfsInf.EfiOutputPath, file))\r
                    \r
-        return FileList, IsSect\r
+        return FileList, IsSect \r
     GetFileList = staticmethod(GetFileList)\r
index b712f60..85d38a1 100644 (file)
@@ -9,7 +9,7 @@ class UiSection (UiSectionClassObject):
     def __init__(self):\r
         UiSectionClassObject.__init__(self)\r
 \r
-    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
         #\r
         # Prepare the parameter of GenSection\r
         #\r
@@ -24,6 +24,7 @@ class UiSection (UiSectionClassObject):
             NameString = self.StringData\r
         elif self.FileName != None:\r
             file = GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.FileName)\r
+            file = GenFdsGlobalVariable.MacroExtend(file, Dict)\r
             f = open(file, 'r')\r
             NameString = f.read()\r
             NameString = '\"' + NameString + "\""\r
index 2840b4f..08291cc 100644 (file)
@@ -9,7 +9,7 @@ class VerSection (VerSectionClassObject):
     def __init__(self):\r
         VerSectionClassObject.__init__(self)\r
         \r
-    def GenSection(self,OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None):\r
+    def GenSection(self,OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
         #\r
         # Prepare the parameter of GenSection\r
         #\r
@@ -33,7 +33,9 @@ class VerSection (VerSectionClassObject):
         if self.StringData != None:\r
              StringData = self.StringData\r
         elif self.FileName != None:\r
-            f = open (self.FileName, 'r')\r
+            file = GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.FileName)\r
+            file = GenFdsGlobalVariable.MacroExtend(file, Dict)\r
+            f = open (file, 'r')\r
             StringData = f.read()\r
             StringData = '\"' + StringData + '\"'\r
             f.close()\r