Skip to content

Commit

Permalink
Rewritten firmware size to also describe what features do. (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
TweetyDaBird authored Jan 21, 2024
1 parent 81fec73 commit 82394af
Showing 1 changed file with 101 additions and 33 deletions.
134 changes: 101 additions & 33 deletions docs/docs/firmware-size.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,155 @@
---
layout: default
title: Reducing firmware size
title: Select Vial GUI features (for size)
parent: Porting guide
nav_order: 6
---

# Reducing firmware size
# Select Vial GUI features

By default Vial enables every supported feature. As a result, on low-powered chips such as AVR series you might experience running out of flash memory, RAM, or EEPROM.
**By default Vial enables all GUI features when you create/compile a firmware for a keyboard.** This takes up a fair bit of resources, and depending on your controller/MCU, it can be a good idea to be a bit more selective in which functionality is the most important to the particular keyboard you are compiling for.

Depending on the type of keyboard (full-size/split/macropad etc), some options simply aren't that useful, and others may be entirely neccesary for it to function as intended.

This also means that some older designs with less powerful MCU's like the classic AVR line in the popular Pro Micro controllers may need to disable or reduce the amount of slots configured in some features to make the firmware fit.

# Available GUI features

## QMK Settings

QMK Settings allows you to configure settings for all the other GUI features, like Tapping term/Permissive hold/Tapping delay for Tap Dance, and Mouse key timing, Auto shift behaviour etc.

Without it, you are missing out on a lot of Vial's actual functionality.

### Configure memory usage

To turn off this feature and reduce compiled firmware size, add the following line to your `keymaps/vial/rules.mk`:

```
quantum/dynamic_keymap.c:102:1: error: static assertion failed: "Dynamic keymaps are configured to use more EEPROM than is available."
_Static_assert(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR >= DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + 100, "Dynamic keymaps are configured to use more EEPROM than is available.");
QMK_SETTINGS = no
```

## Dynamic Tap Dance

Dynamic Tap Dance is the GUI equivalent to [QMK's Tap Dance](https://docs.qmk.fm/#/feature_tap_dance) and can do pretty much what it does, with minor differences as you assign it in GUI rather than code.

Tap the comma key, and you get a comma. Tap it twice and you get a semicolon. Tap it thrice, and you can select entirely what to output.

### Configure memory usage

By default, Tap dance is configured to have 8 slots. To reduce RAM and EEPROM usage, you can define the following in your `config.h`:

```
#define VIAL_TAP_DANCE_ENTRIES 4
```
* The firmware is too large! 30768/28672 (2096 bytes over)
[ERRORS]

make[1]: *** [tmk_core/rules.mk:469: check-size] Error 1
make: *** [Makefile:530: yd60mq:vial] Error 1
Make finished with errors
To turn off this feature completely, and also reducing compiled firmware size, add the following line to your `keymaps/vial/rules.mk`:

```
TAP_DANCE_ENABLE = no
```

If that happens to your keyboard, you can try utilizing of the options below to make the firmware fit.
## Dynamic Combos
Dynamic Combos are the GUI equivalent to [QMK's Combos](https://docs.qmk.fm/#/feature_combo?id=combos) and is a chording solution for adding custom actions. It lets you hit multiple keys at once and produce a different effect. For instance, hitting A and B within the combo term would hit ESC instead, or have it perform even more complex tasks, all configurable in the GUI.

### Enable LTO
### Configure memory usage

To enable LTO, add the following line to your `keymaps/vial/rules.mk`:
By default, Combos is configured to have 8 slots. To reduce RAM and EEPROM usage, you can define the following in your `config.h`:

```
LTO_ENABLE = yes
#define VIAL_COMBO_ENTRIES 4
```

LTO makes the compiler work harder when optimizing your code, resulting in a smaller firmware size; it rarely exposes buggy code in a way which could break certain firmware functionality. Make sure to test your keyboard firmware after enabling this option.
To turn off this feature completely, and also reducing compiled firmware size, add the following line to your `keymaps/vial/rules.mk`:

```
COMBO_ENABLE = no
```

## Dynamic Key Overrides
Dynamic Key overrides is the GUI equivalent to [QMK's Key Overrides](https://docs.qmk.fm/#/feature_key_overrides) and allows you to override modifier-key combinations to send a different modifier-key combination or perform completely custom actions.

Don’t want shift + 1 to type ! on your computer? Use a key override to make your keyboard type something different when you press shift + 1. The general behavior is like this: If modifiers w + key x are pressed, replace these keys with modifiers y + key z in the keyboard report.

### QMK Settings
### Configure memory usage

To turn off this feature, add the following line to your `keymaps/vial/rules.mk`:
By default, Key override is configured to have 8 slots. To reduce RAM and EEPROM usage, you can define the following in your `config.h`:

```
QMK_SETTINGS = no
#define VIAL_KEY_OVERRIDE_ENTRIES 4
```

### Dynamic Tap Dance
To turn off this feature completely, and also reducing compiled firmware size, add the following line to your `keymaps/vial/rules.mk`:

```
KEY_OVERRIDE_ENABLE = no
```

To reduce RAM and EEPROM usage, you can define the following in your `config.h`: `#define VIAL_TAP_DANCE_ENTRIES 4`.
## Dynamic Macros

To turn off this feature, add the following line to your `keymaps/vial/rules.mk`:
Dynamic Macro's is Vials answer to both [QMK Macros](https://docs.qmk.fm/#/feature_macros) and [Dynamic Macro's](https://docs.qmk.fm/#/feature_dynamic_macros) as it allows both functionality to be configured in GUI.

Macro's are basically the most powerful tool, and when all else fails, use one to bend your keyboard to your will.

### Configure memory usage

By default, 16 macros can be configured in Vial. To reduce RAM and EEPROM usage, you can define the following in your `config.h`:

```
TAP_DANCE_ENABLE = no
#define DYNAMIC_KEYMAP_MACRO_COUNT 4
```

### Dynamic Combos
To turn off this feature completely, and also reducing compiled firmware size, add the following line to your `keymaps/vial/rules.mk`:

To reduce RAM and EEPROM usage, you can define the following in your `config.h`: `#define VIAL_COMBO_ENTRIES 4`.
```
KEY_OVERRIDE_ENABLE = no
```

To turn off this feature, add the following line to your `keymaps/vial/rules.mk`:
# Reducing firmware size

By default Vial enables every supported feature. As a result, on low-powered chips such as AVR series you might experience running out of flash memory, RAM, or EEPROM.

```
COMBO_ENABLE = no
quantum/dynamic_keymap.c:102:1: error: static assertion failed: "Dynamic keymaps are configured to use more EEPROM than is available."
_Static_assert(DYNAMIC_KEYMAP_EEPROM_MAX_ADDR >= DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR + 100, "Dynamic keymaps are configured to use more EEPROM than is available.");
```

### Dynamic Key Overrides
```
* The firmware is too large! 30768/28672 (2096 bytes over)
[ERRORS]
make[1]: *** [tmk_core/rules.mk:469: check-size] Error 1
make: *** [Makefile:530: yd60mq:vial] Error 1
Make finished with errors
```

If that happens to your keyboard, you can try utilizing of the options below to make the firmware fit.

To reduce RAM and EEPROM usage, you can define the following in your `config.h`: `#define VIAL_KEY_OVERRIDE_ENTRIES 4`.
### Enable LTO

To turn off this feature, add the following line to your `keymaps/vial/rules.mk`:
To enable LTO, add the following line to your `keymaps/vial/rules.mk`:

```
KEY_OVERRIDE_ENABLE = no
LTO_ENABLE = yes
```

### Reducing number of dynamic keymap layers
LTO makes the compiler work harder when optimizing your code, resulting in a smaller firmware size.

If you are running out of EEPROM, you can reduce the number of dynamic keymap layers. The default layer count is 4. To reduce it, define in your `config.h` file:
> Information
> {: .label .label-green }
> Using LTO can in rare situations expose buggy code in a way which could break certain firmware functionality. Make sure to test your keyboard firmware throughly after enabling this option.
### Reducing dynamic keymap layers

By default Vial is configed to have 4 keymap layers, To reduce EEPROM usage, you can define the following in your `config.h` file:

```
#define DYNAMIC_KEYMAP_LAYER_COUNT 2
```

# Using a different bootloader


## Using a different bootloader

```
* The firmware is too large! 30768/28672 (2096 bytes over)
Expand Down

0 comments on commit 82394af

Please sign in to comment.