qmk_firmware/static/FAQ/Build_Compile_QMK.html

212 lines
19 KiB
HTML
Raw Normal View History

2018-05-06 19:34:47 +00:00
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Build Compile QMK - QMK Firmware</title>
<meta name="description" content="Keyboard controller firmware for Atmel AVR and ARM USB families">
<meta name="author" content="QMK Community">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
2018-05-08 04:02:24 +00:00
<link rel="icon" href="../themes/daux/img/favicon-navy.png" type="image/x-icon">
2018-05-06 19:34:47 +00:00
<!-- Mobile -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Font -->
<!-- CSS -->
2018-05-08 04:02:24 +00:00
<link href='../themes/daux/css/theme-navy.min.css' rel='stylesheet' type='text/css'>
2018-05-06 19:34:47 +00:00
<!-- Tipue Search -->
<link href="../tipuesearch/tipuesearch.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="../themes/daux/js/html5shiv-3.7.3.min.js"></script>
<![endif]-->
</head>
<body class=" ">
<div class="Columns content">
<aside class="Columns__left Collapsible">
<button type="button" class="Button Collapsible__trigger">
<span class="Collapsible__trigger__bar"></span>
<span class="Collapsible__trigger__bar"></span>
<span class="Collapsible__trigger__bar"></span>
</button>
<a class="Brand" href="../index.html">QMK Firmware</a>
<div class="Search">
<svg class="Search__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451 451">
<path d="M447.05 428l-109.6-109.6c29.4-33.8 47.2-77.9 47.2-126.1C384.65 86.2 298.35 0 192.35 0 86.25 0 .05 86.3.05 192.3s86.3 192.3 192.3 192.3c48.2 0 92.3-17.8 126.1-47.2L428.05 447c2.6 2.6 6.1 4 9.5 4s6.9-1.3 9.5-4c5.2-5.2 5.2-13.8 0-19zM26.95 192.3c0-91.2 74.2-165.3 165.3-165.3 91.2 0 165.3 74.2 165.3 165.3s-74.1 165.4-165.3 165.4c-91.1 0-165.3-74.2-165.3-165.4z"/>
</svg>
<input type="search" id="tipue_search_input" class="Search__field" placeholder="Search..." autocomplete="on"
results=25 autosave=text_search>
</div>
<div class="Collapsible__content">
<!-- Navigation -->
2018-05-08 04:02:24 +00:00
<ul class='Nav'><li class='Nav__item has-children'><a href="../Getting_Started/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Getting Started</a><ul class='Nav'><li class='Nav__item has-children'><a href="../Getting_Started/Install_Build_Tools/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Install Build Tools</a><ul class='Nav'><li class='Nav__item '><a href="../Getting_Started/Install_Build_Tools/Vagrant.html">Vagrant</a></li></ul></li><li class='Nav__item '><a href="../Getting_Started/Build_Compile_Instructions.html">Build Compile Instructions</a></li><li class='Nav__item '><a href="../Getting_Started/Flashing_Firmware.html">Flashing Firmware</a></li><li class='Nav__item '><a href="../Getting_Started/Contributing.html">Contributing</a></li><li class='Nav__item '><a href="../Getting_Started/How_to_Use_GitHub.html">How to Use GitHub</a></li><li class='Nav__item '><a href="../Getting_Started/Getting_Help.html">Getting Help</a></li></ul></li><li class='Nav__item has-children'><a href="../Complete_Newbs_Guide/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Complete Newbs Guide</a><ul class='Nav'><li class='Nav__item '><a href="../Complete_Newbs_Guide/Complete_Newbie's_Guide.html">Complete Newbie's Guide</a></li><li class='Nav__item '><a href="../Complete_Newbs_Guide/Building_Your_First_Firmware.html">Building Your First Firmware</a></li><li class='Nav__item '><a href="../Complete_Newbs_Guide/Flashing_Firmware.html">Flashing Firmware</a></li><li class='Nav__item '><a href="../Complete_Newbs_Guide/Testing_and_Debugging.html">Testing and Debugging</a></li></ul></li><li class='Nav__item Nav__item--open has-children'><a href="../FAQ/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>FAQ</a><ul class='Nav'><li class='Nav__item '><a href="../FAQ/General_FAQ.html">General FAQ</a></li><li class='Nav__item Nav__item--active'><a href="../FAQ/Build_Compile_QMK.html">Build Compile QMK</a></li><li class='Nav__item '><a href="../FAQ/Debugging_and_Troubleshooting.html">Debugging and Troubleshooting</a></li><li class='Nav__item '><a href="../FAQ/Keymaps.html">Keymaps</a></li></ul></li><li class='Nav__item has-children'><a href="../Hardware/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Hardware</a><ul class='Nav'><li class='Nav__item '><a href="../Hardware/AVR_Processors.html">AVR Processors</a></li><li class='Nav__item '><a href="../Hardware/Drivers.html">Drivers</a></li></ul></li><li class='Nav__item has-children'><a href="../Features/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Features</a><ul class='Nav'><li class='Nav__item '><a href="../Features/Advanced_Keycodes.html">Advanced Keycodes</a></li><li class='Nav__item '><a href="../Features/Audio.html">Audio</a></li><li class='Nav__item '><a href="../Features/Auto_Shift.html">Auto Shift</a></li><li class='Nav__item '><a href="../Features/Backlight.html">Backlight</a></li><li class='Nav__item '><a href="../Features/Bluetooth.html">Bluetooth</a></li><li class='Nav__item '><a href="../Features/Bootmagic.html">Bootmagic</a></li><li class='Nav__item '><a href="../Features/Command.html">Command</a></li><li class='Nav__item '><a href="../Features/Dynamic_Macros.html">Dynamic Macros</a></li><li class='Nav__item '><a href="../Features/Grave_Escape.html">Grave Escape</a></li><li class='Nav__item '><a href="../Features/Key_Lock.html">Key Lock</a></li><li class='Nav__item '><a href="../Features/Layouts.html">Layouts</a></li><li class='Nav__item '><a href="../Features/Leader_Key.html">Leader Key</a></li><li class='Nav__item '><a href="../Features/Macros.html">Macros</a></li><li class='Nav__item '><a href="../Features/Mouse_Keys.html">Mouse Keys</a></li><li class='Nav__item '><a href="../Features/Pointing_Device.html">Pointing Device</a></li><li class='Nav__item '><a href="../Features/PS_2_Mouse.html">PS 2 Mouse</a></li><li class='Nav__item '><a href="../Features/RGB_Lighting.html">RGB Lighting</a></li><li class='Nav__item '><a href="../Features/Space_Cadet_Shift.html">Space Cadet Shift</a></li><li class='Nav__item
2018-05-06 19:34:47 +00:00
<div class="Links">
2018-05-08 04:02:24 +00:00
</div>
2018-05-06 19:34:47 +00:00
</div>
</aside>
<div class="Columns__right Columns__right--full">
<div class="Columns__right__content">
<div class="doc_content">
<article class="Page">
<div class="Page__header">
<h1><a href="../FAQ/index.html">FAQ</a> <svg class="Page__header--separator" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 477.175 477.175"><path d="M360.73 229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1 0s-5.3 13.8 0 19.1l215.5 215.5-215.5 215.5c-5.3 5.3-5.3 13.8 0 19.1 2.6 2.6 6.1 4 9.5 4 3.4 0 6.9-1.3 9.5-4l225.1-225.1c5.3-5.2 5.3-13.8.1-19z"/></svg> <a href="../FAQ/Build_Compile_QMK.html">Build Compile QMK</a></h1>
2018-05-08 04:02:24 +00:00
<span class="EditOn">
<a href="https://github.com/qmk/qmk_firmware/blob/master/docs/03_FAQ/03_Build_Compile_QMK.md" target="_blank">
Edit on GitHub </a>
</span>
</div>
2018-05-06 19:34:47 +00:00
<div class="s-content">
<ul class="TableOfContents">
<li>
<p><a href="#page_Frequently-Asked-Build-Questions">Frequently Asked Build Questions</a></p>
<ul class="TableOfContents">
<li>
<p><a href="#page_Can-t-Program-on-Linux">Can't Program on Linux</a></p>
</li>
<li>
<p><a href="#page_Linux-Rules">Linux <code>udev</code> Rules</a></p>
</li>
<li>
<p><a href="#page_WINAVR-is-Obsolete">WINAVR is Obsolete</a></p>
</li>
<li>
<p><a href="#page_USB-VID-and-PID">USB VID and PID</a></p>
</li>
<li>
<p><a href="#page_Cortex">Cortex: <code>cstddef: No such file or directory</code></a></p>
</li>
<li>
<p><a href="#page_and-Not-Available"><code>clock_prescale_set</code> and <code>clock_div_1</code> Not Available</a></p>
</li>
<li>
<p><a href="#page_BOOTLOADER-_-SIZE-for-AVR">BOOTLOADER_SIZE for AVR</a></p>
</li>
<li>
<p><a href="#page_on-MacOS"><code>avr-gcc: internal compiler error: Abort trap: 6 (program cc1)</code> on MacOS</a></p>
</li>
</ul>
</li>
</ul>
<h1 id="page_Frequently-Asked-Build-Questions">Frequently Asked Build Questions</h1>
<p>This page covers questions about building QMK. If you haven't yet done so, you should read the <a href="../Getting_Started/index.html">Build Environment Setup</a> and <a href="../Getting_Started/Build_Compile_Instructions.html">Make Instructions</a> guides.</p>
<h2 id="page_Can-t-Program-on-Linux">Can't Program on Linux</h2>
<p>You will need proper permissions to operate a device. For Linux users, see the instructions regarding <code>udev</code> rules, below. If you have issues with <code>udev</code>, a work-around is to use the <code>sudo</code> command. If you are not familiar with this command, check its manual with <code>man sudo</code> or <a href="https://linux.die.net/man/8/sudo" class="Link--external">see this webpage</a>.</p>
<p>An example of using <code>sudo</code>, when your controller is ATMega32u4:</p>
<pre><code>$ sudo dfu-programmer atmega32u4 erase --force
$ sudo dfu-programmer atmega32u4 flash your.hex
$ sudo dfu-programmer atmega32u4 reset
</code></pre>
<p>or just:</p>
<pre><code>$ sudo make &lt;keyboard&gt;:&lt;keymap&gt;:dfu
</code></pre>
<p>Note that running <code>make</code> with <code>sudo</code> is generally <em>not</em> a good idea, and you should use one of the former methods, if possible.</p>
<h2 id="page_Linux-Rules">Linux <code>udev</code> Rules</h2>
<p>On Linux, you'll need proper privileges to access the MCU. You can either use
<code>sudo</code> when flashing firmware, or place these files in <code>/etc/udev/rules.d/</code>.</p>
<p><strong>/etc/udev/rules.d/50-atmel-dfu.rules:</strong></p>
<pre><code># Atmel ATMega32U4
SUBSYSTEMS==&quot;usb&quot;, ATTRS{idVendor}==&quot;03eb&quot;, ATTRS{idProduct}==&quot;2ff4&quot;, MODE:=&quot;0666&quot;
# Atmel USBKEY AT90USB1287
SUBSYSTEMS==&quot;usb&quot;, ATTRS{idVendor}==&quot;03eb&quot;, ATTRS{idProduct}==&quot;2ffb&quot;, MODE:=&quot;0666&quot;
# Atmel ATMega32U2
SUBSYSTEMS==&quot;usb&quot;, ATTRS{idVendor}==&quot;03eb&quot;, ATTRS{idProduct}==&quot;2ff0&quot;, MODE:=&quot;0666&quot;
</code></pre>
<p><strong>/etc/udev/rules.d/52-tmk-keyboard.rules:</strong></p>
<pre><code># tmk keyboard products https://github.com/tmk/tmk_keyboard
SUBSYSTEMS==&quot;usb&quot;, ATTRS{idVendor}==&quot;feed&quot;, MODE:=&quot;0666&quot;
</code></pre>
<h2 id="page_WINAVR-is-Obsolete">WINAVR is Obsolete</h2>
<p>It is no longer recommended and may cause some problem.
See <a href="https://github.com/tmk/tmk_keyboard/issues/99" class="Link--external">TMK Issue #99</a>.</p>
<h2 id="page_USB-VID-and-PID">USB VID and PID</h2>
<p>You can use any ID you want with editing <code>config.h</code>. Using any presumably unused ID will be no problem in fact except for very low chance of collision with other product.</p>
<p>Most boards in QMK use <code>0xFEED</code> as the vendor ID. You should look through other keyboards to make sure you pick a unique Product ID.</p>
<p>Also see this.
https://github.com/tmk/tmk_keyboard/issues/150</p>
<p>You can buy a really unique VID:PID here. I don't think you need this for personal use.</p>
<ul>
<li>http://www.obdev.at/products/vusb/license.html</li>
<li>http://www.mcselec.com/index.php?page=shop.product_details&amp;flypage=shop.flypage&amp;product_id=92&amp;option=com_phpshop&amp;Itemid=1</li>
</ul>
<h2 id="page_Cortex">Cortex: <code>cstddef: No such file or directory</code></h2>
<p>GCC 4.8 of Ubuntu 14.04 had this problem and had to update to 4.9 with this PPA.
https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded</p>
<p>https://github.com/tmk/tmk_keyboard/issues/212
https://github.com/tmk/tmk_keyboard/wiki/mbed-cortex-porting#compile-error-cstddef
https://developer.mbed.org/forum/mbed/topic/5205/</p>
<h2 id="page_and-Not-Available"><code>clock_prescale_set</code> and <code>clock_div_1</code> Not Available</h2>
<p>Your toolchain is too old to support the MCU. For example WinAVR 20100110 doesn't support ATMega32u2.</p>
<pre><code>Compiling C: ../../tmk_core/protocol/lufa/lufa.c
avr-gcc -c -mmcu=atmega32u2 -gdwarf-2 -DF_CPU=16000000UL -DINTERRUPT_CONTROL_ENDPOINT -DBOOTLOADER_SIZE=4096 -DF_USB=16000000UL -DARCH=ARCH_AVR8 -DUSB_DEVICE_ONLY -DUSE_FLASH_DESCRIPTORS -DUSE_STATIC_OPTIONS=&quot;(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)&quot; -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DPROTOCOL_LUFA -DEXTRAKEY_ENABLE -DCONSOLE_ENABLE -DCOMMAND_ENABLE -DVERSION=unknown -Os -funsigned-char -funsigned-bitfields -ffunction-sections -fdata-sections -fno-inline-small-functions -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Wstrict-prototypes -Wa,-adhlns=obj_alps64/protocol/lufa/lufa.lst -I. -I../../tmk_core -I../../tmk_core/protocol/lufa -I../../tmk_core/protocol/lufa/LUFA-git -I../../tmk_core/common -std=gnu99 -include config.h -MMD -MP -MF .dep/obj_alps64_protocol_lufa_lufa.o.d ../../tmk_core/protocol/lufa/lufa.c -o obj_alps64/protocol/lufa/lufa.o
../../tmk_core/protocol/lufa/lufa.c: In function 'setup_mcu':
../../tmk_core/protocol/lufa/lufa.c:575: warning: implicit declaration of function 'clock_prescale_set'
../../tmk_core/protocol/lufa/lufa.c:575: error: 'clock_div_1' undeclared (first use in this function)
../../tmk_core/protocol/lufa/lufa.c:575: error: (Each undeclared identifier is reported only once
../../tmk_core/protocol/lufa/lufa.c:575: error: for each function it appears in.)
make: *** [obj_alps64/protocol/lufa/lufa.o] Error 1
</code></pre>
<h2 id="page_BOOTLOADER-_-SIZE-for-AVR">BOOTLOADER_SIZE for AVR</h2>
<p>Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong comment.</p>
<pre><code># Boot Section Size in *bytes*
# Teensy halfKay 512
# Teensy++ halfKay 2048
# Atmel DFU loader 4096 (TMK Alt Controller)
# LUFA bootloader 4096
# USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=2048
</code></pre>
<h2 id="page_on-MacOS"><code>avr-gcc: internal compiler error: Abort trap: 6 (program cc1)</code> on MacOS</h2>
<p>This is an issue with updating on brew, causing symlinks that avr-gcc depend on getting mangled.</p>
<p>The solution is to remove and reinstall all affected modules.</p>
<pre><code>brew rm avr-gcc
brew rm dfu-programmer
brew rm gcc-arm-none-eabi
brew rm avrdude
brew install avr-gcc
brew install dfu-programmer
brew install gcc-arm-none-eabi
brew install avrdude
</code></pre>
</div>
<nav>
<ul class="Pager">
<li class=Pager--prev><a href="../FAQ/General_FAQ.html">Previous</a></li> <li class=Pager--next><a href="../FAQ/Debugging_and_Troubleshooting.html">Next</a></li> </ul>
</nav>
</article>
</div>
</div>
</div>
</div>
<!-- JS -->
<script src="../themes/daux/js/jquery-1.11.3.min.js"></script><script src="../themes/daux/js/highlight.pack.js"></script><script src="../themes/daux/js/daux.js"></script>
<!-- Tipue Search -->
<script type="text/javascript" src="../tipuesearch/tipuesearch.js"></script>
<script>
window.onunload = function(){}; // force $(document).ready to be called on back/forward navigation in firefox
$(function() {
tipuesearch({
'base_url': '../'
});
});
</script>
</body>
</html>