2017-10-03 5 views
0

Je suis en train d'écrire un protocole simple UEFI basé sur le protocole Print2.UEFI Protocole: erreur: attendu « = », « », « », « asm » ou « __attribute__ » avant « Print3Hello »

Voici l'erreur complète de la compilation:

Building ... /home/qwn/src/edk2/Print3/Print3.inf [X64] 
"gcc" -g -fshort-wchar -fno-builtin -fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-sections -include AutoGen.h -fno-common -DSTRING_ARRAY_NAME=Print3Strings -m64 -fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" -maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie -fno-asynchronous-unwind-tables -Wno-address -flto -DUSING_LTO -Os -D DISABLE_NEW_DEPRECATED_INTERFACES -c -o /home/qwn/src/edk2/Build/MdeModule/DEBUG_GCC5/X64/Print3/Print3/OUTPUT/./Print3.obj -I/home/qwn/src/edk2/Print3 -I/home/qwn/src/edk2/Build/MdeModule/DEBUG_GCC5/X64/Print3/Print3/DEBUG -I/home/qwn/src/edk2/MdePkg -I/home/qwn/src/edk2/MdePkg/Include -I/home/qwn/src/edk2/MdePkg/Include/X64 -I/home/qwn/src/edk2/MdeModulePkg -I/home/qwn/src/edk2/MdeModulePkg/Include /home/qwn/src/edk2/Print3/Print3.c 
/home/qwn/src/edk2/Print3/Print3.c:5:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Print3Hello’ 
Print3Hello() 
^ 

/home/qwn/src/edk2/Print3/Print3.c:12:3: error: ‘Print3Hello’ undeclared here (not in a function) 
Print3Hello 
^ 

/home/qwn/src/edk2/Print3/Print3.c:20:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Print3Entry’ 
Print3Entry(
^ 

GNUmakefile:411: recipe for target '/home/qwn/src/edk2/Build/MdeModule/DEBUG_GCC5/X64/Print3/Print3/OUTPUT/Print3.obj' failed 
make: *** [/home/qwn/src/edk2/Build/MdeModule/DEBUG_GCC5/X64/Print3/Print3/OUTPUT/Print3.obj] Error 1 

Ceci est le principal fichier .c

#include "Print3.h" 

EFI_STATUS 
EFIAPT 
Print3Hello() 
{ 
    Print(L"Hello, self defined print3 protocol \n"); 
    return EFI_SUCCESS; 
} 

EFI_PRINT3_PROTOCOL myPrint3Protocol = { 
    Print3Hello 
}; 

//Entry function for the driver, here we install the protocol 
EFI_HANDLE print3ProtocolHandle = NULL; 

EFI_STATUS 
EFIAPT 
Print3Entry(
    EFI_HANDLE  imageHandle, 
    EFI_SYSTEM_TABLE *systemTable 
) 
{ 
    EFI_STATUS status; 

    status = gBS->InstallProtocolInterface(&print3ProtocolHandle, 
             &gEfiPrint3ProtocolGuid, 
             &myPrint3Protocol, 
             NULL 
             ); 
    ASSERT_EFI_ERROR (status); 
    reutrn status; 
} 

Voici le .h

#ifndef _PRINT3_H_ 
#define _PRINT3_H_ 

#include <Uefi.h> 
#include <Library/UefiLib.h> 
#include <Library/UefiDriverEntryPoint.h> 
#include <Library/UefiBootServicesTableLib.h> 


//Guid for the print 3 protocol. 
#define EFI_PRINT3_PROTOCOL_GUI \ 
    { 0x3b777e4b, 0x93b1, 0x4985, { 0xb0, 0x55, 0x52, 0x55, 0x1b, 0x54, 0xcc, 0xcc }} 

typedef 
EFI_STATUS 
(EFIAPI *EFI_PRINT_STRING)(); 


typedef struct _EFI_PRINT3_PROTOCOL { 
    EFI_PRINT_STRING efiPrintHello; 
}EFI_PRINT3_PROTOCOL; 

extern EFI_GUID gEfiPrint3ProtocolGuid; 
#endif 

Et enfin voici l'inf

[Defines] 
INF_VERSION     = 1.25 
BASE_NAME      = Print3 
FILE_GUID      = f4df2436-242b-4e13-ae42-50c30118eff2 
MODULE_TYPE     = UEFI_DRIVER 
VERSION_STRING     = 1.0 
ENTRY_POINT     = Print3Entry 


[Sources] 
     Print3.h 
     Print3.c 

[Packages] 
     MdePkg/MdePkg.dec 
     MdeModulePkg/MdeModulePkg.dec 

[LibraryClasses] 
     UefiLib 
     UefiDriverEntryPoint 
     UefiBootServicesTableLib 

[Guids] 

[Ppis] 

[Protocols] 
     gEfiPrint3ProtocolGuid 

[FeaturePcd] 

[Pcd] 

Le GUID pour le Print3 est défini dans MdeModule/MdeModule.dec

## Print3/Print3.h 
gEfiPrint3ProtocolGuid = { 0x3b777e4b, 0x93b1, 0x4985, { 0xb0, 0x55, 0x52, 0x55, 0x1b, 0x54, 0xcc, 0xcc }} 

J'ai suivi le protocole Print2 mis en œuvre dans la bibliothèque UEFI. Le fichier inf provient de print2.inf à l'exception du GUID que j'ai généré et j'ai changé les noms des variables.

Les en-têtes ont été utilisés dans le protocole Print2. Il doit être quelque chose de très stupide qui Iam manque

+0

'EFI_STATUS' ou' EFIAPT' sont indéfinis. ... Attendez, vouliez-vous dire «EFIAPI» au lieu de «EFIAPT»? – melpomene

+0

'reutrn' est également mal orthographié. – melpomene

+0

@melpomene Tsk! C'était très stupide de ma part. Si vous voulez écrire une réponse, j'accepterai. – qwn

Répondre

1

Eh bien, vous pouvez trouver une autre erreur plus tard, mais ceux que vous obtenez leur ressemblent parce que la macro EFIAPT n'est pas définie. Je pense que vous voulez dire EFIAPI.

+0

Merci d'avoir accepté ma réponse. Je n'ai pas vu que melpomene avait signalé cette erreur et une autre dans les commentaires avant que je posté ceci. – ChipJust