Super useful Spin Development Script [Linux]

daeg

Well-known member
After about a year of focusing on other things, I got back to messing around with the FV1. I've been using this Bash script I created to test out code tweaks and someone out there might find it useful or adapt it to their needs. Please note that this is a script for Linux, so if you're using Windows or Mac it will need to be adapted. I can probably help.

What does it do?
  1. Copies the current EEPROM
  2. Increments Patch 0 to 1, 1 to 2, 2 to 3, etc, all the way to 7, leaving patch 0 empty
  3. Writes whatever you're working on as patch 0
This way, you can make 1 code change at a time and compare the before and after on your PedalPCB Pythagoras, FV-1 Development board, or Octagon. Think of it as CTRL-Z and CTRL-Y for you FV1 flashing. To make this work, you'll need Python3, Pip3, Asfv1 and Disfv1 installed, as well as the ch341eeprom binary in the same directory as this script. Once setup, it will be as simple as running this:

Bash:
./quickflash.sh myeffect.asm

Here's the code. Just copy it to a file, name it whatever you like and make it executable (ex. chmod 755).

Bash:
# Set Variables
target=${1}
location=/tmp
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Compile new patch
echo "Compiling ${target} as Patch 0"
python3 -m asfv1 -sq -p 0 ${target} ${location}/spinfv1_new.bin
[[ ${?} != 0 ]] && exit 1

# Copy EEPROM Contents
echo "Reading EEPROM"
sudo ${scriptdir}/ch341eeprom -s 24c32 -r ${location}/spinfv1_old.bin
sudo chown ${USER}:${USER} ${location}/spinfv1_old.bin

# Increment old patches by 1 
echo "Decompiling patches 0-6 and recompiling as 1-7"
for i in {0..6}; do
   python3 -m disfv1 -sq -p ${i} ${location}/spinfv1_old.bin ${location}/spinfv1_temp.asm
   python3 -m asfv1 -sq -p  $((i+1)) ${location}/spinfv1_temp.asm ${location}/spinfv1_new.bin
done
[[ ${?} != 0 ]] && exit 1

# Flash EEPROM
sudo ${scriptdir}/ch341eeprom -s 24c32 -w ${location}/spinfv1_new.bin
echo "EEPROM flash successful"

# Remove old files
rm ${location}/spinfv1_*
 
target appears to be the filename of the asm source file you want compiled and inserted into Patch 0.
 
  • Like
Reactions: fig
target appears to be the filename of the asm source file you want compiled and inserted into Patch 0.
Yep. It only takes one command line argument, and that's the filename of the code you're working on.

For me, this is a big time saver when testing code changes, because I'll have a text editor and a terminal open, and when I want to try the code, its just a matter of hitting save in the text editor, then up and enter in the terminal, and 3 seconds later the EEPROM is flashed.

When I want to hear the before and after, it's just a matter of toggling between patch 0 and patch 1.

There hasn't been much discussion of FV1 lately, so I thought it would be a good time to share this.
 
  • Like
Reactions: fig
This is pretty dang useful, I appreciate you posting it. :)

I wrote a small utility application a while back to automate the task of creating the custom EEPROMs from the EEPROM Builder tool but adding new algorithms to the list broke it and I never took the time to update.

There hasn't been much discussion of FV1 lately, so I thought it would be a good time to share this.

The biggest issue right now is they're out of stock everywhere... hopefully they'll be available soon.
 
  • Like
Reactions: fig
Nice one.

I haven't shared much of the fv1 stuff that I worked out, as I'm not sure how much development is still going on these days. But if people have an appetite for learning more algorithm development, I could be convinced to publish some stuff.
 
Back
Top