Skip to content

Instantly share code, notes, and snippets.

@mstratman
Last active June 2, 2020 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstratman/5ede44bfd3bc87219b2a90b9920d51e1 to your computer and use it in GitHub Desktop.
Save mstratman/5ede44bfd3bc87219b2a90b9920d51e1 to your computer and use it in GitHub Desktop.
#!/bin/bash
input=$1
if [ ! -f "$input" ]; then
echo "Usage: ./burn.sh path/input.hex"
exit
fi
output=${input%.hex}.bin
echo "Erasing eeprom"
ch341eeprom -v -s 24c32 -e
echo "Converting to $output"
srec_cat $input -Intel -o $output -binary
echo "Writing EEPROM"
ch341eeprom -v -s 24c32 -w $output
echo "Checking:"
ch341eeprom -v -s 24c32 -r /tmp/eeprom.bin
echo "--------look for problem here-------"
diff /tmp/eeprom.bin $output
echo "---------------------"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment