Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows ARM 64-bit base tools #376

Merged
merged 19 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .azurepipelines/BaseTools-Build-For-Publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ name: BaseTools_Bin_$(release_version)_$(Rev:r)
variables:
linux_build_output_path: '$(Build.Repository.LocalPath)/BaseTools/Source/C/bin'
linux_artifact_name: 'LinuxOutput'
windows_build_output_path: '$(Build.Repository.LocalPath)\BaseTools\Bin\Win32'
windows_build_output_path: '$(Build.Repository.LocalPath)\BaseTools\Bin'
windows_artifact_name: 'WindowsOutput'
temp_publication_directory: 'PackageStaging'
package_artifact_name: 'NugetReleasePackage'
Expand Down Expand Up @@ -86,8 +86,13 @@ jobs:
matrix:
TARGET_x86:
Build.Targets: 'IA32'
Build.TargetFolder: 'Win32'
TARGET_ARM:
Build.Targets: 'ARM'
Build.TargetFolder: 'Win32'
TARGET_AArch64:
Build.Targets: 'AARCH64'
Build.TargetFolder: 'Win64'

pool:
vmImage: windows-latest
Expand Down Expand Up @@ -126,7 +131,7 @@ jobs:
extra_parameters: '--skip_path_env -a $(Build.Targets)'
tool_chain_tag: 'VS2022'

- publish: $(windows_build_output_path)
- publish: '$(windows_build_output_path)\$(Build.TargetFolder)'
artifact: $(windows_artifact_name)_$(Build.Targets)
displayName: Publish To Pipeline
condition: SucceededOrFailed()
Expand Down Expand Up @@ -188,6 +193,7 @@ jobs:
mv $(Pipeline.Workspace)/$(linux_artifact_name)_AARCH64 $(Build.StagingDirectory)/$(temp_publication_directory)/Linux-ARM-64;
mv $(Pipeline.Workspace)/$(windows_artifact_name)_IA32 $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-x86;
mv $(Pipeline.Workspace)/$(windows_artifact_name)_ARM $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-ARM;
mv $(Pipeline.Workspace)/$(windows_artifact_name)_AARCH64 $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-ARM-64;
displayName: Stage Package Files

- powershell:
Expand Down
3 changes: 2 additions & 1 deletion BaseTools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ Source/C/VfrCompile/VfrTokens.h
Source/C/bin/
Source/C/libs/
Bin/Win32
Bin/Win64
Lib
BaseToolsBuild/
BaseToolsBuild/
12 changes: 11 additions & 1 deletion BaseTools/Edk2ToolsBuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,19 @@ def Go(self):
if self.target_arch == "IA32":
VcToolChainArch = "x86"
TargetInfoArch = "x86"
OutputDir = "Win32"
elif self.target_arch == "ARM":
VcToolChainArch = "x86_arm"
TargetInfoArch = "ARM"
OutputDir = "Win32"
elif self.target_arch == "X64":
VcToolChainArch = "amd64"
TargetInfoArch = "x86"
OutputDir = "Win64"
elif self.target_arch == "AARCH64":
VcToolChainArch = "amd64_arm64"
TargetInfoArch = "ARM"
OutputDir = "Win64"
else:
raise NotImplementedError()
# MU_CHANGE
Expand All @@ -166,7 +176,7 @@ def Go(self):
shell_env.set_shell_var('HOST_ARCH', self.target_arch)

self.OutputDir = os.path.join(
shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", "Win32")
shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", OutputDir)

# compiled tools need to be added to path because antlr is referenced
# MU_CHANGE: Added logic to support cross compilation scenarios
Expand Down
83 changes: 70 additions & 13 deletions BaseTools/Source/C/Include/AArch64/ProcessorBind.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,82 @@
#pragma pack()
#endif

// MU_CHANGE Starts: Fixing basic ARM definitions in Windows
#if _MSC_EXTENSIONS

//
// Disable warning that make it impossible to compile at /W4
// This only works for Microsoft* tools
//

//
// Disabling bitfield type checking warnings.
//
#pragma warning ( disable : 4214 )

//
// Disabling the unreferenced formal parameter warnings.
//
#pragma warning ( disable : 4100 )

//
// Disable slightly different base types warning as CHAR8 * can not be set
// to a constant string.
//
#pragma warning ( disable : 4057 )

//
// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
//
#pragma warning ( disable : 4127 )


#endif

#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
//
// use Microsoft* C compiler dependent integer width types
// No ANSI C 2000 stdint.h integer width declarations, so define equivalents
//
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;

#if _MSC_EXTENSIONS
//
// use Microsoft* C compiler dependent integer width types
//
#include <stdint.h>
typedef unsigned __int64 UINT64;
typedef __int64 INT64;
typedef unsigned __int32 UINT32;
typedef __int32 INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;
#else
//
// Assume standard ARM alignment.
//
typedef unsigned long long UINT64;
typedef long long INT64;
typedef unsigned int UINT32;
typedef int INT32;
typedef unsigned short UINT16;
typedef unsigned short CHAR16;
typedef short INT16;
typedef unsigned char BOOLEAN;
typedef unsigned char UINT8;
typedef char CHAR8;
typedef signed char INT8;

#endif

#else
//
// Use ANSI C 2000 stdint.h integer width declarations
//
#include <stdint.h>
#include "stdint.h"
typedef uint8_t BOOLEAN;
typedef int8_t INT8;
typedef uint8_t UINT8;
Expand All @@ -57,6 +113,7 @@
typedef uint16_t CHAR16;

#endif
// MU_CHANGE Ends

///
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
Expand Down
12 changes: 11 additions & 1 deletion BaseTools/Source/C/Makefiles/ms.common
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,23 @@ LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64

# MU_CHANGE Starts: Adding support to build base tools for ARM
# MU_CHANGE Starts: Adding support to build base tools for ARM and AARCH64
!ELSEIF "$(HOST_ARCH)"=="ARM"
ARCH_INCLUDE = $(SOURCE_PATH)\Include\Arm
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32
!ELSEIF "$(HOST_ARCH)"=="AARCH64"
ARCH_INCLUDE = $(SOURCE_PATH)\Include\AArch64
BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64
LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64
SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64
SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64
# Note: These are bit-width conversion related warning suppressions we carry to avoid much more
# overrides in the C code. The future plan is to replace all of these binary based tools
# with python scripts, when it happens in tianocore..
CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334
kuqin12 marked this conversation as resolved.
Show resolved Hide resolved
# MU_CHANGE Ends

!ELSE
Expand Down