Hi UEFI community,

 

I’d like to introduce the CdePkg to edk2-staging.

 

Some time ago I decided to write my own ANSI C Library for UEFI Shell and POST.

 

The UEFI Shell library (“Torito C Library”) has been production-ready for more than one year.

The POST version of the library (“CdeLib”) is not yet fully tested.

 

I will be demonstrating my verification procedure in the upcoming weeks on EDK2 STAGING  https://github.com/tianocore/edk2-staging/tree/CdePkg

 

Currently there are 3 examples implemented:

  1. argvc: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/HOSTED_ENV/argcv/main.c#L57

argc/argv handling according to https://msdn.microsoft.com/en-us/library/a1y7w461.aspx

  1. systeminterfacePEI: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfacePEI/main.c#L57

demonstration, how PeiServices and FileHandle are passed into main()

  1. systeminterfaceDXE: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/SYSTEM_IF/systeminterfaceDXE/main.c#L57

demonstration, how SystemTable and ImageHandle are passed into main()

 

Upcoming next demonstration will be the clock() function end of this week

 

The idea is to bring the ANSI C Library interface into POST drivers.

This will:

  1. ease porting tasks
  2. allow cross development
  3. allow developers to focus on their aims, because they aren’t forced to keep in mind a lot of additional info (e.g. RShiftU64)
  4. provide all intrisics to allow the compiler to be a “C compiler”

(e.g. char buffer[256] = { 1 };)

 

What is CdePkg and Torito C Library?

but guarantees  that the C compiler is always fully usable (all intrinsics available) and the C90/C95 standard library is always available

 

What are the design goals?

entire printf()-family, entire scanf()-family.

UEFI-POST-driver just uses small wrapper functions to run the C-Library-Driver code.

This is required for early PEI before memory sizing, when PEI-images run directly out of flash

    1. use original Microsoft header files for UEFI Shell Apps created in VS2019
    2. allow expensive debugging tasks of ANSI C .EFI applications in Visual Studio in its Windows NT counter part
    3. to save my lifetime writing a documentation https://github.com/tianocore/edk2-staging/tree/CdePkg/implemented.md#validation-status

 

CdePkg shall be adjusted to other compilers/tool chains too, once it is feature-complete and accepted by the UEFI community.

As long as it is for Microsoft VS2019 only.

 

CdePkg README.md is here:   https://github.com/tianocore/edk2-staging/tree/CdePkg#cdepkg

CdePkg HOWTO is here: https://github.com/tianocore/edk2-staging/blob/CdePkg/README.md#howto

CdeValidationPkg README.md is here: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/README.md

CdeValidationPkg HOWTO is here: https://github.com/tianocore/edk2-staging/blob/CdePkg/CdeValidationPkg/README.md

 

HOWTO:

  1. clone the edk2-staging repository
  2. checkout CdePkg
  3. run LAUNCH.BAT
  4. run build -p EmulatorPkg\EmulatorPkg.dsc -t VS2015x86 -a IA32
  5. run DBGEMU.BAT to start emulation (EmulatorPkg)
  6. run build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
  7. update MinnowBoard with Build/Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\VLV.fd

 

Best regards,

Kilian Kegel