diff options
author | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-06-17 13:25:31 +0000 |
---|---|---|
committer | klu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-06-17 13:25:31 +0000 |
commit | 2435723ad99a9068ec74a212ae00886d7bdfc58d (patch) | |
tree | 9a30a77e96053a88b9507a720d42b947dd49eb1d /Tools | |
parent | 38ee8d9e660ef04e03a86dab008355b5c4f2ab62 (diff) | |
download | edk2-platforms-2435723ad99a9068ec74a212ae00886d7bdfc58d.tar.xz |
Fix a bug when generate default value for byte array for FIXED_AT_BUILD, PATCHABLE_IN_MODULE type PCD.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@551 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java | 2 | ||||
-rw-r--r-- | Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java | 75 |
2 files changed, 54 insertions, 23 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java index d6b0c9c9c5..1dbcb2306a 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java @@ -1978,7 +1978,7 @@ public class CollectPCDAction { strValueArray = strValue.split(",");
for (index = 0; index < strValueArray.length; index ++) {
try{
- value = Integer.decode(strValueArray[index]);
+ value = Integer.decode(strValueArray[index].trim());
} catch (NumberFormatException nfeEx) {
exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*, and "+
"it is byte array in fact. For every byte in array should be a valid"+
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java index 40dd3b9454..9005a9808d 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java @@ -203,6 +203,7 @@ public class UsageInstance { throws EntityException {
String guidStringArray[] = null;
String guidString = null;
+ boolean isByteArray = false;
hAutogenStr = "";
cAutogenStr = "";
@@ -217,6 +218,12 @@ public class UsageInstance { parentToken.cName, parentToken.tokenNumber);
}
+ if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {
+ if (datum.trim().charAt(0) == '{') {
+ isByteArray = true;
+ }
+ }
+
switch (modulePcdType) {
case FEATURE_FLAG:
if (isBuildUsedLibrary) {
@@ -254,17 +261,29 @@ public class UsageInstance { hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
parentToken.cName,
datum.toString());
- hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
+ if (isByteArray) {
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = _PCD_VALUE_%s;\r\n",
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s &_gPcd_FixedAtBuild_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ } else {
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ }
}
break;
case PATCHABLE_IN_MODULE:
@@ -280,17 +299,29 @@ public class UsageInstance { hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
parentToken.cName,
datum.toString());
- hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
+ if (isByteArray) {
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s &_gPcd_BinaryPatch_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ } else {
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ }
}
break;
|