Optiboot is the default bootloader for Arduino Uno, and I use it other Arduinos (eg Nano) for all the good reasons Arduino put it on Uno.
To make that work conveniently, I append the Optiboot boards.txt file to the Arduino distribution.
Above is a screen dump of the options added by the appended file.
Here is the modified boards.txt in boards.zip for Arduino 1.6.12.
Arduino 1.6.12 seems to use the boards.txt located at %LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.6.15 in my Win10 installation… but it could be in difference locations in different Arduino and Windows versions. Find it and replace it with the one in the zip to added the full Optiboot options.
Note this will probably be overwritten by version updates of either Arduino IDE or perhaps even just the board manager. Arduino has not come to a good solution for user extension to boards.txt… not yet anyway.
Here is a bat script that I use to perform the work, it needs to be rerun after board manager has been run, it might be the basis for your own work.
@echo off rem generate a unique workfile name :tryworkfileagain set /a workfile=%RANDOM%+100000 set workfile=work-%workfile:~-4%.tmp echo rand is %workfile% if exist %workfile% goto tryworkfileagain set BOARDSDIR=%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\ rem get directory listing dir /ad /on /b %LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\ >>%workfile% rem get the last entry for /F %%f in (%workfile%) do set BOARDSDIR=%BOARDSDIR%%%f\ echo BOARDSDIR=%BOARDSDIR% rem strip optiboot section from end if it exists rem sed -nf AddBoards.sed <"%BOARDSDIR%boards.txt" >"%BOARDSDIR%boards.bak" sed -bne "/#DO NOT MODIFY BELOW/q;p" <"%BOARDSDIR%boards.txt" >"%BOARDSDIR%boards.bak" rem copy /b /y "%BOARDSDIR%boards.txt" "%BOARDSDIR%boards.bak" echo #DO NOT MODIFY BELOW, it may be overwritten (AddOptiBoards.bat). >%workfile% copy /y /b "%BOARDSDIR%boards.bak" + %workfile% + optiboot\boards-1.6.txt "%BOARDSDIR%boards.txt" del %workfile% dir "%BOARDSDIR% pause
Note the location of the Optiboot boards file. Arduino IDE is not very stable so path names may change rendering the script ineffective. One day, Arduino IDE might contain a feature for painless user extension of the boards file.
A Python script to do the same thing…
#Script to append optiboot boards.txt to Arduino boards.txt import os import re import io import sys optiboards='optiboot\\boards-1.6.txt' dest=os.environ['LOCALAPPDATA']+'\\Arduino15\\packages\\arduino\\hardware\\avr\\' def SubDirPath(d): return filter(os.path.isdir, [os.path.join(d,f) for f in os.listdir(d)]) def LatestDirectory(d): return max(SubDirPath(d), key=os.path.basename) dest=LatestDirectory(dest) print(dest) #strip opti from boards.txt to bak boards=io.open(dest+'\\boards.txt', 'rt',newline=None) bak=io.open(dest+'\\boards.bak','wt',newline=None) p=re.compile('^\#DO NOT MODIFY BELOW.*\(AddOptiBoards\)') for line in boards: if(p.match(line)): break bak.write(line) boards.close bak.close #write original from bak to boards boards=io.open(dest+'\\boards.txt', 'wt',newline=None) bak=io.open(dest+'\\boards.bak','rt',newline=None) for line in bak: boards.write(line) bak.close #write opti to boards boards.write(u'#DO NOT MODIFY BELOW, it may be overwritten (AddOptiBoards)\n') opti=io.open(optiboards,'rt',newline=None) for line in opti: boards.write(line) boards.write(u'#END (AddOptiBoards)\n') opti.close boards.close if sys.version_info[0]==2: raw_input("Press ENTER to continue.") else: input("Press ENTER to continue.")
Both or these scripts assume they are run from the Optiboot distribution directory (cloned from the repo).