Print2 프로토콜을 기반으로 간단한 UEFI 프로토콜을 작성하려고합니다. 드디어이다 .HUEFI 프로토콜 : 오류 : 'print3Hello'앞에 '=', ',', ';', 'asm'또는 '__attribute__'이 필요합니다.
#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
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
이 주 .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;
}
가되고 : 여기
는 컴파일의 전체 오류입니다 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]
Print3에 대한 GUID는 내가 Print2 의정서는 UEFI 라이브러리에서 구현 따랐다
## Print3/Print3.h
gEfiPrint3ProtocolGuid = { 0x3b777e4b, 0x93b1, 0x4985, { 0xb0, 0x55, 0x52, 0x55, 0x1b, 0x54, 0xcc, 0xcc }}
MdeModule/MdeModule.dec에 정의되어 있습니다. inf 파일은 내가 생성 한 GUID를 제외하고 print2.inf에서 가져온 것이며 변수 이름을 변경했습니다.
헤더는 Print2 프로토콜에서 사용되었습니다. Iam이 누락 된 것은 매우 바보스러운 것이어야합니다.
'EFI_STATUS' 또는 'EFIAPT'는 정의되지 않습니다. ... 잠깐, 'EFIAPT'대신에'EFIAPI'를 사용 했습니까? – melpomene
'reutrn'의 철자도 잘못되었습니다. – melpomene
@melpomene Tsk! taht는 저를 매우 어리 석 었습니다. 답을 쓰고 싶으면 받아 들일 것입니다. – qwn