self._ToolDefinitions = None
self._ToolDefFile = None # toolcode : tool path
self._ToolChainFamily = None
- self._BuildOption = None # toolcode : option
+ self._BuildRuleFamily = None
+ self._BuildOption = None # toolcode : option
self._PackageList = None
self._ModuleAutoGenList = None
self._LibraryAutoGenList = None
self._ToolChainFamily = ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]
return self._ToolChainFamily
+ def _GetBuildRuleFamily(self):
+ if self._BuildRuleFamily == None:
+ ToolDefinition = self.Workspace.ToolDef.ToolsDefTxtDatabase
+ if TAB_TOD_DEFINES_BUILDRULEFAMILY not in ToolDefinition \
+ or self.ToolChain not in ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY] \
+ or not ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]:
+ EdkLogger.verbose("No tool chain family found in configuration for %s. Default to MSFT." \
+ % self.ToolChain)
+ self._BuildRuleFamily = "MSFT"
+ else:
+ self._BuildRuleFamily = ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]
+ return self._BuildRuleFamily
+
## Return the build options specific to this platform
def _GetBuildOptions(self):
if self._BuildOption == None:
ToolDefinition = property(_GetToolDefinition) # toolcode : tool path
ToolDefinitionFile = property(_GetToolDefFile) # toolcode : lib path
ToolChainFamily = property(_GetToolChainFamily)
+ BuildRuleFamily = property(_GetBuildRuleFamily)
BuildOption = property(_GetBuildOptions) # toolcode : option
BuildCommand = property(_GetBuildCommand)
self.BuildTarget = Target
self.Arch = Arch
self.ToolChainFamily = self.PlatformInfo.ToolChainFamily
+ self.BuildRuleFamily = self.PlatformInfo.BuildRuleFamily
self.IsMakeFileCreated = False
self.IsCodeFileCreated = False
BuildRules = {}
BuildRuleDatabase = self.PlatformInfo.BuildRule
for Type in BuildRuleDatabase.FileTypeList:
- RuleObject = BuildRuleDatabase[Type, self.BuildType, self.Arch, self.ToolChainFamily]
+ RuleObject = BuildRuleDatabase[Type, self.BuildType, self.Arch, self.BuildRuleFamily]
if not RuleObject:
# build type is always module type, but ...
if self.ModuleType != self.BuildType:
- RuleObject = BuildRuleDatabase[Type, self.ModuleType, self.Arch, self.ToolChainFamily]
+ RuleObject = BuildRuleDatabase[Type, self.ModuleType, self.Arch, self.BuildRuleFamily]
if not RuleObject:
continue
RuleObject = RuleObject.Instantiate(self.Macros)
if len(Lib.ConstructorList) <= 0:
continue
Dict = {'Function':Lib.ConstructorList}
- if Lib.ModuleType == 'BASE':
+ if Lib.ModuleType in ['BASE', 'SEC']:
ConstructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))
ConstructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict))
elif Lib.ModuleType in ['PEI_CORE','PEIM']:
if Info.IsLibrary:
AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
else:
- if Info.ModuleType == 'BASE':
+ if Info.ModuleType in ['BASE', 'SEC']:
AutoGenC.Append(gLibraryString['BASE'].Replace(Dict))
elif Info.ModuleType in ['PEI_CORE','PEIM']:
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
if len(Lib.DestructorList) <= 0:
continue
Dict = {'Function':Lib.DestructorList}
- if Lib.ModuleType == 'BASE':
+ if Lib.ModuleType in ['BASE', 'SEC']:
DestructorPrototypeString.Append(gLibraryStructorPrototype['BASE'].Replace(Dict))
DestructorCallingString.Append(gLibraryStructorCall['BASE'].Replace(Dict))
elif Lib.ModuleType in ['PEI_CORE','PEIM']:
if Info.IsLibrary:
AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict)
else:
- if Info.ModuleType == 'BASE':
+ if Info.ModuleType in ['BASE', 'SEC']:
AutoGenC.Append(gLibraryString['BASE'].Replace(Dict))
elif Info.ModuleType in ['PEI_CORE','PEIM']:
AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
# @param AutoGenH The TemplateString object for header file
#
def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
- if Info.IsLibrary or Info.ModuleType == "USER_DEFINED":
+ if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']:
return
#
# Module Entry Points
# @param AutoGenH The TemplateString object for header file
#
def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
- if Info.IsLibrary or Info.ModuleType == "USER_DEFINED":
+ if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']:
return
#
# Unload Image Handlers
#\r
def LoadUniFiles(self, FileList = []):\r
if len(FileList) > 0:\r
- if len(FileList) > 1:\r
- NewList = [];\r
- for File in FileList:\r
- NewList.append (File)\r
- NewList.sort()\r
- for File in NewList:\r
- self.LoadUniFile(File)\r
- else:\r
- for File in FileList:\r
- self.LoadUniFile(File)\r
+ if len(FileList) > 1:\r
+ NewList = [];\r
+ for File in FileList:\r
+ NewList.append (File)\r
+ NewList.sort()\r
+ for File in NewList:\r
+ self.LoadUniFile(File)\r
+ else:\r
+ for File in FileList:\r
+ self.LoadUniFile(File)\r
\r
#\r
# Add a string to list\r
TAB_TOD_DEFINES_TARGET_ARCH = 'TARGET_ARCH'\r
TAB_TOD_DEFINES_COMMAND_TYPE = 'COMMAND_TYPE'\r
TAB_TOD_DEFINES_FAMILY = 'FAMILY'\r
+TAB_TOD_DEFINES_BUILDRULEFAMILY = 'BUILDRULEFAMILY'\r
\r
#\r
# Conditional Statements\r
if List[4] == TAB_TOD_DEFINES_FAMILY and List[2] == '*' and List[3] == '*':\r
if TAB_TOD_DEFINES_FAMILY not in self.ToolsDefTxtDatabase:\r
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY] = {}\r
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value\r
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY] = {}\r
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value\r
elif List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:\r
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] = Value\r
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value\r
elif self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY][List[1]] != Value:\r
EdkLogger.verbose("Line %d: No override allowed for the family of a tool chain: %s" % ((Index + 1), Name))\r
+ if List[4] == TAB_TOD_DEFINES_BUILDRULEFAMILY and List[2] == '*' and List[3] == '*':\r
+ if TAB_TOD_DEFINES_BUILDRULEFAMILY not in self.ToolsDefTxtDatabase \\r
+ or List[1] not in self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_FAMILY]:\r
+ EdkLogger.verbose("Line %d: The family is not specified, but BuildRuleFamily is specified for the tool chain: %s" % ((Index + 1), Name))\r
+ self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_BUILDRULEFAMILY][List[1]] = Value\r
\r
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]))\r
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]))\r
import os
import linecache
import FdfParser
-from Common import BuildToolError
+from Common.BuildToolError import *
from GenFdsGlobalVariable import GenFdsGlobalVariable
from Workspace.WorkspaceDatabase import WorkspaceDatabase
from Workspace.BuildClassObject import PcdClassObject
import struct
import array
-from Common import BuildToolError
+from Common.BuildToolError import *
from Common import EdkLogger
from Common.Misc import SaveFileOnChange
PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.')
TokenSpace = PcdPair[0]
TokenCName = PcdPair[1]
-
- PcdDict = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].Pcds
+
PcdValue = ''
- for Key in PcdDict:
- PcdObj = PcdDict[Key]
- if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
- if PcdObj.Type != 'FixedAtBuild':
- EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
- if PcdObj.DatumType != 'VOID*':
- EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
-
- PcdValue = PcdObj.DefaultValue
- break
+ for Platform in GenFdsGlobalVariable.WorkSpace.PlatformList:
+ PcdDict = Platform.Pcds
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+ if PcdObj.Type != 'FixedAtBuild':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+ if PcdObj.DatumType != 'VOID*':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+
+ PcdValue = PcdObj.DefaultValue
+ return PcdValue
+
+ for Package in GenFdsGlobalVariable.WorkSpace.PackageList:
+ PcdDict = Package.Pcds
+ for Key in PcdDict:
+ PcdObj = PcdDict[Key]
+ if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
+ if PcdObj.Type != 'FixedAtBuild':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
+ if PcdObj.DatumType != 'VOID*':
+ EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
+
+ PcdValue = PcdObj.DefaultValue
+ return PcdValue
return PcdValue
-
SetDir = staticmethod(SetDir)
ReplaceWorkspaceMacro = staticmethod(ReplaceWorkspaceMacro)
CallExternalTool = staticmethod(CallExternalTool)
from GenFds import GenFds\r
from CommonDataClass.FdfClass import OptionRomClassObject\r
from Common.Misc import SaveFileOnChange\r
+from Common import EdkLogger\r
+from Common.BuildToolError import *\r
\r
T_CHAR_LF = '\n'\r
\r