aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-03-10 11:03:27 -0500
committerJack Humbert <jack.humb@gmail.com>2016-03-10 11:03:27 -0500
commitcadd9015dd420cb880d9086fa29e0176fb16cf4d (patch)
treee69b8d3dbeacf64d44abacdf0db18839fef6f2ff
parent2a9d8b3f30a525cf0f384972af8bb54a40af9b72 (diff)
parent191488b96fde7c78e5eb37325cfed3b27ac24737 (diff)
downloadqmk_firmware-cadd9015dd420cb880d9086fa29e0176fb16cf4d.tar.gz
qmk_firmware-cadd9015dd420cb880d9086fa29e0176fb16cf4d.zip
Merge pull request #191 from yoyoerx/windocs
Cygwin Based Users Guide v0.5 -further corrections
-rwxr-xr-xkeyboard/planck/CYGWIN_GUIDE.md697
1 files changed, 350 insertions, 347 deletions
diff --git a/keyboard/planck/CYGWIN_GUIDE.md b/keyboard/planck/CYGWIN_GUIDE.md
index a7ac17a7f..0b08a6aa1 100755
--- a/keyboard/planck/CYGWIN_GUIDE.md
+++ b/keyboard/planck/CYGWIN_GUIDE.md
@@ -1,347 +1,350 @@
1#Planck Advanced (but not too advanced) `cygwin` Users Guide 1#Planck Advanced (but not too advanced) `cygwin` Users Guide
2If you are a user of the [cygwin environment](https://cygwin.com) in Windows and want the freedom to use the latest tools available, then this is the guide for you. If compiling your own copy of the latest and greatest Gnu C Compiler makes you super happy, then this is the guide for you. If the command line make you smile, then this is the guide for you. 2If you are a user of the [cygwin environment](https://cygwin.com) in Windows and want the freedom to use the latest tools available, then this is the guide for you. If compiling your own copy of the latest and greatest Gnu C Compiler makes you super happy, then this is the guide for you. If the command line make you smile, then this is the guide for you.
3 3
4 4This guide was written step by step as I went through the process on a `Windows 10` `x86_64` and a `Windows 7` `amd k10` based system. This should be generally applicable to to any `Windows` environment with `cygwin`.
5This guide was written step by step as I went through the process on a `Windows 10` `x86_64` and a `Windows 7` `amd k10` based system. This should be generally applicable to to any `Windows` environment with `cygwin`. 5
6 6#####Do not skip steps. Do not move past a step until the previous step finishes successfully.
7 7
8#####Do not skip steps. Do not move past a step until the previous step finishes successfully. 8Based on [avr-libc installation guide](http://www.nongnu.org/avr-libc/user-manual/install_tools.html)
9 9
10 10##Get the Required Packages
11 11Download the `cygwin` setup ([x86_64](https://cygwin.com/setup-x86_64.exe)) and install the default system plus the following if they are not already selected:
12Based on [avr-libc installation guide](http://www.nongnu.org/avr-libc/user-manual/install_tools.html) 12- devel/git
13 13- devel/gcc-core
14 14- devel/gcc-g++
15##Get the Required Packages 15- devel/flex
16Download the `cygwin` setup ([x86_64](https://cygwin.com/setup-x86_64.exe)) and install the default system plus the following if they are not already selected: 16- devel/bison
17- devel/gcc-core 17- devel/make
18- devel/gcc-g++ 18- devel/texinfo
19- devel/flex 19- devel/gettext-devel
20- devel/git 20- text/gettext
21- devel/bison 21- libs/libgcc1
22- devel/make 22- interpreters/m4
23- libs/libgcc1 23- web/wget
24- interpreters/m4 24- archive/unzip
25- web/wget 25
26- archive/unzip 26The following sources will be required:
27 27- [gmp](https://gmplib.org/) (6.1.0)
28The following sources will be required: 28- [mpfr](http://www.mpfr.org/) (3.1.4)
29- [gmp](https://gmplib.org/) (6.1.0) 29- [mpc](http://www.multiprecision.org/) (1.0.3)
30- [mpfr](http://www.mpfr.org/) (3.1.4) 30- [binutils](https://www.sourceware.org/binutils/) (2.26)
31- [mpc](http://www.multiprecision.org/) (1.0.3) 31- [gcc](https://gcc.gnu.org/) (5.3.0)
32- [binutils](https://www.sourceware.org/binutils/) (2.26) 32- [avr-libc](http://www.nongnu.org/avr-libc/) (2.0.0)
33- [gcc](https://gcc.gnu.org/) (5.3.0) 33
34- [avr-libc](http://www.nongnu.org/avr-libc/) (2.0.0) 34The `dfu-programmer` will be required to flash the new firmware
35 35- [dfu-programmer](https://dfu-programmer.github.io/) (0.7.2)
36The `dfu-programmer` will be required to flash the new firmware 36
37- [dfu-programmer](https://dfu-programmer.github.io/) (0.7.2) 37The set of commands below will create a directory (`~/local/avr`) for the sources you compile to be installed on the machine and a directory (`~/src`) for these source files to be stored. The commands then download the sources of the needed packages and unpack them. Note: the expand commands are different depending on if the packages are offered as a `bz2` or `gz` archive
38 38```
39 39$ mkdir ~/local
40The set of commands below will create a directory (`~/local/avr`) for the sources you compile to be installed on the machine and a directory (`~/src`) for these source files to be stored. The commands then download the sources of the needed packages and unpack them. Note: the expand commands are different depending on if the packages are offered as a `bz2` or `gz` archive 40$ mkdir ~/local/avr
41 41$ mkdir ~/src
42``` 42$ cd ~/src
43$ mkdir ~/local 43$ wget https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2
44$ mkdir ~/local/avr 44$ wget http://www.mpfr.org/mpfr-3.1.4/mpfr-3.1.4.tar.bz2
45$ mkdir ~/src 45$ wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
46$ cd ~/src 46$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz
47$ wget https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2 47$ wget http://mirror0.babylon.network/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.gz
48$ wget http://www.mpfr.org/mpfr-3.1.4/mpfr-3.1.4.tar.bz2 48$ wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2
49$ wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz 49$ tar -xjf gmp-6.1.0.tar.bz2
50$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz 50$ tar -xjf mpfr-3.1.4.tar.bz2
51$ wget http://mirror0.babylon.network/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.gz 51$ tar -zxf mpc-1.0.3.tar.gz
52$ wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2 52$ tar -zxf binutils-2.26.tar.gz
53$ tar -xjf gmp-6.1.0.tar.bz2 53$ tar -zxf gcc-5.3.0.tar.gz
54$ tar -xjf mpfr-3.1.4.tar.bz2 54$ tar -xjf avr-libc-2.0.0.tar.bz2
55$ tar -zxf mpc-1.0.3.tar.gz 55```
56$ tar -zxf binutils-2.26.tar.gz 56
57$ tar -zxf gcc-5.3.0.tar.gz 57##Setup the Build Environment
58$ tar -xjf avr-libc-2.0.0.tar.bz2 58These commands will set up the install directory and the `PATH` variable, which will allow you to access your installed packages. Note: if you close the `cygwin` terminal window, you will need to rerun these commands, they are not permanent.
59``` 59```
60 60$ PREFIX=$HOME/local/avr
61##Setup the Build Environment 61$ export PREFIX
62These commands will set up the install directory and the `PATH` variable, which will allow you to access your installed packages. Note: if you close the `cygwin` terminal window, you will need to rerun these commands, they are not permanent. 62$ PATH=/usr/local/bin:/usr/local/lib:/usr/local/include:/bin:/lib:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS
63``` 63$ PATH=$PATH:$PREFIX/bin
64$ PREFIX=$HOME/local/avr 64$ export PATH
65$ export PREFIX 65```
66$ PATH=/usr/local/bin:/usr/local/lib:/usr/local/include:/bin:/lib:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS 66
67$ PATH=$PATH:$PREFIX/bin 67##The `gcc` Required Math Library Packages
68$ export PATH 68The following packages are required to be complied and installed in order to compile `gcc`. They are not sufficiently available through the `cygwin` package system, so we have to make them ourselves. They must be complied in this order because each one depends on the previous. Verfiy that for each package, `make check` returns all passing and no fails.
69``` 69
70 70###Build and Install `gmp`
71##The `gcc` Required Math Library Packages 71```
72The following packages are required to be complied and installed in order to compile `gcc`. They are not available through the `cygwin` package system, so we have to make them ourselves. They must be complied in this order because each one depends on the previous. 72$ cd ~/src/gmp-6.1.0
73 73$ ./configure --enable-static --disable-shared
74###Build and Install `gmp` 74$ make
75``` 75$ make check
76$ cd ~/src/gmp-6.1.0 76$ make install
77$ ./configure --enable-static --disable-shared 77```
78$ make 78
79$ make check 79###Build and Install `mpfr`
80$ make install 80```
81``` 81$ cd ~/src/mpfr-3.1.4
82 82$ ./configure --with-gmp-build=../gmp-6.1.0 --enable-static --disable-shared
83###Build and Install `mpfr` 83$ make
84``` 84$ make check
85$ cd ~/src/mpfr-3.1.4 85$ make install
86$ ./configure --with-gmp-build=../gmp-6.1.0 --enable-static --disable-shared 86```
87$ make 87
88$ make check 88###Build and Install `mpc`
89$ make install 89```
90``` 90$ cd ~/src/mpc-1.0.3
91 91$ ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --enable-static --disable-shared
92###Build and Install `mpc` 92$ make
93``` 93$ make check
94$ cd ~/src/mpc-1.0.3 94$ make install
95$ ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --enable-static --disable-shared 95```
96$ make 96
97$ make check 97##OPTIONAL Part
98$ make install 98You can build and install a brand new `gcc` or you can use the one supplied by `cygwin`. This will take about 4-5 hours to compile (It is a "native build", so it does the entire build **3 times**. This takes a long while).
99``` 99
100 100###Build and Install `gcc` for Your Machine
101##OPTIONAL Part 101```
102You can build and install a brand new `gcc` or you can use the one supplied by `cygwin`. This will take about 4-5 hours to compile (It is a "native build", so it does the entire build **3 times**. This takes a long while). 102$ cd ~/src/gcc-5.3.0
103 103$ mkdir obj-local
104###Build and Install `gcc` on your Machine 104$ cd obj-local
105``` 105$ ../configure --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared
106$ cd ~/src/gcc-5.3.0 106$ make
107$ mkdir obj-local 107$ make install
108$ cd obj-local 108```
109$ ../configure --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared 109##End OPTIONAL Part
110$ make 110
111$ make install 111###Build and Install `binutils` for Your Machine
112``` 112```
113 113$ cd ~/src/binutils-2.26
114###Build and Install `binutils` on your Machine 114$ mkdir obj-local
115``` 115$ cd obj-local
116$ cd ~/src/binutils-2.26 116$ ../configure
117$ mkdir obj-local 117$ make
118$ cd obj-local 118$ make install
119$ ../configure 119```
120$ make 120
121$ make install 121##Buliding `binutils`, `gcc`, and `avr-libc` for the AVR system
122``` 122Now we can make the critical stuff for compiling our firmware: `binutils`, `gcc`, and `avr-libc` for the AVR architecture. These allow us to build and manipulate the firmware for the keyboard.
123##End OPTIONAL Part 123
124 124###Build `binutils` for AVR
125##Buliding `binutils`, `gcc`, and `avr-libc` for the AVR system 125If you plan to build and install `avr-gdb` also, use the `gdb` install at the end of this guide as it also builds the `binutils`
126Now we can make the critical stuff for compiling our firmware: `binutils`, `gcc`, and `avr-libc` for the AVR architecture. These allow us to build and manipulate the firmware for the keyboard. 126```
127 127$ cd ~/src/binutils-2.26
128###Build `binutils` for AVR 128$ mkdir obj-avr
129``` 129$ cd obj-avr
130$ cd ~/src/binutils-2.26 130$ ../configure --prefix=$PREFIX --target=avr --disable-nls
131$ mkdir obj-avr 131$ make
132$ cd obj-avr 132$ make install
133$ ../configure --prefix=$PREFIX --target=avr --disable-nls 133```
134$ make 134
135$ make install 135###Build `gcc` for AVR
136``` 136```
137 137$ cd ~/src/gcc-5.3.0
138###Build `gcc` for AVR 138$ mkdir obj-avr
139``` 139$ cd obj-avr
140$ cd ~/src/gcc-5.3.0 140$ ../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared --disable-nls --disable-libssp --with-dwarf2
141$ mkdir obj-avr 141$ make
142$ cd obj-avr 142$ make install
143$ ../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared --disable-nls --disable-libssp --with-dwarf2 143```
144$ make 144
145$ make install 145###Build `avr-libc` for AVR
146``` 146For building the `avr-libc`, we have to specify the host build system. In my case it is `x86_64-unknown-cygwin`. You can look for build system type in the `gcc` configure notes for the proper `--build` specification to pass when you configure `avr-libc`.
147 147```
148For building the `avr-libc`, we have to specify the host build system. In my case it is `x86_64-unknown-cygwin`. You can look for build system type in the `gcc` configure notes for the proper `--build` specification to pass when you configure `avr-libc`. 148$ cd ~/src/avr-libc-2.0.0
149 149$ ./configure --prefix=$PREFIX --build=x86_64-unknown-cygwin --host=avr
150###Build `avr-libc` for AVR 150$ make
151``` 151$ make install
152$ cd ~/src/avr-libc-2.0.0 152```
153$ ./configure --prefix=$PREFIX --build=x86_64-unknown-cygwin --host=avr 153
154$ make 154##Building 'dfu-programmer' for flashing the firmware via USB and installing the drivers
155$ make install 155We can either build our own, or use the precomplied binaries. The precompiled binaries don't play well with `cygwin` so it is better to build them ourselves. The procedure for the precompiled binaries is included at the end of this guide.
156``` 156
157 157### Build and Install the `libusb`
158### Build and Install the `dfu-programmer` 158The `dfu-programmer` requires `libusb` so that it can interact with the USB system.
159We can either build our own, or use the precomplied binaries. The precompiled binaries don't play well with `cygwin` so it is better to build them ourselves. The procedure for the precompiled binaries is included at the end of this guide. 159```
160 160$ cd ~/src
161The `dfu-programmer` requires `libusb`. So let's go ahead and build that first. 161$ git clone https://github.com/libusb/libusb.git
162 162$ cd libusb
163``` 163$ ./bootstrap.sh
164$ cd ~/src 164$ ./configure --prefix=$PREFIX
165$ git clone https://github.com/libusb/libusb.git 165$ make
166$ cd libusb 166$ make install
167$ ./bootstrap.sh 167```
168$ ./configure --prefix=$PREFIX 168
169$ make 169### Build and Install the `dfu-programmer`
170$ make install 170```
171``` 171$ cd ~/src
172 172$ git clone https://github.com/dfu-programmer/dfu-programmer.git
173Next, we can build the `dfu-programmer`. This should be quick. 173$ cd dfu-programmer
174``` 174$ ./bootstrap.sh
175$ cd ~/src 175$ ./configure --prefix=$PREFIX
176$ git clone https://github.com/dfu-programmer/dfu-programmer.git 176$ make
177$ cd dfu-programmer 177$ make install
178$ ./bootstrap.sh 178```
179$ ./configure --prefix=$PREFIX 179
180$ make 180Verify the installation with:
181$ make install 181```
182``` 182$ which dfu-programmer
183 183/home/Kevin/local/avr/bin/dfu-programmer
184Verify the installation with: 184
185 185$ dfu-programmer
186``` 186dfu-programmer 0.7.2
187$ which dfu-programmer 187https://github.com/dfu-programmer/dfu-programmer
188/home/Kevin/local/avr/bin/dfu-programmer 188Type 'dfu-programmer --help' for a list of commands
189 189 'dfu-programmer --targets' to list supported target devices
190$ dfu-programmer 190```
191dfu-programmer 0.7.2 191If you are not getting the above result, you will not be able to flash the firmware!
192https://github.com/dfu-programmer/dfu-programmer 192
193Type 'dfu-programmer --help' for a list of commands 193###Install the USB drivers
194 'dfu-programmer --targets' to list supported target devices 194The drivers are included in the windows binary version of [`dfu-programmer` 0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip).
195``` 195```
196If you are not getting the above result, you will not be able to flash the firmware! 196$ cd ~/src
197 197$ wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip
198###Install the USB drivers 198$ unzip dfu-programmer-win-0.7.2.zip -d dfu-programmer-win-0.7.2
199The official Atmel drivers are included in the windows binary version of [`dfu-programmer` 0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip) and allow the `dfu-programmer` to program the firmware. 199```
200 200
201``` 201or
202$ cd ~/src 202
203$ wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip 203The official drivers are found in [Atmel's `FLIP` installer](http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe). Download and then install `FLIP`. Upon installation, the drivers will be found in `C:\Program Files (x86)\Atmel\Flip 3.4.7\usb`.
204$ unzip dfu-programmer-win-0.7.2.zip -d dfu-programmer-win-0.7.2 204
205 205Then, from an **administrator-privileged** `Windows` terminal, run the following command (adjust the path for username, etc. as necessary) and accept the prompt that pops up:
206``` 206```
207 207C:\> pnputil -i -a C:\cygwin64\home\Kevin\src\dfu-programmer-win-0.7.2\dfu-prog-usb-1.2.2\atmel_usb_dfu.inf
208Then, from an **administrator-privileged** `Windows` terminal, run the following command (adjust the path for username as necessary) and accept the prompt that pops up: 208or
209``` 209C:\> pnputil -i -a "C:\Program Files (x86)\Atmel\Flip 3.4.7\usb\atmel_usb_dfu.inf"
210C:\> pnputil -i -a C:\cygwin64\home\Kevin\src\dfu-programmer-win-0.7.2\dfu-prog-usb-1.2.2\atmel_usb_dfu.inf 210```
211``` 211
212 212This should be the result:
213This should be the result: 213```
214``` 214Microsoft PnP Utility
215Microsoft PnP Utility 215
216 216Processing inf : atmel_usb_dfu.inf
217Processing inf : atmel_usb_dfu.inf 217Successfully installed the driver on a device on the system.
218Successfully installed the driver on a device on the system. 218Driver package added successfully.
219Driver package added successfully. 219Published name : oem104.inf
220Published name : oem104.inf 220
221 221
222 222Total attempted: 1
223Total attempted: 1 223Number successfully imported: 1
224Number successfully imported: 1 224```
225``` 225
226Alternativly, the `Windows` driver can be installed when prompted by `Windows` when the keyboard is attached. Do not let `Windows` search for a driver; specify the path to search for a driver and point it to the `atmel_usb_dfu.inf` file. 226Alternatively, the `Windows` driver can be installed when prompted by `Windows` when the keyboard is attached. Do not let `Windows` search for a driver; specify the path to search for a driver and point it to the `atmel_usb_dfu.inf` file.
227 227
228 228##Building and Flashing the Planck firmware!
229##Building and Flashing the Planck firmware! 229If you did everything else right. This part should be a snap! Grab the latest sources from `github`, make the Plank firmware, then flash it.
230 230
231If you did everything else right. This part should be a snap! Grab the latest sources from `github`, make the Plank firmware, then flash it. 231###Build Planck and Load the Firmware
232 232```
233###Build Planck and Load the Firmware 233$ cd ~/src
234``` 234$ git clone https://github.com/jackhumbert/qmk_firmware.git
235$ cd ~/src 235$ cd qmk_firmware/keyboard/planck
236$ git clone https://github.com/jackhumbert/qmk_firmware.git 236$ make
237$ cd qmk_firmware/keyboard/planck 237```
238$ make 238
239``` 239Make sure there are no errors. You should end up with this or something similar:
240Make sure there are no errors. You should end up with this or something similar: 240```
241 241Creating load file for Flash: planck.hex
242``` 242avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature planck.elf planck.hex
243Creating load file for Flash: planck.hex 243
244avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature planck.elf planck.hex 244Creating load file for EEPROM: planck.eep
245 245avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
246Creating load file for EEPROM: planck.eep 246--change-section-lma .eeprom=0 --no-change-warnings -O ihex planck.elf planck.eep || exit 0
247avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \ 247
248--change-section-lma .eeprom=0 --no-change-warnings -O ihex planck.elf planck.eep || exit 0 248Creating Extended Listing: planck.lss
249 249avr-objdump -h -S -z planck.elf > planck.lss
250Creating Extended Listing: planck.lss 250
251avr-objdump -h -S -z planck.elf > planck.lss 251Creating Symbol Table: planck.sym
252 252avr-nm -n planck.elf > planck.sym
253Creating Symbol Table: planck.sym 253
254avr-nm -n planck.elf > planck.sym 254Size after:
255 255 text data bss dec hex filename
256Size after: 256 18602 82 155 18839 4997 planck.elf
257 text data bss dec hex filename 257
258 18602 82 155 18839 4997 planck.elf 258-------- end --------
259 259```
260-------- end -------- 260
261``` 261If you do not get the above, you **did not** build the firmware, and you will have nothing to flash. If you have the fresh clone from `github`, it was probably something gone wrong in this install process, go check and see what didn't work and threw errors or what steps you might have missed.
262 262
263If you do not get the above, you **did not** build the firmware, and you will have nothing to flash. If you have the fresh clone from github, it was probably something gone wrong in this install process, go check and see what didn't work and threw errors or what steps you might have missed. 263But if everything went OK, you are ready to flash! Press the reset button on the bottom of the Planck, wait two seconds, then:
264 264```
265But if everything went OK, you are ready to flash! Press the reset button on the bottom of the Planck, wait two seconds, then: 265$ make dfu
266``` 266```
267$ make dfu 267.
268``` 268.
269. 269.
270. 270profit!!!
271. 271
272profit!!! 272
273 273
274 274
275 275
276 276##extra bits...
277 277
278##extra bits... 278###Installing Precompiled `dfu-programmer` Binaries (not recommended for `cygwin`)
279 279To install the `dfu-programmer` from the binaries, we must get if from [the `dfu-programmer` website](https://dfu-programmer.github.io/) ([0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip)).
280 280
281 281Copy this file into your `cygwin` home\src directory. (For me, it is `C:\cygwin64\home\Kevin\src`), extract the files, move `dfu-programmer.exe` to `~/local/avr/bin`. Most obnoxiously, the `libusb0_x86.dll` and `libusb0.sys` need to be moved from `./dfu-prog-usb-1.2.2/x86/` to a directory in the `Windows` `PATH` and the `cygwin` `PATH`. This is because the `dfu-programmer` binary is `mingw` based, not `cygwin` based, so the `dlls` do not cooperate. I achieved acceptable pathing by moving the files to `C:\cygwin64\home\Kevin\local\avr\bin` Then, in a `WINDOWS` command prompt running (Adjusting your path for username, etc. as needed):
282###Installing Precompiled `dfu-programmer` Binaries (Not recommended) 282```
283To install the `dfu-programmer` from the binaries, we must get if from [the `dfu-programmer` website](https://dfu-programmer.github.io/) ([0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip)). 283C:\> set PATH=%PATH%;C:\cygwin64\home\Kevin\local\avr\bin
284Copy this file into your `cygwin` home\src directory. (For me, it is `C:\cygwin64\home\Kevin\src`), extract the files, move `dfu-programmer.exe` to `~/local/avr/bin`. Most obnoxiously, the `libusb0_x86.dll` and `libusb0.sys` need to be moved from `./dfu-prog-usb-1.2.2/x86/` to a directory in the `Windows` `PATH` and the `cygwin` `PATH`. I achieved this by moving the files with Windows Explorer (you know, click and drag...) to `C:\cygwin64\home\Kevin\local\avr\bin` Then, in a `WINDOWS` command prompt running: 284```
285``` 285
286C:\> set PATH=%PATH%;C:\cygwin64\home\Kevin\local\avr\bin 286Then, rename `libusb0_x86.dll` to `libusb0.dll`.
287``` 287
288Adjust your path (for username) as needed. 288You can tell that you were successful by trying to execute 'dfu-programmer' from the 'cygwin' prompt:
289Then, rename `libusb0_x86.dll` to `libusb0.dll`. 289```
290You can tell that you were successful by trying to execute 'dfu-programmer' from the 'cygwin' prompt: 290$ which dfu-programmer
291``` 291/home/Kevin/local/avr/bin/dfu-programmer
292$ which dfu-programmer 292
293/home/Kevin/local/avr/bin/dfu-programmer 293$ dfu-programmer
294 294dfu-programmer 0.7.2
295$ dfu-programmer 295https://github.com/dfu-programmer/dfu-programmer
296dfu-programmer 0.7.2 296Type 'dfu-programmer --help' for a list of commands
297https://github.com/dfu-programmer/dfu-programmer 297 'dfu-programmer --targets' to list supported target devices
298Type 'dfu-programmer --help' for a list of commands 298```
299 'dfu-programmer --targets' to list supported target devices 299
300``` 300If you are not getting the above result, you will not be able to flash the firmware!
301If you are not getting the above result, you will not be able to flash the firmware! 301- Try making sure your `PATH` variables are set correctly for both `Windows` and `cygwin`.
302- Try making sure your `PATH` variables are set correctly for both `Windows` and `cygwin`. 302- Make sure the `dll` is named correctly.
303- Make sure the `dll` is named correctly. 303- Do not extract it with `cygwin`'s `unzip` as it does not set the executable permission. If you did it anyway, do `chmod +x dfu-programmer.exe`.
304- Do not extract it with `cygwin`'s `unzip` as it does not set the executable permission. If you did it anyway, do `chmod +x dfu-programmer.exe`. 304- Still have problems? Try building it instead.
305 305
306 306
307##Debugging Tools 307##Debugging Tools
308 308
309These tools are for debugging your firmware, etc. before flashing. Theoretically, it can save your flash memory from wearing out. However, these tool do not work 100% for the Planck firmware. 309These tools are for debugging your firmware, etc. before flashing. Theoretically, it can save your memory from wearing out. However, these tool do not work 100% for the Planck firmware.
310 310
311### `gdb` for AVR 311### `gdb` for AVR
312`gdb` has a simulator for AVR but it does not support all instructions (like WDT), so it immediately crashes when running the Planck firmware (because `lufa.c` disables the WDT in the first few lines of execution). But it can still be useful in debugging example code and test cases, if you know how to use it. 312`gdb` has a simulator for AVR but it does not support all instructions (like WDT), so it immediately crashes when running the Planck firmware (because `lufa.c` disables the WDT in the first few lines of execution). But it can still be useful in debugging example code and test cases, if you know how to use it.
313 313
314``` 314```
315$ cd ~/src 315$ cd ~/src
316$ git clone git://sourceware.org/git/binutils-gdb.git 316$ git clone git://sourceware.org/git/binutils-gdb.git
317$ cd binutils-gdb 317$ cd binutils-gdb
318$ ./bootstrap 318$ ./bootstrap
319$ mkdir obj-avr 319$ mkdir obj-avr
320$ cd obj-avr 320$ cd obj-avr
321$ ../configure --prefix=$PREFIX --target=avr --build=x86_64-unknown-cygwin --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --disable-nls --enable-static 321$ ../configure --prefix=$PREFIX --target=avr --build=x86_64-unknown-cygwin --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --disable-nls --enable-static
322$ make 322$ make
323$ make install 323$ make install
324``` 324```
325 325
326 326### `simulavr`
327### `simulavr` 327`simulavr` is an AVR simulator. It runs the complied AVR elfs. `simulavr` does not support the `atmega32u4` device... it does `atmega32` but that is not good enough for the firmware (no PORTE and other things), so you cannot run the Planck firmware. I use it to simulate ideas I have for features in separate test projects.
328`simulavr` is an AVR simulator. It runs the complied AVR elf's. `simulavr` does not support the `atmega32u4` device... it does `atmega32` but that is not good enough for the firmware (no PORTE and other things), so you cannot run the Planck firmware. I use it to simulate ideas I have for features in separate test projects. 328
329 329This one is a major pain in the butt because it has a lot of dependencies and it is buggy. I will do my best to explain it but... it was hard to figure out. A few things need to be changed in the 'Makefile' to make it work in `cygwin`.
330This one is a major pain in the butt because it has a lot of dependencies and it is almost always buggy. I will do my best to explain it but... it was hard to figure out. A few things need to be changed in the 'Makefile' to make it work in `cygwin`. 330
331 331
332 332```
333``` 333$ cd ~/src
334$ cd ~/src 334$ git clone https://github.com/Traumflug/simulavr.git
335$ git clone https://github.com/Traumflug/simulavr.git 335$ cd simulavr
336$ cd simulavr 336$ ./bootstrap
337$ ./bootstrap 337$ ./configure --prefix=$PREFIX --enable-static --disable-tcl --disable-doxygen-doc
338$ ./configure --prefix=$PREFIX --enable-static --disable-tcl --disable-doxygen-doc 338```
339``` 339 Edit `src/Makefile.am` now so that `-no-undefined` is included (I did this by removing the SYS_MINGW conditional surrounding `libsim_la_LDFLAGS += -no-undefined` and `libsimulavr_la_LDFLAGS += -no-undefined \ libsimulavr_la_LIBADD += $(TCL_LIB)`. Also, `$(EXEEXT)` is added after `kbdgentables` in two places.
340 Edit `src/Makefile.am` now so that `-no-undefined` is included (I did this by removing the SYS_MINGW conditional surrounding `libsim_la_LDFLAGS += -no-undefined` and `libsimulavr_la_LDFLAGS += -no-undefined \ libsimulavr_la_LIBADD += $(TCL_LIB)`. Also, `$(EXEEXT)` is added after `kbdgentables` in two places. 340
341 341```
342``` 342$ make
343$ make 343$ make install
344$ make install 344```
345``` 345
346 346
347 347TODO:
348- git repos for all sources
349- command line magic for cygwin setup
350- better options for `dfu-drivers`