Kiibohd Controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

README 22KB

10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. The Kiibohd Controller
  2. ----------------------
  3. This README is a bit long, just look at the sections you are interested in.
  4. You only need to install avr-gcc if you want to build for the Teensy 2.0/2.0++.
  5. Everything else needs an arm-none-eabi-gcc compiler (e.g. Infinity keyboard, Teensy 3.0/3.1, McHCK).
  6. Linux is the ideal build environment (preferably recent'ish).
  7. In the near future I'll make available an Arch Linux VM for building/manufacturing tests.
  8. Building on Mac should be ok for 99% of users with Macports (haven't tried Brew).
  9. The dfu Bootloader will not build correctly with the old version of arm-none-eabi-gcc that Macports currently has (4.7.3).
  10. This is due to a bug with lto (link time optimizations) which makes the resulting binary too big to fit on the chip (must be less than 4096 Bytes).
  11. Building on Windows should also be fine for 99% of users, but takes a bunch of work to setup (because Windows is a crappy dev environment).
  12. Cygwin is currently required along with some non-Cygwin compilers and utilities (because they are not available for Cygwin).
  13. The dfu Bootloader will not build because of a Make 3.81+ bug/feature that removed support for non-Unix (Windows) filenames as dependencies of targets.
  14. If you replace the version of Make in Cygwin it should work (e.g. http://stackoverflow.com/questions/601516/cygwin-make-error-target-pattern-contains-no).
  15. However, make sure that the flash size is no larger than 4096 Bytes or the bootloader will not work.
  16. Things will likely break if there are *SPACES IN YOUR PATHS*. I install cygwin to C:\cygwin64.
  17. If you are brave and have programming knowledge, I will accept patches to fix any issues regarding spaces in paths.
  18. Please give authors credit for modules used if you use in a distributed product :D
  19. ----------------------
  20. General Dependencies
  21. ----------------------
  22. Below listed are the Arch Linux pacman names, AUR packages may be required.
  23. These depend a bit on which targets you are trying to build, but the general one:
  24. - cmake (2.8 and higher)
  25. - git
  26. - ctags (recommended, not required)
  27. - python3
  28. - libusb1.0 (and -devel)
  29. - make
  30. AVR Specific (Teensy 1.0/++,2.0/++) (try to use something recent, suggested versions below)
  31. - avr-gcc (~4.8.0)
  32. - avr-binutils (~2.23.2)
  33. - avr-libc (~1.8.0)
  34. ARM Specific (Teensy 3.0/3.1, Infinity Keyboard, McHCK)
  35. Arch Linux / Mac Ports
  36. - arm-none-eabi-gcc
  37. - arm-none-eaby-binutils
  38. Windows
  39. (https://launchpad.net/gcc-arm-embedded/+download)
  40. - gcc-arm-none-eabi (win32.zip)
  41. ----------------------
  42. Windows Setup
  43. ----------------------
  44. Compiling on Windows does work, just it's a bunch more work.
  45. First make sure Cygwin is installed - http://www.cygwin.com/ - 32bit or 64bit is fine. Make sure the following are installed:
  46. - make
  47. - git (needed for some compilation info)
  48. - cmake
  49. - gcc-core
  50. - gcc-g++
  51. - libusb1.0
  52. - libusb1.0-devel
  53. - python3
  54. - ctags (recommended, not required)
  55. Please note, I use cygwin term exclusively for any command line options. Unless mentioned otherwise, use it.
  56. Do NOT use CMD or Powershell.
  57. Also install the Windows version of CMake (3+ is ideal) - http://cmake.org/cmake/resources/software.html
  58. Select "Do not add CMake to system PATH".
  59. This is in addition to the Cygwin version. This is an easier alternative to installing another C compiler.
  60. Add the following line to your .bashrc, making sure the CMake path is correct:
  61. echo "alias wincmake=\"PATH='/cygdrive/c/Program Files (x86)/CMake'/bin:'${PATH}' cmake -G 'Unix Makefiles'\"" >> ~/.bashrc
  62. Install the PJRC Virtual Serial Port Driver:
  63. (http://pjrc.com/teensy/serial_install.exe)
  64. Next, install the compiler(s) you want.
  65. ---------
  66. | AVR GCC |
  67. ---------
  68. You just need the Atmel AVR 8-bit Toolchain. The latest should be fine, as of writing it was 3.4.3.
  69. http://www.atmel.com/tools/atmelavrtoolchainforwindows.aspx
  70. (Atmel AVR 8-bit Toolchain 3.4.3 - Windows)
  71. Extract the files to a directory, say C:\avr8-gnu-toolchain. Then copy all the folders in that directory to the Cygwin /usr/local directory.
  72. Mine is C:\cygwin64\usr\local.
  73. (You can also just setup the paths, but this is faster/simpler. Might screw up your Cygwin though).
  74. ----------
  75. | ARM EABI |
  76. ----------
  77. Download the latest GNU Tools for Embedded Processors gcc-arm-none-eabi.
  78. https://launchpad.net/gcc-arm-embedded/+download
  79. Download "gcc-arm-none-eabi*win32.zip".
  80. Then extract all the folders/files in the zip to the Cygwin /usr/local directory.
  81. Mine is C:\cygwin64\usr\local.
  82. Or, you can setup paths using the installer (you have to be more careful, avoid spaces in paths).
  83. ----------------------
  84. CMake Info
  85. ----------------------
  86. One of the big benefits of using CMake is the ability to build multiple configurations (for different microcontrollers) at the same time.
  87. The following sections explain in detail what each CMakeLists.txt configuration option does and what you can change it to.
  88. However, it is possible to configure each of these options using the -D command line flag.
  89. For example, to build the Infinity Keyboard default configuration:
  90. mkdir build_infinity
  91. cd build_infinity
  92. cmake -DCHIP=mk20dx128vlf5 -DScanModule=MD1 -DMacroModule=PartialMap -DOutputModule=pjrcUSB -DDebugModule=full -DBaseMap=defaultMap -DDefaultMap="md1Overlay stdFuncMap" -DPartialMaps="hhkbpro2" ..
  93. make
  94. CMake defaults to the values specified in CMakeLists.txt if not overridden via the command line.
  95. NOTE: On Windows, you will have to use "wincmake" instead of "cmake".
  96. ----------------------
  97. Selecting Microcontroller
  98. ----------------------
  99. This is where you select the chip you want to compile for.
  100. The build system will automatically select the compiler needed to compile for your chip.
  101. Open up CMakeLists.txt in your favourite text editor.
  102. You are looking for:
  103. ###
  104. # Chip Selection
  105. #
  106. #| You _MUST_ set this to match the microcontroller you are trying to compile for
  107. #| You _MUST_ clean the build directory if you change this value
  108. #|
  109. set( CHIP
  110. # "at90usb162" # Teensy 1.0 (avr)
  111. # "atmega32u4" # Teensy 2.0 (avr)
  112. # "at90usb646" # Teensy++ 1.0 (avr)
  113. # "at90usb1286" # Teensy++ 2.0 (avr)
  114. # "mk20dx128" # Teensy 3.0 (arm)
  115. "mk20dx128vlf5" # McHCK mk20dx128vlf5
  116. # "mk20dx256" # Teensy 3.1 (arm)
  117. CACHE STRING "Microcontroller Chip" )
  118. Just uncomment the chip you want, and comment out the old one.
  119. NOTE: If you change this option, you will *need* to delete the build directory that is created in the Building sections below.
  120. ----------------------
  121. Selecting Modules
  122. ----------------------
  123. WARNING: Not all modules are compatible, and some modules may have dependencies on other modules.
  124. This is where the options start getting interesting.
  125. The Kiibohd Controller is designed around a set of 4 types of modules that correspond to different functionality:
  126. - Scan Module
  127. - Macro Module
  128. - Output Module
  129. - Debug Module
  130. The Scan Module is where the most interesting stuff happens. These modules take in "keypress data".
  131. A converter Scan Module will interpret a protocol into key press/releases.
  132. A matrix Scan Module may inherit from the matrix module to scan keypress from a matrix
  133. 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).
  134. Each Scan Module has it's own default keymap/modifier map. (TODO recommend keymap changing in the Macro Module).
  135. 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!).
  136. The Macro Module takes care of the mapping of the key press/release code into an Output (USB) scan code.
  137. Any layering, macros, keypress intelligence/reaction is done here.
  138. The Output Module is the module dealing with output from the microcontroller. Currently USB is the only output protocol.
  139. Different USB output implementations are available, pjrc being the safest/least featureful one.
  140. Debug capabilities may depend on the module selected.
  141. The Debug Module enables various things like the Teensy LED on errors, debug terminal output.
  142. (TODO get true UART working in avr, not just arm)
  143. Open up CMakeLists.txt in your favourite text editor.
  144. Look for:
  145. ###
  146. # Project Modules
  147. #
  148. #| Note: This is the only section you probably want to modify
  149. #| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
  150. #| All of the modules must be specified, as they generate the sources list of files to compile
  151. #| Any modifications to this file will cause a complete rebuild of the project
  152. #| Please look at the {Scan,Macro,Output,Debug} for information on the modules and how to create new ones
  153. ##| Deals with acquiring the keypress information and turning it into a key index
  154. set( ScanModule "MD1"
  155. CACHE STRING "Scan Module" )
  156. ##| Provides the mapping functions for DefaultMap and handles any macro processing before sending to the OutputModule
  157. set( MacroModule "PartialMap"
  158. CACHE STRING "Macro Module" )
  159. ##| Sends the current list of usb key codes through USB HID
  160. set( OutputModule "pjrcUSB"
  161. CACHE STRING "Output Module" )
  162. ##| Debugging source to use, each module has it's own set of defines that it sets
  163. set( DebugModule "full"
  164. CACHE STRING "Debug Module" )
  165. 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.
  166. There are also CMake options for temporarily selecting modules. But it's easier to just edit the file.
  167. e.g. cmake -DScanModuleOverride=<module name>
  168. ----------------------
  169. Linux Building
  170. ----------------------
  171. From this directory.
  172. mkdir build
  173. cd build
  174. cmake ..
  175. make
  176. Example output:
  177. [master]: cmake .. [~/Source/controller/build](hyatt@x230mas:pts/6)
  178. -- Compiler Family:
  179. arm
  180. -- Chip Selected:
  181. mk20dx128vlf5
  182. -- Chip Family:
  183. mk20dx
  184. -- CPU Selected:
  185. cortex-m4
  186. -- Compiler Source Files:
  187. Lib/mk20dx.c;Lib/delay.c
  188. -- Bootloader Type:
  189. dfu
  190. -- Detected Scan Module Source Files:
  191. Scan/MD1/scan_loop.c;Scan/MD1/../MatrixARM/matrix_scan.c
  192. -- Detected Macro Module Source Files:
  193. Macro/PartialMap/macro.c
  194. -- Detected Output Module Source Files:
  195. Output/pjrcUSB/output_com.c;Output/pjrcUSB/arm/usb_desc.c;Output/pjrcUSB/arm/usb_dev.c;
  196. Output/pjrcUSB/arm/usb_keyboard.c;Output/pjrcUSB/arm/usb_mem.c;Output/pjrcUSB/arm/usb_serial.c
  197. -- Detected Debug Module Source Files:
  198. Debug/full/../cli/cli.c;Debug/full/../led/led.c;Debug/full/../print/print.c
  199. -- Found Git: /usr/bin/git (found version "2.2.1")
  200. -- Found Ctags: /usr/bin/ctags (found version "5.8")
  201. -- Checking for latest kll version:
  202. Current branch master is up to date.
  203. -- Detected Layout Files:
  204. /home/hyatt/Source/controller/Macro/PartialMap/capabilities.kll
  205. /home/hyatt/Source/controller/Output/pjrcUSB/capabilities.kll
  206. /home/hyatt/Source/controller/Scan/MD1/defaultMap.kll
  207. /home/hyatt/Source/controller/kll/layouts/md1Overlay.kll
  208. /home/hyatt/Source/controller/kll/layouts/stdFuncMap.kll
  209. /home/hyatt/Source/controller/kll/layouts/hhkbpro2.kll
  210. -- Configuring done
  211. -- Generating done
  212. -- Build files have been written to: /home/hyatt/Source/controller/build
  213. [master]: make [~/Source/controller/build](hyatt@x230mas:pts/6)
  214. [ 5%] Generating KLL Layout
  215. Scanning dependencies of target kiibohd.elf
  216. [ 11%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.o
  217. [ 17%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/mk20dx.c.o
  218. [ 23%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/delay.c.o
  219. [ 29%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MD1/scan_loop.c.o
  220. [ 35%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MatrixARM/matrix_scan.c.o
  221. [ 41%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/PartialMap/macro.c.o
  222. [ 47%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/output_com.c.o
  223. [ 52%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_desc.c.o
  224. [ 58%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_dev.c.o
  225. [ 64%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_keyboard.c.o
  226. [ 70%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_mem.c.o
  227. [ 76%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_serial.c.o
  228. [ 82%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/cli/cli.c.o
  229. [ 88%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.o
  230. [ 94%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.o
  231. Linking C executable kiibohd.elf
  232. [ 94%] Built target kiibohd.elf
  233. Scanning dependencies of target SizeAfter
  234. [100%] Chip usage for mk20dx128vlf5
  235. SRAM: 32% 5384/16384 bytes
  236. Flash: 18% 23384/126976 bytes
  237. [100%] Built target SizeAfter
  238. ----------------------
  239. Linux Loading Firmware
  240. ----------------------
  241. First place the keyboard into re-flash mode.
  242. This can be done either by pressing the re-flash button on the PCB/Teensy.
  243. Or by entering the Kiibohd Virtual Serial Port and using the 'reload' command.
  244. The 'load' script that is created during the build can load the firmware over USB.
  245. Either run it with sudo, or install the 98-kiibohd.rules to /etc/udev/rules.d
  246. and run: udevadm control --reload-rules
  247. To load the newly built firmware:
  248. ./load
  249. ----------------------
  250. Linux Building Bootloader
  251. ----------------------
  252. *NOTE* Does not apply to Teensy based builds.
  253. From this directory.
  254. cd Bootloader
  255. mkdir build
  256. cd build
  257. cmake ..
  258. make
  259. Example output:
  260. [master]: cmake .. [~/Source/controller/Bootloader/build](hyatt@x230mas:pts/6)
  261. -- Compiler Family:
  262. arm
  263. -- Chip Selected:
  264. mk20dx128vlf5
  265. -- Chip Family:
  266. mk20dx
  267. -- CPU Selected:
  268. cortex-m4
  269. -- Compiler Source Files:
  270. Lib/mk20dx.c;Lib/delay.c
  271. -- Bootloader Type:
  272. dfu
  273. -- Bootloader Source Files:
  274. main.c;dfu.c;dfu.desc.c;flash.c;kinetis.c;usb.c
  275. -- Found Git: /usr/bin/git (found version "2.2.1")
  276. -- Found Ctags: /usr/bin/ctags (found version "5.8")
  277. -- Configuring done
  278. -- Generating done
  279. -- Build files have been written to: /home/hyatt/Source/controller/Bootloader/build
  280. [master]: make [~/Source/controller/Bootloader/build](hyatt@x230mas:pts/6)
  281. Scanning dependencies of target kiibohd_bootloader.elf
  282. [ 11%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/main.c.o
  283. [ 22%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/dfu.c.o
  284. [ 33%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/dfu.desc.c.o
  285. [ 44%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/flash.c.o
  286. [ 55%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/kinetis.c.o
  287. [ 66%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/usb.c.o
  288. [ 77%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/home/hyatt/Source/controller/Lib/mk20dx.c.o
  289. [ 88%] Building C object CMakeFiles/kiibohd_bootloader.elf.dir/home/hyatt/Source/controller/Lib/delay.c.o
  290. Linking C executable kiibohd_bootloader.elf
  291. [ 88%] Built target kiibohd_bootloader.elf
  292. Scanning dependencies of target SizeAfter
  293. [100%] Chip usage for mk20dx128vlf5
  294. SRAM: 19% 3176/16384 bytes
  295. Flash: 2% 3736/126976 bytes
  296. [100%] Built target SizeAfter
  297. ----------------------
  298. Linux Loading Bootloader
  299. ----------------------
  300. *NOTE* Does not apply to Teensy based builds.
  301. It's recommended to use an SWD-type flasher like a Bus Pirate.
  302. There is a convenience script for loading the firmware once the system is setup.
  303. cd Bootloader/Scripts
  304. ./swdLoad.bash
  305. The above script requires Ruby, Ruby serial port module, git, and a /dev/buspirate udev rule.
  306. Additional Notes:
  307. https://github.com/mchck/mchck/wiki/Getting-Started (See Bus-Pirate section)
  308. https://wiki.archlinux.org/index.php/Bus_pirate
  309. ----------------------
  310. Windows Building
  311. ----------------------
  312. From this directory.
  313. mkdir build
  314. cd build
  315. wincmake ..
  316. make
  317. Example output:
  318. $ wincmake ..
  319. -- Compiler Family:
  320. arm
  321. -- Chip Selected:
  322. mk20dx128vlf5
  323. -- Chip Family:
  324. mk20dx
  325. -- CPU Selected:
  326. cortex-m4
  327. -- Compiler Source Files:
  328. Lib/mk20dx.c;Lib/delay.c
  329. -- Bootloader Type:
  330. dfu
  331. -- Detected Scan Module Source Files:
  332. Scan/MD1/scan_loop.c;Scan/MD1/../MatrixARM/matrix_scan.c
  333. -- Detected Macro Module Source Files:
  334. Macro/PartialMap/macro.c
  335. -- Detected Output Module Source Files:
  336. 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
  337. -- Detected Debug Module Source Files:
  338. Debug/full/../cli/cli.c;Debug/full/../led/led.c;Debug/full/../print/print.c
  339. -- Found Git: C:/cygwin64/bin/git.exe (found version "2.1.1")
  340. -- Found Ctags: C:/cygwin64/bin/ctags.exe (found version "5.8")
  341. -- Checking for latest kll version:
  342. Current branch master is up to date.
  343. -- Detected Layout Files:
  344. C:/cygwin64/home/Jacob/controller/Macro/PartialMap/capabilities.kll
  345. C:/cygwin64/home/Jacob/controller/Output/pjrcUSB/capabilities.kll
  346. C:/cygwin64/home/Jacob/controller/Scan/MD1/defaultMap.kll
  347. C:/cygwin64/home/Jacob/controller/kll/layouts/md1Overlay.kll
  348. C:/cygwin64/home/Jacob/controller/kll/layouts/stdFuncMap.kll
  349. C:/cygwin64/home/Jacob/controller/kll/layouts/hhkbpro2.kll
  350. -- Configuring done
  351. -- Generating done
  352. -- Build files have been written to: C:/cygwin64/home/Jacob/controller/build
  353. Jacob@DenPC ~/controller/build
  354. $ make
  355. [ 5%] Generating KLL Layout
  356. Scanning dependencies of target kiibohd.elf
  357. [ 11%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.obj
  358. [ 17%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/mk20dx.c.obj
  359. [ 23%] Building C object CMakeFiles/kiibohd.elf.dir/Lib/delay.c.obj
  360. [ 29%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MD1/scan_loop.c.obj
  361. [ 35%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/MatrixARM/matrix_scan.c.obj
  362. [ 41%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/PartialMap/macro.c.obj
  363. [ 47%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/output_com.c.obj
  364. [ 52%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_desc.c.obj
  365. [ 58%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_dev.c.obj
  366. [ 64%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_keyboard.c.obj
  367. [ 70%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_mem.c.obj
  368. [ 76%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/arm/usb_serial.c.obj
  369. [ 82%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/cli/cli.c.obj
  370. [ 88%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.obj
  371. [ 94%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.obj
  372. Linking C executable kiibohd.elf
  373. [ 94%] Built target kiibohd.elf
  374. Scanning dependencies of target SizeAfter
  375. [100%] Chip usage for mk20dx128vlf5
  376. SRAM: 32% 5384/16384 bytes
  377. Flash: 18% 23296/126976 bytes
  378. [100%] Built target SizeAfter
  379. NOTES:
  380. If you get the following error, you have not setup wincmake correctly:
  381. $ make
  382. [ 5%] Generating KLL Layout
  383. Scanning dependencies of target kiibohd.elf
  384. [ 11%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.o
  385. ../main.c:28:19: fatal error: macro.h: No such file or directory
  386. #include <macro.h>
  387. ^
  388. compilation terminated.
  389. CMakeFiles/kiibohd.elf.dir/build.make:67: recipe for target 'CMakeFiles/kiibohd.elf.dir/main.c.o' failed
  390. make[2]: *** [CMakeFiles/kiibohd.elf.dir/main.c.o] Error 1
  391. CMakeFiles/Makefile2:98: recipe for target 'CMakeFiles/kiibohd.elf.dir/all' failed
  392. make[1]: *** [CMakeFiles/kiibohd.elf.dir/all] Error 2
  393. Makefile:75: recipe for target 'all' failed
  394. make: *** [all] Error 2
  395. If you have already added the line to your ~/.bashrc try restarting your cygwin shell.
  396. ----------------------
  397. Windows Loading Firmware
  398. ----------------------
  399. First place the keyboard into re-flash mode.
  400. This can be done either by pressing the re-flash button on the PCB/Teensy.
  401. Or by entering the Kiibohd Virtual Serial Interface and using the 'reload' command.
  402. The 'load' script that is created during the build can load the firmware over USB.
  403. To load the newly built firmware:
  404. ./load
  405. Be patient the couple of times, Windows is slow at installing drivers...
  406. ----------------------
  407. Mac OS X Building
  408. ----------------------
  409. From this directory.
  410. mkdir build
  411. cd build
  412. cmake ..
  413. make
  414. Example output:
  415. TODO
  416. ----------------------
  417. Mac OS X Loading Firmware
  418. ----------------------
  419. First place the keyboard into re-flash mode.
  420. This can be done either by pressing the re-flash button on the PCB/Teensy.
  421. Or by entering the Kiibohd Virtual Serial Port and using the 'reload' command.
  422. The 'load' script that is created during the build can load the firmware over USB.
  423. To load the newly built firmware:
  424. ./load
  425. ----------------------
  426. Virtual Serial Port - CLI
  427. ----------------------
  428. Rather than use a special program that can interpret Raw HID, this controller exposes a USB Serial CDC endpoint.
  429. This allows for you to use a generic serial terminal to debug/control the keyboard firmware (e.g. Tera Term, minicom, screen)
  430. -------
  431. | Linux |
  432. -------
  433. I generally use screen.
  434. You will need sudo/root priviledges if you haven't installed the 98-kiibohd.rules file to /etc/udev/rules.d
  435. screen /dev/ttyACM0
  436. (Might be ACM1, ACM2, etc.)
  437. ---------
  438. | Windows |
  439. ---------
  440. Make sure the Teensy Virtual Serial Port driver is installed.
  441. If possible use screen (as part of Cygwin).
  442. Check which COM port the virtual serial port has been assigned to:
  443. Device Manager->Ports (COM & LPT)->Teensy USB Serial
  444. In brackets it will say which COM port (e.g. COM3)
  445. putty works well when using DTR/DSR or RTS/CTS flow control.
  446. Connection type: Serial
  447. Serial line: <Your COM port, e.g. COM3>
  448. Speed: (doesn't matter, it's auto-negotiated)
  449. Under Category->Connections->Serial
  450. Flow control: DTR/DSR
  451. If stuff is hard to read (you have a dumb colour scheme):
  452. Category->Window->Colours->Use system colur
  453. That seems to make text at least readable (I use a custom colour scheme that makes each colour easy to see -HaaTa).
  454. Unfortunately, screen for Cygwin seems to be broken for serial ports, but you can try it...
  455. screen /dev/ttyS2
  456. (Might be a different file, ttyS0, ttyACM0, ttyUSB0, etc.)
  457. Gnu screen doesn't seem to echo all the characters (it works though).
  458. I believe it's a problem with stty, but I don't know how to fix it...
  459. ----------
  460. | Mac OS X |
  461. ----------
  462. I recommend screen (can be installed via Macports).
  463. screen /dev/tty.<usb something>