-Open up CMakeLists.txt in your favourite text editor. You are looking for:
-
-```cmake
-###
-# Chip Selection
-#
-
-#| You _MUST_ set this to match the microcontroller you are trying to compile for
-#| You _MUST_ clean the build directory if you change this value
-#|
-set( CHIP
-# "at90usb162" # Teensy 1.0 (avr)
-# "atmega32u4" # Teensy 2.0 (avr)
-# "at90usb646" # Teensy++ 1.0 (avr)
-# "at90usb1286" # Teensy++ 2.0 (avr)
-# "mk20dx128" # Teensy 3.0 (arm)
- "mk20dx128vlf5" # McHCK mk20dx128vlf5
-# "mk20dx256" # Teensy 3.1 (arm)
- CACHE STRING "Microcontroller Chip" )
-```
-
-Just uncomment the chip you want, and comment out the old one.
-
-> NOTE: If you change this option, you will *need* to delete the build
-> directory that is created in the Building sections below.
-
-
-Selecting Modules
------------------
-
-> WARNING: Not all modules are compatible, and some modules may have
-> dependencies on other modules.
-
-This is where the options start getting interesting. The Kiibohd Controller
-is designed around a set of 4 types of modules that correspond to different
-functionality:
-
-- Scan Module
-- Macro Module
-- Output Module
-- Debug Module
-
-The Scan Module is where the most interesting stuff happens. These modules
-take in "keypress data". A converter Scan Module will interpret a protocol
-into key press/releases. A matrix Scan Module may inherit from the matrix
-module to scan keypress from a matrix This module just has to give
-press/release codes, but does have some callback control to other modules
-depending on the lifecycle for press/release codes (this can be very
-complicated depending on the protocol). Each Scan Module has it's own default
-keymap/modifier map. (TODO recommend keymap changing in the Macro Module).
-
-Some scan modules have very specialized hardware requirements, each module
-directory should have at least a link to the needed parts and/or schematics
-(TODO!).
-
-The Macro Module takes care of the mapping of the key press/release code into
-an Output (USB) scan code. Any layering, macros, keypress
-intelligence/reaction is done here.
-
-The Output Module is the module dealing with output from the microcontroller.
-Currently USB is the only output protocol. Different USB output
-implementations are available, pjrc being the safest/least featureful one.
-Debug capabilities may depend on the module selected.
-
-The Debug Module enables various things like the Teensy LED on errors, debug
-terminal output. (TODO get true UART working in avr, not just arm)
-
-Open up CMakeLists.txt in your favourite text editor. Look for:
-
-```cmake
-###
-# Project Modules
-#
-
-#| Note: This is the only section you probably want to modify
-#| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
-#| All of the modules must be specified, as they generate the sources list of files to compile
-#| Any modifications to this file will cause a complete rebuild of the project
-
-#| Please look at the {Scan,Macro,Output,Debug} for information on the modules and how to create new ones
-
-##| Deals with acquiring the keypress information and turning it into a key index
-set( ScanModule "MD1"
- CACHE STRING "Scan Module" )
-
-##| Provides the mapping functions for DefaultMap and handles any macro processing before sending to the OutputModule
-set( MacroModule "PartialMap"
- CACHE STRING "Macro Module" )
-
-##| Sends the current list of usb key codes through USB HID
-set( OutputModule "pjrcUSB"
- CACHE STRING "Output Module" )
-
-##| Debugging source to use, each module has it's own set of defines that it sets
-set( DebugModule "full"
- CACHE STRING "Debug Module" )
-```
-
-Look at each module individually for it's requirements. There is
-chip/architecture dependency checking but some permutations of modules may not
-be tested/compile.
-
-There are also CMake options for temporarily selecting modules. But it's
-easier to just edit the file. e.g. `cmake -DScanModuleOverride=<module name>`.
-
-
-Linux Building
---------------
-
-From this directory.
-
-```bash
-$ mkdir build
-$ cd build
-$ cmake ..
-$ make
-```
-
-Example output:
-
-```
-$ cmake ..
--- Compiler Family:
-arm
--- Chip Selected:
-mk20dx128vlf5
--- Chip Family:
-mk20dx
--- CPU Selected:
-cortex-m4
--- Compiler Source Files:
-Lib/mk20dx.c;Lib/delay.c
--- Bootloader Type:
-dfu
--- Detected Scan Module Source Files:
-Scan/MD1/scan_loop.c;Scan/MD1/../MatrixARM/matrix_scan.c
--- Detected Macro Module Source Files:
-Macro/PartialMap/macro.c
--- Detected Output Module Source Files:
-Output/pjrcUSB/output_com.c;Output/pjrcUSB/arm/usb_desc.c;Output/pjrcUSB/arm/usb_dev.c;
-Output/pjrcUSB/arm/usb_keyboard.c;Output/pjrcUSB/arm/usb_mem.c;Output/pjrcUSB/arm/usb_serial.c
--- Detected Debug Module Source Files:
-Debug/full/../cli/cli.c;Debug/full/../led/led.c;Debug/full/../print/print.c
--- Found Git: /usr/bin/git (found version "2.2.1")
--- Found Ctags: /usr/bin/ctags (found version "5.8")
--- Checking for latest kll version:
-Current branch master is up to date.
--- Detected Layout Files:
-/home/hyatt/Source/controller/Macro/PartialMap/capabilities.kll
-/home/hyatt/Source/controller/Output/pjrcUSB/capabilities.kll
-/home/hyatt/Source/controller/Scan/MD1/defaultMap.kll
-/home/hyatt/Source/controller/kll/layouts/md1Overlay.kll
-/home/hyatt/Source/controller/kll/layouts/stdFuncMap.kll
-/home/hyatt/Source/controller/kll/layouts/hhkbpro2.kll
--- Configuring done
--- Generating done
--- Build files have been written to: /home/hyatt/Source/controller/build
-[master]: make [~/Source/controller/build](hyatt@x230mas:pts/6)
-[ 5%] Generating KLL Layout
-Scanning dependencies of target kiibohd.elf
-[ 11%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.o
-[ 17%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/mk20dx.c.o
-[ 23%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/delay.c.o
-[ 29%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MD1/scan_loop.c.o
-[ 35%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MatrixARM/matrix_scan.c.o
-[ 41%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/PartialMap/macro.c.o
-[ 47%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/output_com.c.o
-[ 52%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_desc.c.o
-[ 58%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_dev.c.o
-[ 64%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_keyboard.c.o
-[ 70%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_mem.c.o
-[ 76%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_serial.c.o
-[ 82%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/cli/cli.c.o
-[ 88%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.o
-[ 94%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.o
-Linking C executable kiibohd.elf
-[ 94%] Built target kiibohd.elf
-Scanning dependencies of target SizeAfter
-[100%] Chip usage for mk20dx128vlf5
- SRAM: 32% 5384/16384 bytes
- Flash: 18% 23384/126976 bytes
-[100%] Built target SizeAfter
-```
-
-Linux Loading Firmware
-----------------------
-
-First place the keyboard into re-flash mode. This can be done either by
-pressing the re-flash button on the PCB/Teensy. Or by entering the Kiibohd
-Virtual Serial Port and using the 'reload' command.
-
-The `load` script that is created during the build can load the firmware over
-USB. Either run it with sudo, or install the `98-kiibohd.rules` to
-`/etc/udev/rules.d` and run: `udevadm control --reload-rules`.
-
-To load the newly built firmware: `./load`.
-
-
-Linux Building Bootloader
--------------------------
-
-> NOTE: Does not apply to Teensy based builds.
-
-From this directory.
-
-```bash
-$ cd Bootloader
-$ mkdir build
-$ cd build
-$ cmake ..
-$ make
-```
-
-Example output:
-
-```bash
-$ cmake ..
--- Compiler Family:
-arm
--- Chip Selected:
-mk20dx128vlf5
--- Chip Family:
-mk20dx
--- CPU Selected:
-cortex-m4
--- Compiler Source Files:
-Lib/mk20dx.c;Lib/delay.c
--- Bootloader Type:
-dfu
--- Bootloader Source Files:
-main.c;dfu.c;dfu.desc.c;flash.c;kinetis.c;usb.c
--- Found Git: /usr/bin/git (found version "2.2.1")
--- Found Ctags: /usr/bin/ctags (found version "5.8")
--- Configuring done
--- Generating done
--- Build files have been written to: /home/hyatt/Source/controller/Bootloader/build
-[master]: make [~/Source/controller/Bootloader/build](hyatt@x230mas:pts/6)
-Scanning dependencies of target kiibohd_bootloader.elf
-[ 11%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/main.c.o
-[ 22%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/dfu.c.o
-[ 33%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/dfu.desc.c.o
-[ 44%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/flash.c.o
-[ 55%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/kinetis.c.o
-[ 66%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/usb.c.o
-[ 77%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/home/hyatt/Source/controller/Lib/mk20dx.c.o
-[ 88%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/home/hyatt/Source/controller/Lib/delay.c.o
-Linking C executable kiibohd_bootloader.elf
-[ 88%] Built target kiibohd_bootloader.elf
-Scanning dependencies of target SizeAfter
-[100%] Chip usage for mk20dx128vlf5
- SRAM: 19% 3176/16384 bytes
- Flash: 2% 3736/126976 bytes
-[100%] Built target SizeAfter
-```
-
-
-Linux Loading Bootloader
-------------------------
-
-> NOTE: Does not apply to Teensy based builds.
-
-It's recommended to use an SWD-type flasher like a Bus Pirate. There is a
-convenience script for loading the firmware once the system is setup.
-
-```bash
-$ cd Bootloader/Scripts
-$ ./swdLoad.bash
-```
-
-The above script requires Ruby, Ruby serial port module, git, and a
-`/dev/buspirate` udev rule.
-
-Additional Notes:
-
-* https://github.com/mchck/mchck/wiki/Getting-Started (See Bus-Pirate section)
-* https://wiki.archlinux.org/index.php/Bus_pirate
-
-
-Windows Building
-----------------
-
-From this directory.
-
-```bash
-$ mkdir build
-$ cd build
-$ wincmake ..
-$ make
-```
-
-Example output:
-
-```bash
-$ wincmake ..
--- Compiler Family:
-arm
--- Chip Selected:
-mk20dx128vlf5
--- Chip Family:
-mk20dx
--- CPU Selected:
-cortex-m4
--- Compiler Source Files:
-Lib/mk20dx.c;Lib/delay.c
--- Bootloader Type:
-dfu
--- Detected Scan Module Source Files:
-Scan/MD1/scan_loop.c;Scan/MD1/../MatrixARM/matrix_scan.c
--- Detected Macro Module Source Files:
-Macro/PartialMap/macro.c
--- Detected Output Module Source Files:
-Output/pjrcUSB/output_com.c;Output/pjrcUSB/arm/usb_desc.c;Output/pjrcUSB/arm/usb_dev.c;Output/pjrcUSB/arm/usb_keyboard.c;Output/pjrcUSB/arm/usb_mem.c;Output/pjrcUSB/arm/usb_serial.c
--- Detected Debug Module Source Files:
-Debug/full/../cli/cli.c;Debug/full/../led/led.c;Debug/full/../print/print.c
--- Found Git: C:/cygwin64/bin/git.exe (found version "2.1.1")
--- Found Ctags: C:/cygwin64/bin/ctags.exe (found version "5.8")
--- Checking for latest kll version:
-Current branch master is up to date.
--- Detected Layout Files:
-C:/cygwin64/home/Jacob/controller/Macro/PartialMap/capabilities.kll
-C:/cygwin64/home/Jacob/controller/Output/pjrcUSB/capabilities.kll
-C:/cygwin64/home/Jacob/controller/Scan/MD1/defaultMap.kll
-C:/cygwin64/home/Jacob/controller/kll/layouts/md1Overlay.kll
-C:/cygwin64/home/Jacob/controller/kll/layouts/stdFuncMap.kll
-C:/cygwin64/home/Jacob/controller/kll/layouts/hhkbpro2.kll
--- Configuring done
--- Generating done
--- Build files have been written to: C:/cygwin64/home/Jacob/controller/build
-
-$ make
-[ 5%] Generating KLL Layout
-Scanning dependencies of target kiibohd.elf
-[ 11%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.obj
-[ 17%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/mk20dx.c.obj
-[ 23%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/delay.c.obj
-[ 29%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MD1/scan_loop.c.obj
-[ 35%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MatrixARM/matrix_scan.c.obj
-[ 41%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/PartialMap/macro.c.obj
-[ 47%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/output_com.c.obj
-[ 52%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_desc.c.obj
-[ 58%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_dev.c.obj
-[ 64%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_keyboard.c.obj
-[ 70%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_mem.c.obj
-[ 76%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_serial.c.obj
-[ 82%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/cli/cli.c.obj
-[ 88%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.obj
-[ 94%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.obj
-Linking C executable kiibohd.elf
-[ 94%] Built target kiibohd.elf
-Scanning dependencies of target SizeAfter
-[100%] Chip usage for mk20dx128vlf5
- SRAM: 32% 5384/16384 bytes
- Flash: 18% 23296/126976 bytes
-[100%] Built target SizeAfter
-```
-
-### NOTES:
-
-If you get the following error, you have not setup wincmake correctly:
-
-```bash
-$ make
-[ 5%] Generating KLL Layout
-Scanning dependencies of target kiibohd.elf
-[ 11%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.o
-../main.c:28:19: fatal error: macro.h: No such file or directory
- #include <macro.h>
- ^
-compilation terminated.
-CMakeFiles/kiibohd.elf.dir/build.make:67: recipe for target 'CMakeFiles/kiibohd.elf.dir/main.c.o' failed
-make[2]: *** [CMakeFiles/kiibohd.elf.dir/main.c.o] Error 1
-CMakeFiles/Makefile2:98: recipe for target 'CMakeFiles/kiibohd.elf.dir/all' failed
-make[1]: *** [CMakeFiles/kiibohd.elf.dir/all] Error 2
-Makefile:75: recipe for target 'all' failed
-make: *** [all] Error 2
-```
-
-If you have already added the line to your `~/.bashrc` try restarting your
-cygwin shell.
-
-
-Windows Loading Firmware
-------------------------
-
-First place the keyboard into re-flash mode. This can be done either by
-pressing the re-flash button on the PCB/Teensy. Or by entering the Kiibohd
-Virtual Serial Interface and using the `reload` command.
-
-The `load` script that is created during the build can load the firmware over
-USB.
-
-To load the newly built firmware: `./load`
-
-Be patient the couple of times, Windows is slow at installing drivers...
-
-
-Mac OS X Building
------------------
-
-From this directory.
-
-```bash
-$ mkdir build
-$ cd build
-$ cmake ..
-$ make
-```
-
-Example output:
-
-> TODO
-
-
-Mac OS X Loading Firmware
--------------------------
-
-First place the keyboard into re-flash mode. This can be done either by
-pressing the re-flash button on the PCB/Teensy. Or by entering the Kiibohd
-Virtual Serial Port and using the `reload` command.
-
-The `load` script that is created during the build can load the firmware over
-USB.
-
-To load the newly built firmware: `./load`.
-
-
-Virtual Serial Port - CLI
--------------------------
-
-Rather than use a special program that can interpret Raw HID, this controller exposes a USB Serial CDC endpoint.
-This allows for you to use a generic serial terminal to debug/control the keyboard firmware (e.g. Tera Term, minicom, screen)
-
-
-### Linux
-
-I generally use screen. You will need sudo/root priviledges if you haven't
-installed the `98-kiibohd.rules` file to `/etc/udev/rules.d`.
-
-```
-$ screen /dev/ttyACM0
-# (Might be ACM1, ACM2, etc.)
-```