Implementing MicroPython as a UEFI Test Framework

ID 标签 659582
已更新 3/8/2018
版本 Latest
公共

author-image

作者

Since its introduction in 2005, the Unified Extensible Firmware Interface (UEFI) has become the primary standard for firmware development. As the industry continues to develop Embedded Development Kit II (EDK II) as a core UEFI component, we are also supporting test frameworks to accelerate firmware validation.


Python is a popular high-level interpreted language, common in automated testing environments. While C is still the language of choice for developing UEFI firmware components, Python support allows validation engineers to apply existing skills from operating system (OS) level scripting to UEFI unit tests and manufacturing line applications.

Python already is used for a number of UEFI platform tests. TianoCore currently includes a CPython 2.7.10 implementation as part of EDK II. The CHIPSEC platform security assessment framework uses Python to execute the same scripts across Microsoft* Windows, Linux*, Mac OS X*, and UEFI Shell environments. However, the existing EDK II port of CPython has several limitations:

Because of Python’s flexibility and wide adoption, my team investigated several options to support Python 3.x in UEFI boot services. Because firmware is a constrained environment compared to OS runtime, we evaluated porting MicroPython to UEFI. MicroPython is a Python 3 variant designed for microcontrollers, with memory and size optimizations that make it ideal for pre-OS applications.

MicroPython

My colleagues will present an overview of a MicroPython-based UEFI test framework at the Spring 2018 UEFI Plugfest (March 26-30 in Bellevue, WA). This framework provides scripts with access to UEFI and EDK II interfaces, along with access to hardware resources. We also see this as an ideal environment for rapid prototyping of UEFI applications, and replacing legacy applications still used in manufacturing environments. MicroPython also extends support for existing UEFI CPython scripts, since the Python 2.7 tree is scheduled for end-of-life in 2020.

Using MicroPython for a firmware test framework leverages Python experience from validation engineers and a Python interpreted optimized for execution in constrained environments. There aren’t many unified EDK II testing frameworks optimized for both development and validation engineers. Extending the Python model adopted by CHIPSEC to a common framework expands validation capabilities for open source UEFI firmware.

Firmware is a critical platform component, with a limited number of developers who understand its development and validation. Supporting Python 3.x & MicroPython in open source creates new opportunities for the TianoCore community to validate robust firmware solutions.

MicroPython for UEFI - Stack Overview

The upcoming presentation at the Spring 2018 UEFI Plugfest will introduce plans for developing and releasing this test framework. If you’re interested in following this project, check out the “How to Contribute” page on tianocore.org.