We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Testing microcontroller firmware with Python

Formal Metadata

Title
Testing microcontroller firmware with Python
Title of Series
Number of Parts
160
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Testing microcontroller firmware with Python [EuroPython 2017 - Talk - 2017-07-10 - Arengo] [Rimini, Italy] Last year's talk (https://ep2016.europython.eu/conference/talks/writing-unit-tests-for-c-code-in-python) showed you how to use CFFI (https://cffi.readthedocs.io/) to write unit tests for C code in Python. This year we will take the concept one step further and create integration tests covering (almost) the whole firmware of a microcontroller, again leveraging the power of CFFI. But instead of running the firmware on the controller, it will be executed on the development machine (that is, a standard x86 architecture), allowing for much faster test execution, without requiring the target hardware. For this to work, all the hardware-dependent parts of the firmware code need to be replaced by Python code simulating the hardware functionality, so that all the firmware above this hardware abstraction layer can be executed unmodified. In addition, this allows to use advanced security testing tools like AddressSanitizer (https://github.com/google/sanitizers/wiki/AddressSanitizer) and american fuzzy lop (http://lcamtuf.coredump.cx/afl/) that would not be able to run directly on the microcontroller