Before running a system integration test on an embedded device, the device needs to be flashed with the firmware. Here’s how to do this from a GitHub Workflow.
First we need to checkout the firmware and build it. Checking out the project is easy with the checkout
action from GitHub. Building it can be a little trickier, but if you have taken the time to Dockerize your build environment, building the project is also easy. Here’s an example Job for checking out and building a project using a Docker build environment.
The CMake
build command mkdir -p _build;cd _build;cmake .. -G Ninja;cmake --build .
is run inside the lagerdata/devenv-cortexm:latest
Docker image so no setup has to be done on the GitHub runner itself.
Once the project is built we can flash our device using either the Lager CLI command lager debug flash
or with a method from Lager’s Python library, dut.flash("path/to/image.hex")
.
CLI Command
In the above Workflow, we first power up the device using lager supply
which allows us to control power to the device
And then we flash the image that was built in the previous step, image.hex
.
Python
Or we could combine both those steps into a small python script:
Assuming this script is saved in the project as tests/flash.py
you could then run
And that’s it!
Reach out to learn more about Lager's hardware test automation platform.
Try One Month Free
hello@lagerdata.com