Of all the gin joints in all the towns in all the world, John Davis had to 
walk into mine at 10:02:01 on Friday 21 February 2014 and say:

> Hello
> 
> I got a few emails.  Perhaps I should repose the question.
> 
> I was reading the EDKII Coding Guidelines document on tianocore.  In it, it
> says do not use int or char native types.  Consquently, I was trying to use
> UINT32 and UNIT8 types.
> When I try to extend the HelloWorld sample application from the
> MdeModulePkg with simple type definitions as UINT32 it fails to compile.  I
> am confused by the other sample main since it seems to be doing precisely
> what the coding guidelines say not to do.
> 
> So, how do you setup your includes in your .c file and the .inf file to
> build code which uses UINT types?
> 
> John

I created a small application sample for you which you can download from:

http://people.freebsd.org/~wpaul/w00t/MooPkg.zip

Unzip this in your edk2 directory and it will create a MooPkg directory. You 
can build it by doing:

build  -a IA32 -b RELEASE -t [yourtool] -p MooPkg/MooPkg.dsc
build  -a X64 -b RELEASE -t [yourtool] -p MooPkg/MooPkg.dsc

I only set it up for the IA32 and X64 arches because that's all I can readily 
test right now, but you can change this by editing MooPkg.dsc and editing the 
SUPPORTED_ARCHITECTURES line. Note that all the GUIDs in the .dsc, .dec and 
.inf files are zeros. I leave it to you to fill in the blanks.

This builds you a simple application, Moo.efi, which just prints a hello world 
message on the console with a variable declared as UINT32. This does not use 
StdLib, ShellLib or any of the EDK I compatibility stuff. Here's a sample run 
using OVMF under QEMU:

UEFI Interactive Shell v2.0
EDK II
UEFI v2.40 (EDK II, 0x00010000)
Mapping table
      FS0: Alias(s):HD7a1:;BLK3:
          PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)/HD(1,MBR,0xBE1AFDFA,0x3F,0xFBFC1)
     BLK0: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x0)
     BLK1: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x0)/Floppy(0x1)
     BLK2: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
     BLK4: Alias(s):
          PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
Press ESC in 5 seconds to skip startup.nsh or any other key to continue.
Shell> Moo
HELLO WORLD: 123
Shell> 

It seems that include paths are specified by an [Includes] section in the .dec 
file. The MooPkg.dec just specifies that MooPkg/Include should be added as a 
path, but other paths are inherited from other .dec files. For example, 
Moo.inf says:

[Packages]
  MdePkg/MdePkg.dec

This causes the Moo package to inherit the include paths specified my 
MdePkg.dec.

-Bill

-- 
=============================================================================
-Bill Paul            (510) 749-2329 | Senior Member of Technical Staff,
                 wp...@windriver.com | Master of Unix-Fu - Wind River Systems
=============================================================================
   "I put a dollar in a change machine. Nothing changed." - George Carlin
=============================================================================

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to