top of page

Automated Firmware Binaries

One of the first steps to a proper DevOps setup is putting in processes to prevent the "It works on my machine" problem. All binaries should be generated by an independent build server that only pulls it's code and sometimes configuration from a central repository. This ensures that necessary files have been uploaded and all dependencies have been sufficiently configured. A high quality firmware build script should perform the following tasks:

  • Take in command line arguments to record build specific parameters such as version and file locations

  • Inject the build version created by the build system into the source code itself so the binaries and build version are tightly coupled

  • (Optional) Create a snapshot of the source code at the time of building

  • Add version info to the filename of the binaries files themselves '

  • Create SHA256 hashes of the deliverable binaries

  • Upload all artifacts (source code, built binaries, hash file) to the build systems

This script has four main sections:

  • Bootstrap - Here we parse the command line arguments and setup the script variables.

  • Inject build version into source code - Here we inject the build version by searching for a specific token, STR_FW_VERSION, and injecting the version there. The version can be based on a Date Code (2021.5), incrementing the previous version, or base it off the build number generated by the build system.

  • Compile - Here we compile the code. Some compilers and IDE's will be very sensitive on how they need to be called from a script. Some trial and error is usually necessary here when working with a new toolset.

  • Wrap Up - Here we do our final steps such as renaming the binaries and created SHA256 hashes

There are many tool sets and many build systems. The script above is meant for building Atmel Studio projects on Atlassian Bamboo but can be easily adopted to fit other tools.


Happy Coding!



1 view0 comments

Recent Posts

See All

©2023 by EmbeddedDevOps

bottom of page