If you have a brand new SPIKE Prime hub running the below script will allow you to copy the firmware from the device.
This requires a linux machine (I used ubuntu 18.04)
# Install the dfu-util program if you do no already have it.
# sudo apt-get install dfu-util
# List the connected devices, this should show the hub is connected.
sudo dfu-util --list
# Read the firmware.
sudo dfu-util --alt 0 --dfuse-address 0x08000000:1048576 --upload ~/firmware.bin
# Take ownership of the file created by the dfu-util program.
sudo chown $(whoami) ~/firmware.bin
# Remove the first 0x8000 bytes, as these are before the firmware starts.
fallocate -c -o 0 -l 32768 ~/firmware.bin
# Remove the trailing bytes that have the value 0xFF, as these are unnecessary.
sed -i '$ s/\xFF*$//' ~/firmware.bin
# Rename the firmware to the md5 hash of itself.
mv ~/firmware.bin ~/$(md5sum ~/firmware.bin | awk '{ print $1 }').bin
I foolishly updated my hub before ripping the firmware.
If you have a brand new SPIKE Prime hub running the below script will allow you to copy the firmware from the device. This requires a linux machine (I used ubuntu 18.04)
I foolishly updated my hub before ripping the firmware.