Drop bs4 dependency, update docs, minor improvements
[jackhill/qmk/firmware.git] / docs / faq_build.md
CommitLineData
d8e29b53 1# Frequently Asked Build Questions
2
8df2ee4e 3This page covers questions about building QMK. If you haven't yet done so, you should read the [Build Environment Setup](getting_started_build_tools.md) and [Make Instructions](getting_started_make_guide.md) guides.
00ec258e 4
7b0356d1 5## Can't Program on Linux
8df2ee4e 6You will need proper permissions to operate a device. For Linux users, see the instructions regarding `udev` rules, below. If you have issues with `udev`, a work-around is to use the `sudo` command. If you are not familiar with this command, check its manual with `man sudo` or [see this webpage](https://linux.die.net/man/8/sudo).
a5fc9c91 7
8df2ee4e 8An example of using `sudo`, when your controller is ATMega32u4:
bb53635f 9
a5fc9c91 10 $ sudo dfu-programmer atmega32u4 erase --force
1ef3dee8 11 $ sudo dfu-programmer atmega32u4 flash your.hex
a5fc9c91 12 $ sudo dfu-programmer atmega32u4 reset
13
8df2ee4e 14or just:
a5fc9c91 15
800ec55d 16 $ sudo make <keyboard>:<keymap>:dfu
a5fc9c91 17
c534a4c7 18Note that running `make` with `sudo` is generally ***not*** a good idea, and you should use one of the former methods, if possible.
12e5912c 19
ea17e363 20### Linux `udev` Rules
8df2ee4e 21On Linux, you'll need proper privileges to access the MCU. You can either use
b5677853
JC
22`sudo` when flashing firmware, or place these files in `/etc/udev/rules.d/`. Once added run the following:
23```console
24sudo udevadm control --reload-rules
25sudo udevadm trigger
26```
12e5912c 27
28**/etc/udev/rules.d/50-atmel-dfu.rules:**
29```
30# Atmel ATMega32U4
31SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", MODE:="0666"
32# Atmel USBKEY AT90USB1287
33SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", MODE:="0666"
34# Atmel ATMega32U2
35SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff0", MODE:="0666"
36```
37
38**/etc/udev/rules.d/52-tmk-keyboard.rules:**
39```
40# tmk keyboard products https://github.com/tmk/tmk_keyboard
41SUBSYSTEMS=="usb", ATTRS{idVendor}=="feed", MODE:="0666"
81545bbe 42```
2519de92
RR
43**/etc/udev/rules.d/54-input-club-keyboard.rules:**
44
45```
46# Input Club keyboard bootloader
47SUBSYSTEMS=="usb", ATTRS{idVendor}=="1c11", MODE:="0666"
48```
81545bbe 49
235da697 50**/etc/udev/rules.d/55-caterina.rules:**
b5677853
JC
51```
52# ModemManager should ignore the following devices
53ATTRS{idVendor}=="2a03", ENV{ID_MM_DEVICE_IGNORE}="1"
54ATTRS{idVendor}=="2341", ENV{ID_MM_DEVICE_IGNORE}="1"
55```
56
57**Note:** ModemManager filtering only works when not in strict mode, the following commands can update that settings:
58```console
59sudo sed -i 's/--filter-policy=strict/--filter-policy=default/' /lib/systemd/system/ModemManager.service
60sudo systemctl daemon-reload
61sudo systemctl restart ModemManager
62```
63
64**/etc/udev/rules.d/56-dfu-util.rules:**
65```
66# stm32duino
67SUBSYSTEMS=="usb", ATTRS{idVendor}=="1eaf", ATTRS{idProduct}=="0003", MODE:="0666"
68# Generic stm32
69SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666"
70```
71
235da697
JC
72**/etc/udev/rules.d/57-bootloadhid.rules:**
73```
74# bootloadHID
75SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE:="0666"
76```
77
4397b17c 78### Serial device is not detected in bootloader mode on Linux
efef5403 79Make sure your kernel has appropriate support for your device. If your device uses USB ACM, such as
4397b17c
RHK
80Pro Micro (Atmega32u4), make sure to include `CONFIG_USB_ACM=y`. Other devices may require `USB_SERIAL` and any of its sub options.
81
ea17e363
DJ
82## Unknown Device for DFU Bootloader
83
fb7c65dc 84Issues encountered when flashing keyboards on Windows are most often due to having the wrong drivers installed for the bootloader, or none at all.
ea17e363 85
fb7c65dc 86Re-running the QMK installation script (`./util/qmk_install.sh` from the `qmk_firmware` directory in MSYS2 or WSL) or reinstalling the QMK Toolbox may fix the issue. Alternatively, you can download and run the [`qmk_driver_installer`](https://github.com/qmk/qmk_driver_installer) package manually.
c534a4c7 87
fb7c65dc 88If that doesn't work, then you may need to download and run Zadig. See [Bootloader Driver Installation with Zadig](driver_installation_zadig.md) for more detailed information.
ea17e363 89
8df2ee4e
BH
90## USB VID and PID
91You can use any ID you want with editing `config.h`. Using any presumably unused ID will be no problem in fact except for very low chance of collision with other product.
92
93Most boards in QMK use `0xFEED` as the vendor ID. You should look through other keyboards to make sure you pick a unique Product ID.
94
95Also see this.
96https://github.com/tmk/tmk_keyboard/issues/150
97
98You can buy a really unique VID:PID here. I don't think you need this for personal use.
99- http://www.obdev.at/products/vusb/license.html
100- http://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1
81545bbe 101
f3b7863b 102## BOOTLOADER_SIZE for AVR
103Note that Teensy2.0++ bootloader size is 2048byte. Some Makefiles may have wrong comment.
104
105```
bb53635f 106# Boot Section Size in *bytes*
107# Teensy halfKay 512
108# Teensy++ halfKay 2048
f3b7863b 109# Atmel DFU loader 4096 (TMK Alt Controller)
bb53635f 110# LUFA bootloader 4096
111# USBaspLoader 2048
f3b7863b 112OPT_DEFS += -DBOOTLOADER_SIZE=2048
d8e29b53 113```
07b90db8
DJ
114
115## `avr-gcc: internal compiler error: Abort trap: 6 (program cc1)` on MacOS
efef5403 116This is an issue with updating on brew, causing symlinks that avr-gcc depend on getting mangled.
07b90db8 117
efef5403 118The solution is to remove and reinstall all affected modules.
07b90db8
DJ
119
120```
121brew rm avr-gcc
a52e55ec 122brew rm avr-gcc@8
07b90db8 123brew rm dfu-programmer
91bfbb62 124brew rm dfu-util
07b90db8 125brew rm gcc-arm-none-eabi
a52e55ec 126brew rm arm-gcc-bin@8
07b90db8 127brew rm avrdude
a52e55ec 128brew install avr-gcc@8
07b90db8 129brew install dfu-programmer
91bfbb62 130brew install dfu-util
a52e55ec 131brew install arm-gcc-bin@8
07b90db8 132brew install avrdude
a52e55ec
DJ
133brew link --force avr-gcc@8
134brew link --force arm-gcc-bin@8
135
07b90db8 136```
0d5a8b04 137
a52e55ec 138### `avr-gcc` and LUFA
0d5a8b04 139
a52e55ec 140If you updated your `avr-gcc` and you see errors involving LUFA, for example:
0d5a8b04
ET
141
142`lib/lufa/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h:380:5: error: 'const' attribute on function returning 'void'`
143
a52e55ec 144For now, you need to rollback `avr-gcc` to 8 in Homebrew.
0d5a8b04
ET
145
146```
147brew uninstall --force avr-gcc
4f2f2271
DN
148brew install avr-gcc@8
149brew link --force avr-gcc@8
0d5a8b04 150```
efef5403
YFL
151
152### I just flashed my keyboard and it does nothing/keypresses don't register - it's also ARM (rev6 planck, clueboard 60, hs60v2, etc...) (Feb 2019)
153Due to how EEPROM works on ARM based chips, saved settings may no longer be valid. This affects the default layers, and *may*, under certain circumstances we are still figuring out, make the keyboard unusable. Resetting the EEPROM will correct this.
154
155[Planck rev6 reset EEPROM](https://cdn.discordapp.com/attachments/473506116718952450/539284620861243409/planck_rev6_default.bin) can be used to force an eeprom reset. After flashing this image, flash your normal firmware again which should restore your keyboard to _normal_ working order.
156[Preonic rev3 reset EEPROM](https://cdn.discordapp.com/attachments/473506116718952450/537849497313738762/preonic_rev3_default.bin)
157
158If bootmagic is enabled in any form, you should be able to do this too (see [Bootmagic docs](feature_bootmagic.md) and keyboard info for specifics on how to do this).