0

I'm trying to build a hello world c program to run on UEFI referencing EDK2 headers https://github.com/tianocore/edk2/tree/master/MdePkg/Include

I've git clone the repo, copied the folder above in my project directory and included as

#include <stdint.h>
#include <inttypes.h>
#include <stddef.h> // NULL

#include "./Include/Uefi/UefiSpec.h"
#include "./Include/Uefi/UefiBaseType.h"
#include "./Include/Base.h"
#include "./Include/X64/ProcessorBind.h"
#include "./Include/Protocol/LoadedImage.h"

// EFI Image Entry Point
EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
...

Here's my build command

x86_64-w64-mingw32-gcc -Wl,--subsystem,10 -e efi_main -I "./Include" -std=c17 -Wall -Wextra -Wpedantic -mno-red-zone -ffreestanding -nostdlib

And I get pages of errors like

./Include/Uefi/UefiInternalFormRepresentation.h:2095:3: error: unknown type name ‘UINT8’
 2095 |   UINT8    SkipCount;
      |   ^~~~~

the UINT8 is defined in "Include/X64/ProcessorBind.h" which is included

///
/// 1-byte unsigned value
///
typedef unsigned char UINT8;

Any idea?

Thank you

moxede3067
  • 21
  • 3
  • Why are you not using the edk2 build system? You include 'ProcessorBind.h' after 'UefiSpec.h', you have to include it before. You will probably have another problem because 'UefiBaseType.h' includes 'Base.h' which includes 'ProcessorBind.h' and this file is not in the main edk2 include folder. – MiSimon Jun 29 '23 at 10:01
  • Your right, I haven't realize there was a whole build system, currently I have VS2022, and for some reason it only support VS2019. From the bugs and forum, it seems there's no plan to support VS2022. Anyway, Thanks – moxede3067 Jun 30 '23 at 02:06

0 Answers0