Re: [edk2] Status of PCD usage in VFR and ASL?

Subject: Re: [edk2] Status of PCD usage in VFR and ASL?

From: Andrew Fish <>


Date: 2013-04-11 17:41:17

On Apr 11, 2013, at 9:31 AM, "Gao, Liming" <> wrote:

  For VFR file with FixedPcd, it is not supported, because VfrCompiler only recognizes the limited C syntax used in VFR file. It doesnt support many C syntax used in C source code, such as VOID* and function definitions. But, to know FixedPcd value in VFR file, VFR file needs to include AutoGen.h and PcdLib.h. AutoGen.h and PcdLib.h may include some C syntax those are not supported by VfrCompiler, which will cause VFR build failure. Thats why VFRPP_FLAGS defined in tools_def.txt doesnt include AutoGen.h.

It would be possible to wrap the non compatible parts of the AutoGen.h file in a #ifndef and then add that define to the VFRPP_FLAGS. I guess it would also be possible to post process the VFRPP_FLAGS with Trim, or some Python script to clean up the file. 


Andrew Fish

  For ASL code with FixedPcd, EDKII build rule uses C compiler preprocess it, then calls BaseTools Trim tool to convert the preprocessed file to ASL format, last runs ASL compiler. We have verified it in MSFT tool chain. You can see Conf\Build_Rule.txt. Seemly, GCC tool chain misses one step. I also check tools_def.txt. GCC ASLPP_FLAGS doesnt include AutoGen.h, which cant get FixedPcd value. You may also need to update tools_def.txt for ASLPP_FLAGS.
    <Command.MSFT, Command.INTEL>
        Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
        Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
        "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
        Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
        "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
        "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii