A simple script to monitor .hex, .eep files and program it to the avr chip

.hex and .eep flashingmodify the following lines to setup the system in avrdude_flasher.py:
9 chip = "attiny2313" define here the default chip if it not in the filename. See avrdude docu -p flagprogrammer = "usbasp" define here your programming device. See avrdude docu for the -c flagpath_to_watch = "./GccApplication3/GccApplication3/Debug" define the path to watch for .hex filesSee at function flash for more configration flags.
Any linux system with python2 and avrdude installed.
I used a RPI Zero W with an USBASP connected.
I setup a smb share and setup the path_to_watch path to it, so if AtmelStudio generates a new build and the pythonscript flashes the new file to the chip on an other Computer.
After setup simply run avrdude_flasher.py
A feature is that the chip to programm can be determand in the filename, so you dont need to change the script.
The filename for .hex and .eep need the following pattern:
_<projectname>_<chipname>_.hex and _<projectname>_<chipname>_.eep
So a valid build file for an Attiny2313 is:
~/build/_ledblink_attiny2313_.hex~/build/_ledblink_attiny2313_.eepA AtmelStudioProject runs not very well on a FileShare i have noticed. So i added a PostBuildRule to copy the build files to the share via a windows copy command:
copy $(MSBuildProjectDirectory)Debug$(AssemblyName).hex C:UsersrootDropboxtestprojDebug_$(AssemblyName)_attiny2313_.hexcopy $(MSBuildProjectDirectory)Debug$(AssemblyName).hex C:UsersrootDropboxtestprojDebug_$(AssemblyName)_$(avrdevice)_.hexIf you want to watch *.hex files on smb shares you have to mount it on ubuntu into the filesystem.
The normal Files-Application dont do that.
So first you have to install cifs-utils
sudo apt-get install cifs-utils
Create a local mounting foldersudo mkdir /mnt/tmp_dev_share
And mount the SMB Server to it (Here the smb share is on 192.168.1.23 and we want to mount the /home/tmp folder)sudo mount -t cifs //192.168.1.23/home/tmp /mnt/tmp_dev_shareThe last step is to edit the path_to_watch Variable to /mnt/tmp_dev_share