Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build option firmware size impacts #6947

Merged
merged 7 commits into from
Oct 19, 2019
10 changes: 5 additions & 5 deletions docs/config_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,13 @@ This is a [make](https://www.gnu.org/software/make/manual/make.html) file that i
Use these to enable or disable building certain features. The more you have enabled the bigger your firmware will be, and you run the risk of building a firmware too large for your MCU.

* `BOOTMAGIC_ENABLE`
* Virtual DIP switch configuration(+1000)
* Virtual DIP switch configuration
* `MOUSEKEY_ENABLE`
* Mouse keys(+4700)
* Mouse keys
* `EXTRAKEY_ENABLE`
* Audio control and System control(+450)
* Audio control and System control
* `CONSOLE_ENABLE`
* Console for debug(+400)
* Console for debug
* `COMMAND_ENABLE`
* Commands for debug and configuration
* `COMBO_ENABLE`
Expand Down Expand Up @@ -340,7 +340,7 @@ Use these to enable or disable building certain features. The more you have enab
* `NO_USB_STARTUP_CHECK`
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
* `LINK_TIME_OPTIMIZATION_ENABLE`
= Enables Link Time Optimization (`LTO`) when compiling the keyboard. This makes the process take longer, but can significantly reduce the compiled size (and since the firmware is small, the added time is not noticable). However, this will automatically disable the old Macros and Functions features automatically, as these break when `LTO` is enabled. It does this by automatically defining `NO_ACTION_MACRO` and `NO_ACTION_FUNCTION`
= Enables Link Time Optimization (`LTO`) when compiling the keyboard. This makes the process take longer, but can significantly reduce the compiled size (and since the firmware is small, the added time is not noticable). However, this will automatically disable the old Macros and Functions features automatically, as these break when `LTO` is enabled. It does this by automatically defining `NO_ACTION_MACRO` and `NO_ACTION_FUNCTION`

## USB Endpoint Limitations

Expand Down
8 changes: 4 additions & 4 deletions docs/feature_hd44780.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is an integration of Peter Fleury's LCD library. This page will explain the basics. [For in depth documentation visit his page.](http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-libraries/group__pfleury__lcd.html)

You can enable support for HD44780 Displays by setting the `HD44780_ENABLE` flag in your keyboards `rules.mk` to yes. This will use about 400 KB of extra space.
You can enable support for HD44780 Displays by setting the `HD44780_ENABLE` flag in your keyboards `rules.mk` to yes.

## Configuration

Expand All @@ -25,7 +25,7 @@ Uncomment the section labled HD44780 and change the parameters as needed.
#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
#define LCD_RS_PORT LCD_PORT //< port for RS line
#define LCD_RS_PIN 3 //< pin for RS line
Expand All @@ -38,14 +38,14 @@ Uncomment the section labled HD44780 and change the parameters as needed.

Should you need to configure other properties you can copy them from `quantum/hd44780.h` and set them in your `config.h`

## Usage
## Usage

To initialize your display call lcd_init() with one of these parameters:
````
LCD_DISP_OFF : display off
LCD_DISP_ON : display on, cursor off
LCD_DISP_ON_CURSOR : display on, cursor on
LCD_DISP_ON_CURSOR_BLINK : display on, cursor on flashing
LCD_DISP_ON_CURSOR_BLINK : display on, cursor on flashing
````
This is best done in your keyboards `matrix_init_kb` or your keymaps `matrix_init_user`.
It is advised to clear the display before use.
Expand Down
4 changes: 2 additions & 2 deletions docs/feature_terminal.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Terminal

> This feature is currently *huge* at 4400 bytes, and should probably only be put on boards with a lot of memory, or for fun.
> This feature is currently *huge*, and should probably only be put on boards with a lot of memory, or for fun.

The terminal feature is a command-line-like interface designed to communicate through a text editor with keystrokes. It's beneficial to turn off auto-indent features in your editor.

Expand Down Expand Up @@ -56,7 +56,7 @@ Outputs the last 5 commands entered
1. help
2. about
3. keymap 0
4. help
4. help
5. flush-buffer
```

Expand Down
8 changes: 1 addition & 7 deletions docs/getting_started_make_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ Set these variables to `no` to disable them, and `yes` to enable them.

This allows you to hold a key and the salt key (space by default) and have access to a various EEPROM settings that persist over power loss. It's advised you keep this disabled, as the settings are often changed by accident, and produce confusing results that makes it difficult to debug. It's one of the more common problems encountered in help sessions.

Consumes about 1000 bytes.

`MOUSEKEY_ENABLE`

This gives you control over cursor movements and clicks via keycodes/custom functions.
Expand All @@ -67,8 +65,6 @@ To see the text, open `hid_listen` and enjoy looking at your printed messages.

**NOTE:** Do not include *uprint* messages in anything other than your keymap code. It must not be used within the QMK system framework. Otherwise, you will bloat other people's .hex files.

Consumes about 400 bytes.

`COMMAND_ENABLE`

This enables magic commands, typically fired with the default magic key combo `LSHIFT+RSHIFT+KEY`. Magic commands include turning on debugging messages (`MAGIC+D`) or temporarily toggling NKRO (`MAGIC+N`).
Expand Down Expand Up @@ -125,11 +121,9 @@ Use this to debug changes to variable values, see the [tracing variables](unit_t

This enables using the Quantum SYSEX API to send strings (somewhere?)

This consumes about 5390 bytes.

`KEY_LOCK_ENABLE`

This enables [key lock](feature_key_lock.md). This consumes an additional 260 bytes.
This enables [key lock](feature_key_lock.md).

`SPLIT_KEYBOARD`

Expand Down
13 changes: 6 additions & 7 deletions quantum/template/avr/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,19 @@ BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
UNICODE_ENABLE = no # Unicode
MIDI_ENABLE = no # MIDI support
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
40 changes: 40 additions & 0 deletions util/rules_cleaner.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we've been trying to move to a python based CLI system, and ideally, this should be added to the qmk cli code, if possible.

https://docs.qmk.fm/#/cli_development

If you don't think you can do that, that's fine, no worries. But if you're able to, awesome!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not au fait with Python, so I'd have to take a look at this in the future after some learning.


# This script finds all rules.mk files in keyboards/ subdirectories,
# and deletes the build option filesize impacts from them.

# Print an error message with the word "ERROR" in red.
echo_error() {
echo -e "[\033[0;91mERROR\033[m]: $1"
}

# If we've been started from util/, we want to be in qmk_firmware/
[[ "$PWD" == *util ]] && cd ..

# The root qmk_firmware/ directory should have a subdirectory called quantum/
if [ ! -d "quantum" ]; then
echo_error "Could not detect the QMK firmware directory!"
echo_error "Are you sure you're in the right place?"
exit 1
fi

# Set the inplace editing parameter for sed.
# macOS/BSD sed expects a file extension immediately following -i.
set_sed_i() {
sed_i=(-i)

case $(uname -a) in
*Darwin*) sed_i=(-i "")
esac
}
set_sed_i

# Exclude keyamps/ directories
files=$(find keyboards -type f -name 'rules.mk' -not \( -path '*/keymaps*' -prune \))

# Edit rules.mk files
for file in $files; do
sed "${sed_i[@]}" -e "s/(+[0-9].*)$//g" "$file"
done

echo "Cleaned up rules.mk files."