From: lgao4 Date: Tue, 11 Oct 2011 02:49:48 +0000 (+0000) Subject: Sync BaseTools Branch (version r2362) to EDKII main trunk. X-Git-Tag: edk2-stable201903~14075 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=79b74a03e018ecbf03d8d50e6f20301e249c1ba5 Sync BaseTools Branch (version r2362) to EDKII main trunk. Signed-off-by: lgao4 Reviewed-by: jsu1 Reviewed-by: ydliu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12525 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/BaseTools/Bin/Win32/BPDG.exe b/BaseTools/Bin/Win32/BPDG.exe index 9d2cc2b823..016bee5d84 100644 Binary files a/BaseTools/Bin/Win32/BPDG.exe and b/BaseTools/Bin/Win32/BPDG.exe differ diff --git a/BaseTools/Bin/Win32/BootSectImage.exe b/BaseTools/Bin/Win32/BootSectImage.exe index 1ac08a171e..313bc71756 100755 Binary files a/BaseTools/Bin/Win32/BootSectImage.exe and b/BaseTools/Bin/Win32/BootSectImage.exe differ diff --git a/BaseTools/Bin/Win32/EfiLdrImage.exe b/BaseTools/Bin/Win32/EfiLdrImage.exe index e1c47508e2..e06cbedc51 100755 Binary files a/BaseTools/Bin/Win32/EfiLdrImage.exe and b/BaseTools/Bin/Win32/EfiLdrImage.exe differ diff --git a/BaseTools/Bin/Win32/EfiRom.exe b/BaseTools/Bin/Win32/EfiRom.exe index 73c638f421..01ad3703d0 100755 Binary files a/BaseTools/Bin/Win32/EfiRom.exe and b/BaseTools/Bin/Win32/EfiRom.exe differ diff --git a/BaseTools/Bin/Win32/Fpd2Dsc.exe b/BaseTools/Bin/Win32/Fpd2Dsc.exe index da0b3957dc..fd41b60624 100755 Binary files a/BaseTools/Bin/Win32/Fpd2Dsc.exe and b/BaseTools/Bin/Win32/Fpd2Dsc.exe differ diff --git a/BaseTools/Bin/Win32/GenBootSector.exe b/BaseTools/Bin/Win32/GenBootSector.exe index 62a576b1a6..25f50e5e7e 100755 Binary files a/BaseTools/Bin/Win32/GenBootSector.exe and b/BaseTools/Bin/Win32/GenBootSector.exe differ diff --git a/BaseTools/Bin/Win32/GenCrc32.exe b/BaseTools/Bin/Win32/GenCrc32.exe index 2a4fa4647a..d20d15a950 100755 Binary files a/BaseTools/Bin/Win32/GenCrc32.exe and b/BaseTools/Bin/Win32/GenCrc32.exe differ diff --git a/BaseTools/Bin/Win32/GenDepex.exe b/BaseTools/Bin/Win32/GenDepex.exe index 4330f6d09f..cf6ff7fed9 100755 Binary files a/BaseTools/Bin/Win32/GenDepex.exe and b/BaseTools/Bin/Win32/GenDepex.exe differ diff --git a/BaseTools/Bin/Win32/GenFds.exe b/BaseTools/Bin/Win32/GenFds.exe index a0c20def4d..9209a7dd86 100755 Binary files a/BaseTools/Bin/Win32/GenFds.exe and b/BaseTools/Bin/Win32/GenFds.exe differ diff --git a/BaseTools/Bin/Win32/GenFfs.exe b/BaseTools/Bin/Win32/GenFfs.exe index fa31eeee46..434f8890f0 100755 Binary files a/BaseTools/Bin/Win32/GenFfs.exe and b/BaseTools/Bin/Win32/GenFfs.exe differ diff --git a/BaseTools/Bin/Win32/GenFv.exe b/BaseTools/Bin/Win32/GenFv.exe index 08f4320f87..6d1096efc9 100755 Binary files a/BaseTools/Bin/Win32/GenFv.exe and b/BaseTools/Bin/Win32/GenFv.exe differ diff --git a/BaseTools/Bin/Win32/GenFw.exe b/BaseTools/Bin/Win32/GenFw.exe index 8eab045150..f4331d3eea 100755 Binary files a/BaseTools/Bin/Win32/GenFw.exe and b/BaseTools/Bin/Win32/GenFw.exe differ diff --git a/BaseTools/Bin/Win32/GenPage.exe b/BaseTools/Bin/Win32/GenPage.exe index 8c7097c007..2cdca2ad6c 100755 Binary files a/BaseTools/Bin/Win32/GenPage.exe and b/BaseTools/Bin/Win32/GenPage.exe differ diff --git a/BaseTools/Bin/Win32/GenPatchPcdTable.exe b/BaseTools/Bin/Win32/GenPatchPcdTable.exe index 2371e995e8..4a506e4858 100755 Binary files a/BaseTools/Bin/Win32/GenPatchPcdTable.exe and b/BaseTools/Bin/Win32/GenPatchPcdTable.exe differ diff --git a/BaseTools/Bin/Win32/GenSec.exe b/BaseTools/Bin/Win32/GenSec.exe index 9dbdb062e0..64730c5fa5 100755 Binary files a/BaseTools/Bin/Win32/GenSec.exe and b/BaseTools/Bin/Win32/GenSec.exe differ diff --git a/BaseTools/Bin/Win32/GenVtf.exe b/BaseTools/Bin/Win32/GenVtf.exe index 88e3bc42f5..e15f567a31 100755 Binary files a/BaseTools/Bin/Win32/GenVtf.exe and b/BaseTools/Bin/Win32/GenVtf.exe differ diff --git a/BaseTools/Bin/Win32/LzmaCompress.exe b/BaseTools/Bin/Win32/LzmaCompress.exe index 7c0d8d1363..2652a7b5bd 100755 Binary files a/BaseTools/Bin/Win32/LzmaCompress.exe and b/BaseTools/Bin/Win32/LzmaCompress.exe differ diff --git a/BaseTools/Bin/Win32/MigrationMsa2Inf.exe b/BaseTools/Bin/Win32/MigrationMsa2Inf.exe index a6ed5abd74..2c7b28d59c 100755 Binary files a/BaseTools/Bin/Win32/MigrationMsa2Inf.exe and b/BaseTools/Bin/Win32/MigrationMsa2Inf.exe differ diff --git a/BaseTools/Bin/Win32/PatchPcdValue.exe b/BaseTools/Bin/Win32/PatchPcdValue.exe index 5d6a2aa0e7..4500f21a84 100755 Binary files a/BaseTools/Bin/Win32/PatchPcdValue.exe and b/BaseTools/Bin/Win32/PatchPcdValue.exe differ diff --git a/BaseTools/Bin/Win32/Spd2Dec.exe b/BaseTools/Bin/Win32/Spd2Dec.exe index 60fdb26dd0..5a5bb7b59c 100755 Binary files a/BaseTools/Bin/Win32/Spd2Dec.exe and b/BaseTools/Bin/Win32/Spd2Dec.exe differ diff --git a/BaseTools/Bin/Win32/Split.exe b/BaseTools/Bin/Win32/Split.exe index 761f805315..250cedba6e 100755 Binary files a/BaseTools/Bin/Win32/Split.exe and b/BaseTools/Bin/Win32/Split.exe differ diff --git a/BaseTools/Bin/Win32/TargetTool.exe b/BaseTools/Bin/Win32/TargetTool.exe index 7550a5efee..14b2680005 100755 Binary files a/BaseTools/Bin/Win32/TargetTool.exe and b/BaseTools/Bin/Win32/TargetTool.exe differ diff --git a/BaseTools/Bin/Win32/TianoCompress.exe b/BaseTools/Bin/Win32/TianoCompress.exe index 25b80ed9b7..7bf2896f70 100755 Binary files a/BaseTools/Bin/Win32/TianoCompress.exe and b/BaseTools/Bin/Win32/TianoCompress.exe differ diff --git a/BaseTools/Bin/Win32/Trim.exe b/BaseTools/Bin/Win32/Trim.exe index 85ca31b554..a094bb1102 100755 Binary files a/BaseTools/Bin/Win32/Trim.exe and b/BaseTools/Bin/Win32/Trim.exe differ diff --git a/BaseTools/Bin/Win32/UPT.exe b/BaseTools/Bin/Win32/UPT.exe index 396397d92e..a1cf4d889f 100644 Binary files a/BaseTools/Bin/Win32/UPT.exe and b/BaseTools/Bin/Win32/UPT.exe differ diff --git a/BaseTools/Bin/Win32/VfrCompile.exe b/BaseTools/Bin/Win32/VfrCompile.exe index 3e37b6711e..03d35d7b2d 100755 Binary files a/BaseTools/Bin/Win32/VfrCompile.exe and b/BaseTools/Bin/Win32/VfrCompile.exe differ diff --git a/BaseTools/Bin/Win32/VolInfo.exe b/BaseTools/Bin/Win32/VolInfo.exe index ef8ac32eb2..754857cc1e 100755 Binary files a/BaseTools/Bin/Win32/VolInfo.exe and b/BaseTools/Bin/Win32/VolInfo.exe differ diff --git a/BaseTools/Bin/Win32/build.exe b/BaseTools/Bin/Win32/build.exe index 0f899504f1..8536c7249b 100755 Binary files a/BaseTools/Bin/Win32/build.exe and b/BaseTools/Bin/Win32/build.exe differ diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index cc91445862..c8af70495d 100644 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -161,8 +161,6 @@ DEFINE ICC_WIN_ASLCC_FLAGS = /nologo /c /FIAutoGen.h /TC /Dmain=ReferenceAcp DEFINE ICC_WIN_ASLDLINK_FLAGS = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libmmt /NODEFAULTLIB:libirc DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Developer -DEFINE RVCT31_TOOLS_PATH = c:/Program Files/ARM/RVCT/Programs/3.1/569/win_32-pentium -DEFINE RVCT31CYGWIN_TOOLS_PATH = /cygdrive/c/Program Files/ARM/RVCT/Programs/3.1/569/win_32-pentium DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program Files/CodeSourcery/Sourcery G++ Lite/bin @@ -1976,6 +1974,7 @@ DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing - DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-probe DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency +DEFINE GCC_ARMGCC_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mword-relocations -mlittle-endian -mabi=aapcs -mapcs -fno-short-enums -save-temps -fsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) @@ -3983,99 +3982,145 @@ RELEASE_XCLANG_X64_CC_FLAGS = -ccc-host-triple x86_64-pc-win32-macho -c -Os *_XCLANG_*_ASLPP_FLAGS = -x c -E *_XCLANG_*_ASL_FLAGS = +#################################################################################### +# +# RVCT Common +# +#################################################################################### + +DEFINE RVCT_ALL_CC_FLAGS = --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167 --diag_style=ide +DEFINE RVCT_ALL_DLINK_FLAGS = --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --diag_style=ide #################################################################################### # -# ARM Tools +# ARM RealView Tools - Windows # #################################################################################### -# RVCT31 - Tools from ARM +# RVCT - Tools from ARM -*_RVCT31_*_*_FAMILY = RVCT +*_RVCT_*_*_FAMILY = RVCT # # Use default values, or override in DSC file # -*_RVCT31_ARM_ARCHCC_FLAGS = --thumb --cpu 7-A -*_RVCT31_ARM_ARCHASM_FLAGS = --cpu 7-A -*_RVCT31_ARM_ARCHDLINK_FLAGS = -*_RVCT31_ARM_PLATFORM_FLAGS = +*_RVCT_ARM_ARCHCC_FLAGS = --thumb +*_RVCT_ARM_ARCHASM_FLAGS = +*_RVCT_ARM_ARCHDLINK_FLAGS = +*_RVCT_ARM_PLATFORM_FLAGS = --cpu 7-A - DEBUG_RVCT31_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map --diag_style=ide -RELEASE_RVCT31_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map --diag_style=ide + DEBUG_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map +RELEASE_RVCT_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map -*_RVCT31_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) --apcs /interwork --diag_style=ide -*_RVCT31_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E --diag_style=ide -*_RVCT31_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h -*_RVCT31_ARM_MAKE_PATH = nmake -*_RVCT31_ARM_SLINK_FLAGS = --partial --diag_style=ide -o - DEBUG_RVCT31_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -g -Ospace -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167 --diag_style=ide -RELEASE_RVCT31_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -Ospace -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167 --diag_style=ide +*_RVCT_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) --apcs /interwork +*_RVCT_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E +*_RVCT_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h +*_RVCT_ARM_MAKE_PATH = nmake /NOLOGO +*_RVCT_ARM_SLINK_FLAGS = --partial -o + DEBUG_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g +RELEASE_RVCT_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O2 ################## # ARM definitions ################## -*_RVCT31_ARM_CC_PATH = DEF(RVCT31_TOOLS_PATH)/armcc -*_RVCT31_ARM_SLINK_PATH = DEF(RVCT31_TOOLS_PATH)/armlink -*_RVCT31_ARM_DLINK_PATH = DEF(RVCT31_TOOLS_PATH)/armlink -*_RVCT31_ARM_ASM_PATH = DEF(RVCT31_TOOLS_PATH)/armasm -*_RVCT31_ARM_PP_PATH = DEF(RVCT31_TOOLS_PATH)/armcc -*_RVCT31_ARM_VFRPP_PATH = DEF(RVCT31_TOOLS_PATH)/armcc -*_RVCT31_ARM_FROMELF_PATH = DEF(RVCT31_TOOLS_PATH)/fromelf +*_RVCT_ARM_CC_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCT_ARM_SLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCT_ARM_DLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCT_ARM_ASM_PATH = ENV(RVCT_TOOLS_PATH)armasm +*_RVCT_ARM_PP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCT_ARM_VFRPP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCT_ARM_FROMELF_PATH = ENV(RVCT_TOOLS_PATH)fromelf #################################################################################### # -# ARM Tools & Cygwin +# ARM RealView Tools - Linux # #################################################################################### -# ARMCYGWIN - Tools from ARM in a Cygwin environment +# RVCTLINUX - Tools from ARM in a Cygwin environment +*_RVCTLINUX_*_*_FAMILY = RVCT +*_RVCTLINUX_*_*_BUILDRULEFAMILY = RVCTLINUX -*_RVCT31CYGWIN_*_*_FAMILY = RVCT -*_RVCT31CYGWIN_*_*_BUILDRULEFAMILY = RVCTCYGWIN +# +# Use default values, or override in DSC file +# +*_RVCTLINUX_ARM_ARCHCC_FLAGS = --thumb +*_RVCTLINUX_ARM_ARCHASM_FLAGS = +*_RVCTLINUX_ARM_ARCHDLINK_FLAGS = +*_RVCTLINUX_ARM_PLATFORM_FLAGS = --cpu 7-A -*_RVCT31CYGWIN_ARM_CCPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc -*_RVCT31CYGWIN_ARM_SLINKPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armlink -*_RVCT31CYGWIN_ARM_DLINKPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armlink -*_RVCT31CYGWIN_ARM_ASMPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armasm -*_RVCT31CYGWIN_ARM_PPPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc -*_RVCT31CYGWIN_ARM_VFRPPPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc -*_RVCT31CYGWIN_ARM_FROMELFPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/fromelf +DEBUG_RVCTLINUX_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map +RELEASE_RVCTLINUX_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map +*_RVCTLINUX_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) --apcs /interwork +*_RVCTLINUX_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E +*_RVCTLINUX_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h +*_RVCTLINUX_ARM_MAKE_PATH = make +*_RVCTLINUX_ARM_SLINK_FLAGS = --partial -o + DEBUG_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g +RELEASE_RVCTLINUX_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O2 +################## +# ARM definitions +################## +*_RVCTLINUX_ARM_CC_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTLINUX_ARM_SLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTLINUX_ARM_DLINK_PATH = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTLINUX_ARM_ASM_PATH = ENV(RVCT_TOOLS_PATH)armasm +*_RVCTLINUX_ARM_PP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTLINUX_ARM_VFRPP_PATH = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTLINUX_ARM_FROMELF_PATH = ENV(RVCT_TOOLS_PATH)fromelf + +#################################################################################### # -# Use default values, or override in DSC file +# ARM RealView Tools - Cygwin # -*_RVCT31CYGWIN_ARM_ARCHCC_FLAGS = --thumb --cpu 7-A -*_RVCT31CYGWIN_ARM_ARCHASM_FLAGS = --cpu 7-A -*_RVCT31CYGWIN_ARM_ARCHDLINK_FLAGS = -*_RVCT31CYGWIN_ARM_PLATFORM_FLAGS = +#################################################################################### +# ARMCYGWIN - Tools from ARM in a Cygwin environment + +*_RVCTCYGWIN_*_*_FAMILY = RVCT +*_RVCTCYGWIN_*_*_BUILDRULEFAMILY = RVCTCYGWIN - DEBUG_RVCT31CYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` --diag_style=ide -RELEASE_RVCT31CYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` --diag_style=ide +*_RVCTCYGWIN_ARM_CCPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTCYGWIN_ARM_SLINKPATH_FLAG = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTCYGWIN_ARM_DLINKPATH_FLAG = ENV(RVCT_TOOLS_PATH)armlink +*_RVCTCYGWIN_ARM_ASMPATH_FLAG = ENV(RVCT_TOOLS_PATH)armasm +*_RVCTCYGWIN_ARM_PPPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTCYGWIN_ARM_VFRPPPATH_FLAG = ENV(RVCT_TOOLS_PATH)armcc +*_RVCTCYGWIN_ARM_FROMELFPATH_FLAG = ENV(RVCT_TOOLS_PATH)fromelf -*_RVCT31CYGWIN_ARM_ASM_FLAGS = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) --apcs /interwork --diag_style=ide -*_RVCT31CYGWIN_ARM_PP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E --diag_style=ide -*_RVCT31CYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h` -*_RVCT31CYGWIN_ARM_MAKE_PATH = make -*_RVCT31CYGWIN_ARM_SLINK_FLAGS = "$(SLINKPATH_FLAG)" --partial --diag_style=ide -o - DEBUG_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -Ospace --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167 --diag_style=ide -RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -Ospace --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167 --diag_style=ide +# +# Use default values, or override in DSC file +# +*_RVCTCYGWIN_ARM_ARCHCC_FLAGS = --thumb +*_RVCTCYGWIN_ARM_ARCHASM_FLAGS = +*_RVCTCYGWIN_ARM_ARCHDLINK_FLAGS = +*_RVCTCYGWIN_ARM_PLATFORM_FLAGS = --cpu 7-A + + DEBUG_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` +RELEASE_RVCTCYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) DEF(RVCT_ALL_DLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` + +*_RVCTCYGWIN_ARM_ASM_FLAGS = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) --apcs /interwork +*_RVCTCYGWIN_ARM_PP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E +*_RVCTCYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h` +*_RVCTCYGWIN_ARM_MAKE_PATH = make +*_RVCTCYGWIN_ARM_SLINK_FLAGS = "$(SLINKPATH_FLAG)" --partial -o + DEBUG_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O1 -g +RELEASE_RVCTCYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(RVCT_ALL_CC_FLAGS) -O2 ################## # ARM definitions ################## -*_RVCT31CYGWIN_ARM_CC_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py -*_RVCT31CYGWIN_ARM_SLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py -*_RVCT31CYGWIN_ARM_DLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py -*_RVCT31CYGWIN_ARM_ASM_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py -*_RVCT31CYGWIN_ARM_PP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py -*_RVCT31CYGWIN_ARM_VFRPP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py -*_RVCT31CYGWIN_ARM_FROMELF_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_CC_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_SLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_DLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_ASM_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_PP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_VFRPP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py +*_RVCTCYGWIN_ARM_FROMELF_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py #################################################################################### # -# ARM GCC (www.codesourcery.com) +# ARM EABI GCC (www.codesourcery.com) # #################################################################################### # ARMGCC - ARM version of the GCC cross compiler @@ -4089,12 +4134,12 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM ################## # ASL definitions ################## -*_ARMGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN) -*_ARMGCC_*_ASL_FLAGS = DEF(IASL_FLAGS) -*_ARMGCC_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) -*_ARMGCC_*_ASLPP_FLAGS = -x c -E -P -*_ARMGCC_*_ASLCC_FLAGS = -x c -*_ARMGCC_*_ASLDLINK_FLAGS = DEF(GCC_DLINK_FLAGS_COMMON) --entry _ReferenceAcpiTable +*_ARMGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN) +*_ARMGCC_*_ASL_FLAGS = DEF(IASL_FLAGS) +*_ARMGCC_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) +*_ARMGCC_*_ASLPP_FLAGS = -x c -E -P +*_ARMGCC_*_ASLCC_FLAGS = -x c +*_ARMGCC_*_ASLDLINK_FLAGS = DEF(GCC_DLINK_FLAGS_COMMON) --entry _ReferenceAcpiTable ################## # ARM definitions @@ -4114,22 +4159,22 @@ RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM # # Use default values, or override in DSC file # -*_ARMGCC_ARM_ARCHCC_FLAGS = -march=armv7-a -mthumb -*_ARMGCC_ARM_ARCHASM_FLAGS = -march=armv7-a +*_ARMGCC_ARM_ARCHCC_FLAGS = -mthumb +*_ARMGCC_ARM_ARCHASM_FLAGS = *_ARMGCC_ARM_ARCHDLINK_FLAGS = *_ARMGCC_ARM_PLATFORM_FLAGS = -march=armv7-a - DEBUG_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian -g -RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian + DEBUG_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -g +RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -*_ARMGCC_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h -*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h +*_ARMGCC_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h +*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_ARMGCC_ARM_SLINK_FLAGS = -rc *_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --oformat=elf32-littlearm --emit-relocs -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map - DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -g -O0 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mlittle-endian -Os -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h + DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -combine -O0 +RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) DEF(GCC_ARMGCC_CC_FLAGS) -combine -Wno-unused ################# # ASM 16 linker defintions diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c index 8f452c7374..fa86d009da 100644 --- a/BaseTools/Source/C/GenFv/GenFv.c +++ b/BaseTools/Source/C/GenFv/GenFv.c @@ -124,6 +124,11 @@ Returns: Address is the rebase start address for drivers that\n\ run in Flash. It supports DEC or HEX digital format.\n\ If it is set to zero, no rebase action will be taken\n"); + fprintf (stdout, " -F ForceRebase, --force-rebase ForceRebase\n\ + If value is TRUE, will always take rebase action\n\ + If value is FALSE, will always not take reabse action\n\ + If not specified, will take rebase action if rebase address greater than zero, \n\ + will not take rebase action if rebase address is zero.\n"); fprintf (stdout, " -a AddressFile, --addrfile AddressFile\n\ AddressFile is one file used to record the child\n\ FV base address when current FV base address is set.\n"); @@ -231,6 +236,7 @@ Returns: // Set the default FvGuid // memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID)); + mFvDataInfo.ForceRebase = -1; // // Parse command line @@ -330,7 +336,7 @@ Returns: continue; } - if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) { + if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) { if (argv[1] == NULL) { Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile can't be null"); return STATUS_ERROR; @@ -372,6 +378,26 @@ Returns: argv ++; continue; } + + if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) { + if (argv[1] == NULL) { + Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null"); + return STATUS_ERROR; + } + + if (stricmp (argv[1], "TRUE") == 0) { + mFvDataInfo.ForceRebase = 1; + } else if (stricmp (argv[1], "FALSE") == 0) { + mFvDataInfo.ForceRebase = 0; + } else { + Error (NULL, 0, 1003, "Invalid option value", "froce rebase flag value must be \"TRUE\" or \"FALSE\""); + return STATUS_ERROR; + } + + argc -= 2; + argv += 2; + continue; + } if (stricmp (argv[0], "--capheadsize") == 0) { // @@ -597,7 +623,12 @@ Returns: ); } else { VerboseMsg ("Create Fv image and its map file"); - if (mFvDataInfo.BaseAddress != 0) { + // + // Will take rebase action at below situation: + // 1. ForceRebase Flag specified to TRUE; + // 2. ForceRebase Flag not specified, BaseAddress greater than zero. + // + if (((mFvDataInfo.BaseAddress > 0) && (mFvDataInfo.ForceRebase == -1)) || (mFvDataInfo.ForceRebase == 1)) { VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress); } // diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c index d86909b4df..9fdcb47d6b 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -209,6 +209,7 @@ Returns: DebugMsg (NULL, 0, 9, "rebase address", "%s = %s", EFI_FV_BASE_ADDRESS_STRING, Value); FvInfo->BaseAddress = Value64; + FvInfo->BaseAddressSet = TRUE; } } @@ -2826,11 +2827,20 @@ Returns: PeFileBuffer = NULL; // - // Don't need to relocate image when BaseAddress is not set. + // Don't need to relocate image when BaseAddress is zero and no ForceRebase Flag specified. // - if (FvInfo->BaseAddress == 0) { + if ((FvInfo->BaseAddress == 0) && (FvInfo->ForceRebase == -1)) { return EFI_SUCCESS; } + + // + // If ForceRebase Flag specified to FALSE, will always not take rebase action. + // + if (FvInfo->ForceRebase == 0) { + return EFI_SUCCESS; + } + + XipBase = FvInfo->BaseAddress + XipOffset; // diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.h b/BaseTools/Source/C/GenFv/GenFvInternalLib.h index bc25ea8358..2629b9aee8 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.h +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.h @@ -232,6 +232,7 @@ typedef struct { CHAR8 FvFiles[MAX_NUMBER_OF_FILES_IN_FV][_MAX_PATH]; UINT32 SizeofFvFiles[MAX_NUMBER_OF_FILES_IN_FV]; BOOLEAN IsPiFvImage; + INT8 ForceRebase; } FV_INFO; typedef struct { diff --git a/BaseTools/Source/C/Include/Common/BuildVersion.h b/BaseTools/Source/C/Include/Common/BuildVersion.h index 3e1f8f93fa..ec4acc338a 100644 --- a/BaseTools/Source/C/Include/Common/BuildVersion.h +++ b/BaseTools/Source/C/Include/Common/BuildVersion.h @@ -1,3 +1,3 @@ //This file is for build version number auto generation // -#define __BUILD_VERSION "Build 2322" +#define __BUILD_VERSION "Build 2361" diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g index 0cd87bb5e8..d9f8dd99a7 100644 --- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g +++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g @@ -1683,7 +1683,7 @@ vfrStatementGoto : Question "=" ( QN3:StringIdentifier "," << mCVfrQuestionDB.GetQuestionId (QN3->getText (), NULL, QId, BitMask); >> - | QN4:Number "," << QId = _STOQID(QN4->getText()); >> + | QN3:Number "," << QId = _STOQID(QN3->getText()); >> ) ) | diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 55a6a81ccc..8150ea0b69 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -155,7 +155,7 @@ class AutoGen(object): class WorkspaceAutoGen(AutoGen): ## Real constructor of WorkspaceAutoGen # - # This method behaves the same as __init__ except that it needs explict invoke + # This method behaves the same as __init__ except that it needs explicit invoke # (in super class's __new__ method) # # @param WorkspaceDir Root directory of workspace @@ -246,6 +246,9 @@ class WorkspaceAutoGen(AutoGen): # self._CheckPcdDefineAndType() + if self.FdfFile: + self._CheckDuplicateInFV(Fdf) + self._BuildDir = None self._FvDir = None self._MakeFileDir = None @@ -253,6 +256,130 @@ class WorkspaceAutoGen(AutoGen): return True + ## _CheckDuplicateInFV() method + # + # Check whether there is duplicate modules/files exist in FV section. + # The check base on the file GUID; + # + def _CheckDuplicateInFV(self, Fdf): + for Fv in Fdf.Profile.FvDict: + _GuidDict = {} + for FfsFile in Fdf.Profile.FvDict[Fv].FfsList: + if FfsFile.InfFileName and FfsFile.NameGuid == None: + # + # Get INF file GUID + # + InfFoundFlag = False + for Pa in self.AutoGenObjectList: + for Module in Pa.ModuleAutoGenList: + if path.normpath(Module.MetaFile.File) == path.normpath(FfsFile.InfFileName): + InfFoundFlag = True + if not Module.Guid.upper() in _GuidDict.keys(): + _GuidDict[Module.Guid.upper()] = FfsFile + else: + EdkLogger.error("build", + FORMAT_INVALID, + "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum, + FfsFile.CurrentLineContent, + _GuidDict[Module.Guid.upper()].CurrentLineNum, + _GuidDict[Module.Guid.upper()].CurrentLineContent, + Module.Guid.upper()), + ExtraData=self.FdfFile) + # + # Some INF files not have entity in DSC file. + # + if not InfFoundFlag: + if FfsFile.InfFileName.find('$') == -1: + InfPath = NormPath(FfsFile.InfFileName) + if not os.path.exists(InfPath): + EdkLogger.error('build', GENFDS_ERROR, "Non-existant Module %s !" % (FfsFile.InfFileName)) + + PathClassObj = PathClass(FfsFile.InfFileName, self.WorkspaceDir) + # + # Here we just need to get FILE_GUID from INF file, use 'COMMON' as ARCH attribute. and use + # BuildObject from one of AutoGenObjectList is enough. + # + InfObj = self.AutoGenObjectList[0].BuildDatabase.WorkspaceDb.BuildObject[PathClassObj, 'COMMON', self.BuildTarget, self.ToolChain] + if not InfObj.Guid.upper() in _GuidDict.keys(): + _GuidDict[InfObj.Guid.upper()] = FfsFile + else: + EdkLogger.error("build", + FORMAT_INVALID, + "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum, + FfsFile.CurrentLineContent, + _GuidDict[InfObj.Guid.upper()].CurrentLineNum, + _GuidDict[InfObj.Guid.upper()].CurrentLineContent, + InfObj.Guid.upper()), + ExtraData=self.FdfFile) + InfFoundFlag = False + + if FfsFile.NameGuid != None: + _CheckPCDAsGuidPattern = re.compile("^PCD\(.+\..+\)$") + + # + # If the NameGuid reference a PCD name. + # The style must match: PCD(xxxx.yyy) + # + if _CheckPCDAsGuidPattern.match(FfsFile.NameGuid): + # + # Replace the PCD value. + # + _PcdName = FfsFile.NameGuid.lstrip("PCD(").rstrip(")") + PcdFoundFlag = False + for Pa in self.AutoGenObjectList: + if not PcdFoundFlag: + for PcdItem in Pa.AllPcdList: + if (PcdItem.TokenSpaceGuidCName + "." + PcdItem.TokenCName) == _PcdName: + # + # First convert from CFormatGuid to GUID string + # + _PcdGuidString = GuidStructureStringToGuidString(PcdItem.DefaultValue) + + if not _PcdGuidString: + # + # Then try Byte array. + # + _PcdGuidString = GuidStructureByteArrayToGuidString(PcdItem.DefaultValue) + + if not _PcdGuidString: + # + # Not Byte array or CFormat GUID, raise error. + # + EdkLogger.error("build", + FORMAT_INVALID, + "The format of PCD value is incorrect. PCD: %s , Value: %s\n"%(_PcdName, PcdItem.DefaultValue), + ExtraData=self.FdfFile) + + if not _PcdGuidString.upper() in _GuidDict.keys(): + _GuidDict[_PcdGuidString.upper()] = FfsFile + PcdFoundFlag = True + break + else: + EdkLogger.error("build", + FORMAT_INVALID, + "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum, + FfsFile.CurrentLineContent, + _GuidDict[_PcdGuidString.upper()].CurrentLineNum, + _GuidDict[_PcdGuidString.upper()].CurrentLineContent, + FfsFile.NameGuid.upper()), + ExtraData=self.FdfFile) + + if not FfsFile.NameGuid.upper() in _GuidDict.keys(): + _GuidDict[FfsFile.NameGuid.upper()] = FfsFile + else: + # + # Two raw file GUID conflict. + # + EdkLogger.error("build", + FORMAT_INVALID, + "Duplicate GUID found for these lines: Line %d: %s and Line %d: %s. GUID: %s"%(FfsFile.CurrentLineNum, + FfsFile.CurrentLineContent, + _GuidDict[FfsFile.NameGuid.upper()].CurrentLineNum, + _GuidDict[FfsFile.NameGuid.upper()].CurrentLineContent, + FfsFile.NameGuid.upper()), + ExtraData=self.FdfFile) + + def _CheckPcdDefineAndType(self): PcdTypeList = [ "FixedAtBuild", "PatchableInModule", "FeatureFlag", @@ -1749,6 +1876,7 @@ class ModuleAutoGen(AutoGen): self._DepexList = None self._DepexExpressionList = None self._BuildOption = None + self._BuildOptionIncPathList = None self._BuildTargets = None self._IntroBuildTargetList = None self._FinalBuildTargetList = None @@ -2004,6 +2132,50 @@ class ModuleAutoGen(AutoGen): self._BuildOption = self.PlatformInfo.ApplyBuildOption(self.Module) return self._BuildOption + ## Get include path list from tool option for the module build + # + # @retval list The include path list + # + def _GetBuildOptionIncPathList(self): + if self._BuildOptionIncPathList == None: + # + # Regular expression for finding Include Directories, the difference between MSFT and INTEL/GCC + # is the former use /I , the Latter used -I to specify include directories + # + if self.PlatformInfo.ToolChainFamily in ('MSFT'): + gBuildOptIncludePattern = re.compile(r"(?:.*?)/I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL) + elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC'): + gBuildOptIncludePattern = re.compile(r"(?:.*?)-I[ \t]*([^ ]*)", re.MULTILINE|re.DOTALL) + + BuildOptionIncPathList = [] + for Tool in ('CC', 'PP', 'VFRPP', 'ASLPP', 'ASLCC', 'APP', 'ASM'): + Attr = 'FLAGS' + try: + FlagOption = self.BuildOption[Tool][Attr] + except KeyError: + FlagOption = '' + + IncPathList = [NormPath(Path, self.Macros) for Path in gBuildOptIncludePattern.findall(FlagOption)] + # + # EDK II modules must not reference header files outside of the packages they depend on or + # within the module's directory tree. Report error if violation. + # + if self.AutoGenVersion >= 0x00010005 and len(IncPathList) > 0: + for Path in IncPathList: + if (Path not in self.IncludePathList) and (CommonPath([Path, self.MetaFile.Dir]) != self.MetaFile.Dir): + ErrMsg = "The include directory for the EDK II module in this line is invalid %s specified in %s FLAGS '%s'" % (Path, Tool, FlagOption) + EdkLogger.error("build", + PARAMETER_INVALID, + ExtraData = ErrMsg, + File = str(self.MetaFile)) + + + BuildOptionIncPathList += IncPathList + + self._BuildOptionIncPathList = BuildOptionIncPathList + + return self._BuildOptionIncPathList + ## Return a list of files which can be built from source # # What kind of files can be built is determined by build rules in @@ -2256,7 +2428,7 @@ class ModuleAutoGen(AutoGen): # def _GetLibraryPcdList(self): if self._LibraryPcdList == None: - Pcds = {} + Pcds = sdict() if not self.IsLibrary: # get PCDs from dependent libraries for Library in self.DependentLibraryList: @@ -2584,6 +2756,7 @@ class ModuleAutoGen(AutoGen): DxsFile = property(_GetDxsFile) DepexExpressionList = property(_GetDepexExpressionTokenList) BuildOption = property(_GetModuleBuildOption) + BuildOptionIncPathList = property(_GetBuildOptionIncPathList) BuildCommand = property(_GetBuildCommand) # This acts like the main() function for the script, unless it is 'import'ed into another script. diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 5bf693c50f..3720c8bfed 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -614,7 +614,7 @@ cleanlib: self.FileDependency = self.GetFileDependency( SourceFileList, ForceIncludedFile, - self._AutoGenObject.IncludePathList + self._AutoGenObject.IncludePathList + self._AutoGenObject.BuildOptionIncPathList ) DepSet = None for File in self.FileDependency: @@ -1253,7 +1253,7 @@ ${END}\t@cd $(BUILD_DIR) # fds: init \t-@cd $(FV_DIR) -${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END} +${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list}${END}${BEGIN}${extra_options}${END}${BEGIN} -r ${fd}${END}${BEGIN} -i ${fv}${END}${BEGIN} -C ${cap}${END}${BEGIN} -D${macro}${END} # # run command for emulator platform only @@ -1335,6 +1335,9 @@ ${END}\t@cd $(BUILD_DIR)\n if GlobalData.gCaseInsensitive: ExtraOption += " -c" + ExtraOptionList = [] + if ExtraOption: + ExtraOptionList.append(ExtraOption) MakefileName = self._FILE_NAME_[self._FileType] SubBuildCommandList = [] @@ -1366,7 +1369,7 @@ ${END}\t@cd $(BUILD_DIR)\n "fd" : PlatformInfo.FdTargetList, "fv" : PlatformInfo.FvTargetList, "cap" : PlatformInfo.CapTargetList, - "extra_options" : ExtraOption, + "extra_options" : ExtraOptionList, "macro" : MacroList, } diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/Python/AutoGen/StrGather.py index 3df493834c..7187f0a440 100644 --- a/BaseTools/Source/Python/AutoGen/StrGather.py +++ b/BaseTools/Source/Python/AutoGen/StrGather.py @@ -168,8 +168,9 @@ def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag): Str = WriteLine(Str, Line) Line = COMMENT_DEFINE_STR + ' ' + PRINTABLE_LANGUAGE_NAME_STRING_NAME + ' ' * (ValueStartPtr - len(DEFINE_STR + PRINTABLE_LANGUAGE_NAME_STRING_NAME)) + DecToHexStr(1, 4) + COMMENT_NOT_REFERENCED Str = WriteLine(Str, Line) + UnusedStr = '' - #Group the referred STRING token together. + #Group the referred/Unused STRING token together. for Index in range(2, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]])): StringItem = UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]][Index] Name = StringItem.StringName @@ -183,21 +184,14 @@ def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag): else: Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) Str = WriteLine(Str, Line) - - #Group the unused STRING token together. - for Index in range(2, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]])): - StringItem = UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[0][0]][Index] - Name = StringItem.StringName - Token = StringItem.Token - Referenced = StringItem.Referenced - if Name != None: - Line = '' - if Referenced == False: + else: if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0: Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED else: Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED - Str = WriteLine(Str, Line) + UnusedStr = WriteLine(UnusedStr, Line) + + Str = ''.join([Str,UnusedStr]) Str = WriteLine(Str, '') if IsCompatibleMode or UniGenCFlag: @@ -383,7 +377,6 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer, # for IndexI in range(len(UniObjectClass.LanguageDef)): Language = UniObjectClass.LanguageDef[IndexI][0] - LangPrintName = UniObjectClass.LanguageDef[IndexI][1] if Language not in UniLanguageListFiltered: continue @@ -393,12 +386,12 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer, NumberOfUseOtherLangDef = 0 Index = 0 for IndexJ in range(1, len(UniObjectClass.OrderedStringList[UniObjectClass.LanguageDef[IndexI][0]])): - Item = UniObjectClass.FindByToken(IndexJ, Language) + Item = UniObjectClass.OrderedStringListByToken[Language][IndexJ] + Name = Item.StringName Value = Item.StringValueByteList Referenced = Item.Referenced Token = Item.Token - Length = Item.Length UseOtherLangDef = Item.UseOtherLangDef if UseOtherLangDef != '' and Referenced: @@ -595,10 +588,7 @@ def SearchString(UniObjectClass, FileList, IsCompatibleMode): # This function is used for UEFI2.1 spec # # -def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]): - Status = True - ErrorMessage = '' - +def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, SkipList, BaseName, IsCompatibleMode = False, ShellMode = False, UniGenCFlag = True, UniGenBinBuffer = None, FilterInfo = [True, []]): if len(UniFilList) > 0: if ShellMode: # @@ -627,13 +617,13 @@ def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, Ski # Write an item # def Write(Target, Item): - return Target + Item + return ''.join([Target,Item]) # # Write an item with a break line # def WriteLine(Target, Item): - return Target + Item + '\n' + return ''.join([Target,Item,'\n']) # This acts like the main() function for the script, unless it is 'import'ed into another # script. diff --git a/BaseTools/Source/Python/AutoGen/UniClassObject.py b/BaseTools/Source/Python/AutoGen/UniClassObject.py index 1825c81d91..54751bab4e 100644 --- a/BaseTools/Source/Python/AutoGen/UniClassObject.py +++ b/BaseTools/Source/Python/AutoGen/UniClassObject.py @@ -193,6 +193,8 @@ class UniFileClassObject(object): self.Token = 2 self.LanguageDef = [] #[ [u'LanguageIdentifier', u'PrintableName'], ... ] self.OrderedStringList = {} #{ u'LanguageIdentifier' : [StringDefClassObject] } + self.OrderedStringDict = {} #{ u'LanguageIdentifier' : {StringName:(IndexInList)} } + self.OrderedStringListByToken = {} #{ u'LanguageIdentifier' : {Token: StringDefClassObject} } self.IsCompatibleMode = IsCompatibleMode self.IncludePathList = IncludePathList if len(self.FileList) > 0: @@ -246,14 +248,13 @@ class UniFileClassObject(object): else: OtherLang = FirstLangName self.OrderedStringList[LangName].append (StringDefClassObject(Item.StringName, '', Item.Referenced, Item.Token, OtherLang)) - + self.OrderedStringDict[LangName][Item.StringName] = len(self.OrderedStringList[LangName]) - 1 return True # # Get String name and value # def GetStringObject(self, Item): - Name = '' Language = '' Value = '' @@ -476,20 +477,22 @@ class UniFileClassObject(object): if Language not in self.OrderedStringList: self.OrderedStringList[Language] = [] + self.OrderedStringDict[Language] = {} IsAdded = True - for Item in self.OrderedStringList[Language]: - if Name == Item.StringName: - IsAdded = False - if Value != None: - Item.UpdateValue(Value) - Item.UseOtherLangDef = '' - break + if Name in self.OrderedStringDict[Language]: + IsAdded = False + if Value != None: + ItemIndexInList = self.OrderedStringDict[Language][Name] + Item = self.OrderedStringList[Language][ItemIndexInList] + Item.UpdateValue(Value) + Item.UseOtherLangDef = '' if IsAdded: Token = len(self.OrderedStringList[Language]) if Index == -1: self.OrderedStringList[Language].append(StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef)) + self.OrderedStringDict[Language][Name] = Token for LangName in self.LanguageDef: # # New STRING token will be added into all language string lists. @@ -501,8 +504,10 @@ class UniFileClassObject(object): else: OtherLangDef = Language self.OrderedStringList[LangName[0]].append(StringDefClassObject(Name, '', Referenced, Token, OtherLangDef)) + self.OrderedStringDict[LangName[0]][Name] = len(self.OrderedStringList[LangName[0]]) - 1 else: self.OrderedStringList[Language].insert(Index, StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef)) + self.OrderedStringDict[Language][Name] = Index # # Set the string as referenced @@ -513,17 +518,18 @@ class UniFileClassObject(object): # So, only update the status of string stoken in first language string list. # Lang = self.LanguageDef[0][0] - for Item in self.OrderedStringList[Lang]: - if Name == Item.StringName: - Item.Referenced = True - break + if Name in self.OrderedStringDict[Lang]: + ItemIndexInList = self.OrderedStringDict[Lang][Name] + Item = self.OrderedStringList[Lang][ItemIndexInList] + Item.Referenced = True + # # Search the string in language definition by Name # def FindStringValue(self, Name, Lang): - for Item in self.OrderedStringList[Lang]: - if Item.StringName == Name: - return Item + if Name in self.OrderedStringDict[Lang]: + ItemIndexInList = self.OrderedStringDict[Lang][Name] + return self.OrderedStringList[Lang][ItemIndexInList] return None @@ -546,6 +552,10 @@ class UniFileClassObject(object): # FirstLangName = self.LanguageDef[0][0] + # Convert the OrderedStringList to be OrderedStringListByToken in order to faciliate future search by token + for LangNameItem in self.LanguageDef: + self.OrderedStringListByToken[LangNameItem[0]] = {} + # # Use small token for all referred string stoken. # @@ -558,6 +568,7 @@ class UniFileClassObject(object): OtherLangItem = self.OrderedStringList[LangName][Index] OtherLangItem.Referenced = True OtherLangItem.Token = RefToken + self.OrderedStringListByToken[LangName][OtherLangItem.Token] = OtherLangItem RefToken = RefToken + 1 # @@ -571,6 +582,7 @@ class UniFileClassObject(object): LangName = LangNameItem[0] OtherLangItem = self.OrderedStringList[LangName][Index] OtherLangItem.Token = RefToken + UnRefToken + self.OrderedStringListByToken[LangName][OtherLangItem.Token] = OtherLangItem UnRefToken = UnRefToken + 1 # diff --git a/BaseTools/Source/Python/Common/BuildVersion.py b/BaseTools/Source/Python/Common/BuildVersion.py index 48316716b1..fecc40e84a 100644 --- a/BaseTools/Source/Python/Common/BuildVersion.py +++ b/BaseTools/Source/Python/Common/BuildVersion.py @@ -1,3 +1,3 @@ #This file is for build version number auto generation # -gBUILD_VERSION = "Build 2322" +gBUILD_VERSION = "Build 2361" diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index d6a796bd2b..731bbf1458 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1396,6 +1396,27 @@ class PathClass(object): else: return self.Path == str(Other) + ## Override __cmp__ function + # + # Customize the comparsion operation of two PathClass + # + # @retval 0 The two PathClass are different + # @retval -1 The first PathClass is less than the second PathClass + # @retval 1 The first PathClass is Bigger than the second PathClass + def __cmp__(self, Other): + if type(Other) == type(self): + OtherKey = Other.Path + else: + OtherKey = str(Other) + + SelfKey = self.Path + if SelfKey == OtherKey: + return 0 + elif SelfKey > OtherKey: + return 1 + else: + return -1 + ## Override __hash__ function # # Use Path as key in hash table diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index 4c831e0ff7..532f4a0918 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -62,7 +62,7 @@ def PrintErrorMsg(ErrorType, Msg, TableName, ItemId): for Part in MsgPartList: Msg += Part Msg += ' ' - GetDB().TblReport.Insert(ErrorType, OtherMsg = Msg, BelongsToTable = TableName, BelongsToItem = ItemId) + GetDB().TblReport.Insert(ErrorType, OtherMsg=Msg, BelongsToTable=TableName, BelongsToItem=ItemId) def GetIdType(Str): Type = DataClass.MODEL_UNKNOWN @@ -93,16 +93,16 @@ def SuOccurInTypedef (Su, TdList): def GetIdentifierList(): IdList = [] for comment in FileProfile.CommentList: - IdComment = DataClass.IdentifierClass(-1, '', '', '', comment.Content, DataClass.MODEL_IDENTIFIER_COMMENT, -1, -1, comment.StartPos[0],comment.StartPos[1],comment.EndPos[0],comment.EndPos[1]) + IdComment = DataClass.IdentifierClass(-1, '', '', '', comment.Content, DataClass.MODEL_IDENTIFIER_COMMENT, -1, -1, comment.StartPos[0], comment.StartPos[1], comment.EndPos[0], comment.EndPos[1]) IdList.append(IdComment) for pp in FileProfile.PPDirectiveList: Type = GetIdType(pp.Content) - IdPP = DataClass.IdentifierClass(-1, '', '', '', pp.Content, Type, -1, -1, pp.StartPos[0],pp.StartPos[1],pp.EndPos[0],pp.EndPos[1]) + IdPP = DataClass.IdentifierClass(-1, '', '', '', pp.Content, Type, -1, -1, pp.StartPos[0], pp.StartPos[1], pp.EndPos[0], pp.EndPos[1]) IdList.append(IdPP) for pe in FileProfile.PredicateExpressionList: - IdPE = DataClass.IdentifierClass(-1, '', '', '', pe.Content, DataClass.MODEL_IDENTIFIER_PREDICATE_EXPRESSION, -1, -1, pe.StartPos[0],pe.StartPos[1],pe.EndPos[0],pe.EndPos[1]) + IdPE = DataClass.IdentifierClass(-1, '', '', '', pe.Content, DataClass.MODEL_IDENTIFIER_PREDICATE_EXPRESSION, -1, -1, pe.StartPos[0], pe.StartPos[1], pe.EndPos[0], pe.EndPos[1]) IdList.append(IdPE) FuncDeclPattern = GetFuncDeclPattern() @@ -191,7 +191,7 @@ def GetIdentifierList(): var.Modifier += ' ' + Name[LSBPos:] Name = Name[0:LSBPos] - IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0],var.StartPos[1], VarNameStartLine, VarNameStartColumn) + IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0], var.StartPos[1], VarNameStartLine, VarNameStartColumn) IdList.append(IdVar) else: DeclList = var.Declarator.split('=') @@ -200,15 +200,15 @@ def GetIdentifierList(): LSBPos = var.Declarator.find('[') var.Modifier += ' ' + Name[LSBPos:] Name = Name[0:LSBPos] - IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0],var.StartPos[1], VarNameStartLine, VarNameStartColumn) + IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', Name, (len(DeclList) > 1 and [DeclList[1]]or [''])[0], DataClass.MODEL_IDENTIFIER_VARIABLE, -1, -1, var.StartPos[0], var.StartPos[1], VarNameStartLine, VarNameStartColumn) IdList.append(IdVar) for enum in FileProfile.EnumerationDefinitionList: LBPos = enum.Content.find('{') RBPos = enum.Content.find('}') Name = enum.Content[4:LBPos].strip() - Value = enum.Content[LBPos+1:RBPos] - IdEnum = DataClass.IdentifierClass(-1, '', '', Name, Value, DataClass.MODEL_IDENTIFIER_ENUMERATE, -1, -1, enum.StartPos[0],enum.StartPos[1],enum.EndPos[0],enum.EndPos[1]) + Value = enum.Content[LBPos + 1:RBPos] + IdEnum = DataClass.IdentifierClass(-1, '', '', Name, Value, DataClass.MODEL_IDENTIFIER_ENUMERATE, -1, -1, enum.StartPos[0], enum.StartPos[1], enum.EndPos[0], enum.EndPos[1]) IdList.append(IdEnum) for su in FileProfile.StructUnionDefinitionList: @@ -226,8 +226,8 @@ def GetIdentifierList(): Value = '' else: Name = su.Content[SkipLen:LBPos].strip() - Value = su.Content[LBPos:RBPos+1] - IdPE = DataClass.IdentifierClass(-1, '', '', Name, Value, Type, -1, -1, su.StartPos[0],su.StartPos[1],su.EndPos[0],su.EndPos[1]) + Value = su.Content[LBPos:RBPos + 1] + IdPE = DataClass.IdentifierClass(-1, '', '', Name, Value, Type, -1, -1, su.StartPos[0], su.StartPos[1], su.EndPos[0], su.EndPos[1]) IdList.append(IdPE) TdFuncPointerPattern = GetTypedefFuncPointerPattern() @@ -238,7 +238,7 @@ def GetIdentifierList(): if TdFuncPointerPattern.match(td.ToType): Modifier = td.FromType LBPos = td.ToType.find('(') - TmpStr = td.ToType[LBPos+1:].strip() + TmpStr = td.ToType[LBPos + 1:].strip() StarPos = TmpStr.find('*') if StarPos != -1: Modifier += ' ' + TmpStr[0:StarPos] @@ -260,11 +260,11 @@ def GetIdentifierList(): Value += Name[LBPos : RBPos + 1] Name = Name[0 : LBPos] - IdTd = DataClass.IdentifierClass(-1, Modifier, '', Name, Value, DataClass.MODEL_IDENTIFIER_TYPEDEF, -1, -1, td.StartPos[0],td.StartPos[1],td.EndPos[0],td.EndPos[1]) + IdTd = DataClass.IdentifierClass(-1, Modifier, '', Name, Value, DataClass.MODEL_IDENTIFIER_TYPEDEF, -1, -1, td.StartPos[0], td.StartPos[1], td.EndPos[0], td.EndPos[1]) IdList.append(IdTd) for funcCall in FileProfile.FunctionCallingList: - IdFC = DataClass.IdentifierClass(-1, '', '', funcCall.FuncName, funcCall.ParamList, DataClass.MODEL_IDENTIFIER_FUNCTION_CALLING, -1, -1, funcCall.StartPos[0],funcCall.StartPos[1],funcCall.EndPos[0],funcCall.EndPos[1]) + IdFC = DataClass.IdentifierClass(-1, '', '', funcCall.FuncName, funcCall.ParamList, DataClass.MODEL_IDENTIFIER_FUNCTION_CALLING, -1, -1, funcCall.StartPos[0], funcCall.StartPos[1], funcCall.EndPos[0], funcCall.EndPos[1]) IdList.append(IdFC) return IdList @@ -275,7 +275,7 @@ def StripNonAlnumChars(Str): StrippedStr += Char return StrippedStr -def GetParamList(FuncDeclarator, FuncNameLine = 0, FuncNameOffset = 0): +def GetParamList(FuncDeclarator, FuncNameLine=0, FuncNameOffset=0): FuncDeclarator = StripComments(FuncDeclarator) ParamIdList = [] #DeclSplitList = FuncDeclarator.split('(') @@ -477,7 +477,7 @@ def GetFunctionList(): FuncNameStartColumn += 1 PreChar = FirstChar - FuncObj = DataClass.FunctionClass(-1, FuncDef.Declarator, FuncDef.Modifier, FuncName.strip(), '', FuncDef.StartPos[0],FuncDef.StartPos[1],FuncDef.EndPos[0],FuncDef.EndPos[1], FuncDef.LeftBracePos[0], FuncDef.LeftBracePos[1], -1, ParamIdList, [], FuncNameStartLine, FuncNameStartColumn) + FuncObj = DataClass.FunctionClass(-1, FuncDef.Declarator, FuncDef.Modifier, FuncName.strip(), '', FuncDef.StartPos[0], FuncDef.StartPos[1], FuncDef.EndPos[0], FuncDef.EndPos[1], FuncDef.LeftBracePos[0], FuncDef.LeftBracePos[1], -1, ParamIdList, [], FuncNameStartLine, FuncNameStartColumn) FuncObjList.append(FuncObj) return FuncObjList @@ -547,7 +547,7 @@ def CollectSourceCodeDataIntoDB(RootDir): Db.UpdateIdentifierBelongsToFunction() -def GetTableID(FullFileName, ErrorMsgList = None): +def GetTableID(FullFileName, ErrorMsgList=None): if ErrorMsgList == None: ErrorMsgList = [] @@ -562,11 +562,11 @@ def GetTableID(FullFileName, ErrorMsgList = None): for Result in ResultSet: if FileID != -1: ErrorMsgList.append('Duplicate file ID found in DB for file %s' % FullFileName) - return -2 + return - 2 FileID = Result[0] if FileID == -1: ErrorMsgList.append('NO file ID found in DB for file %s' % FullFileName) - return -1 + return - 1 return FileID def GetIncludeFileList(FullFileName): @@ -645,7 +645,7 @@ def GetPredicateListFromPredicateExpStr(PES): while i < len(PES) - 1: if (PES[i].isalnum() or PES[i] == '_' or PES[i] == '*') and LogicOpPos > PredicateBegin: PredicateBegin = i - if (PES[i] == '&' and PES[i+1] == '&') or (PES[i] == '|' and PES[i+1] == '|'): + if (PES[i] == '&' and PES[i + 1] == '&') or (PES[i] == '|' and PES[i + 1] == '|'): LogicOpPos = i Exp = PES[PredicateBegin:i].strip() # Exp may contain '.' or '->' @@ -670,7 +670,7 @@ def GetPredicateListFromPredicateExpStr(PES): PredicateList.append(Exp.rstrip(';').rstrip(')').strip()) return PredicateList -def GetCNameList(Lvalue, StarList = []): +def GetCNameList(Lvalue, StarList=[]): Lvalue += ' ' i = 0 SearchBegin = 0 @@ -686,7 +686,7 @@ def GetCNameList(Lvalue, StarList = []): VarEnd = i i += 1 elif VarEnd != -1: - VarList.append(Lvalue[VarStart:VarEnd+1]) + VarList.append(Lvalue[VarStart:VarEnd + 1]) i += 1 break else: @@ -714,7 +714,7 @@ def GetCNameList(Lvalue, StarList = []): return VarList -def SplitPredicateByOp(Str, Op, IsFuncCalling = False): +def SplitPredicateByOp(Str, Op, IsFuncCalling=False): Name = Str.strip() Value = None @@ -760,7 +760,7 @@ def SplitPredicateByOp(Str, Op, IsFuncCalling = False): return [Name] Name = Str[0:Index + IndexInRemainingStr].strip() - Value = Str[Index+IndexInRemainingStr+len(Op):].strip().strip(')') + Value = Str[Index + IndexInRemainingStr + len(Op):].strip().strip(')') return [Name, Value] TmpStr = Str.rstrip(';').rstrip(')') @@ -769,7 +769,7 @@ def SplitPredicateByOp(Str, Op, IsFuncCalling = False): if Index == -1: return [Name] - if Str[Index - 1].isalnum() or Str[Index - 1].isspace() or Str[Index - 1] == ')': + if Str[Index - 1].isalnum() or Str[Index - 1].isspace() or Str[Index - 1] == ')' or Str[Index - 1] == ']': Name = Str[0:Index].strip() Value = Str[Index + len(Op):].strip() return [Name, Value] @@ -826,15 +826,13 @@ def PatternInModifier(Modifier, SubStr): def GetDataTypeFromModifier(ModifierStr): MList = ModifierStr.split() + ReturnType = '' for M in MList: if M in EccGlobalData.gConfig.ModifierList: - MList.remove(M) + continue # remove array sufix - if M.startswith('['): - MList.remove(M) - - ReturnType = '' - for M in MList: + if M.startswith('[') or M.endswith(']'): + continue ReturnType += M + ' ' ReturnType = ReturnType.strip() @@ -950,7 +948,7 @@ def StripComments(Str): DoubleSlashComment = False Index += 1 # check for */ comment end - elif InComment and not DoubleSlashComment and ListFromStr[Index] == '*' and ListFromStr[Index+1] == '/': + elif InComment and not DoubleSlashComment and ListFromStr[Index] == '*' and ListFromStr[Index + 1] == '/': ListFromStr[Index] = ' ' Index += 1 ListFromStr[Index] = ' ' @@ -961,12 +959,12 @@ def StripComments(Str): ListFromStr[Index] = ' ' Index += 1 # check for // comment - elif ListFromStr[Index] == '/' and ListFromStr[Index+1] == '/' and ListFromStr[Index+2] != '\n': + elif ListFromStr[Index] == '/' and ListFromStr[Index + 1] == '/' and ListFromStr[Index + 2] != '\n': InComment = True DoubleSlashComment = True # check for /* comment start - elif ListFromStr[Index] == '/' and ListFromStr[Index+1] == '*': + elif ListFromStr[Index] == '/' and ListFromStr[Index + 1] == '*': ListFromStr[Index] = ' ' Index += 1 ListFromStr[Index] = ' ' @@ -1024,7 +1022,7 @@ def GetFinalTypeValue(Type, FieldName, TypedefDict, SUDict): return None -def GetRealType(Type, TypedefDict, TargetType = None): +def GetRealType(Type, TypedefDict, TargetType=None): if TargetType != None and Type == TargetType: return Type while TypedefDict.get(Type): @@ -1033,7 +1031,7 @@ def GetRealType(Type, TypedefDict, TargetType = None): return Type return Type -def GetTypeInfo(RefList, Modifier, FullFileName, TargetType = None): +def GetTypeInfo(RefList, Modifier, FullFileName, TargetType=None): TypedefDict = GetTypedefDict(FullFileName) SUDict = GetSUDict(FullFileName) Type = GetDataTypeFromModifier(Modifier).replace('*', '').strip() @@ -1051,7 +1049,7 @@ def GetTypeInfo(RefList, Modifier, FullFileName, TargetType = None): # we only want to check if it is a pointer else: Type = FromType - if Type.find('*') != -1 and Index == len(RefList)-1: + if Type.find('*') != -1 and Index == len(RefList) - 1: return Type Type = FromType.split()[0] @@ -1061,7 +1059,7 @@ def GetTypeInfo(RefList, Modifier, FullFileName, TargetType = None): return Type -def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall = False, TargetType = None, StarList = None): +def GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall=False, TargetType=None, StarList=None): PredVar = PredVarList[0] FileID = GetTableID(FullFileName) @@ -1536,7 +1534,7 @@ def CheckFuncLayoutLocalVariable(FullFileName): FL.append(Result) for F in FL: - SqlStatement = """ select Name, Value, ID + SqlStatement = """ select Name, Value, ID, Modifier from %s where Model = %d and BelongsToFunction = %d """ % (FileTable, DataClass.MODEL_IDENTIFIER_VARIABLE, F[0]) @@ -1545,7 +1543,7 @@ def CheckFuncLayoutLocalVariable(FullFileName): continue for Result in ResultSet: - if len(Result[1]) > 0: + if len(Result[1]) > 0 and 'CONST' not in Result[3]: PrintErrorMsg(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE, 'Variable Name: %s' % Result[0], FileTable, Result[2]) def CheckMemberVariableFormat(Name, Value, FileTable, TdId, ModelId): @@ -1687,9 +1685,9 @@ def CheckDeclTypedefFormat(FullFileName, ModelId): # Check member variable format. ErrMsgList = CheckMemberVariableFormat(Name, Value, FileTable, Td[5], ModelId) for ErrMsg in ErrMsgList: - if EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Name+'.'+ErrMsg): + if EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Name + '.' + ErrMsg): continue - PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Member variable [%s] NOT follow naming convention.' % (Name+'.'+ErrMsg), FileTable, Td[5]) + PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Member variable [%s] NOT follow naming convention.' % (Name + '.' + ErrMsg), FileTable, Td[5]) # First check in current file to see whether struct/union/enum is typedef-ed. UntypedefedList = [] @@ -1710,9 +1708,9 @@ def CheckDeclTypedefFormat(FullFileName, ModelId): continue ErrMsgList = CheckMemberVariableFormat(Name, Value, FileTable, Result[3], ModelId) for ErrMsg in ErrMsgList: - if EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Result[0]+'.'+ErrMsg): + if EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, Result[0] + '.' + ErrMsg): continue - PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Member variable [%s] NOT follow naming convention.' % (Result[0]+'.'+ErrMsg), FileTable, Result[3]) + PrintErrorMsg(ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME, 'Member variable [%s] NOT follow naming convention.' % (Result[0] + '.' + ErrMsg), FileTable, Result[3]) # Check whether it is typedefed. Found = False for Td in TdList: @@ -1949,7 +1947,7 @@ def CheckPointerNullComparison(FullFileName): if SearchInCache: Type = FuncReturnTypeDict.get(PredVarStr) if Type != None: - if Type.find('*') != -1: + if Type.find('*') != -1 and Type != 'BOOLEAN*': PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2]) continue @@ -1962,7 +1960,7 @@ def CheckPointerNullComparison(FullFileName): if Type == None: continue Type = GetTypeFromArray(Type, PredVarStr) - if Type.find('*') != -1: + if Type.find('*') != -1 and Type != 'BOOLEAN*': PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_COMPARISON_NULL_TYPE, 'Predicate Expression: %s' % Exp, FileTable, Str[2]) def CheckNonBooleanValueComparison(FullFileName): @@ -2004,8 +2002,6 @@ def CheckNonBooleanValueComparison(FullFileName): continue for Exp in GetPredicateListFromPredicateExpStr(Str[0]): -# if p.match(Exp): -# continue PredInfo = SplitPredicateStr(Exp) if PredInfo[1] == None: PredVarStr = PredInfo[0][0].strip() @@ -2037,7 +2033,6 @@ def CheckNonBooleanValueComparison(FullFileName): if PredVarStr in FuncReturnTypeDict: continue - Type = GetVarInfo(PredVarList, FuncRecord, FullFileName, IsFuncCall, 'BOOLEAN', StarList) if SearchInCache: FuncReturnTypeDict[PredVarStr] = Type @@ -2446,7 +2441,7 @@ def GetDoxygenStrFromComment(Str): return DoxygenStrList -def CheckGeneralDoxygenCommentLayout(Str, StartLine, ErrorMsgList, CommentId = -1, TableName = ''): +def CheckGeneralDoxygenCommentLayout(Str, StartLine, ErrorMsgList, CommentId= -1, TableName=''): #/** --*/ @retval after @param if not Str.startswith('/**'): ErrorMsgList.append('Line %d : Comment does NOT have prefix /** ' % StartLine) @@ -2460,7 +2455,7 @@ def CheckGeneralDoxygenCommentLayout(Str, StartLine, ErrorMsgList, CommentId = - ErrorMsgList.append('Line %d : @retval appear before @param ' % StartLine) PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, @retval appear before @param ', TableName, CommentId) -def CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHeader, FuncStartLine, CommentStr, CommentStartLine, ErrorMsgList, CommentId = -1, TableName = ''): +def CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHeader, FuncStartLine, CommentStr, CommentStartLine, ErrorMsgList, CommentId= -1, TableName=''): ParamList = GetParamList(FuncHeader) CheckGeneralDoxygenCommentLayout(CommentStr, CommentStartLine, ErrorMsgList, CommentId, TableName) @@ -2480,18 +2475,18 @@ def CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHeader, Fu ParamName = ParamList[Index].Name.strip() Tag = DoxygenStrList[Index].strip(' ') if (not Tag[-1] == ('\n')) and (not Tag[-1] == ('\r')): - ErrorMsgList.append('Line %d : in Comment, \"%s\" does NOT end with new line ' % (CommentStartLine, Tag.replace('\n', '').replace('\r', ''))) - PrintErrorMsg(ERROR_HEADER_CHECK_FUNCTION, 'in Comment, \"%s\" does NOT end with new line ' % (Tag.replace('\n', '').replace('\r', '')), TableName, CommentId) + ErrorMsgList.append('Line %d : in Comment, <%s> does NOT end with new line ' % (CommentStartLine, Tag.replace('\n', '').replace('\r', ''))) + PrintErrorMsg(ERROR_HEADER_CHECK_FUNCTION, 'in Comment, <%s> does NOT end with new line ' % (Tag.replace('\n', '').replace('\r', '')), TableName, CommentId) TagPartList = Tag.split() if len(TagPartList) < 2: - ErrorMsgList.append('Line %d : in Comment, \"%s\" does NOT contain doxygen contents ' % (CommentStartLine, Tag.replace('\n', '').replace('\r', ''))) - PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, \"%s\" does NOT contain doxygen contents ' % (Tag.replace('\n', '').replace('\r', '')), TableName, CommentId) + ErrorMsgList.append('Line %d : in Comment, <%s> does NOT contain doxygen contents ' % (CommentStartLine, Tag.replace('\n', '').replace('\r', ''))) + PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT contain doxygen contents ' % (Tag.replace('\n', '').replace('\r', '')), TableName, CommentId) Index += 1 continue LBPos = Tag.find('[') RBPos = Tag.find(']') ParamToLBContent = Tag[len('@param'):LBPos].strip() - if LBPos > 0 and len(ParamToLBContent)==0 and RBPos > LBPos: + if LBPos > 0 and len(ParamToLBContent) == 0 and RBPos > LBPos: InOutStr = '' ModifierPartList = ParamModifier.split() for Part in ModifierPartList: @@ -2504,12 +2499,19 @@ def CheckFunctionHeaderConsistentWithDoxygenComment(FuncModifier, FuncHeader, Fu InOutStr = 'out' if InOutStr != '': - if Tag.find('['+InOutStr+']') == -1: - ErrorMsgList.append('Line %d : in Comment, \"%s\" does NOT have %s ' % (CommentStartLine, (TagPartList[0] + ' ' +TagPartList[1]).replace('\n', '').replace('\r', ''), '['+InOutStr+']')) - PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, \"%s\" does NOT have %s ' % ((TagPartList[0] + ' ' +TagPartList[1]).replace('\n', '').replace('\r', ''), '['+InOutStr+']'), TableName, CommentId) + if Tag.find('[' + InOutStr + ']') == -1: + if InOutStr != 'in, out': + ErrorMsgList.append('Line %d : in Comment, <%s> does NOT have %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']')) + PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT have %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'), TableName, CommentId) + else: + if Tag.find('[in,out]') == -1: + ErrorMsgList.append('Line %d : in Comment, <%s> does NOT have %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']')) + PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT have %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), '[' + InOutStr + ']'), TableName, CommentId) + + if Tag.find(ParamName) == -1 and ParamName != 'VOID' and ParamName != 'void': - ErrorMsgList.append('Line %d : in Comment, \"%s\" does NOT consistent with parameter name %s ' % (CommentStartLine, (TagPartList[0] + ' ' +TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName)) - PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, \"%s\" does NOT consistent with parameter name %s ' % ((TagPartList[0] + ' ' +TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName), TableName, CommentId) + ErrorMsgList.append('Line %d : in Comment, <%s> does NOT consistent with parameter name %s ' % (CommentStartLine, (TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName)) + PrintErrorMsg(ERROR_DOXYGEN_CHECK_FUNCTION_HEADER, 'in Comment, <%s> does NOT consistent with parameter name %s ' % ((TagPartList[0] + ' ' + TagPartList[1]).replace('\n', '').replace('\r', ''), ParamName), TableName, CommentId) Index += 1 if Index < ParamNumber: diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 6a9e5b7b40..4f555e32bb 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1690,9 +1690,13 @@ class FdfParser: self.__UndoToken() self.__GetRegionFileType( RegionObj) - else: + elif self.__Token == "DATA": self.__UndoToken() self.__GetRegionDataType( RegionObj) + else: + raise Warning("A valid region type was not found. " + "Valid types are [SET, FV, CAPSULE, FILE, DATA]. This error occurred", + self.FileName, self.CurrentLineNumber) return True @@ -1929,6 +1933,8 @@ class FdfParser: self.__GetSetStatements(FvObj) self.__GetFvBaseAddress(FvObj) + + self.__GetFvForceRebase(FvObj) self.__GetFvAlignment(FvObj) @@ -2006,11 +2012,42 @@ class FdfParser: IsValidBaseAddrValue = re.compile('^0[x|X][0-9a-fA-F]+') if not IsValidBaseAddrValue.match(self.__Token.upper()): - raise Warning("Unknown alignment value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) + raise Warning("Unknown FV base address value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) Obj.FvBaseAddress = self.__Token return True + ## __GetFvForceRebase() method + # + # Get FvForceRebase for FV + # + # @param self The object pointer + # @param Obj for whom FvForceRebase is got + # @retval True Successfully find a FvForceRebase statement + # @retval False Not able to find a FvForceRebase statement + # + def __GetFvForceRebase(self, Obj): + + if not self.__IsKeyword("FvForceRebase"): + return False + + if not self.__IsToken( "="): + raise Warning("expected '='", self.FileName, self.CurrentLineNumber) + + if not self.__GetNextToken(): + raise Warning("expected FvForceRebase value", self.FileName, self.CurrentLineNumber) + if self.__Token.upper() not in ["TRUE", "FALSE", "0", "0X0", "0X00", "1", "0X1", "0X01"]: + raise Warning("Unknown FvForceRebase value '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) + + if self.__Token.upper() in ["TRUE", "1", "0X1", "0X01"]: + Obj.FvForceRebase = True + elif self.__Token.upper() in ["FALSE", "0", "0X0", "0X00"]: + Obj.FvForceRebase = False + else: + Obj.FvForceRebase = None + + return True + ## __GetFvAttributes() method # # Get attributes for FV @@ -2215,7 +2252,10 @@ class FdfParser: ffsInf.KeepReloc = True else: raise Warning("Unknown reloc strip flag '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) - + + ffsInf.CurrentLineNum = self.CurrentLineNumber + ffsInf.CurrentLineContent = self.__CurrentLine() + if ForCapsule: capsuleFfs = CapsuleData.CapsuleFfs() capsuleFfs.Ffs = ffsInf @@ -2325,7 +2365,10 @@ class FdfParser: self.__Token = 'PCD('+PcdPair[1]+'.'+PcdPair[0]+')' FfsFileObj.NameGuid = self.__Token - + + FfsFileObj.CurrentLineNum = self.CurrentLineNumber + FfsFileObj.CurrentLineContent = self.__CurrentLine() + self.__GetFilePart( FfsFileObj, MacroDict.copy()) if ForCapsule: @@ -3922,7 +3965,7 @@ class FdfParser: Overrides.PciRevision = self.__Token continue - if self.__IsKeyword( "COMPRESS"): + if self.__IsKeyword( "PCI_COMPRESS"): if not self.__IsToken( "="): raise Warning("expected '='", self.FileName, self.CurrentLineNumber) if not self.__GetNextToken(): diff --git a/BaseTools/Source/Python/GenFds/FfsFileStatement.py b/BaseTools/Source/Python/GenFds/FfsFileStatement.py index 013dbb1f02..b858549361 100644 --- a/BaseTools/Source/Python/GenFds/FfsFileStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsFileStatement.py @@ -39,6 +39,10 @@ class FileStatement (FileStatementClassObject) : # def __init__(self): FileStatementClassObject.__init__(self) + self.CurrentLineNum = None + self.CurrentLineContent = None + self.FileName = None + self.InfFileName = None ## GenFfs() method # @@ -94,7 +98,7 @@ class FileStatement (FileStatementClassObject) : SectionFiles = [] Index = 0 SectionAlignments = [] - for section in self.SectionList : + for section in self.SectionList: Index = Index + 1 SecIndex = '%d' %Index # process the inside FvImage from FvSection or GuidSection diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index b9e18f6bca..c6f29f6ddd 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -56,6 +56,10 @@ class FfsInfStatement(FfsInfStatementClassObject): self.PiSpecVersion = '0x00000000' self.InfModule = None self.FinalTargetSuffixMap = {} + self.CurrentLineNum = None + self.CurrentLineContent = None + self.FileName = None + self.InfFileName = None ## GetFinalTargetSuffixMap() method # @@ -452,7 +456,7 @@ class FfsInfStatement(FfsInfStatementClassObject): Arch = '' OutputPath = '' (ModulePath, FileName) = os.path.split(self.InfFileName) - Index = FileName.find('.') + Index = FileName.rfind('.') FileName = FileName[0:Index] Arch = "NoneArch" if self.CurrentArch != None: diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 773b0efbe8..f186ab0e73 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -47,6 +47,7 @@ class FV (FvClassObject): self.FvAddressFileName = None self.CapsuleName = None self.FvBaseAddress = None + self.FvForceRebase = None ## AddToBuffer() # @@ -133,7 +134,8 @@ class FV (FvClassObject): FvOutputFile, [self.InfFileName], AddressFile=FvInfoFileName, - FfsList=FfsFileList + FfsList=FfsFileList, + ForceRebase=self.FvForceRebase ) NewFvInfo = None @@ -162,7 +164,8 @@ class FV (FvClassObject): FvOutputFile, [self.InfFileName], AddressFile=FvInfoFileName, - FfsList=FfsFileList + FfsList=FfsFileList, + ForceRebase=self.FvForceRebase ) # diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 3abaef2023..236283751e 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -422,7 +422,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS") @staticmethod - def GenerateFirmwareVolume(Output, Input, BaseAddress=None, Capsule=False, Dump=False, + def GenerateFirmwareVolume(Output, Input, BaseAddress=None, ForceRebase=None, Capsule=False, Dump=False, AddressFile=None, MapFile=None, FfsList=[]): if not GenFdsGlobalVariable.NeedsUpdate(Output, Input+FfsList): return @@ -431,6 +431,12 @@ class GenFdsGlobalVariable: Cmd = ["GenFv"] if BaseAddress not in [None, '']: Cmd += ["-r", BaseAddress] + + if ForceRebase == False: + Cmd +=["-F", "FALSE"] + elif ForceRebase == True: + Cmd +=["-F", "TRUE"] + if Capsule: Cmd += ["-c"] if Dump: diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py index d64f836164..069414df5b 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -50,10 +50,10 @@ class OptRomInfStatement (FfsInfStatement): self.OverrideAttribs = OptionRom.OverrideAttribs() if self.OverrideAttribs.NeedCompress == None: - self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('COMPRESS') + self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('PCI_COMPRESS') if self.OverrideAttribs.NeedCompress is not None: if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'): - GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for COMPRESS: %s" %self.InfFileName) + GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for PCI_COMPRESS: %s" %self.InfFileName) self.OverrideAttribs.NeedCompress = \ self.OverrideAttribs.NeedCompress.upper() == 'TRUE' diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index fabc7ed986..4bad21298a 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -895,21 +895,28 @@ class DscParser(MetaFileParser): # three operands elif TokenNumber == 3: TokenValue = TokenList[0] - if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']: - TokenValue = TokenValue[1:-1] - if TokenValue.startswith("$(") and TokenValue.endswith(")"): - TokenValue = self._EvaluateToken(TokenValue, Expression) - if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']: - TokenValue = TokenValue[1:-1] - if TokenValue == None: - return False + if TokenValue != "": + if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']: + TokenValue = TokenValue[1:-1] + if TokenValue.startswith("$(") and TokenValue.endswith(")"): + TokenValue = self._EvaluateToken(TokenValue, Expression) + if TokenValue == None: + return False + if TokenValue != "": + if TokenValue[0] in ["'", '"'] and TokenValue[-1] in ["'", '"']: + TokenValue = TokenValue[1:-1] + Value = TokenList[2] - if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']: - Value = Value[1:-1] - if Value.startswith("$(") and Value.endswith(")"): - Value = self._EvaluateToken(Value, Expression) - if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']: - Value = Value[1:-1] + if Value != "": + if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']: + Value = Value[1:-1] + if Value.startswith("$(") and Value.endswith(")"): + Value = self._EvaluateToken(Value, Expression) + if Value == None: + return False + if Value != "": + if Value[0] in ["'", '"'] and Value[-1] in ["'", '"']: + Value = Value[1:-1] Op = TokenList[1] if Op not in self._OP_: EdkLogger.error('Parser', FORMAT_INVALID, "Unsupported operator [%s]" % Op, File=self.MetaFile, diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py index 4bfa7d8ffd..ac2ca057cc 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py @@ -1896,7 +1896,7 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve PCDs used in this module def _GetPcds(self): if self._Pcds == None: - self._Pcds = {} + self._Pcds = sdict() self._Pcds.update(self._GetPcd(MODEL_PCD_FIXED_AT_BUILD)) self._Pcds.update(self._GetPcd(MODEL_PCD_PATCHABLE_IN_MODULE)) self._Pcds.update(self._GetPcd(MODEL_PCD_FEATURE_FLAG)) @@ -1996,7 +1996,7 @@ class InfBuildData(ModuleBuildClassObject): ## Retrieve PCD for given type def _GetPcd(self, Type): - Pcds = {} + Pcds = sdict() PcdDict = tdict(True, 4) PcdList = [] RecordList = self._RawData[Type, self._Arch, self._Platform] @@ -2071,18 +2071,9 @@ class InfBuildData(ModuleBuildClassObject): # # Check hexadecimal token value length and format. # + ReIsValidPcdTokenValue = re.compile(r"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re.DOTALL) if Pcd.TokenValue.startswith("0x") or Pcd.TokenValue.startswith("0X"): - if len(Pcd.TokenValue) < 3 or len(Pcd.TokenValue) > 10: - EdkLogger.error( - 'build', - FORMAT_INVALID, - "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd.TokenValue, TokenSpaceGuid, PcdCName, str(Package)), - File =self.MetaFile, Line=LineNo, - ExtraData=None - ) - try: - int (Pcd.TokenValue, 16) - except: + if ReIsValidPcdTokenValue.match(Pcd.TokenValue) == None: EdkLogger.error( 'build', FORMAT_INVALID,