Canonical has published a tutorial that details how to create a custom Ubuntu Core image for the TurtleBot3, with the capability to update OpenCR firmware. The firmware enables communication between Raspberry Pi and motors, IMUs and batteries, and is configured via USB. Firmware versions must match those of the ROS distribution to which they are connected. Updating the robot's firmware is necessary when using a ROS noetic snap with an OpenCR board that is configured with ROS 2 Humble firmware. With firmware updates built into a snap, it will stay compatible with ROS distributions and run the most current firmware. Canonical's solution for firmware updates for OpenCR is just one example of how firmware can be updated with snaps.
Snaps can now carry and flash firmware, meaning that they can be updated remotely even on devices that can't run an OS. Canonical's TurtleBot3 already has a defined procedure for firmware updates, according to blogpost author or Core Software Engineer for Robotics at Canonical, Alex, AKA Siku. The blogpost details how Siku avoided conflicts between OpenCR and ROS by running the firmware updater in the very same snap controlling the TurtleBot3. Using Ubuntu Core on TurtleBot3, Siku was able to demonstrate how firmware updates can be added to a snap to ensure they always come with the firmware version matching the ROS distribution.
The post goes on to outline specifics regarding the OpenCR scripts themselves, sharing access to the port, updating the firmware application, etc. Users can update the firmware only when it changes using a hashing mechanism in the post-refresh hook. Siku writes that almost every microcontroller has its own flashing method, so the approach described is just one example of how firmware updates can be built into a snap.