UEFI Application

Home >> | Back to Courseware Access page >> | Back to Other Courseware Content page >> |


UEFI Curriculum

About UEFI

UEFI-Framework Course Contents

Introduction to PC Architecture

Beyond BIOS

UEFI Introduction

UEFI Architecture and Technical Overview

UEFI Application

UEFI Shell

UEFI Boot Manager

UEFI Services

UEFI Drivers

Framework Architecture and Technical Overview



Potential research topics


• Introduction
• UEFI Shell
• UEFI Toolkit
• 3rd Party Libraries
• Summary





• EFI Applications extend firmware

–No hardware dependence

–No OS dependence

• Portable across platforms

–Intel® IA-32, EM64T, Itanium® Architecture and XScale® technology

• Enables rapid application development


What is UEFI Application?

• A UEFI Loadable Image

–Loaded by UEFI loader just like drivers
–Does not register protocols like drivers do
–Consumes protocols
–Typically user driven (exits when task completed)
–Same set of interfaces available as drivers have

• Can be used for

–Platform diagnostics
–Factory diagnostics
–Driver prototyping
–’Platform’ applications


UEFI Shell

• A UEFI Application

• Interactive Console Interface

• Application Launch

• Load UEFI Drivers

• Scripting Capability

• Automatic execution of startup script file

• Console redirection to files


UEFI Toolkit

UEFI Toolkit Components

• Utilities

• C Library

• Network Stack

• Platform Management

• Compression

• Database

Useful tools for UEFI application development

Programming Models

• Native UEFI Model

–Uses only UEFI constructs

–Access to all UEFI constructs

–Smaller code size

• Portability Model

–Familiar programming interfaces

–Easier to port ANSI/POSIX based programs

–Larger binary image

• A single program can use both


UEFI Toolkit Integration


C Library

• FreeBSD Port

• ANSI/POSIX compliant

• System I/O - open(), read(), write(), close(), stat()

• Standard I/O - fopen(), printf(), gets(), …

• String/Char - strcmp(), isascii(), atoi(), …

• Memory - malloc(), free(), realloc(), …

• Time/Date - time(), asctime(), ctime(), …

• Math - sqrt(), pow(), sin(), log(), …


UEFI Library

• Lite Weight” C Library like functions

–String Functions
–Memory Support Functions
–CRC Support Functions
–Text I/O Functions
–Math Functions
–Spin Lock Functions

• Specific EFI functions

–Handle and Protocol Support Functions
–Device Path Support Functions


Network Components

• Port of FreeBSD TCP/IP stack

• Supports standard protocols –IPv4, ICMP, ARP, UDP, TCP

• Socket library interface

• Implemented as an EFI protocol



• SMBIOS Library

–Library routines for parsing SMBIOS tables

• Database



• Compression

–General purpose compression/decompression

–Gzip functionality



• Network utilities – FTP client and server, ping

• Text editor

• Scripting interpreter (Python)

• Sample applications


UEFI Hello.c

#include "efi.h"

InitializeHelloApplication (
   IN EFI_HANDLE           ImageHandle,
   IN EFI_SYSTEM_TABLE     *SystemTable
   UINTN Index;

          L”Hello application started

Hit any key to exit this image

          1, &(SystemTable->ConIn->WaitForKey), &Index);

   return EFI_SUCCESS;

aewdsa saf wefrasf adsf sdaf

C Library Hello.c

#include <atk_libc.h>
#include <stdio.h>

InitializeHelloLibCApplication (
   IN EFI_HANDLE           ImageHandle,
   IN EFI_SYSTEM_TABLE     *SystemTable
        InitializeLib(ImageHandle, SystemTable);
        printf("Hello LibC application started

f("Hit C/R to exit this image
       return( getchar() );


#include <atk_libc.h>
#include <stdio.h>

int main (int argc, char **argv )
        printf("Hello LibC application started

        printf("Hit C/R to exit this image
        return( getchar() );

C++ Support

• No direct support

–No Global constructors and destructors

• New and Delete can be mapped to malloc/free


3rd Party Libraries

Portable Embedded Graphics

• Portable Embedded Graphics

–Portable graphics library for UEFI
–Similar windowing components (widgets) 
     •        Dialog boxes
     •        Progress bars, scroll bars
     •        Text boxes
     •        Window Management
     •        Fonts
     •        Bitmaps, JPEG, …

• Contact Swell Software



PEG Components




• UEFI Applications extend firmware

–Provides system independence in the pre-boot space
     •        Hardware
     •        Operating System
     •        Platform
–Intel® IA-32, EM64T, Itanium® Architecture and XScale® technology

• Large library support

• UEFI Shell provides convenient launch point

For more complete information about compiler optimizations, see our Optimization Notice.


Randy S.'s picture

Where can I find more information on the APIs and example code for UEFI applications ? Do you have to use a specific compiler or development tool ? I saw something about Python support. Do you have any more info on this ? Where can I find more info on the UEFI shell scripting environment ? Can you recommend any good books on UEFI applications development ? I see a USB application in my future. Do you have any info on accessing USB devices through UEFI ?




anonymous's picture

Right at the end, you mention SWELL Software's PEG lib as supporting UEFI. However, directly asking them for this, they responded with not having a UEFI video driver available and thus no support. What gives? Are there any other UEFI GUI frameworks?

Holger Thiele

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.