0

Upon deciding to write a simple "Hello World!" program in EDK2, I stumbled upon the following problem:

As I am using a serial connection for debugging, the output of the debug functions like DebugPrint successfully get redirected to my serial terminal (PuTTY in this case), well sort of.

After compiling an executing the following program inside an UEFI shell, I simply get an empty line as a result. But after executing the same binary again, the line gets successfully printed in all it's beauty.

This is the source code of the program i ran:

#include <Uefi.h>
#include <Library/DebugLib.h>

EFI_STATUS
efi_main(EFI_HANDLE ImageHandle, 
    EFI_SYSTEM_TABLE* SystemTable
    )
{
    DebugPrint(DEBUG_INFO, "Hello World!\n");
    return EFI_SUCCESS;
}

Serial output:

enter image description here

Note: I linked my program against IoLib, SerialPortLib and DebugLib

What could be causing this issue?

Dalex
  • 61
  • 1
  • 5
  • 2
    Try `DebugPrint(DEBUG_INFO, "Hello World!\n"); DebugPrint(DEBUG_INFO, "Hello World!\n");` and `DebugPrint(DEBUG_INFO, "Hello World!\nHello World!\n");` and see what happens – Jabberwocky Apr 01 '21 at 11:49
  • Already tried that one out, but that sadly didn't help either – Dalex Apr 01 '21 at 12:39

1 Answers1

0

After a lot of fiddling around I realised, that I manually specified the entry point to my main-function (efi_main), which should instead point to _ModuleEntryPoint when using the UefiDriverEntryPoint library from EDK2.

This solved my problem instantly :)

Dalex
  • 61
  • 1
  • 5