Skip to content

Commit

Permalink
add ARM64 compilation for Visual Studio 2017 (Yay!)
Browse files Browse the repository at this point in the history
* Requires Update 15.4 and Windows SDK 10.0.16299.0 or later
* Also add /Oi- option to disable intrinsics
* Closes #7
  • Loading branch information
pbatard committed Nov 3, 2017
1 parent 6edbb58 commit d2c7506
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 64 deletions.
160 changes: 127 additions & 33 deletions .vs/msvc/gnu-efi.vcxproj

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .vs/msvc/gnu-efi.vcxproj.filters
Expand Up @@ -18,6 +18,9 @@
<Filter Include="Source Files\ia32">
<UniqueIdentifier>{e6e3d25a-4fce-4036-bef9-3cfbafc4baaf}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\aarch64">
<UniqueIdentifier>{cf7e7031-77e5-4827-9aa6-f996fc4b3d06}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\gnu-efi\lib\console.c">
Expand Down Expand Up @@ -110,5 +113,11 @@
<ClCompile Include="..\..\gnu-efi\lib\arm\initplat.c">
<Filter>Source Files\arm</Filter>
</ClCompile>
<ClCompile Include="..\..\gnu-efi\lib\aarch64\initplat.c">
<Filter>Source Files\aarch64</Filter>
</ClCompile>
<ClCompile Include="..\..\gnu-efi\lib\aarch64\math.c">
<Filter>Source Files\aarch64</Filter>
</ClCompile>
</ItemGroup>
</Project>
117 changes: 96 additions & 21 deletions .vs/msvc/uefi-simple.vcxproj
Expand Up @@ -5,6 +5,10 @@
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
Expand All @@ -17,6 +21,10 @@
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
Expand All @@ -29,6 +37,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}</ProjectGuid>
<RootNamespace>uefi-simple</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
Expand All @@ -53,6 +62,13 @@
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
Expand All @@ -72,28 +88,14 @@
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
Expand All @@ -115,6 +117,13 @@
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
Expand All @@ -136,6 +145,13 @@
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\gnu-efi\inc;$(SolutionDir)\gnu-efi\inc\x86_64</AdditionalIncludeDirectories>
Expand Down Expand Up @@ -224,6 +240,36 @@
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\gnu-efi\inc;$(SolutionDir)\gnu-efi\inc\aarch64</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_UNICODE;UNICODE;HAVE_USE_MS_ABI;GNU_EFI_USE_EXTERNAL_STDARG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>gnu-efi.lib;libcmtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress>
</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\gnu-efi\inc;$(SolutionDir)\gnu-efi\inc\x86_64</AdditionalIncludeDirectories>
Expand Down Expand Up @@ -310,6 +356,35 @@
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\gnu-efi\inc;$(SolutionDir)\gnu-efi\inc\aarch64</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_UNICODE;UNICODE;HAVE_USE_MS_ABI;GNU_EFI_USE_EXTERNAL_STDARG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link />
<Link>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalDependencies>gnu-efi.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress>
</RandomizedBaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\main.c" />
</ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions .vs/msvc/uefi-simple.vcxproj.user
Expand Up @@ -18,6 +18,12 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<LocalDebuggerCommand>$(SystemRoot)\System32\wscript</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>//d debug.vbs "$(TargetPath)" "$(PlatformShortName)"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommand>$(SystemRoot)\System32\wscript</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>//d debug.vbs "$(TargetPath)" "$(PlatformShortName)"</LocalDebuggerCommandArguments>
Expand All @@ -36,4 +42,10 @@
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<LocalDebuggerCommand>$(SystemRoot)\System32\wscript</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>//d debug.vbs "$(TargetPath)" "$(PlatformShortName)"</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
</PropertyGroup>
</Project>
16 changes: 8 additions & 8 deletions README.md
Expand Up @@ -3,7 +3,7 @@ UEFI:SIMPLE - EFI development made easy

