From 4b2f964749e77ca888176e91ae2cebc76e958b4c Mon Sep 17 00:00:00 2001 From: kuqin12 <42554914+kuqin12@users.noreply.github.com> Date: Tue, 21 Mar 2023 16:27:54 -0700 Subject: BaseTools: Adding support of building BaseTool on Windows ARM/ARM64 This change focuses on the support of building basetool natively for Windows ARM/ARM64 host system, which will enable the ARM based platforms to build UEFI and unit tests. Note that the warnings due to integer conversions are suppressed for this specific target to avoid too much local changes carried in MU. The formal change should drop all these binaries and move to pythonic scripts. The binary output is tested on Windows ARM based hardware systems. Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Kun Qin --- BaseTools/Source/C/GenFfs/GenFfs.c | 2 ++ BaseTools/Source/C/GenFw/Elf32Convert.c | 2 ++ BaseTools/Source/C/GenFw/Elf64Convert.c | 2 ++ BaseTools/Source/C/GenFw/ElfConvert.c | 2 ++ BaseTools/Source/C/GenFw/GenFw.c | 2 ++ BaseTools/Source/C/GenSec/GenSec.c | 2 ++ BaseTools/Source/C/Makefiles/ms.common | 17 +++++++++++++++++ 7 files changed, 29 insertions(+) diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index d78d62ab36..4c2e93e6f4 100644 --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -7,7 +7,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __GNUC__ +#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include +#undef RUNTIME_FUNCTION #include #include #include diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c index de198e58db..246497a718 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -10,7 +10,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __GNUC__ +#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include +#undef RUNTIME_FUNCTION #include #endif #include diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c index 897045b2be..6919e18809 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -11,7 +11,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __GNUC__ +#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include +#undef RUNTIME_FUNCTION #include #endif #include diff --git a/BaseTools/Source/C/GenFw/ElfConvert.c b/BaseTools/Source/C/GenFw/ElfConvert.c index 3205f61494..d6d9feb7d8 100644 --- a/BaseTools/Source/C/GenFw/ElfConvert.c +++ b/BaseTools/Source/C/GenFw/ElfConvert.c @@ -8,7 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __GNUC__ +#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include +#undef RUNTIME_FUNCTION #include #endif #include diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index bd635b375a..daf840c3cd 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -7,7 +7,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __GNUC__ +#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include +#undef RUNTIME_FUNCTION #include #include #include diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index cf24d821aa..d9d2efeca7 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -6,7 +6,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ #ifndef __GNUC__ +#define RUNTIME_FUNCTION _WINNT_DUP_RUNTIME_FUNCTION #include +#undef RUNTIME_FUNCTION #include #include #include diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common index fe7a59c280..66f0f5ba4c 100644 --- a/BaseTools/Source/C/Makefiles/ms.common +++ b/BaseTools/Source/C/Makefiles/ms.common @@ -51,6 +51,23 @@ 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 +CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334 + +!ELSEIF "$(HOST_ARCH)"=="ARM" +ARCH_INCLUDE = $(EDK2_PATH)\MdePkg\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 = $(EDK2_PATH)\MdePkg\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. +CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334 !ELSE !ERROR "Bad HOST_ARCH" -- cgit