4 TODO, write some insightful/informative :P
6 Please give authors credit for modules used if you use in a distributed product :D
10 ----------------------
12 ----------------------
14 Below listed are the Arch Linux pacman names, AUR packages may be required.
16 These depend a bit on which targets you are trying to build, but the general one:
17 - cmake (2.8 and higher)
20 AVR Specific (Teensy 1.0/++,2.0/++) (try to use something recent, suggested versions below)
22 - avr-binutils (~2.23.2)
26 ARM Specific (Teensy 3.0/3.1) (Sourcery CodeBench Lite for ARM EABI
27 (http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/)
31 - arm-none-eaby-binutils
32 (I've actually had some issues with Sourcery CodeBench on Linux, so I often just use these)
36 ----------------------
38 ----------------------
40 Compiling on Windows does work, just it's a bunch more work.
42 First make sure Cygwin is installed - http://www.cygwin.com/ - 32bit or 64bit is fine. Make sure the following are installed:
44 - git (needed for some compilation info)
50 Also install the Windows version of CMake - http://cmake.org/cmake/resources/software.html
51 This is in addition to the Cygwin version. This is an easier alternative to installing another C compiler.
52 Add the following line to your .bashrc, making sure the CMake path is correct:
53 alias wincmake="PATH='/cygdrive/c/Program Files (x86)/CMake 2.8'/bin:\"${PATH}\" cmake"
55 Next, install the compiler(s) you want.
62 You just need the Atmel AVR 8-bit Toolchain. The latest should be fine, as of writing it was 3.4.3.
64 http://www.atmel.com/tools/atmelavrtoolchainforwindows.aspx
66 Extract the files to a directory, say C:\avr8-gnu-toolchain. Then copy all the folders in that directory to the Cygwin directory.
68 (You can also just setup the paths, but this is faster/simpler. Might screw up your Cygwin though).
75 Download the latest version of Mentor Graphics Sourcery CodeBench ARM EABI.
77 http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/
79 Use the installer and make sure you add the binaries to your path within the installer.
83 ----------------------
84 Selecting Microcontroller
85 ----------------------
87 This is where you select the chip you want to compile for.
88 The build system will automatically select the compiler needed to compile for your chip.
90 Open up CMakeLists.txt in your favourite text editor.
97 #| You _MUST_ set this to match the microcontroller you are trying to compile for
98 #| You _MUST_ clean the build directory if you change this value
101 # "at90usb162" # Teensy 1.0 (avr)
102 # "atmega32u4" # Teensy 2.0 (avr)
103 # "at90usb646" # Teensy++ 1.0 (avr)
104 "at90usb1286" # Teensy++ 2.0 (avr)
105 # "mk20dx128" # Teensy 3.0 (arm)
106 # "mk20dx256" # Teensy 3.1 (arm)
109 Just uncomment the chip you want, and comment out the old one.
111 NOTE: If you change this option, you will *need* to delete the build directory that is created in the Building sections below.
115 ----------------------
117 ----------------------
119 WARNING: Not all modules are compatible, and some modules may have dependencies on other modules.
121 This is where the options start getting interesting.
122 The Kiibohd Controller is designed around a set of 4 types of modules that correspond to different functionality:
129 The Scan Module is where the most interesting stuff happens. These modules take in "keypress data".
130 A converter Scan Module will interpret a protocol into key press/releases.
131 A matrix Scan Module may inherit from the matrix module to scan keypress from a matrix
132 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).
133 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!).
138 The Macro Module takes care of the mapping of the key press/release code into an Output (USB) scan code.
139 Any layering, macros, keypress intelligence/reaction is done here.
142 The Output Module is the module dealing with output from the microcontroller. Currently USB is the only output protocol.
143 Different USB output implementations are available, pjrc being the safest/least featureful one.
144 Debug capabilities may depend on the module selected.
147 The Debug Module enables various things like the Teensy LED on errors, debug terminal output.
148 (TODO get true UART working in avr, not just arm)
152 Open up CMakeLists.txt in your favourite text editor.
159 #| Note: This is the only section you probably want to modify
160 #| Each module is defined by it's own folder (e.g. Scan/Matrix represents the "Matrix" module)
161 #| All of the modules must be specified, as they generate the sources list of files to compile
162 #| Any modifications to this file will cause a complete rebuild of the project
164 #| Please look at the {Scan,Macro,Output,Debug}/module.txt for information on the modules and how to create new ones
166 ##| Deals with acquiring the keypress information and turning it into a key index
167 set( ScanModule "avr-capsense" )
169 ##| Uses the key index and potentially applies special conditions to it, mapping it to a usb key code
170 set( MacroModule "buffer" )
172 ##| Sends the current list of usb key codes through USB HID
173 set( OutputModule "pjrc" )
175 ##| Debugging source to use, each module has it's own set of defines that it sets
176 set( DebugModule "full" )
179 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.
182 There are also CMake options for temporarily selecting modules. But it's easier to just edit the file.
183 e.g. cmake -DScanModuleOverride=<module name>
187 ----------------------
189 ----------------------
200 [master]: cmake .. [...sy/avr-capsense-haata/build](hyatt@901Mas:pts/4)
205 -- Detected Scan Module Source Files:
206 Scan/avr-capsense/scan_loop.c
207 -- Detected Macro Module Source Files:
209 -- Detected Output Module Source Files:
210 Output/pjrc/usb_com.c;Output/pjrc/avr/usb_keyboard_debug.c
211 -- Detected Debug Module Source Files:
212 Debug/full/../led/led.c;Debug/full/../print/print.c
215 -- Build files have been written to: /home/hyatt/Source/Teensy/avr-capsense-haata/build
216 [master]: make [...sy/avr-capsense-haata/build](hyatt@901Mas:pts/4)
217 Scanning dependencies of target kiibohd.elf
218 [ 12%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.o
219 [ 25%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/avr-capsense/scan_loop.c.o
220 [ 37%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/buffer/macro.c.o
221 [ 50%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrc/usb_com.c.o
222 [ 62%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrc/avr/usb_keyboard_debug.c.o
223 [ 75%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.o
224 [ 87%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.o
225 Linking C executable kiibohd.elf
226 Creating load file for Flash: kiibohd.hex
227 Creating Extended Listing: kiibohd.lss
228 Creating Symbol Table: kiibohd.sym
229 [ 87%] Built target kiibohd.elf
230 Scanning dependencies of target SizeAfter
231 [100%] Size after generation:
232 text data bss dec hex filename
233 0 6112 0 6112 17e0 kiibohd.hex
234 5792 320 852 6964 1b34 kiibohd.elf
235 [100%] Built target SizeAfter
239 ----------------------
240 Linux Loading Firmware
241 ----------------------
243 The 'load' script that is created during the build can load the firmware over USB.
244 It uses sudo, so make sure you have the priviledges.
250 ----------------------
252 ----------------------
257 wincmake -G "Unix Makefiles" ..
262 $ cmake -G "Unix Makefiles" ..
269 -- Detected Scan Module Source Files:
270 Scan/SKM67001/../matrix/matrix_scan.c;Scan/SKM67001/../matrix/scan_loop.c
271 -- Detected Macro Module Source Files:
272 Macro/PartialMap/macro.c
273 -- Detected Output Module Source Files:
274 Output/pjrcUSB/output_com.c;Output/pjrcUSB/avr/usb_keyboard_serial.c
275 -- Detected Debug Module Source Files:
276 Debug/full/../cli/cli.c;Debug/full/../led/led.c;Debug/full/../print/print.c
277 -- Found Git: C:/cygwin64/bin/git.exe (found version "1.7.9")
280 -- Build files have been written to: C:/cygwin64/home/jacob.alexander/src/capsense-beta/build
282 jacob.alexander@JALEXANDER2-LT ~/src/capsense-beta/build
284 Scanning dependencies of target kiibohd.elf
285 [ 10%] Building C object CMakeFiles/kiibohd.elf.dir/main.c.obj
286 [ 20%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/matrix/matrix_scan.c.obj
287 [ 30%] Building C object CMakeFiles/kiibohd.elf.dir/Scan/matrix/scan_loop.c.obj
288 [ 40%] Building C object CMakeFiles/kiibohd.elf.dir/Macro/PartialMap/macro.c.obj
289 [ 50%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/output_com.c.obj
290 [ 60%] Building C object CMakeFiles/kiibohd.elf.dir/Output/pjrcUSB/avr/usb_keyboard_serial.c.obj
291 [ 70%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/cli/cli.c.obj
292 [ 80%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/led/led.c.obj
293 [ 90%] Building C object CMakeFiles/kiibohd.elf.dir/Debug/print/print.c.obj
294 Linking C executable kiibohd.elf
295 Creating load file for Flash: kiibohd.hex
296 Creating Extended Listing: kiibohd.lss
297 Creating Symbol Table: kiibohd.sym
298 [ 90%] Built target kiibohd.elf
299 Scanning dependencies of target SizeAfter
300 [100%] Size after generation
301 Flash Usage: data (hex)
302 RAM Usage: data (elf)
303 text data bss dec hex filename
304 0 9738 0 9738 260a kiibohd.hex
305 7982 1756 264 10002 2712 kiibohd.elf
306 [100%] Built target SizeAfter
310 ----------------------
311 Windows Loading Firmware
312 ----------------------
316 ----------------------
318 ----------------------
322 ----------------------
323 Mac OS X Loading Firmware
324 ----------------------
329 ----------------------
330 Virtual Serial Port - CLI
331 ----------------------
333 Rather than use a special program that can interpret Raw HID, this controller exposes a USB Serial CDC endpoint.
334 This allows for you to use a generic serial terminal to debug/control the keyboard firmware (e.g. Tera Term, minicom, screen)
340 I generally use screen.
342 sudo screen /dev/ttyACM0
349 TODO Probably COM1, but not exactly sure. Tera Term.
356 TODO (What is the usual device name). screen if possible.