Date
1 - 1 of 1
Difference between boolean PCD fixed at build and a PCD feature flag
Konstantin Aladyshev <aladyshev22@...>
What is the difference between boolean PCD fixed at build and a PCD feature flag?
```
[PcdsFixedAtBuild]
gMyPkgTokenSpaceGuid.PcdMyVarBool|FALSE|BOOLEAN|0x00000004
[PcdsFeatureFlag]
gMyPkgTokenSpaceGuid.PcdMyFeatureFlagVar|FALSE|BOOLEAN|0x20000001
gMyPkgTokenSpaceGuid.PcdMyVarBool|FALSE|BOOLEAN|0x00000004
[PcdsFeatureFlag]
gMyPkgTokenSpaceGuid.PcdMyFeatureFlagVar|FALSE|BOOLEAN|0x20000001
```
I'm looking at the AutoGen files and the result from both of these PCDs is practically the same.
AutoGen.c
```
GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_PcdMyVarBool = _PCD_VALUE_PcdMyVarBool;
GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_PcdMyFeatureFlagVar = _PCD_VALUE_PcdMyFeatureFlagVar;
```
AutoGen.h
```
#define _PCD_TOKEN_PcdMyVarBool 0U
#define _PCD_SIZE_PcdMyVarBool 1
#define _PCD_GET_MODE_SIZE_PcdMyVarBool _PCD_SIZE_PcdMyVarBool
#define _PCD_VALUE_PcdMyVarBool 0U
extern const BOOLEAN _gPcd_FixedAtBuild_PcdMyVarBool;
#define _PCD_GET_MODE_BOOL_PcdMyVarBool _gPcd_FixedAtBuild_PcdMyVarBool
//#define _PCD_SET_MODE_BOOL_PcdMyVarBool ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdMyFeatureFlagVar 0U
#define _PCD_SIZE_PcdMyFeatureFlagVar 1
#define _PCD_GET_MODE_SIZE_PcdMyFeatureFlagVar _PCD_SIZE_PcdMyFeatureFlagVar
#define _PCD_VALUE_PcdMyFeatureFlagVar ((BOOLEAN)0U)
extern const BOOLEAN _gPcd_FixedAtBuild_PcdMyFeatureFlagVar;
#define _PCD_GET_MODE_BOOL_PcdMyFeatureFlagVar _gPcd_FixedAtBuild_PcdMyFeatureFlagVar
//#define _PCD_SET_MODE_BOOL_PcdMyFeatureFlagVar ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
```
```
GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_PcdMyVarBool = _PCD_VALUE_PcdMyVarBool;
GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_PcdMyFeatureFlagVar = _PCD_VALUE_PcdMyFeatureFlagVar;
```
AutoGen.h
```
#define _PCD_TOKEN_PcdMyVarBool 0U
#define _PCD_SIZE_PcdMyVarBool 1
#define _PCD_GET_MODE_SIZE_PcdMyVarBool _PCD_SIZE_PcdMyVarBool
#define _PCD_VALUE_PcdMyVarBool 0U
extern const BOOLEAN _gPcd_FixedAtBuild_PcdMyVarBool;
#define _PCD_GET_MODE_BOOL_PcdMyVarBool _gPcd_FixedAtBuild_PcdMyVarBool
//#define _PCD_SET_MODE_BOOL_PcdMyVarBool ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
#define _PCD_TOKEN_PcdMyFeatureFlagVar 0U
#define _PCD_SIZE_PcdMyFeatureFlagVar 1
#define _PCD_GET_MODE_SIZE_PcdMyFeatureFlagVar _PCD_SIZE_PcdMyFeatureFlagVar
#define _PCD_VALUE_PcdMyFeatureFlagVar ((BOOLEAN)0U)
extern const BOOLEAN _gPcd_FixedAtBuild_PcdMyFeatureFlagVar;
#define _PCD_GET_MODE_BOOL_PcdMyFeatureFlagVar _gPcd_FixedAtBuild_PcdMyFeatureFlagVar
//#define _PCD_SET_MODE_BOOL_PcdMyFeatureFlagVar ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD
```
Are there any actual differences between those two methods of defining a PCD? Or is `PcdsFeatureFlag` simply a syntactic sugar?