A simple UEFI "Hello World!" style application that can:
* be compiled on Windows or Linux, using Visual Studio 2017 (including CodeGen/Clang support), MinGW or gcc.
* be compiled for x86_32, x86_64, ARM or AARCH64 targets
* be compiled for x86_32, x86_64, ARM or ARM64/AARCH64 targets
* be tested on the fly, through a [QEMU](http://www.qemu.org)+[OVMF](http://tianocore.github.io/ovmf/)
UEFI virtual machine.

Expand Down Expand Up @@ -44,14 +44,14 @@ You can also add `qemu` as your `make` target to run the application under QEMU,
in which case a relevant UEFI firmware (OVMF for x86 or QEMU_EFI for Arm) will
be automatically downloaded to run your application against it.

## Visual Studio 2017 and ARM support
## Visual Studio 2017 and ARM/ARM64 support

Please be mindful that, to enable ARM compilation support in Visual Studio 2017,
you __MUST__ go to the _Individual components_ screen in the setup application
and select the ARM compilers and libraries there, as they do __NOT__ appear in
Please be mindful that, to enable ARM or ARM64 compilation support in Visual Studio
2017, you __MUST__ go to the _Individual components_ screen in the setup application
and select the ARM/ARM64 compilers and libraries there, as they do __NOT__ appear in
the default _Workloads_ screen:

![VS2017 Individual Components](http://files.akeo.ie/pics/VS2017_Individual_Components.png)
![VS2017 Individual Components](http://files.akeo.ie/pics/VS2017_Individual_Components2.png)

While in this section, you may also want to select the installation of _Clang/C2
(experimental)_, so that you can open and compile the Clang solution...
You also need to ensure that you have Windows SDK 10.0.14393.0 or later installed,
as this is the minimum version with support for ARM64.
2 changes: 1 addition & 1 deletion debug.vbs
Expand Up @@ -31,7 +31,7 @@ ElseIf (TARGET = "ARM") Then
' You can also add '-device VGA' to the options below, to get graphics output.
' But if you do, be mindful that the keyboard input may not work... :(
QEMU_OPTS = "-M virt -cpu cortex-a15 " & QEMU_OPTS
ElseIf (TARGET = "AA64") Then
ElseIf (TARGET = "ARM64") Then
UEFI_EXT = "aa64"
QEMU_ARCH = "aarch64"
FW_BASE = "QEMU_EFI"
Expand Down
15 changes: 14 additions & 1 deletion uefi-simple.sln
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.27004.2006
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uefi-simple", ".vs\msvc\uefi-simple.vcxproj", "{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -13,33 +13,43 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|arm = Debug|arm
Debug|aa64 = Debug|aa64
Debug|ia32 = Debug|ia32
Debug|x64 = Debug|x64
Release|arm = Release|arm
Release|aa64 = Release|aa64
Release|ia32 = Release|ia32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|arm.ActiveCfg = Debug|ARM
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|arm.Build.0 = Debug|ARM
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|aa64.ActiveCfg = Debug|ARM64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|aa64.Build.0 = Debug|ARM64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|ia32.ActiveCfg = Debug|Win32
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|ia32.Build.0 = Debug|Win32
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|x64.ActiveCfg = Debug|x64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Debug|x64.Build.0 = Debug|x64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|arm.ActiveCfg = Release|ARM
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|arm.Build.0 = Release|ARM
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|aa64.ActiveCfg = Release|ARM64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|aa64.Build.0 = Release|ARM64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|ia32.ActiveCfg = Release|Win32
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|ia32.Build.0 = Release|Win32
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|x64.ActiveCfg = Release|x64
{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}.Release|x64.Build.0 = Release|x64
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|arm.ActiveCfg = Debug|ARM
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|arm.Build.0 = Debug|ARM
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|aa64.ActiveCfg = Debug|ARM64
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|aa64.Build.0 = Debug|ARM64
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|ia32.ActiveCfg = Debug|Win32
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|ia32.Build.0 = Debug|Win32
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|x64.ActiveCfg = Debug|x64
{3135D563-9596-4584-9ED6-616ADEC52974}.Debug|x64.Build.0 = Debug|x64
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|arm.ActiveCfg = Release|ARM
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|arm.Build.0 = Release|ARM
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|aa64.ActiveCfg = Release|ARM64
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|aa64.Build.0 = Release|ARM64
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|ia32.ActiveCfg = Release|Win32
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|ia32.Build.0 = Release|Win32
{3135D563-9596-4584-9ED6-616ADEC52974}.Release|x64.ActiveCfg = Release|x64
Expand All @@ -48,4 +58,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {376E6530-5878-4CF4-AFB7-123F799056A2}
EndGlobalSection
EndGlobal

0 comments on commit d2c7506

Please sign in to comment.