Author: Karl-Heinz Kübbeler   (kh_kuebbeler@web.de) , Jun 2020

Usage of the Makefile at a Windows10 system
===========================================

If you will build the programming data (.hex file) for a optiboot Bootloader,
you need a installed tool package (tool chain) for AVR processors.
I suggest the installation of the Arduino IDE, which will include
all programs like avr-gcc, avr-ld, avrsize and so on.
The standard installation path of this package is
C:\Programme (x86)\Arduino so you can find the tools at
C:\Programme (x86)\Arduino\hardware\tools\avr\bin.
Make shure, that this path is added to the Windows system variable Path.
With this addition the tools are callable without the path specification
at the command line or from inside the Makefile.

The automatic computation of the bootloader start address and also the
setting of the fuses for the AVR processor need some little 
support programs, which came from the Linux (Unix) world.
The required programs are bc, cat, cut, echo, grep, make and tr.
These utilities are included to the cygwin64 package for Windows.
You can select the required programs during the installation of
the cygwin packages, but there is also a predefined selection. 
Usually you should select the C:\cygwin64 installation path.
If any of the programs is missing, you can start the installation program
of cygwin64 again and select the missing programs.
You should choose the path C:\cygwin64 as the base of the installation and
this path should be added to the Path system variable of Windows10.

After the successfull installation of Cygwin64 the required programs and
a additional Cygwin64 Terminal should be usable.
In this Cygwin Terminal the usage of the command line is Linux like.
But you should note, that for this terminal a new separate Home directory
is build, which appeared at the terminal as /home/<userID>.
Please note, that <userID> is your specific user identification.
You will find this directory at your Windows as C:\cygwin64\home\<userID>
Your normal Windows home directory is usually C:\Users\<userID>
You can see this Windows home from the Cygwin64 terminal as
/cygdrive/c/Users/<userID> .
Additional storage devices will appear also in the /cygdrive directory
with their identification character. You can find a plugged USB stick,
which will Windows show as E:, in the Cygwin64 terminal as /cygdrive/e .
This is consistent for the Cygwin64 terminal, because the Linux system does 
not know any drive letter followed by a colon.
Here the full file system has a common root / .

You can call the installed Cygwin64 programs also from the normal Windows terminal
window together or without the usage of the Cygwin64 terminal.
You must add the directory name C:\cygwin64\bin\ to the Windows10 Path variable.
The you can call the building ot the optiboot bootloader from the
normal Windows terminal. To do so, you must first change to optiboot directory
with the cd (Change Directory) command (cd optiboot or cd bootloaders\optiboot).
Then you can call the building of the standard bootloader for a ATmega168
with the make atmega168 command. This should build the optiboot_atmega168.hex file.

If you have set up the parameters for your own ISP programmer in the file Makefile.isp ,
and the programmer with the ATmega168 target is connectes right,
you can transfer the optiboot to the ATmega168 and set all fuses with
the command make atmega168 ISP=1 .
After writing the new bootloader, the ATmega168 will be erased and only
a ready to use bootloader is present. All previous progran data are erased!

In conclusion, I would like to compare the drastic speed difference for
creating bootloader files (.hex) between Linux and Windows10.
If all 79 sample configurations are build with the makeall command,
this action will be finished in 11 seconds at my working computer with
installed Linux Mint. My laptop with the same system take about 20 seconds.
With a Windows10 at the same laptop the same action take 438 seconds, when
started from the Windows console. This is more than factor 20 more!!!
When I start the same action from the Cygwin64 Terminal, the same action
take even 536 seconds. The time command reports about the half time as system time.


The Linux operating system take the avantage here, that it is optimized for
the use of many small tools due to intensive use of scripts.
But this result surprised me.

