This article assumes that you have Visual Studio 2012 and that you have the Visual Studio project to build the EDK2's NT32 platform in C:\sourcecode\edk2.
To set up EDK2's UEFI environment with Visual Studio 2012, click here.
To debug the UEFI environment with Visual Studio 2010, click here.
To debug the UEFI environment with Visual Studio 2008, click here.
Set-Up


2. Go to File -> Open File...


4. Find the section of Nt32Pkg.dsc labeled "Pcd Dynamic Section."

gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"GOP Window 1!GOP Window 2"|VOID*|52

6.Again, got to File -> Open File...

7. Open the file Main.c, which is located at c:\sourcecode\edk2\AppPkg\Applications\Main\Main.c

puts("Hello there fellow Programmer");


10. Use the tabs in Visual Studios to switch back to Nt32Pkg.dsc.


12. Under that line of code, write the following text:

13. Scroll down to the very bottom of Nt32Pkg.dsc and write the following text:
DEFINE EMULATE
!include StdLib/StdLib.inc

14. Go to Build->Build Solution.

15. Wait for the Build to finish.
The picture to the right shows what the output box will display when it is finished.
Debugging

17. When the Graphics Output Window appears, hit "Enter" twice, or wait for the window to load completely.



You can halt the execution of the emulated UEFI environment at any time by selecting Debug->Break All. Then you can set some breakpoints on a specific function by using Debug->New Breakpoint->Break At Function and typing in the function name. You can force a breakpoint by inserting a __debugbreak() into your code or by hitting F9.

No comments:
Post a Comment