top of page

Testing ELF Files

In addition to testing logic flows, verifying firmware settings that the customer expects is equally important. Some of these settings are verifiable by examining the ELF file that is produced when compiling the firmware. In our use case, the customer was reporting faulty behavior at low voltages. After investigating, it turned out that the fuse bits were inadvertently changed by a developer.


To show the customer that this wouldn't happen again, we created an automated test that would test the ELF binary after compilation and make sure the fuse bits were properly set.

This test script uses a python library called pyelftools that we use to analyze the ELF file. We get the fuse section by name and then inspect the byte we are interested in to verify it has the necessary value.


We run this test using pytest with the following command:

python -m pytest -q --junitxml=testLog.xml

We output the test results to a JUnit Test file which is then fed to the build system. The build system will alert the engineers if there is a failure.


Happy Coding!





0 views0 comments

Recent Posts

See All

Comments


bottom of page